diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 226d4dd..0ffb97d 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -26,8 +26,8 @@ android { applicationId = "com.ejada.hmg" // minSdk = 24 minSdk = 26 - targetSdk = 35 - compileSdk = 35 + targetSdk = 36 + compileSdk = 36 // targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 6c4ac3d..328e8fc 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -19,5 +19,5 @@ Geofence requests happened too frequently. - sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg + diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index ab39a10..3e6502f 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -18,7 +18,8 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.7.3" apply false +// id("com.android.application") version "8.7.3" apply false + id("com.android.application") version "8.9.3" apply false id("org.jetbrains.kotlin.android") version "2.1.0" apply false } diff --git a/assets/images/png/female_icon.png b/assets/images/png/female_icon.png new file mode 100644 index 0000000..b41a542 Binary files /dev/null and b/assets/images/png/female_icon.png differ diff --git a/assets/images/png/full_body_back.png b/assets/images/png/full_body_back.png new file mode 100644 index 0000000..2eda5e8 Binary files /dev/null and b/assets/images/png/full_body_back.png differ diff --git a/assets/images/png/full_body_front.png b/assets/images/png/full_body_front.png new file mode 100644 index 0000000..d1f34b4 Binary files /dev/null and b/assets/images/png/full_body_front.png differ diff --git a/assets/images/png/home_health_care.png b/assets/images/png/home_health_care.png new file mode 100644 index 0000000..21378c4 Binary files /dev/null and b/assets/images/png/home_health_care.png differ diff --git a/assets/images/png/male_icon.png b/assets/images/png/male_icon.png new file mode 100644 index 0000000..fa518fb Binary files /dev/null and b/assets/images/png/male_icon.png differ diff --git a/assets/images/png/pharmacy_service.png b/assets/images/png/pharmacy_service.png new file mode 100644 index 0000000..7093d41 Binary files /dev/null and b/assets/images/png/pharmacy_service.png differ 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/E_Referral.svg b/assets/images/svg/E_Referral.svg new file mode 100644 index 0000000..fb6b859 --- /dev/null +++ b/assets/images/svg/E_Referral.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/svg/activity.svg b/assets/images/svg/activity.svg new file mode 100644 index 0000000..7e1c342 --- /dev/null +++ b/assets/images/svg/activity.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/add_icon_dark.svg b/assets/images/svg/add_icon_dark.svg new file mode 100644 index 0000000..399df3c --- /dev/null +++ b/assets/images/svg/add_icon_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/age_icon.svg b/assets/images/svg/age_icon.svg new file mode 100644 index 0000000..8acfad3 --- /dev/null +++ b/assets/images/svg/age_icon.svg @@ -0,0 +1,9 @@ + + + + + + + + + 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/approximate_ovulation_accordion.svg b/assets/images/svg/approximate_ovulation_accordion.svg new file mode 100644 index 0000000..a721d61 --- /dev/null +++ b/assets/images/svg/approximate_ovulation_accordion.svg @@ -0,0 +1,9 @@ + + + + + + + + + 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/bloodcholestrol.svg b/assets/images/svg/bloodcholestrol.svg new file mode 100644 index 0000000..8a77bb5 --- /dev/null +++ b/assets/images/svg/bloodcholestrol.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/bloodsugar.svg b/assets/images/svg/bloodsugar.svg new file mode 100644 index 0000000..a97032c --- /dev/null +++ b/assets/images/svg/bloodsugar.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/bmi.svg b/assets/images/svg/bmi.svg new file mode 100644 index 0000000..7ee99db --- /dev/null +++ b/assets/images/svg/bmi.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/bmr.svg b/assets/images/svg/bmr.svg new file mode 100644 index 0000000..6b797e4 --- /dev/null +++ b/assets/images/svg/bmr.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/body_icon.svg b/assets/images/svg/body_icon.svg new file mode 100644 index 0000000..03591ec --- /dev/null +++ b/assets/images/svg/body_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/svg/bulb.svg b/assets/images/svg/bulb.svg new file mode 100644 index 0000000..94553a5 --- /dev/null +++ b/assets/images/svg/bulb.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/calendar-grey.svg b/assets/images/svg/calendar-grey.svg new file mode 100644 index 0000000..2bcc178 --- /dev/null +++ b/assets/images/svg/calendar-grey.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/svg/calories.svg b/assets/images/svg/calories.svg new file mode 100644 index 0000000..9f8d2b5 --- /dev/null +++ b/assets/images/svg/calories.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/confirm.svg b/assets/images/svg/confirm.svg index 62cfa01..5ed3693 100755 --- a/assets/images/svg/confirm.svg +++ b/assets/images/svg/confirm.svg @@ -1,3 +1,3 @@ - +add_ diff --git a/assets/images/svg/covid_19.svg b/assets/images/svg/covid_19.svg new file mode 100644 index 0000000..f3aa128 --- /dev/null +++ b/assets/images/svg/covid_19.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/svg/cup_add.svg b/assets/images/svg/cup_add.svg new file mode 100644 index 0000000..ebe186a --- /dev/null +++ b/assets/images/svg/cup_add.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/cup_empty.svg b/assets/images/svg/cup_empty.svg new file mode 100644 index 0000000..fae08fe --- /dev/null +++ b/assets/images/svg/cup_empty.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/cup_filled.svg b/assets/images/svg/cup_filled.svg new file mode 100644 index 0000000..6a085bb --- /dev/null +++ b/assets/images/svg/cup_filled.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/due_date_accordion.svg b/assets/images/svg/due_date_accordion.svg new file mode 100644 index 0000000..828a1c9 --- /dev/null +++ b/assets/images/svg/due_date_accordion.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/svg/dumbell_icon.svg b/assets/images/svg/dumbell_icon.svg new file mode 100644 index 0000000..1d6db5f --- /dev/null +++ b/assets/images/svg/dumbell_icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/fertile_window_accordion.svg b/assets/images/svg/fertile_window_accordion.svg new file mode 100644 index 0000000..63f0173 --- /dev/null +++ b/assets/images/svg/fertile_window_accordion.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/svg/file.svg b/assets/images/svg/file.svg new file mode 100644 index 0000000..004145c --- /dev/null +++ b/assets/images/svg/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/svg/files.svg b/assets/images/svg/files.svg new file mode 100644 index 0000000..dfc862e --- /dev/null +++ b/assets/images/svg/files.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/svg/gallery.svg b/assets/images/svg/gallery.svg new file mode 100644 index 0000000..ec1c45e --- /dev/null +++ b/assets/images/svg/gallery.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/svg/gender.svg b/assets/images/svg/gender.svg new file mode 100644 index 0000000..6819ba6 --- /dev/null +++ b/assets/images/svg/gender.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/gender_icon.svg b/assets/images/svg/gender_icon.svg new file mode 100644 index 0000000..4573125 --- /dev/null +++ b/assets/images/svg/gender_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/general_health.svg b/assets/images/svg/general_health.svg new file mode 100644 index 0000000..0102df1 --- /dev/null +++ b/assets/images/svg/general_health.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/glass_icon.svg b/assets/images/svg/glass_icon.svg new file mode 100644 index 0000000..1df8eec --- /dev/null +++ b/assets/images/svg/glass_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/graph_icon.svg b/assets/images/svg/graph_icon.svg new file mode 100644 index 0000000..7bb6fbb --- /dev/null +++ b/assets/images/svg/graph_icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/green_tick_icon.svg b/assets/images/svg/green_tick_icon.svg new file mode 100644 index 0000000..e041191 --- /dev/null +++ b/assets/images/svg/green_tick_icon.svg @@ -0,0 +1,3 @@ + + + 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/height.svg b/assets/images/svg/height.svg new file mode 100644 index 0000000..f275d34 --- /dev/null +++ b/assets/images/svg/height.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/height_icon.svg b/assets/images/svg/height_icon.svg new file mode 100644 index 0000000..78cefdc --- /dev/null +++ b/assets/images/svg/height_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/home_bordered.svg b/assets/images/svg/home_bordered.svg new file mode 100644 index 0000000..b9f6291 --- /dev/null +++ b/assets/images/svg/home_bordered.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/ibw.svg b/assets/images/svg/ibw.svg new file mode 100644 index 0000000..2f11ca4 --- /dev/null +++ b/assets/images/svg/ibw.svg @@ -0,0 +1,5 @@ + + + + + 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/list_icon.svg b/assets/images/svg/list_icon.svg new file mode 100644 index 0000000..e68f20b --- /dev/null +++ b/assets/images/svg/list_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + 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/minimize_icon.svg b/assets/images/svg/minimize_icon.svg new file mode 100644 index 0000000..b60a041 --- /dev/null +++ b/assets/images/svg/minimize_icon.svg @@ -0,0 +1,3 @@ + + + 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/next_period_accordion.svg b/assets/images/svg/next_period_accordion.svg new file mode 100644 index 0000000..4ff65db --- /dev/null +++ b/assets/images/svg/next_period_accordion.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/svg/notification_icon_grey.svg b/assets/images/svg/notification_icon_grey.svg new file mode 100644 index 0000000..9e5e8d5 --- /dev/null +++ b/assets/images/svg/notification_icon_grey.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/open_camera.svg b/assets/images/svg/open_camera.svg new file mode 100644 index 0000000..171452a --- /dev/null +++ b/assets/images/svg/open_camera.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/svg/outer_bubbles.svg b/assets/images/svg/outer_bubbles.svg new file mode 100644 index 0000000..cfe860d --- /dev/null +++ b/assets/images/svg/outer_bubbles.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/svg/phramacy_icon.svg b/assets/images/svg/phramacy_icon.svg new file mode 100644 index 0000000..a9c5d1c --- /dev/null +++ b/assets/images/svg/phramacy_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/pregnancy_test_day_accordion.svg b/assets/images/svg/pregnancy_test_day_accordion.svg new file mode 100644 index 0000000..5a29588 --- /dev/null +++ b/assets/images/svg/pregnancy_test_day_accordion.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/svg/profile_icon.svg b/assets/images/svg/profile_icon.svg new file mode 100644 index 0000000..20dfb2b --- /dev/null +++ b/assets/images/svg/profile_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/rate_1.svg b/assets/images/svg/rate_1.svg new file mode 100644 index 0000000..8e1c2f2 --- /dev/null +++ b/assets/images/svg/rate_1.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/rate_2.svg b/assets/images/svg/rate_2.svg new file mode 100644 index 0000000..9500556 --- /dev/null +++ b/assets/images/svg/rate_2.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/rate_3.svg b/assets/images/svg/rate_3.svg new file mode 100644 index 0000000..7c9d0f5 --- /dev/null +++ b/assets/images/svg/rate_3.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/rate_4.svg b/assets/images/svg/rate_4.svg new file mode 100644 index 0000000..7f82267 --- /dev/null +++ b/assets/images/svg/rate_4.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/rate_5.svg b/assets/images/svg/rate_5.svg new file mode 100644 index 0000000..a7308ba --- /dev/null +++ b/assets/images/svg/rate_5.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/refresh.svg b/assets/images/svg/refresh.svg new file mode 100644 index 0000000..6a84970 --- /dev/null +++ b/assets/images/svg/refresh.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/rotate_icon.svg b/assets/images/svg/rotate_icon.svg new file mode 100644 index 0000000..cb52c31 --- /dev/null +++ b/assets/images/svg/rotate_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/ruler.svg b/assets/images/svg/ruler.svg new file mode 100644 index 0000000..a2e8c11 --- /dev/null +++ b/assets/images/svg/ruler.svg @@ -0,0 +1,3 @@ + + + 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/switch.svg b/assets/images/svg/switch.svg new file mode 100644 index 0000000..1db8753 --- /dev/null +++ b/assets/images/svg/switch.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/tick.svg b/assets/images/svg/tick.svg new file mode 100644 index 0000000..b6210c0 --- /dev/null +++ b/assets/images/svg/tick.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/trade_down_red.svg b/assets/images/svg/trade_down_red.svg new file mode 100644 index 0000000..7c77c8e --- /dev/null +++ b/assets/images/svg/trade_down_red.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/trade_down_yellow.svg b/assets/images/svg/trade_down_yellow.svg new file mode 100644 index 0000000..93c6805 --- /dev/null +++ b/assets/images/svg/trade_down_yellow.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/triglycerides.svg b/assets/images/svg/triglycerides.svg new file mode 100644 index 0000000..0f8facd --- /dev/null +++ b/assets/images/svg/triglycerides.svg @@ -0,0 +1,5 @@ + + + + + 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/water_bottle.svg b/assets/images/svg/water_bottle.svg new file mode 100644 index 0000000..4763d7e --- /dev/null +++ b/assets/images/svg/water_bottle.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/svg/weight-scale.svg b/assets/images/svg/weight-scale.svg new file mode 100644 index 0000000..c3329ff --- /dev/null +++ b/assets/images/svg/weight-scale.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/weight.svg b/assets/images/svg/weight.svg new file mode 100644 index 0000000..6c42c17 --- /dev/null +++ b/assets/images/svg/weight.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/weight_scale_icon.svg b/assets/images/svg/weight_scale_icon.svg new file mode 100644 index 0000000..c3329ff --- /dev/null +++ b/assets/images/svg/weight_scale_icon.svg @@ -0,0 +1,3 @@ + + + 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/assets/images/svg/women_health.svg b/assets/images/svg/women_health.svg new file mode 100644 index 0000000..5eca669 --- /dev/null +++ b/assets/images/svg/women_health.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/yellow_arrow_down_icon.svg b/assets/images/svg/yellow_arrow_down_icon.svg new file mode 100644 index 0000000..f2ca09f --- /dev/null +++ b/assets/images/svg/yellow_arrow_down_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/json/body_symptoms_data.json b/assets/json/body_symptoms_data.json new file mode 100644 index 0000000..f38aa96 --- /dev/null +++ b/assets/json/body_symptoms_data.json @@ -0,0 +1,22117 @@ +export const BodySymptomsData = { + halfneck: { + both: [ + "s_36", + "s_363", + "s_418", + "s_671", + "s_758", + "s_965", + "s_1388", + "s_1483", + "s_2465", + "s_2971", + "s_2954", + "s_2953", + "s_2941", + "s_2940", + "s_2939", + "s_2481", + "s_2467", + "s_2248", + "s_2247", + "s_2173", + "s_2163", + "s_2060" + ] + }, + whole_head: { + both: [ + "s_21", + "s_22", + "s_23", + "s_24", + "s_25", + "s_60", + "s_85", + "s_191", + "s_214", + "s_433", + "s_541", + "s_604", + "s_605", + "s_625", + "s_799", + "s_970", + "s_1193", + "s_1230", + "s_1349", + "s_1479", + "s_1535", + "s_1762", + "s_2189", + "s_2148", + "s_1912", + "s_1911", + "s_1907", + "s_1905", + "s_1901", + "s_1871", + "s_1870", + "s_1868", + "s_1864", + "s_1792", + "s_1781", + "s_1780", + "s_2673", + "s_2566", + "s_2520", + "s_2516", + "s_2366", + "s_2191", + "s_2190", + "s_2914", + "s_3034", + "s_2971" + ] + }, + thighs: { + both: [ + "s_73", + "s_757", + "s_734", + "s_1893", + "s_2238", + "s_2267", + "s_2552", + "s_38" + ] + }, + upperleg: { + both: [ + "s_734", + "s_313", + "s_273", + "s_175", + "s_2638", + "s_2611", + "s_2608", + "s_2262", + "s_2140", + "s_1927", + "s_1725", + "s_1463", + "s_1447", + "s_1066" + ] + }, + breasts: { + female: [ + "s_1480", + "s_609", + "s_219", + "s_1422", + "s_547", + "s_300", + "s_194", + "s_343" + ], + both: [ + "s_219", + "s_300", + "s_342", + "s_547", + "s_609", + "s_1480", + "s_1509", + "s_2234", + "s_3144" + ] + }, + lowerleg: { + both: [ + "s_175", + "s_2840", + "s_2696", + "s_2647", + "s_2638", + "s_2611", + "s_2262", + "s_2140", + "s_1927" + ] + }, + buttocks: { + both: [ + "s_11", + "s_579", + "s_1453", + "s_38", + "s_436", + "s_115", + "s_351", + "s_355", + "s_249", + "s_112", + "s_71" + ] + }, + lower_back: { + both: [ + "s_53", + "s_1190", + "s_159", + "s_663", + "s_1339", + "s_257", + "s_186" + ] + }, + skin: { + both: [ + "s_43", + "s_254", + "s_332", + "s_9", + "s_388", + "s_229", + "s_437", + "s_224", + "s_180", + "s_393", + "s_234", + "s_248", + "s_362" + ] + }, + lower_limb: { + both: [ + "s_1081", + "s_232", + "s_273", + "s_1063", + "s_579", + "s_1453", + "s_581", + "s_11", + "s_175", + "s_117", + "s_743", + "s_40", + "s_1463", + "s_173", + "s_1343", + "s_313" + ] + }, + lower_leg: { + both: [ + "s_581", + "s_579", + "s_1453", + "s_11", + "s_38", + "s_175", + "s_173", + "s_148", + "s_743", + "s_766", + "s_83", + "s_503", + "s_1463" + ] + }, + forearm: { + both: [ + "s_580", + "s_1447", + "s_40", + "s_650", + "s_268", + "s_973", + "s_83", + "s_1452", + "s_972", + "s_1426", + "s_87" + ] + }, + neck_or_throat: { + both: [ + "s_20", + "s_509", + "s_1367", + "s_68", + "s_88", + "s_102", + "s_962", + "s_220", + "s_363", + "s_298", + "s_1483", + "s_418" + ] + }, + ears: { + both: [ + "s_47", + "s_208", + "s_297", + "s_276", + "s_255", + "s_407" + ] + }, + back: { + both: [ + "s_1190", + "s_1772", + "s_159", + "s_257", + "s_186" + ] + }, + head: { + both: [ + "s_21", + "s_370", + "p_74", + "s_121", + "s_478", + "s_616", + "s_177", + "s_1435", + "s_388", + "s_188", + "s_316", + "s_156", + "s_1543", + "s_438" + ] + }, + oral_cavity: { + both: [ + "s_551", + "s_228", + "s_19", + "s_172", + "s_111", + "s_607", + "s_200", + "s_1", + "s_65", + "s_247", + "s_266", + "s_102", + "s_67", + "s_305" + ] + }, + eyes: { + both: [ + "s_493", + "s_492", + "s_72", + "s_1563", + "s_122", + "s_1492", + "s_54", + "s_320", + "s_207", + "s_1465", + "s_479", + "s_497", + "s_235", + "s_483", + "s_591", + "s_621", + "s_192", + "s_489", + "s_606" + ] + }, + chest: { + both: [ + "s_50", + "s_110", + "s_261", + "s_534", + "s_102", + "s_88", + "s_1462", + "s_474", + "s_338" + ] + }, + thigh: { + both: [ + "s_579", + "s_1453", + "s_11", + "s_38", + "s_175", + "s_173", + "s_148", + "s_581", + "s_743", + "s_83", + "s_503" + ] + }, + sexual_organs: { + both: [ + "s_215", + "s_39", + "s_368", + "s_611", + "s_113", + "s_367", + "s_369", + "s_153", + "s_182", + "s_28" + ], + female: [ + "s_328", + "s_152", + "s_32", + "s_324", + "s_253", + "s_59", + "s_158", + "s_1217", + "s_1457", + "s_1440", + "s_151" + ], + male: [ + "s_52", + "s_176", + "s_349", + "s_733" + ] + }, + upper_arm: { + both: [ + "s_580", + "s_1447", + "s_40", + "s_650", + "s_268", + "s_973", + "s_83", + "s_1452", + "s_972", + "s_1426", + "s_1654", + "s_87" + ] + }, + upper_limb: { + both: [ + "s_1447", + "s_268", + "s_973", + "s_1452", + "s_580", + "s_1426", + "s_313" + ] + }, + elbow: { + both: [ + "s_1632", + "s_40", + "s_575", + "s_174", + "s_1447", + "s_580", + "s_1452" + ] + }, + problem_concerning_behavior_or_thoughts: { + both: [ + "s_119", + "s_540", + "s_143", + "s_236", + "s_421", + "s_169", + "s_633", + "s_646", + "s_145", + "s_316", + "s_631", + "s_348", + "s_127", + "s_4", + "s_198", + "s_222", + "s_120", + "s_660", + "s_716" + ] + }, + knee: { + both: [ + "s_38", + "s_170", + "s_581", + "s_323", + "s_1610", + "s_1744", + "s_1745", + "s_2267", + "s_2309", + "s_2552", + "s_2591", + "s_2592", + "s_2610", + "s_3046", + "s_3059" + ] + }, + nose: { + both: [ + "s_107", + "s_331", + "s_252", + "s_1095", + "s_1435", + "s_1429", + "s_1303", + "s_1471", + "s_715", + "s_67", + "s_505", + "s_88" + ] + }, + hand: { + both: [ + "s_1430", + "s_1639", + "s_554", + "s_1449", + "s_557", + "s_1464", + "s_1431", + "s_1311", + "s_258", + "s_553", + "s_405", + "s_1125", + "s_555", + "s_87", + "s_86", + "s_564" + ] + }, + nape_of_neck: { + both: [ + "s_1483", + "s_363", + "s_298", + "s_418", + "s_186" + ] + }, + foot: { + both: [ + "s_1621", + "s_79", + "s_578", + "s_26", + "s_405", + "s_125" + ] + }, + abdomin: { + both: [ + "s_1922", + "s_1860", + "s_1859", + "s_1856", + "s_1855", + "s_1193", + "s_1853", + "s_1851", + "s_1848", + "s_1840" + ] + }, + upper_abdomen: { + both: [ + "s_13", + "s_1387", + "s_16", + "s_57", + "s_299", + "s_277", + "s_1514", + "s_309", + "s_329", + "s_8", + "s_156", + "s_305", + "s_338" + ] + }, + mid_abdomen: { + both: [ + "s_13", + "s_1532", + "s_14", + "s_299", + "s_277", + "s_1514", + "s_309", + "s_329", + "s_8", + "s_156", + "s_305", + "s_71", + "s_112" + ], + female: [ + "s_17" + ] + }, + lower_abdomen: { + both: [ + "s_13", + "s_1598", + "s_15", + "s_299", + "s_277", + "s_1514", + "s_309", + "s_329", + "s_8", + "s_156", + "s_305", + "s_71", + "s_112" + ], + female: [ + "s_17" + ] + }, + anus: { + both: [ + "s_436", + "s_115", + "s_351", + "s_355", + "s_249", + "s_112", + "s_71" + ] + }, + COMBINATIONS: { + whole_head: [ + "head", + "eyes", + "nose", + "ears", + "oral_cavity" + ] + } +}; + +export const SymptomsData = [ +{ +id: "s_1", +type: "symptom", +name: "Mouth ulcer", +common_name: "Mouth sores", +}, +{ +id: "s_3", +type: "symptom", +name: "Sexual dysfunction, sexual activity despite adverse outcomes", +common_name: "Activity related to sex despite negative consequences", +}, +{ +id: "s_4", +type: "symptom", +name: "Apathy", +common_name: "Lack of interest, enthusiasm, or concern", +}, +{ +id: "s_6", +type: "symptom", +name: "Appetite for salty foods", +common_name: "Appetite for salty foods", +}, +{ +id: "s_7", +type: "symptom", +name: "Female infertility", +common_name: "Female infertility", +}, +{ +id: "s_8", +type: "symptom", +name: "Diarrhea", +common_name: "Diarrhea", +}, +{ +id: "s_9", +type: "symptom", +name: "Skin pallor", +common_name: "Pale skin", +}, +{ +id: "s_10", +type: "symptom", +name: "Pale and brittle nails", +common_name: "Pale and brittle nails", +}, +{ +id: "s_11", +type: "symptom", +name: "Joint pain, hip", +common_name: "Hip pain", +}, +{ +id: "s_13", +type: "symptom", +name: "Abdominal pain", +common_name: "Stomach pain", +}, +{ +id: "s_14", +type: "symptom", +name: "Abdominal pain, exacerbating on an empty stomach", +common_name: "Abdominal pain on empty stomach", +}, +{ +id: "s_15", +type: "symptom", +name: "Abdominal pain, exacerbating during coughing or movement", +common_name: "Abdominal pain worsens when coughing or moving", +}, +{ +id: "s_16", +type: "symptom", +name: "Abdominal pain, postprandial", +common_name: "Abdominal pain after eating", +}, +{ +id: "s_17", +type: "symptom", +name: "Abdominal pain, premenstrual", +common_name: "Cramps before period", +}, +{ +id: "s_19", +type: "symptom", +name: "Gum pain", +common_name: "Gum pain", +}, +{ +id: "s_20", +type: "symptom", +name: "Pharyngeal pain", +common_name: "Sore throat", +}, +{ +id: "s_21", +type: "symptom", +name: "Headache", +common_name: "Headache", +}, +{ +id: "s_22", +type: "symptom", +name: "Headache, unilateral", +common_name: "Headache located on only one side", +}, +{ +id: "s_23", +type: "symptom", +name: "Headache, pressing", +common_name: "Pressing or squeezing headache", +}, +{ +id: "s_24", +type: "symptom", +name: "Headache, generalized", +common_name: "Headache located all over head", +}, +{ +id: "s_25", +type: "symptom", +name: "Headache, pulsating", +common_name: "Pulsing headache", +}, +{ +id: "s_28", +type: "symptom", +name: "Crotch pain", +common_name: "Pain in groin or genital area", +}, +{ +id: "s_30", +type: "symptom", +name: "Chest pain, exacerbating with deep breath or cough", +common_name: "Chest pain worsening with deep breath or cough", +}, +{ +id: "s_31", +type: "symptom", +name: "Chest pain, continuing during rest", +common_name: "Chest pain continuing after rest", +}, +{ +id: "s_32", +type: "symptom", +name: "Painful vaginal intercourse", +common_name: "Painful sex", +}, +{ +id: "s_33", +type: "symptom", +name: "Painful ejaculation", +common_name: "Pain when ejaculating", +}, +{ +id: "s_34", +type: "symptom", +name: "Crotch pain, sudden", +common_name: "Sudden pain in crotch", +}, +{ +id: "s_35", +type: "symptom", +name: "Chest pain, during physical activity", +common_name: "Chest pain during physical activity", +}, +{ +id: "s_36", +type: "symptom", +name: "Chest pain, radiating to the neck", +common_name: "Chest pain spreading to the neck", +}, +{ +id: "s_37", +type: "symptom", +name: "Chest pain, radiating between shoulder blades", +common_name: "Chest pain spreading to between the shoulder blades", +}, +{ +id: "s_38", +type: "symptom", +name: "Back pain, lumbar, radiates to back of the thigh", +common_name: "Lower back pain spreading to the back of the thigh or knee", +}, +{ +id: "s_39", +type: "symptom", +name: "Painful urination", +common_name: "Pain when urinating", +}, +{ +id: "s_41", +type: "symptom", +name: "Joint pain, severe, after trauma", +common_name: "Severe joint pain after an injury", +}, +{ +id: "s_43", +type: "symptom", +name: "Skin pain, severe", +common_name: "Severe skin pain", +}, +{ +id: "s_44", +type: "symptom", +name: "Joint pain", +common_name: "Joint pain", +}, +{ +id: "s_47", +type: "symptom", +name: "Earache", +common_name: "Earache", +}, +{ +id: "s_50", +type: "symptom", +name: "Chest pain", +common_name: "Chest pain", +}, +{ +id: "s_51", +type: "symptom", +name: "Chest pain, diffuse", +common_name: "Widespread chest pain", +}, +{ +id: "s_52", +type: "symptom", +name: "Crotch pain, testicular or scrotal", +common_name: "Pain in scrotum or testicle", +}, +{ +id: "s_53", +type: "symptom", +name: "Back pain, lumbar", +common_name: "Lower back pain", +}, +{ +id: "s_54", +type: "symptom", +name: "Pain near eye socket", +common_name: "Pain around or behind eye", +}, +{ +id: "s_56", +type: "symptom", +name: "Toothache, associated with chewing", +common_name: "Toothache when chewing", +}, +{ +id: "s_57", +type: "symptom", +name: "Abdominal pain, reduced by defecation or relieving flatulence", +common_name: "Abdominal pain improves after bowel movement or passing gas", +}, +{ +id: "s_60", +type: "symptom", +name: "Crotch pain, glans penis", +common_name: "Pain in head of penis", +}, +{ +id: "s_64", +type: "symptom", +name: "Vaginal discharge, unpleasant odour", +common_name: "Vaginal discharge with unpleasant odour", +}, +{ +id: "s_65", +type: "symptom", +name: "Halitosis", +common_name: "Bad breath", +}, +{ +id: "s_67", +type: "symptom", +name: "Snoring", +common_name: "Hoarse or harsh sounds when sleeping", +}, +{ +id: "s_68", +type: "symptom", +name: "Dysphonia", +common_name: "Hoarse voice", +}, +{ +id: "s_69", +type: "symptom", +name: "Preoccupation with food", +common_name: "Preoccupation with food", +}, +{ +id: "s_71", +type: "symptom", +name: "Black-coloured stool", +common_name: "Black stool", +}, +{ +id: "s_72", +type: "symptom", +name: "Red and stinging conjunctivae", +common_name: "Red and stinging eyes", +}, +{ +id: "s_73", +type: "symptom", +name: "Red stretch marks on abdomen, hips, or thighs", +common_name: "Red stretch marks on stomach, hips, or thighs", +}, +{ +id: "s_74", +type: "symptom", +name: "Sexual dysfunction, unrestrained sexual encounters", +common_name: "Sexual activity more often or with more partners than intended", +}, +{ +id: "s_75", +type: "symptom", +name: "Polyuria", +common_name: "Passing more urine than usual in a day", +}, +{ +id: "s_79", +type: "symptom", +name: "Joint pain, hallux", +common_name: "Big toe pain", +}, +{ +id: "s_80", +type: "symptom", +name: "Sexual dysfunction, irritability due to lack of sexual activity", +common_name: "Irritability, when unable to engage in sexual activities", +}, +{ +id: "s_81", +type: "symptom", +name: "Chills", +common_name: "Chills", +}, +{ +id: "s_84", +type: "symptom", +name: "Tremors, subsides after drinking alcohol", +common_name: "Trembling subsiding after alcohol", +}, +{ +id: "s_85", +type: "symptom", +name: "Tremors, head", +common_name: "Head tremors", +}, +{ +id: "s_86", +type: "symptom", +name: "Tremors, one hand", +common_name: "Trembling of one hand", +}, +{ +id: "s_87", +type: "symptom", +name: "Tremors, both hands", +common_name: "Trembling of both hands", +}, +{ +id: "s_88", +type: "symptom", +name: "Dyspnea", +common_name: "Shortness of breath", +}, +{ +id: "s_90", +type: "symptom", +name: "Dyspnea, lasting between 1 day and 4 weeks", +common_name: "Shortness of breath lasting between 1 day and 4 weeks", +}, +{ +id: "s_92", +type: "symptom", +name: "Dyspnea, started less than 1 hour ago", +common_name: "Shortness of breath started less than 1 hour ago", +}, +{ +id: "s_93", +type: "symptom", +name: "Smoking, large quantities", +common_name: "Smoking more than 20 cigarettes a day", +}, +{ +id: "s_95", +type: "symptom", +name: "Discomfort while speaking, maxillo-facial", +common_name: "Discomfort in the lower half of the face or mouth while speaking", +}, +{ +id: "s_97", +type: "symptom", +name: "Deep filling of treated tooth", +common_name: "Deep filling of treated tooth", +}, +{ +id: "s_98", +type: "symptom", +name: "Fever", +common_name: "Fever", +}, +{ +id: "s_99", +type: "symptom", +name: "Fever, between 37°C and 38°C or between 98.6°F and 100.4°F", +common_name: "Body temperature between 37°C and 38°C or 98.6°F and 100.4°F", +}, +{ +id: "s_100", +type: "symptom", +name: "Fever, between 38°C and 40°C or between 100.4°F and 104°F", +common_name: "Fever between 38°C and 40°C or between 100.4 and 104°F", +}, +{ +id: "s_101", +type: "symptom", +name: "Skin mass, smaller than 1 cm", +common_name: "Bump smaller than 1 cm", +}, +{ +id: "s_102", +type: "symptom", +name: "Cough", +common_name: "Cough", +}, +{ +id: "s_103", +type: "symptom", +name: "Cough, lasting less than 3 weeks", +common_name: "Cough lasting less than 3 weeks", +}, +{ +id: "s_104", +type: "symptom", +name: "Cough, productive", +common_name: "Coughing up phlegm", +}, +{ +id: "s_105", +type: "symptom", +name: "Cough, dry", +common_name: "Dry cough", +}, +{ +id: "s_106", +type: "symptom", +name: "Cough, lasting more than 8 weeks", +common_name: "Cough lasting more than 8 weeks", +}, +{ +id: "s_107", +type: "symptom", +name: "Nasal catarrh", +common_name: "Runny nose", +}, +{ +id: "s_108", +type: "symptom", +name: "Deepening of periodontal pockets", +common_name: "Deepened spaces between the gums and the teeth", +}, +{ +id: "s_109", +type: "symptom", +name: "Alcohol consumption, drinking to ease hangover", +common_name: "Drinking alcohol to ease hangover", +}, +{ +id: "s_110", +type: "symptom", +name: "Palpitations", +common_name: "Palpitations", +}, +{ +id: "s_111", +type: "symptom", +name: "Bleeding gums", +common_name: "Bleeding gums", +}, +{ +id: "s_112", +type: "symptom", +name: "Red-coloured stool", +common_name: "Red stool", +}, +{ +id: "s_113", +type: "symptom", +name: "Red-coloured urine", +common_name: "Red urine", +}, +{ +id: "s_115", +type: "symptom", +name: "Bleeding from anus", +common_name: "Bleeding from anus", +}, +{ +id: "s_116", +type: "symptom", +name: "Hemoptysis", +common_name: "Coughing up blood", +}, +{ +id: "s_118", +type: "symptom", +name: "Cold sensitivity", +common_name: "Cold sensitivity", +}, +{ +id: "s_120", +type: "symptom", +name: "Anxiety", +common_name: "Anxiety", +}, +{ +id: "s_121", +type: "symptom", +name: "Hair loss", +common_name: "Hair loss", +}, +{ +id: "s_122", +type: "symptom", +name: "Excessive tear production", +common_name: "Watery eyes", +}, +{ +id: "s_123", +type: "symptom", +name: "Self-neglect", +common_name: "Lack of self-care", +}, +{ +id: "s_124", +type: "symptom", +name: "Scotoma", +common_name: "Black spots in vision", +}, +{ +id: "s_125", +type: "symptom", +name: "Paresthesia, both feet", +common_name: "Feet tingling or numbness", +}, +{ +id: "s_126", +type: "symptom", +name: "Paresthesia, around the mouth", +common_name: "Tingling or numbness around the mouth", +}, +{ +id: "s_127", +type: "symptom", +name: "Obsessions", +common_name: "Obsessive thoughts", +}, +{ +id: "s_131", +type: "symptom", +name: "Sleep attacks", +common_name: "Falling asleep during the day", +}, +{ +id: "s_132", +type: "symptom", +name: "Excess hair growth", +common_name: "Excessive hair", +}, +{ +id: "s_134", +type: "symptom", +name: "Smoking, need first cigarette of the day", +common_name: "Difficulty not smoking first cigarette of the day", +}, +{ +id: "s_136", +type: "symptom", +name: "Sneezing attacks", +common_name: "Sneezing fits", +}, +{ +id: "s_137", +type: "symptom", +name: "Binge eating", +common_name: "Binge eating", +}, +{ +id: "s_139", +type: "symptom", +name: "Recurrent tonsils inflammation", +common_name: "Recurrent tonsils inflammation", +}, +{ +id: "s_142", +type: "symptom", +name: "Recurrent gastric ulcers", +common_name: "Recurrent gastric ulcers", +}, +{ +id: "s_146", +type: "symptom", +name: "Impaired memory, forgetting names of friends and family", +common_name: "Forgetting names of friends and family", +}, +{ +id: "s_147", +type: "symptom", +name: "History of anemia", +common_name: "History of anemia", +}, +{ +id: "s_150", +type: "symptom", +name: "Alcohol consumption, inability to stop drinking", +common_name: "Inability to stop drinking alcohol", +}, +{ +id: "s_151", +type: "symptom", +name: "Abnormal uterine bleeding or spotting, postmenopausal", +common_name: "Vaginal bleeding after menopause", +}, +{ +id: "s_152", +type: "symptom", +name: "Vaginal bleeding after intercourse", +common_name: "Bleeding after intercourse", +}, +{ +id: "s_153", +type: "symptom", +name: "Urinary incontinence", +common_name: "Leaking urine by accident", +}, +{ +id: "s_155", +type: "symptom", +name: "Low sense of self-worth", +common_name: "Low self-esteem", +}, +{ +id: "s_156", +type: "symptom", +name: "Nausea", +common_name: "Feeling sick or queasy", +}, +{ +id: "s_157", +type: "symptom", +name: "Fear of obesity", +common_name: "Fear of obesity", +}, +{ +id: "s_159", +type: "symptom", +name: "Back pain, exacerbated by physical exertion", +common_name: "Back pain worsening after physical activity", +}, +{ +id: "s_161", +type: "symptom", +name: "Symptoms regularly appearing a few days before menstrual period", +common_name: "Symptoms regularly appearing a few days before period", +}, +{ +id: "s_169", +type: "symptom", +name: "Episodes of depressed mood", +common_name: "Depressed mood", +}, +{ +id: "s_170", +type: "symptom", +name: "Edema, knee joint", +common_name: "Swollen knee", +}, +{ +id: "s_171", +type: "symptom", +name: "Edema, one ankle", +common_name: "Swollen ankle", +}, +{ +id: "s_172", +type: "symptom", +name: "Swollen gums", +common_name: "Swollen gums", +}, +{ +id: "s_173", +type: "symptom", +name: "Edema, one lower limb", +common_name: "Swollen leg", +}, +{ +id: "s_175", +type: "symptom", +name: "Edema, both lower limbs", +common_name: "Swollen legs", +}, +{ +id: "s_176", +type: "symptom", +name: "Edema, scrotum", +common_name: "Swollen scrotum", +}, +{ +id: "s_177", +type: "symptom", +name: "Swollen cheek", +common_name: "Swollen cheek", +}, +{ +id: "s_180", +type: "symptom", +name: "Hypopigmentation of the skin", +common_name: "Lightening of the skin", +}, +{ +id: "s_181", +type: "symptom", +name: "Sexual dysfunction, persistent sexual desire", +common_name: "Constant need for sex", +}, +{ +id: "s_182", +type: "symptom", +name: "Nocturia", +common_name: "Urinating often at night", +}, +{ +id: "s_183", +type: "symptom", +name: "Urination while coughing, laughing, or during physical exertion", +common_name: "Urination while coughing, laughing, or during physical activity", +}, +{ +id: "s_185", +type: "symptom", +name: "Oliguria", +common_name: "Urinating less than usual", +}, +{ +id: "s_186", +type: "symptom", +name: "Restricted mobility, difficulty bending over", +common_name: "Difficulty bending down", +}, +{ +id: "s_189", +type: "symptom", +name: "Seizures, with loss of consciousness", +common_name: "Seizures with loss of consciousness", +}, +{ +id: "s_190", +type: "symptom", +name: "Loss of consciousness, with urination or defecation", +common_name: "Fainting with loss of bladder or bowel control", +}, +{ +id: "s_191", +type: "symptom", +name: "Head drop", +common_name: "Head drop", +}, +{ +id: "s_192", +type: "symptom", +name: "Blepharoptosis", +common_name: "Drooping eyelids", +}, +{ +id: "s_194", +type: "symptom", +name: "Ulcer, nipple", +common_name: "Ulcer on the nipple", +}, +{ +id: "s_195", +type: "symptom", +name: "Current cigarette smoking", +common_name: "Current cigarette smoking", +}, +{ +id: "s_196", +type: "symptom", +name: "Smoking, during illness", +common_name: "Smoking even when sick", +}, +{ +id: "s_200", +type: "symptom", +name: "Burning tongue", +common_name: "Burning sensation on tongue", +}, +{ +id: "s_201", +type: "symptom", +name: "Feeling of sand under eyelids", +common_name: "Feeling of sand under eyelids", +}, +{ +id: "s_202", +type: "symptom", +name: "Erythema migrans", +common_name: "Expanding red spot with regular skin or clearing in the middle", +}, +{ +id: "s_203", +type: "symptom", +name: "Dental plaque", +common_name: "Fuzzy teeth", +}, +{ +id: "s_204", +type: "symptom", +name: "Forward-leaning posture", +common_name: "Forward-leaning posture", +}, +{ +id: "s_205", +type: "symptom", +name: "Feeling of guilt", +common_name: "Feeling of guilt", +}, +{ +id: "s_207", +type: "symptom", +name: "Diplopia", +common_name: "Double vision", +}, +{ +id: "s_208", +type: "symptom", +name: "Decreased hearing", +common_name: "Decreased hearing", +}, +{ +id: "s_213", +type: "symptom", +name: "Sexual dysfunction, spending much time on erotic activities", +common_name: "Spending a lot of time on sex-related activity", +}, +{ +id: "s_214", +type: "symptom", +name: "Sweating on painful side of forehead", +common_name: "Sweating on painful side of forehead", +}, +{ +id: "s_215", +type: "symptom", +name: "Frequent urination", +common_name: "Urinating often", +}, +{ +id: "s_216", +type: "symptom", +name: "Excessive sweating", +common_name: "Heavy sweating", +}, +{ +id: "s_217", +type: "symptom", +name: "Night sweats", +common_name: "Night sweats", +}, +{ +id: "s_219", +type: "symptom", +name: "Enlarged breasts", +common_name: "Enlarged breasts", +}, +{ +id: "s_220", +type: "symptom", +name: "Enlarged lymph nodes", +common_name: "Enlarged lymph nodes", +}, +{ +id: "s_221", +type: "symptom", +name: "Dermatological changes, on genitals resembling cauliflower", +common_name: "Bumps on genitals resembling a cauliflower", +}, +{ +id: "s_223", +type: "symptom", +name: "Inability to stop flow of urine", +common_name: "Inability to stop flow of urine", +}, +{ +id: "s_225", +type: "symptom", +name: "Premature graying", +common_name: "Premature graying", +}, +{ +id: "s_226", +type: "symptom", +name: "Weight gain", +common_name: "Weight gain", +}, +{ +id: "s_227", +type: "symptom", +name: "Tachypnea", +common_name: "Rapid breathing", +}, +{ +id: "s_228", +type: "symptom", +name: "Loose tooth unrelated to a tooth exchange", +common_name: "Loose teeth", +}, +{ +id: "s_229", +type: "symptom", +name: "Erythema", +common_name: "Redness of skin", +}, +{ +id: "s_230", +type: "symptom", +name: "Erythema, facial, butterfly-shaped", +common_name: "Redness only on the cheeks and nose", +}, +{ +id: "s_231", +type: "symptom", +name: "Toothache, associated with heat", +common_name: "Toothache associated with heat", +}, +{ +id: "s_232", +type: "symptom", +name: "Calf pain, severe while walking", +common_name: "Severe pain in calf while walking", +}, +{ +id: "s_233", +type: "symptom", +name: "Toothache, severe", +common_name: "Severe toothache", +}, +{ +id: "s_234", +type: "symptom", +name: "Easy bruising", +common_name: "Easy bruising", +}, +{ +id: "s_235", +type: "symptom", +name: "Eyelid twitching", +common_name: "Trembling eyelids", +}, +{ +id: "s_236", +type: "symptom", +name: "Decreased libido", +common_name: "Loss of interest in sex", +}, +{ +id: "s_237", +type: "symptom", +name: "Weight loss, without loss of appetite", +common_name: "Weight loss without loss of appetite", +}, +{ +id: "s_238", +type: "symptom", +name: "Slower gait", +common_name: "Slower walk", +}, +{ +id: "s_241", +type: "symptom", +name: "Dermatological changes", +common_name: "Skin changes", +}, +{ +id: "s_243", +type: "symptom", +name: "Unhealthy weight loss practices", +common_name: "Unhealthy weight loss practices", +}, +{ +id: "s_244", +type: "symptom", +name: "Fear of specific object, situation, or action", +common_name: "Specific fear", +}, +{ +id: "s_245", +type: "symptom", +name: "Dermatological changes, scabs", +common_name: "Scab or crust", +}, +{ +id: "s_247", +type: "symptom", +name: "Dry mouth", +common_name: "Dry mouth", +}, +{ +id: "s_249", +type: "symptom", +name: "Itching around anus", +common_name: "Itchy anus", +}, +{ +id: "s_250", +type: "symptom", +name: "Pruritus, most intense at night", +common_name: "Itching most intense at night", +}, +{ +id: "s_251", +type: "symptom", +name: "Pruritus, aggravated by change in temperature, sweating, or wearing wool", +common_name: "Itching aggravated by changes in temperature, sweat or wearing wool", +}, +{ +id: "s_252", +type: "symptom", +name: "Itching nose or throat", +common_name: "Itchy nose or throat", +}, +{ +id: "s_253", +type: "symptom", +name: "Genital itch", +common_name: "Itching in crotch", +}, +{ +id: "s_254", +type: "symptom", +name: "Pruritus", +common_name: "Itching", +}, +{ +id: "s_255", +type: "symptom", +name: "Itching inside ear", +common_name: "Itchy inner ear", +}, +{ +id: "s_256", +type: "symptom", +name: "Trismus", +common_name: "Difficulty in opening mouth", +}, +{ +id: "s_257", +type: "symptom", +name: "Spine stiffness in the morning", +common_name: "Stiff spine in the morning", +}, +{ +id: "s_258", +type: "symptom", +name: "Joint stiffness, hand stiffness in the morning", +common_name: "Stiff hands in the morning", +}, +{ +id: "s_259", +type: "symptom", +name: "Joint stiffness, subsides after exercising", +common_name: "Joint stiffness disappears after exercise", +}, +{ +id: "s_261", +type: "symptom", +name: "Tachycardia", +common_name: "Fast heart rate", +}, +{ +id: "s_263", +type: "symptom", +name: "Phimosis", +common_name: "Difficulty retracting foreskin", +}, +{ +id: "s_265", +type: "symptom", +name: "Smoking, in non-smoking areas", +common_name: "Smoking in non-smoking areas", +}, +{ +id: "s_266", +type: "symptom", +name: "Difficulty biting and chewing", +common_name: "Difficulty biting and chewing", +}, +{ +id: "s_267", +type: "symptom", +name: "Toothache, difficulty determining which tooth hurts", +common_name: "Difficulty identifying which tooth hurts", +}, +{ +id: "s_269", +type: "symptom", +name: "Difficulty acquiring new information", +common_name: "Difficulty learning new things", +}, +{ +id: "s_270", +type: "symptom", +name: "Creaking joints during movement", +common_name: "Creaking joints during movement", +}, +{ +id: "s_271", +type: "symptom", +name: "Smooth face without wrinkles", +common_name: "Smooth face without wrinkles", +}, +{ +id: "s_272", +type: "symptom", +name: "Enamel lesions, caries", +common_name: "Cavities", +}, +{ +id: "s_273", +type: "symptom", +name: "Heavy legs at the end of the day", +common_name: "Heavy legs at the end of the day", +}, +{ +id: "s_274", +type: "symptom", +name: "Feeling hot", +common_name: "Feeling hot", +}, +{ +id: "s_276", +type: "symptom", +name: "Clogged ear", +common_name: "Clogged ear", +}, +{ +id: "s_277", +type: "symptom", +name: "Increased abdominal girth", +common_name: "Increased abdominal size", +}, +{ +id: "s_279", +type: "symptom", +name: "Feeling pressure or pulsation inside the tooth", +common_name: "Feeling pressure or pulsation inside the tooth", +}, +{ +id: "s_280", +type: "symptom", +name: "Hot flashes", +common_name: "Hot flashes", +}, +{ +id: "s_284", +type: "symptom", +name: "Diminished appetite", +common_name: "Diminished appetite", +}, +{ +id: "s_285", +type: "symptom", +name: "Weight loss", +common_name: "Weight loss", +}, +{ +id: "s_287", +type: "symptom", +name: "Anhedonia, lasting at least 2 weeks", +common_name: "Inability to feel pleasure for 2 weeks or more", +}, +{ +id: "s_289", +type: "symptom", +name: "Malocclusions", +common_name: "Malocclusions", +}, +{ +id: "s_291", +type: "symptom", +name: "Ear canal swelling", +common_name: "Swelling inside the ear", +}, +{ +id: "s_297", +type: "symptom", +name: "Discharge from ear", +common_name: "Discharge from ear", +}, +{ +id: "s_299", +type: "symptom", +name: "Abdominal mass", +common_name: "Lump in stomach", +}, +{ +id: "s_300", +type: "symptom", +name: "Nodule located in breast", +common_name: "Lump in the breast", +}, +{ +id: "s_301", +type: "symptom", +name: "Discharge under foreskin", +common_name: "Discharge under foreskin", +}, +{ +id: "s_302", +type: "symptom", +name: "Discharge from periodontal pockets", +common_name: "Discharge from spaces between the gums and teeth", +}, +{ +id: "s_303", +type: "symptom", +name: "Compulsions", +common_name: "Compulsive behavior", +}, +{ +id: "s_305", +type: "symptom", +name: "Vomiting", +common_name: "Vomiting", +}, +{ +id: "s_306", +type: "symptom", +name: "Hematemesis", +common_name: "Vomiting blood", +}, +{ +id: "s_308", +type: "symptom", +name: "Smoking, mostly in the morning", +common_name: "Smoking mostly in the morning", +}, +{ +id: "s_309", +type: "symptom", +name: "Bloating", +common_name: "Bloating", +}, +{ +id: "s_310", +type: "symptom", +name: "Increased thirst", +common_name: "More thirsty than usual", +}, +{ +id: "s_311", +type: "symptom", +name: "Increased appetite", +common_name: "More hungry than usual", +}, +{ +id: "s_313", +type: "symptom", +name: "Sensory loss in one limb", +common_name: "Loss of feeling in one arm or leg", +}, +{ +id: "s_316", +type: "symptom", +name: "Impaired memory", +common_name: "Impaired memory", +}, +{ +id: "s_317", +type: "symptom", +name: "Impaired balance while walking", +common_name: "Stumbling or losing balance while walking", +}, +{ +id: "s_319", +type: "symptom", +name: "Sleep disorder", +common_name: "Changes and difficulties in sleeping pattern or habit", +}, +{ +id: "s_320", +type: "symptom", +name: "Impaired vision", +common_name: "Visual impairment", +}, +{ +id: "s_322", +type: "symptom", +name: "Gum erythema", +common_name: "Red gums", +}, +{ +id: "s_323", +type: "symptom", +name: "Erythema, joint", +common_name: "Redness of skin over joint", +}, +{ +id: "s_325", +type: "symptom", +name: "Erythema, limb", +common_name: "Red skin on arms or legs", +}, +{ +id: "s_326", +type: "symptom", +name: "Sexual dysfunction, prioritizing sex over duties and hobbies", +common_name: "Neglecting family work or hobbies due to sex", +}, +{ +id: "s_327", +type: "symptom", +name: "Smoking, need when waking up", +common_name: "Smoking as soon as waking up", +}, +{ +id: "s_328", +type: "symptom", +name: "Abnormal vaginal discharge", +common_name: "Abnormal vaginal discharge", +}, +{ +id: "s_329", +type: "symptom", +name: "Constipation", +common_name: "Constipation", +}, +{ +id: "s_330", +type: "symptom", +name: "Regurgitation", +common_name: "Food coming back up into the mouth", +}, +{ +id: "s_331", +type: "symptom", +name: "Nasal congestion", +common_name: "Blocked nose", +}, +{ +id: "s_332", +type: "symptom", +name: "Jaundice", +common_name: "Jaundice", +}, +{ +id: "s_334", +type: "symptom", +name: "Jaundice, stress-related", +common_name: "Yellow skin or eyes during times of increased stress", +}, +{ +id: "s_335", +type: "symptom", +name: "Jaundice, following intense physical exertion", +common_name: "Yellow skin or eyes after physical activity", +}, +{ +id: "s_336", +type: "symptom", +name: "Jaundice, during infectious disease", +common_name: "Yellow skin or eyes during infectious disease", +}, +{ +id: "s_338", +type: "symptom", +name: "Heartburn", +common_name: "Heartburn", +}, +{ +id: "s_341", +type: "symptom", +name: "Illusion of surroundings being bigger or smaller than they actually are", +common_name: "Illusion of surroundings being bigger or smaller than they actually are", +}, +{ +id: "s_342", +type: "symptom", +name: "Wrinkling or dimpling of skin on breast", +common_name: "Wrinkling or dimpling of skin on breast", +}, +{ +id: "s_343", +type: "symptom", +name: "Retraction or indentation of nipple", +common_name: "Change in the nipple", +}, +{ +id: "s_345", +type: "symptom", +name: "Change in handwriting", +common_name: "Change in handwriting", +}, +{ +id: "s_346", +type: "symptom", +name: "Change in colour of a tooth", +common_name: "Change in colour of a tooth", +}, +{ +id: "s_348", +type: "symptom", +name: "Personality changes", +common_name: "Personality changes", +}, +{ +id: "s_350", +type: "symptom", +name: "Dermatological changes, forming a line", +common_name: "Skin changes forming a line", +}, +{ +id: "s_351", +type: "symptom", +name: "Ulcer, sore, or abscess near the anus", +common_name: "Ulcer, sore, or abscess near the anus", +}, +{ +id: "s_352", +type: "symptom", +name: "Dermatological changes, in direct contact with buttons, fasteners, or cosmetics", +common_name: "Skin changes in direct contact with buttons, fasteners, jewelry, or cosmetics", +}, +{ +id: "s_358", +type: "symptom", +name: "Intermittent urine flow", +common_name: "Intermittent urine flow", +}, +{ +id: "s_359", +type: "symptom", +name: "Joint deformity, non-traumatic", +common_name: "Joint deformity not associated with recent trauma", +}, +{ +id: "s_360", +type: "symptom", +name: "Microstomia", +common_name: "Narrow mouth", +}, +{ +id: "s_361", +type: "symptom", +name: "Sexual dysfunction, increased longing for stimulation", +common_name: "Increased need in sexual experiences or sensations to attain desired effect", +}, +{ +id: "s_362", +type: "symptom", +name: "Oily skin", +common_name: "Greasy or oily skin", +}, +{ +id: "s_363", +type: "symptom", +name: "Edema, neck", +common_name: "Swollen neck", +}, +{ +id: "s_369", +type: "symptom", +name: "Discharge from urethra", +common_name: "Discharge from urethra", +}, +{ +id: "s_370", +type: "symptom", +name: "Dizziness", +common_name: "Dizzy", +}, +{ +id: "s_371", +type: "symptom", +name: "Overworked", +common_name: "Overworked", +}, +{ +id: "s_373", +type: "symptom", +name: "Honey-coloured crust on the skin", +common_name: "Honey-coloured scabs on the skin", +}, +{ +id: "s_376", +type: "symptom", +name: "Skin phototype I or II", +common_name: "Light or fair skin that easily burns", +}, +{ +id: "s_377", +type: "symptom", +name: "Numerous nevi", +common_name: "Many moles or birthmarks", +}, +{ +id: "s_380", +type: "symptom", +name: "Suspicious mole or birthmark, asymmetrical", +common_name: "Asymmetric mole or birthmark", +}, +{ +id: "s_381", +type: "symptom", +name: "Suspicious mole or birthmark, irregular border", +common_name: "Mole or birthmark with irregular border", +}, +{ +id: "s_382", +type: "symptom", +name: "Suspicious mole or birthmark, larger than 6 mm", +common_name: "Mole or birthmark larger than 6 mm", +}, +{ +id: "s_383", +type: "symptom", +name: "Suspicious mole or birthmark", +common_name: "Suspicious mole or birthmark", +}, +{ +id: "s_384", +type: "symptom", +name: "Red macules with silver-white, flaky scales", +common_name: "Red skin patches with silver-white, flaky scales", +}, +{ +id: "s_385", +type: "symptom", +name: "Dry, cracked skin, bleeding occasionally", +common_name: "Dry, cracked skin, bleeding occasionally", +}, +{ +id: "s_386", +type: "symptom", +name: "Thickened nails, with pits or grooves", +common_name: "Thickened nails with pits or grooves", +}, +{ +id: "s_388", +type: "symptom", +name: "Pustule", +common_name: "Small bumps less than 1 cm filled with pus", +}, +{ +id: "s_389", +type: "symptom", +name: "Open comedones", +common_name: "Blackheads", +}, +{ +id: "s_393", +type: "symptom", +name: "Urticaria", +common_name: "Hives", +}, +{ +id: "s_398", +type: "symptom", +name: "Dermatological changes, entire body", +common_name: "Skin changes all over the body", +}, +{ +id: "s_400", +type: "symptom", +name: "Dermatological changes, preceded by pain or itching", +common_name: "Skin changes preceded by pain or itching", +}, +{ +id: "s_402", +type: "symptom", +name: "Dermatological changes, recurring during infections or menstrual period", +common_name: "Skin changes recurring during period or infections", +}, +{ +id: "s_404", +type: "symptom", +name: "Dermatological changes, rough and irregular surface", +common_name: "Skin changes with rough, irregular surface", +}, +{ +id: "s_407", +type: "symptom", +name: "Tinnitus", +common_name: "Ringing in ears", +}, +{ +id: "s_408", +type: "symptom", +name: "Cold feet and toes", +common_name: "Cold feet and toes", +}, +{ +id: "s_410", +type: "symptom", +name: "Reduced body temperature", +common_name: "Reduced body temperature", +}, +{ +id: "s_412", +type: "symptom", +name: "Diarrhea, foamy", +common_name: "Foamy diarrhea", +}, +{ +id: "s_418", +type: "symptom", +name: "Stiff neck", +common_name: "Stiff neck", +}, +{ +id: "s_419", +type: "symptom", +name: "Feeling overweight despite normal to low weight", +common_name: "Feeling overweight despite normal to low weight", +}, +{ +id: "s_420", +type: "symptom", +name: "Lying about eating or hiding food", +common_name: "Lying about eating or hiding food", +}, +{ +id: "s_421", +type: "symptom", +name: "Increased libido", +common_name: "Increased sex drive", +}, +{ +id: "s_422", +type: "symptom", +name: "Deepening of voice", +common_name: "Deepened voice", +}, +{ +id: "s_423", +type: "symptom", +name: "Sense of self-worth dependent on weight", +common_name: "Self-worth based on weight", +}, +{ +id: "s_424", +type: "symptom", +name: "Facial pain, unilateral", +common_name: "Face pain on one side", +}, +{ +id: "s_425", +type: "symptom", +name: "Facial pain, stabbing", +common_name: "Stabbing face pain", +}, +{ +id: "s_426", +type: "symptom", +name: "Facial pain, triggered by eating, or touching or brushing teeth", +common_name: "Face pain triggered by eating, or touching or brushing teeth", +}, +{ +id: "s_427", +type: "symptom", +name: "Facial pain, periodic", +common_name: "Periodic face pain", +}, +{ +id: "s_429", +type: "symptom", +name: "Clicking or cracking in the jaw when opening or closing the mouth", +common_name: "Clicking or cracking in the jaw when opening or closing the mouth", +}, +{ +id: "s_430", +type: "symptom", +name: "Pain in temporomandibular joint during movement", +common_name: "Pain in jaw during movement", +}, +{ +id: "s_433", +type: "symptom", +name: "Erythema, foreskin or head of the penis", +common_name: "Reddened foreskin or head of the penis", +}, +{ +id: "s_435", +type: "symptom", +name: "Feeling of incomplete evacuation of the bladder", +common_name: "Bladder not emptying completely", +}, +{ +id: "s_436", +type: "symptom", +name: "Anorectal pain", +common_name: "Anorectal pain", +}, +{ +id: "s_437", +type: "symptom", +name: "Cyanosis", +common_name: "Bluish-grey coloured skin", +}, +{ +id: "s_471", +type: "symptom", +name: "Abdominal pain, radiating to right shoulder or shoulder blade", +common_name: "Abdominal pain spreading to the right shoulder area", +}, +{ +id: "s_474", +type: "symptom", +name: "Audible wheezing", +common_name: "Whistling sound made while breathing", +}, +{ +id: "s_476", +type: "symptom", +name: "Earache, tenderness around the ear", +common_name: "Pain when pressing area around the ear", +}, +{ +id: "s_477", +type: "symptom", +name: "Aphonia", +common_name: "Loss of voice", +}, +{ +id: "s_478", +type: "symptom", +name: "Facial pain", +common_name: "Face pain", +}, +{ +id: "s_479", +type: "symptom", +name: "Nystagmus", +common_name: "Nystagmus", +}, +{ +id: "s_480", +type: "symptom", +name: "Enlargement of hands, feet, or face", +common_name: "Enlargement of hands, feet, or face", +}, +{ +id: "s_483", +type: "symptom", +name: "Dermatological changes, eyelid", +common_name: "Skin changes on eyelid", +}, +{ +id: "s_484", +type: "symptom", +name: "Eyelid lesion, red lump with yellow tip", +common_name: "Red lump with yellow tip on eyelid", +}, +{ +id: "s_485", +type: "symptom", +name: "Eyelid lesion, painful", +common_name: "Painful skin changes on eyelid", +}, +{ +id: "s_486", +type: "symptom", +name: "Eyelid lesion, red and warm", +common_name: "Red and warm skin changes on eyelid", +}, +{ +id: "s_488", +type: "symptom", +name: "Eyes sensitive to light", +common_name: "Light sensitivity", +}, +{ +id: "s_489", +type: "symptom", +name: "Dry discharge on eyelids", +common_name: "Dry discharge on eyelids", +}, +{ +id: "s_492", +type: "symptom", +name: "Red eye", +common_name: "Red eye", +}, +{ +id: "s_493", +type: "symptom", +name: "Eye pain", +common_name: "Eye pain", +}, +{ +id: "s_494", +type: "symptom", +name: "Visual field narrowing", +common_name: "Tunnel vision", +}, +{ +id: "s_497", +type: "symptom", +name: "Anisocoria", +common_name: "Asymmetric pupils", +}, +{ +id: "s_501", +type: "symptom", +name: "Distance misjudgment", +common_name: "Problems judging distances", +}, +{ +id: "s_503", +type: "symptom", +name: "Muscle cramps", +common_name: "Muscle cramps", +}, +{ +id: "s_504", +type: "symptom", +name: "Foamy urine", +common_name: "Foamy urine", +}, +{ +id: "s_505", +type: "symptom", +name: "Frequent infections", +common_name: "Frequent infections", +}, +{ +id: "s_506", +type: "symptom", +name: "Skin mark from insect or bug bite", +common_name: "Insect bite", +}, +{ +id: "s_507", +type: "symptom", +name: "Loss of will to live", +common_name: "Loss of will to live", +}, +{ +id: "s_508", +type: "symptom", +name: "Anhedonia", +common_name: "Inability to feel pleasure", +}, +{ +id: "s_509", +type: "symptom", +name: "Odynophagia", +common_name: "Painful swallowing", +}, +{ +id: "s_510", +type: "symptom", +name: "Urethral discharge when pressing the penis", +common_name: "Discharge when pressing penis", +}, +{ +id: "s_513", +type: "symptom", +name: "Globus sensation", +common_name: "Feeling of lump in throat", +}, +{ +id: "s_514", +type: "symptom", +name: "Derealization", +common_name: "Feeling detached from onessurroundings", +}, +{ +id: "s_518", +type: "symptom", +name: "Paresthesia", +common_name: "Tingling or numbness", +}, +{ +id: "s_524", +type: "symptom", +name: "Nasal polyps", +common_name: "Polyps in nose", +}, +{ +id: "s_525", +type: "symptom", +name: "Foul-smelling stools", +common_name: "Foul-smelling stools", +}, +{ +id: "s_526", +type: "symptom", +name: "Cough, productive with yellow or green sputum", +common_name: "Coughing up thick, yellow or green phlegm", +}, +{ +id: "s_528", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago", +common_name: "Drinking alcohol less than 24 hours ago", +}, +{ +id: "s_529", +type: "symptom", +name: "Parotid swelling", +common_name: "Parotid swelling", +}, +{ +id: "s_530", +type: "symptom", +name: "Sudden increase in blood pressure", +common_name: "Sudden increase in blood pressure", +}, +{ +id: "s_531", +type: "symptom", +name: "Frequent infections, upper respiratory tract", +common_name: "Frequent runny nose, cough", +}, +{ +id: "s_532", +type: "symptom", +name: "Frequent infections, lower respiratory tract", +common_name: "Frequent bronchitis", +}, +{ +id: "s_533", +type: "symptom", +name: "Hypotension", +common_name: "Low blood pressure", +}, +{ +id: "s_534", +type: "symptom", +name: "Bradycardia", +common_name: "Slow heart rate", +}, +{ +id: "s_535", +type: "symptom", +name: "Decreased pupillary light reflex", +common_name: "Decreased pupillary light reflex", +}, +{ +id: "s_536", +type: "symptom", +name: "Mydriasis", +common_name: "Dilated pupils", +}, +{ +id: "s_537", +type: "symptom", +name: "Miosis", +common_name: "Constricted pupils", +}, +{ +id: "s_538", +type: "symptom", +name: "Tremors", +common_name: "Muscles trembling", +}, +{ +id: "s_539", +type: "symptom", +name: "Seizures, without loss of consciousness", +common_name: "Seizures without loss of consciousness", +}, +{ +id: "s_540", +type: "symptom", +name: "Irritability", +common_name: "Irritability", +}, +{ +id: "s_541", +type: "symptom", +name: "Orthostatic hypotension", +common_name: "Dizzy or lightheaded after standing up", +}, +{ +id: "s_542", +type: "symptom", +name: "Dry skin", +common_name: "Dry skin", +}, +{ +id: "s_543", +type: "symptom", +name: "Blood pressure, elevated", +common_name: "High blood pressure", +}, +{ +id: "s_545", +type: "symptom", +name: "Telangiectasias", +common_name: "Spider veins", +}, +{ +id: "s_547", +type: "symptom", +name: "Galactorrhea in women", +common_name: "Milky discharge from the nipple outside of breastfeeding period", +}, +{ +id: "s_550", +type: "symptom", +name: "Lens clouding", +common_name: "Cloudy appearance of either eye", +}, +{ +id: "s_551", +type: "symptom", +name: "Toothache", +common_name: "Toothache", +}, +{ +id: "s_553", +type: "symptom", +name: "Cyanosis, fingers", +common_name: "Grayish-blue fingers", +}, +{ +id: "s_554", +type: "symptom", +name: "Pain in upper limb, hand or fingers", +common_name: "Pain in hand or fingers", +}, +{ +id: "s_555", +type: "symptom", +name: "Tingling fingers", +common_name: "Tingling fingers", +}, +{ +id: "s_556", +type: "symptom", +name: "Cold hands or fingers", +common_name: "Cold hands or fingers", +}, +{ +id: "s_557", +type: "symptom", +name: "Erythema, hands", +common_name: "Red hand", +}, +{ +id: "s_558", +type: "symptom", +name: "Symptoms exacerbated by low temperature", +common_name: "Symptoms worse in the cold", +}, +{ +id: "s_561", +type: "symptom", +name: "Belching", +common_name: "Burping", +}, +{ +id: "s_562", +type: "symptom", +name: "Edema, pitting", +common_name: "Pitting edema", +}, +{ +id: "s_563", +type: "symptom", +name: "Dyspnea, orthopnea", +common_name: "Shortness of breath when lying down", +}, +{ +id: "s_564", +type: "symptom", +name: "Loss of muscle mass, hands", +common_name: "Loss of muscles in hands", +}, +{ +id: "s_567", +type: "symptom", +name: "Murphyssign", +common_name: "Stomach pain on deep inhalation and simultaneous pressing right upper part of abdomen", +}, +{ +id: "s_568", +type: "symptom", +name: "Binge eating, followed by self-disgust", +common_name: "Self-disgust after binge eating", +}, +{ +id: "s_569", +type: "symptom", +name: "Pale or clay-colored stool", +common_name: "Pale stool", +}, +{ +id: "s_570", +type: "symptom", +name: "Hypopyon", +common_name: "Collection of pus in front of the eye", +}, +{ +id: "s_571", +type: "symptom", +name: "Spasticity", +common_name: "Tight and spasming muscles", +}, +{ +id: "s_572", +type: "symptom", +name: "Reduced degree of facial expression", +common_name: "Face lacking expression or animation", +}, +{ +id: "s_575", +type: "symptom", +name: "Joint stiffness", +common_name: "Stiff joints", +}, +{ +id: "s_576", +type: "symptom", +name: "Joint pain, aggravated by cold or damp weather", +common_name: "Joint pain aggravated by cold or damp weather", +}, +{ +id: "s_578", +type: "symptom", +name: "Foot pain", +common_name: "Pain in one foot", +}, +{ +id: "s_579", +type: "symptom", +name: "Pain in lower limb", +common_name: "Pain in lower limb", +}, +{ +id: "s_580", +type: "symptom", +name: "Pain in upper limb", +common_name: "Pain in upper limb", +}, +{ +id: "s_581", +type: "symptom", +name: "Joint pain, one knee", +common_name: "Pain in one knee", +}, +{ +id: "s_582", +type: "symptom", +name: "Anxiety attack", +common_name: "Anxiety attack", +}, +{ +id: "s_583", +type: "symptom", +name: "General anxiety", +common_name: "General anxiety", +}, +{ +id: "s_584", +type: "symptom", +name: "Suspicious mole or birthmark, change in shape", +common_name: "Change in shape of mole or birthmark", +}, +{ +id: "s_585", +type: "symptom", +name: "Suspicious mole or birthmark, change in colour", +common_name: "Change in colour of mole or birthmark", +}, +{ +id: "s_586", +type: "symptom", +name: "Gynecomastia", +common_name: "Breast enlargement in man", +}, +{ +id: "s_588", +type: "symptom", +name: "Alcohol consumption, increasing tolerance", +common_name: "Alcohol tolerance", +}, +{ +id: "s_590", +type: "symptom", +name: "Tremors, tongue", +common_name: "Trembling of tongue", +}, +{ +id: "s_593", +type: "symptom", +name: "Prolonged bleeding time", +common_name: "Prolonged bleeding time", +}, +{ +id: "s_594", +type: "symptom", +name: "Petechiae", +common_name: "Red or purple spots not fading under pressure smaller than 3 mm", +}, +{ +id: "s_598", +type: "symptom", +name: "Abscess", +common_name: "Reddened, swollen and painful skin change", +}, +{ +id: "s_603", +type: "symptom", +name: "Nail clubbing", +common_name: "Enlarged fingertips and nails", +}, +{ +id: "s_604", +type: "symptom", +name: "Headache, lancinating", +common_name: "Stabbing headache", +}, +{ +id: "s_605", +type: "symptom", +name: "Headache, series over a period of time", +common_name: "Series of headaches", +}, +{ +id: "s_606", +type: "symptom", +name: "Eye flashes", +common_name: "Eye flashes", +}, +{ +id: "s_607", +type: "symptom", +name: "Tongue erythema", +common_name: "Unusually red tongue", +}, +{ +id: "s_608", +type: "symptom", +name: "Angular cheilitis", +common_name: "Cracked corners of lips", +}, +{ +id: "s_609", +type: "symptom", +name: "Breast pain or tenderness, unilateral", +common_name: "Pain or tenderness in only one breast", +}, +{ +id: "s_610", +type: "symptom", +name: "Coated tonsils", +common_name: "White spots on tonsils", +}, +{ +id: "s_611", +type: "symptom", +name: "Dark urine", +common_name: "Dark urine", +}, +{ +id: "s_612", +type: "symptom", +name: "Bone pain", +common_name: "Bone pain", +}, +{ +id: "s_613", +type: "symptom", +name: "Xanthelasma", +common_name: "Yellowish deposits on eyelids", +}, +{ +id: "s_614", +type: "symptom", +name: "Itching after a hot shower or bath", +common_name: "Itchy skin after a hot shower or bath", +}, +{ +id: "s_616", +type: "symptom", +name: "Edema, face", +common_name: "Swollen face", +}, +{ +id: "s_618", +type: "symptom", +name: "Hairy leukoplakia", +common_name: "Hairy leukoplakia", +}, +{ +id: "s_622", +type: "symptom", +name: "Loss of muscle mass", +common_name: "Loss of muscles", +}, +{ +id: "s_623", +type: "symptom", +name: "Edema, both ankles", +common_name: "Swollen ankles", +}, +{ +id: "s_625", +type: "symptom", +name: "Headache, exacerbated by tilting head forwards", +common_name: "Headache worsened by tilting head forward", +}, +{ +id: "s_629", +type: "symptom", +name: "Feeling of helplessness", +common_name: "Feeling of helplessness", +}, +{ +id: "s_630", +type: "symptom", +name: "Vulvovaginal itching", +common_name: "Vulvovaginal itching", +}, +{ +id: "s_631", +type: "symptom", +name: "Impaired concentration", +common_name: "Poor concentration", +}, +{ +id: "s_632", +type: "symptom", +name: "Feeling of hopelessness", +common_name: "Feeling of hopelessness", +}, +{ +id: "s_633", +type: "symptom", +name: "Episode of elevated mood", +common_name: "Elevated mood", +}, +{ +id: "s_634", +type: "symptom", +name: "Decreased need for sleep", +common_name: "Decreased need for sleep", +}, +{ +id: "s_635", +type: "symptom", +name: "Contentiousness", +common_name: "Argumentative behaviour", +}, +{ +id: "s_636", +type: "symptom", +name: "Financial recklessness", +common_name: "Financial recklessness", +}, +{ +id: "s_637", +type: "symptom", +name: "Quickening of thoughts and speech", +common_name: "Quickening of thoughts and speech", +}, +{ +id: "s_640", +type: "symptom", +name: "Tenesmus", +common_name: "Feeling of incomplete defecation", +}, +{ +id: "s_641", +type: "symptom", +name: "Bowel incontinence", +common_name: "Loss of bowel control", +}, +{ +id: "s_642", +type: "symptom", +name: "Mucous secretion in stool", +common_name: "Mucus in stool", +}, +{ +id: "s_646", +type: "symptom", +name: "Mood swings", +common_name: "Mood swings", +}, +{ +id: "s_647", +type: "symptom", +name: "Simple visual paradelusions", +common_name: "Simple visual paradelusions", +}, +{ +id: "s_648", +type: "symptom", +name: "Simple auditory paradelusions", +common_name: "Simple auditory paradelusions", +}, +{ +id: "s_649", +type: "symptom", +name: "Psychomotor retardation", +common_name: "Psychomotor retardation", +}, +{ +id: "s_650", +type: "symptom", +name: "Muscle weakness", +common_name: "Weak muscles", +}, +{ +id: "s_651", +type: "symptom", +name: "Ataxia", +common_name: "Problems with coordinating movement", +}, +{ +id: "s_652", +type: "symptom", +name: "Deep tendon reflexes, decreased", +common_name: "Decreased deep tendon reflexes", +}, +{ +id: "s_653", +type: "symptom", +name: "Pupil dilation variation", +common_name: "Pupil dilation variation", +}, +{ +id: "s_659", +type: "symptom", +name: "Social isolation", +common_name: "Social isolation", +}, +{ +id: "s_660", +type: "symptom", +name: "Anger outbursts", +common_name: "Anger outbursts", +}, +{ +id: "s_662", +type: "symptom", +name: "Cough, productive in the morning", +common_name: "Coughing up phlegm or mucus in the morning", +}, +{ +id: "s_663", +type: "symptom", +name: "Back pain, lumbar, radiating to the groin", +common_name: "Lower back pain spreading to the groin", +}, +{ +id: "s_664", +type: "symptom", +name: "Kopliksspots", +common_name: "Small white spots surrounded by red ring on the insides of cheeks", +}, +{ +id: "s_665", +type: "symptom", +name: "Measles rash", +common_name: "Measles rash", +}, +{ +id: "s_666", +type: "symptom", +name: "Leopard-like spots on skin", +common_name: "Brick-coloured spots resembling leopard spots", +}, +{ +id: "s_668", +type: "symptom", +name: "Unilateral enophthalmos", +common_name: "One sunken eyeball", +}, +{ +id: "s_669", +type: "symptom", +name: "Anhidrosis, face, unilateral", +common_name: "Lack of sweating on one side of the face", +}, +{ +id: "s_670", +type: "symptom", +name: "Cough, productive with pink, frothy sputum", +common_name: "Coughing up pink phlegm", +}, +{ +id: "s_671", +type: "symptom", +name: "Neck vein distention", +common_name: "Swollen neck veins", +}, +{ +id: "s_673", +type: "symptom", +name: "Tongue enlargement", +common_name: "Swollen tongue", +}, +{ +id: "s_675", +type: "symptom", +name: "Delusions, persecutory", +common_name: "Belief of being watched, conspired against, or purposely hindered by others", +}, +{ +id: "s_676", +type: "symptom", +name: "Delusions, referential", +common_name: "Belief of hidden or secret messages meant for onesself", +}, +{ +id: "s_677", +type: "symptom", +name: "Delusions, grandiose", +common_name: "Belief of being superior to others", +}, +{ +id: "s_678", +type: "symptom", +name: "Delusions, nihilistic", +common_name: "Belief of being dead, decomposed, or destroyed", +}, +{ +id: "s_679", +type: "symptom", +name: "Delusions, hypochondriacal", +common_name: "Belief of being sick despite medical proof of the contrary", +}, +{ +id: "s_680", +type: "symptom", +name: "Delusions, of control", +common_name: "Belief that onesthoughts or actions are controlled by others", +}, +{ +id: "s_681", +type: "symptom", +name: "Hallucinations, visual", +common_name: "Seeing things that others do not see", +}, +{ +id: "s_682", +type: "symptom", +name: "Hallucinations, auditory", +common_name: "Hearing voices or sounds others do not hear", +}, +{ +id: "s_689", +type: "symptom", +name: "Urination in small amounts", +common_name: "Urination in small amounts", +}, +{ +id: "s_690", +type: "symptom", +name: "Urinary urgency", +common_name: "Urgent need to urinate", +}, +{ +id: "s_691", +type: "symptom", +name: "Trouble beginning urination", +common_name: "Trouble beginning urination", +}, +{ +id: "s_692", +type: "symptom", +name: "Red and swollen oral mucosa", +common_name: "Red and swollen inside of mouth", +}, +{ +id: "s_694", +type: "symptom", +name: "Oral lesions", +common_name: "Changes in the mouth", +}, +{ +id: "s_696", +type: "symptom", +name: "Urinary retention", +common_name: "Unable to urinate when bladder is full", +}, +{ +id: "s_697", +type: "symptom", +name: "Decreased skin turgor", +common_name: "Decreased skin elasticity", +}, +{ +id: "s_698", +type: "symptom", +name: "Bilateral enophthalmos", +common_name: "Both eyes sunken", +}, +{ +id: "s_699", +type: "symptom", +name: "Edema, dependent on the body position", +common_name: "Swelling dependent on the position of the body", +}, +{ +id: "s_700", +type: "symptom", +name: "Edema", +common_name: "Swelling", +}, +{ +id: "s_701", +type: "symptom", +name: "Edema, daytime", +common_name: "Daytime swelling", +}, +{ +id: "s_711", +type: "symptom", +name: "Dissociative amnesia of trauma", +common_name: "Difficulty remembering traumatic experiences", +}, +{ +id: "s_715", +type: "symptom", +name: "Sneezing", +common_name: "Sneezing", +}, +{ +id: "s_716", +type: "symptom", +name: "Impaired social functioning", +common_name: "Difficulty functioning at home, work, or school", +}, +{ +id: "s_725", +type: "symptom", +name: "Excessive worry about the health of a child", +common_name: "Excessive worry about the health of a child", +}, +{ +id: "s_727", +type: "symptom", +name: "Difficulty bonding with infant", +common_name: "Difficulty bonding with baby", +}, +{ +id: "s_728", +type: "symptom", +name: "Thoughts of harming oneschild", +common_name: "Thoughts of harming oneschild", +}, +{ +id: "s_729", +type: "symptom", +name: "Thoughts of killing oneschild", +common_name: "Thoughts of killing oneschild", +}, +{ +id: "s_730", +type: "symptom", +name: "Mood swings, diurnal", +common_name: "Mood better in the evening than in the morning", +}, +{ +id: "s_732", +type: "symptom", +name: "Calf pain, severe while walking, intermittent claudication", +common_name: "Pain in calf during exertion and relieved by rest", +}, +{ +id: "s_733", +type: "symptom", +name: "Erectile dysfunction", +common_name: "Erectile dysfunction", +}, +{ +id: "s_734", +type: "symptom", +name: "Claudication in upper leg", +common_name: "Acute thigh or buttock pain appearing during exertion and relieving after short rest", +}, +{ +id: "s_735", +type: "symptom", +name: "Weak pulse in legs", +common_name: "Weak pulse in legs", +}, +{ +id: "s_746", +type: "symptom", +name: "Loss or impairment of proprioception", +common_name: "Loss or impairment of proprioception", +}, +{ +id: "s_747", +type: "symptom", +name: "Loss or impairment of temperature sensation", +common_name: "Loss or impairment of temperature sensation", +}, +{ +id: "s_750", +type: "symptom", +name: "Ocular motility disorder", +common_name: "Difficulty moving eyes", +}, +{ +id: "s_756", +type: "symptom", +name: "Gottronspapules", +common_name: "Red, painful, or scaly bumps over hand and finger joints", +}, +{ +id: "s_757", +type: "symptom", +name: "Holster sign", +common_name: "Redness on hips or sides of thighs", +}, +{ +id: "s_758", +type: "symptom", +name: "Erythema, shoulders and nape of neck", +common_name: "Redness on the shoulders and the back of the neck", +}, +{ +id: "s_759", +type: "symptom", +name: "Erythema, V-shaped on chest", +common_name: "V-shaped redness on the chest", +}, +{ +id: "s_760", +type: "symptom", +name: "Hyperkeratosis on hands", +common_name: "Thickened and cracked skin on hands", +}, +{ +id: "s_762", +type: "symptom", +name: "Purpuric rash", +common_name: "Red or purple spots not fading under pressure larger than 3 mm", +}, +{ +id: "s_763", +type: "symptom", +name: "Livedo reticularis", +common_name: "Blotchy, red-purplish marbling of the skin", +}, +{ +id: "s_768", +type: "symptom", +name: "Delusions, self-accusation", +common_name: "Belief of being evil, guilty, or responsible for a disaster", +}, +{ +id: "s_769", +type: "symptom", +name: "Delusions, bizarre", +common_name: "Belief in the bizarre or impossible, e.g., alien, cloning, or teleportation", +}, +{ +id: "s_770", +type: "symptom", +name: "Poor personal hygiene", +common_name: "Poor personal hygiene", +}, +{ +id: "s_773", +type: "symptom", +name: "Social maladjustment", +common_name: "Social maladjustment", +}, +{ +id: "s_776", +type: "symptom", +name: "Waking up early", +common_name: "Waking up early", +}, +{ +id: "s_777", +type: "symptom", +name: "Prolonged nighttime sleep", +common_name: "Prolonged nighttime sleep", +}, +{ +id: "s_778", +type: "symptom", +name: "Lack of boundaries in interpersonal relations", +common_name: "Lack of boundaries in relationships", +}, +{ +id: "s_779", +type: "symptom", +name: "Rash or impulsive decisions", +common_name: "Making rash or impulsive decisions", +}, +{ +id: "s_780", +type: "symptom", +name: "Delusions, religious", +common_name: "Belief of being chosen by a higher power or being a deity", +}, +{ +id: "s_789", +type: "symptom", +name: "Urticaria, triggered by scratching", +common_name: "Hives after scratching", +}, +{ +id: "s_790", +type: "symptom", +name: "Urticaria, triggered by prolonged pressure on the skin", +common_name: "Hives appearing after exposure to prolonged pressure on the skin", +}, +{ +id: "s_791", +type: "symptom", +name: "Urticaria, triggered by cold", +common_name: "Hives appearing after exposure to cold", +}, +{ +id: "s_793", +type: "symptom", +name: "Urticaria, triggered by heat", +common_name: "Hives appearing after exposure to heat", +}, +{ +id: "s_795", +type: "symptom", +name: "Pencil-thin stools", +common_name: "Pencil-thin stools", +}, +{ +id: "s_799", +type: "symptom", +name: "Headache, worse in the morning", +common_name: "Morning headache", +}, +{ +id: "s_801", +type: "symptom", +name: "Vomiting, projectile", +common_name: "Projectile vomiting", +}, +{ +id: "s_803", +type: "symptom", +name: "Papilledema", +common_name: "Papilledema", +}, +{ +id: "s_814", +type: "symptom", +name: "Hemianopsia bitemporalis", +common_name: "Hemianopsia bitemporalis", +}, +{ +id: "s_817", +type: "symptom", +name: "Alcohol consumption, alcohol craving", +common_name: "Alcohol craving", +}, +{ +id: "s_818", +type: "symptom", +name: "Alcohol consumption, signs of withdrawal", +common_name: "Alcohol withdrawal syndrome", +}, +{ +id: "s_820", +type: "symptom", +name: "Alcohol consumption, neglecting duties due to alcohol", +common_name: "Neglecting family, work, or hobbies due to alcohol", +}, +{ +id: "s_824", +type: "symptom", +name: "Alcohol consumption, violating norms under influence", +common_name: "Violating social norms after drinking alcohol", +}, +{ +id: "s_825", +type: "symptom", +name: "Impaired memory, alcohol-related amnesia", +common_name: "Alcohol-related amnesia", +}, +{ +id: "s_828", +type: "symptom", +name: "Alcohol consumption, drinking alone", +common_name: "Drinking alcohol alone", +}, +{ +id: "s_829", +type: "symptom", +name: "Alcohol consumption, secret consumption", +common_name: "Secret alcohol consumption", +}, +{ +id: "s_830", +type: "symptom", +name: "Impaired memory, short-term", +common_name: "Impaired short-term memory", +}, +{ +id: "s_831", +type: "symptom", +name: "Confabulation", +common_name: "Confabulation", +}, +{ +id: "s_833", +type: "symptom", +name: "Agnosia", +common_name: "Inability to recognize objects, people, sounds, shapes, or smells", +}, +{ +id: "s_835", +type: "symptom", +name: "Episodes of depressed mood, seasonal pattern", +common_name: "Depressive symptoms occurring at the same time every year", +}, +{ +id: "s_836", +type: "symptom", +name: "Schizophasia", +common_name: "Schizophasia", +}, +{ +id: "s_837", +type: "symptom", +name: "Alogia", +common_name: "Poverty of speech", +}, +{ +id: "s_838", +type: "symptom", +name: "Paralogical thinking", +common_name: "Paralogical thinking", +}, +{ +id: "s_856", +type: "symptom", +name: "Auscultative wheezes over the thorax", +common_name: "Auscultative wheezes over the thorax", +}, +{ +id: "s_857", +type: "symptom", +name: "Auscultative fine crackles over the thorax", +common_name: "Auscultative fine crackles over the thorax", +}, +{ +id: "s_866", +type: "symptom", +name: "Trousseau sign of latent tetany", +common_name: "Trousseau sign of latent tetany", +}, +{ +id: "s_867", +type: "symptom", +name: "Chvostekssign", +common_name: "Chvostekssign", +}, +{ +id: "s_868", +type: "symptom", +name: "Orbicularis oris muscle spasm", +common_name: "Orbicularis oris muscle spasm", +}, +{ +id: "s_869", +type: "symptom", +name: "Clubfoot", +common_name: "Clubfoot", +}, +{ +id: "s_878", +type: "symptom", +name: "Deep tendon reflexes, increased", +common_name: "Increased deep tendon reflexes", +}, +{ +id: "s_884", +type: "symptom", +name: "Agoraphobia", +common_name: "Fear of open or crowded places", +}, +{ +id: "s_917", +type: "symptom", +name: "Insomnia", +common_name: "Insomnia", +}, +{ +id: "s_935", +type: "symptom", +name: "Decreased hearing, variable intensity and duration", +common_name: "Hearing loss with variable intensity and duration", +}, +{ +id: "s_936", +type: "symptom", +name: "Dizziness, vertigo", +common_name: "Vertigo", +}, +{ +id: "s_957", +type: "symptom", +name: "Homonymous hemianopsia", +common_name: "Visual field loss on the same side of both eyes", +}, +{ +id: "s_959", +type: "symptom", +name: "Loss of sensation in the face", +common_name: "Loss of feeling in face", +}, +{ +id: "s_962", +type: "symptom", +name: "Dysphagia", +common_name: "Difficulty swallowing", +}, +{ +id: "s_964", +type: "symptom", +name: "Lateropulsion", +common_name: "Falling or losing gait on one side", +}, +{ +id: "s_965", +type: "symptom", +name: "Neck pain, unilateral", +common_name: "Neck pain on only one side", +}, +{ +id: "s_967", +type: "symptom", +name: "Decreased visual acuity", +common_name: "Decreased vision", +}, +{ +id: "s_970", +type: "symptom", +name: "Headache, occipital", +common_name: "Headache located at back of head", +}, +{ +id: "s_971", +type: "symptom", +name: "Paresthesia, face", +common_name: "Face tingling or numbness", +}, +{ +id: "s_972", +type: "symptom", +name: "Sensory loss in both arms", +common_name: "Loss of feeling in both arms", +}, +{ +id: "s_973", +type: "symptom", +name: "Paresthesia, both upper limbs", +common_name: "Tingling or numbness of both upper limbs", +}, +{ +id: "s_989", +type: "symptom", +name: "Pyramidal signs", +common_name: "Pyramidal signs", +}, +{ +id: "s_990", +type: "symptom", +name: "Frontal release signs", +common_name: "Frontal release signs", +}, +{ +id: "s_991", +type: "symptom", +name: "Increased masseter reflex", +common_name: "Jaw jerk", +}, +{ +id: "s_995", +type: "symptom", +name: "Tongue muscle atrophy", +common_name: "Shrinkage of tongue", +}, +{ +id: "s_996", +type: "symptom", +name: "Cervical dystonia", +common_name: "Cervical dystonia", +}, +{ +id: "s_1006", +type: "symptom", +name: "Lack of initiative, motivation, or drive", +common_name: "Lack of initiative, motivation, or drive", +}, +{ +id: "s_1007", +type: "symptom", +name: "Disinhibition", +common_name: "Disinhibition", +}, +{ +id: "s_1010", +type: "symptom", +name: "Apraxia", +common_name: "Apraxia", +}, +{ +id: "s_1012", +type: "symptom", +name: "Agraphia", +common_name: "Loss of writing ability", +}, +{ +id: "s_1013", +type: "symptom", +name: "Buccofacial or orofacial apraxia", +common_name: "Buccofacial or orofacial apraxia", +}, +{ +id: "s_1018", +type: "symptom", +name: "Perseveration", +common_name: "Perseveration", +}, +{ +id: "s_1021", +type: "symptom", +name: "Diminished superficial reflexes", +common_name: "Diminished superficial reflexes", +}, +{ +id: "s_1023", +type: "symptom", +name: "Babinski sign", +common_name: "Babinski sign", +}, +{ +id: "s_1027", +type: "symptom", +name: "Loss of vision in the superior quadrant", +common_name: "Loss of vision in the superior quadrant", +}, +{ +id: "s_1028", +type: "symptom", +name: "Auditory verbal agnosia", +common_name: "Auditory verbal agnosia", +}, +{ +id: "s_1032", +type: "symptom", +name: "Amusia", +common_name: "Inability to produce or recognize musical sounds", +}, +{ +id: "s_1034", +type: "symptom", +name: "Visual agnosia", +common_name: "Visual agnosia", +}, +{ +id: "s_1035", +type: "symptom", +name: "Diminished fear responses", +common_name: "Diminished fear responses", +}, +{ +id: "s_1045", +type: "symptom", +name: "Splenomegaly", +common_name: "Enlarged spleen", +}, +{ +id: "s_1050", +type: "symptom", +name: "Tooth loss", +common_name: "Tooth loss", +}, +{ +id: "s_1051", +type: "symptom", +name: "Hepatomegaly", +common_name: "Hepatomegaly", +}, +{ +id: "s_1052", +type: "symptom", +name: "Enlarged kidneys", +common_name: "Enlarged kidneys", +}, +{ +id: "s_1054", +type: "symptom", +name: "Lhermittessign", +common_name: "Lhermittessign", +}, +{ +id: "s_1055", +type: "symptom", +name: "Retrobulbar neuritis", +common_name: "Retrobulbar neuritis", +}, +{ +id: "s_1056", +type: "symptom", +name: "Trigeminal neuralgia", +common_name: "Trigeminal neuralgia", +}, +{ +id: "s_1057", +type: "symptom", +name: "Enlarged salivary glands", +common_name: "Enlarged salivary glands", +}, +{ +id: "s_1063", +type: "symptom", +name: "Paresthesia, both lower limbs", +common_name: "Tingling or numbness of both lower limbs", +}, +{ +id: "s_1066", +type: "symptom", +name: "Paresthesia in both upper limbs, glove distribution", +common_name: "Paresthesia in both upper limbs, glove distribution", +}, +{ +id: "s_1067", +type: "symptom", +name: "Sudden face flushing", +common_name: "Sudden red flushed face", +}, +{ +id: "s_1068", +type: "symptom", +name: "Paresthesias, symmetrical", +common_name: "Symmetrical paresthesias", +}, +{ +id: "s_1069", +type: "symptom", +name: "Paresthesia, ascending", +common_name: "Ascending tingling or numbness", +}, +{ +id: "s_1070", +type: "symptom", +name: "Loss of sense of vibration in distal parts of extremities", +common_name: "Loss of sense of vibration in distal parts of extremities", +}, +{ +id: "s_1072", +type: "symptom", +name: "Absence of deep reflexes", +common_name: "Absence of deep reflexes", +}, +{ +id: "s_1073", +type: "symptom", +name: "Bilateral absence of Achilles tendon reflex", +common_name: "Bilateral absence of Achilles tendon reflex", +}, +{ +id: "s_1074", +type: "symptom", +name: "Trophic changes", +common_name: "Trophic changes", +}, +{ +id: "s_1076", +type: "symptom", +name: "Trophic ulcer", +common_name: "Trophic ulcer", +}, +{ +id: "s_1078", +type: "symptom", +name: "Trophic ulcer, plantar side of the foot", +common_name: "Trophic ulcer on the plantar side of the foot", +}, +{ +id: "s_1083", +type: "symptom", +name: "Interosseous muscles atrophy, hands", +common_name: "Interosseous muscles atrophy, hands", +}, +{ +id: "s_1084", +type: "symptom", +name: "Interosseous muscles atrophy, feet", +common_name: "Interosseous muscles atrophy, feet", +}, +{ +id: "s_1087", +type: "symptom", +name: "Fear of going insane", +common_name: "Fear of going insane", +}, +{ +id: "s_1088", +type: "symptom", +name: "Fear of losing control", +common_name: "Fear of losing control", +}, +{ +id: "s_1089", +type: "symptom", +name: "Prostate enlargement", +common_name: "Prostate enlargement", +}, +{ +id: "s_1090", +type: "symptom", +name: "Glassy eyes", +common_name: "Glassy eyes", +}, +{ +id: "s_1091", +type: "symptom", +name: "Chemosis", +common_name: "Chemosis", +}, +{ +id: "s_1092", +type: "symptom", +name: "Positive prick or patch skin allergy test", +common_name: "Positive prick or patch skin allergy test", +}, +{ +id: "s_1093", +type: "symptom", +name: "Positive allergy challenge", +common_name: "Positive allergy challenge", +}, +{ +id: "s_1094", +type: "symptom", +name: "Clearing the throat", +common_name: "Clearing the throat", +}, +{ +id: "s_1095", +type: "symptom", +name: "Impaired smell", +common_name: "Inability to smell properly", +}, +{ +id: "s_1096", +type: "symptom", +name: "Taste disorders", +common_name: "Abnormal or loss of taste", +}, +{ +id: "s_1097", +type: "symptom", +name: "Swelling of nasal mucosa", +common_name: "Swelling of nasal mucosa", +}, +{ +id: "s_1098", +type: "symptom", +name: "Swollen blue or bluish-gray nasal mucosa", +common_name: "Swollen blue or bluish-gray nasal mucosa", +}, +{ +id: "s_1099", +type: "symptom", +name: "Swelling of nasal concha", +common_name: "Swelling of nasal concha", +}, +{ +id: "s_1100", +type: "symptom", +name: "Transverse furrow on the nose", +common_name: "Transverse furrow on the nose", +}, +{ +id: "s_1102", +type: "symptom", +name: "Enlargement of palatine tonsils, bilateral", +common_name: "Swelling on both sides of throat", +}, +{ +id: "s_1103", +type: "symptom", +name: "Enlargement of the lymphoid tissue in the pharynx", +common_name: "Enlargement of the lymphoid tissue in the pharynx", +}, +{ +id: "s_1104", +type: "symptom", +name: "Mouth breathing", +common_name: "Mouth breathing", +}, +{ +id: "s_1105", +type: "symptom", +name: "Cyanosis under the eyes", +common_name: "Dark circles under eyes", +}, +{ +id: "s_1106", +type: "symptom", +name: "Dennie-Morgan fold", +common_name: "Dennie-Morgan fold", +}, +{ +id: "s_1107", +type: "symptom", +name: "Opacified tympanic membrane", +common_name: "Opacified tympanic membrane", +}, +{ +id: "s_1108", +type: "symptom", +name: "High-arched palate", +common_name: "High-arched palate", +}, +{ +id: "s_1109", +type: "symptom", +name: "Discharge in tympanic cavity", +common_name: "Discharge in tympanic cavity", +}, +{ +id: "s_1110", +type: "symptom", +name: "Overbite", +common_name: "Overbite", +}, +{ +id: "s_1111", +type: "symptom", +name: "Adenoid face", +common_name: "Adenoid face", +}, +{ +id: "s_1112", +type: "symptom", +name: "Pain in both lower limbs, stocking distribution", +common_name: "Pain in both lower limbs with stocking distribution", +}, +{ +id: "s_1114", +type: "symptom", +name: "Terrysnails", +common_name: "Terrysnails", +}, +{ +id: "s_1115", +type: "symptom", +name: "Loss of body hair", +common_name: "Loss of body hair", +}, +{ +id: "s_1116", +type: "symptom", +name: "Ascites", +common_name: "Ascites", +}, +{ +id: "s_1117", +type: "symptom", +name: "Testicular atrophy", +common_name: "Shrinking or diminishing of both testicles", +}, +{ +id: "s_1119", +type: "symptom", +name: "Bladder sphincter dysfunction", +common_name: "Bladder sphincter dysfunction", +}, +{ +id: "s_1123", +type: "symptom", +name: "Anhidrosis", +common_name: "Lack of sweating", +}, +{ +id: "s_1125", +type: "symptom", +name: "Erythema, palmar", +common_name: "Red skin on palms", +}, +{ +id: "s_1139", +type: "symptom", +name: "Suicidal thoughts", +common_name: "Suicidal thoughts", +}, +{ +id: "s_1140", +type: "symptom", +name: "Suicidal intent", +common_name: "Planning or taking steps toward suicide", +}, +{ +id: "s_1141", +type: "symptom", +name: "Russellssign", +common_name: "Russellssign", +}, +{ +id: "s_1142", +type: "symptom", +name: "Myalgia", +common_name: "Muscle pain", +}, +{ +id: "s_1144", +type: "symptom", +name: "Swelling of temporal artery", +common_name: "Swelling of temporal artery", +}, +{ +id: "s_1145", +type: "symptom", +name: "Redness in temporal region", +common_name: "Redness around the temple", +}, +{ +id: "s_1146", +type: "symptom", +name: "Impaired vision, temple pain on side with vision problem", +common_name: "Temple pain on side with visual impairment", +}, +{ +id: "s_1147", +type: "symptom", +name: "Oculomotor nerve palsy", +common_name: "Oculomotor nerve palsy", +}, +{ +id: "s_1148", +type: "symptom", +name: "Numbness of tongue", +common_name: "Loss of feeling in tongue", +}, +{ +id: "s_1150", +type: "symptom", +name: "Hypersensitivity to sound", +common_name: "Oversensitivity to sound", +}, +{ +id: "s_1153", +type: "symptom", +name: "Taste disorder, anterior two-thirds of tongue", +common_name: "Taste disorder in anterior two-thirds of tongue", +}, +{ +id: "s_1159", +type: "symptom", +name: "Loss of sensation in the face, unilateral", +common_name: "Loss of feeling on only one side of the face", +}, +{ +id: "s_1162", +type: "symptom", +name: "Pretibial myxedema", +common_name: "Pretibial myxedema", +}, +{ +id: "s_1163", +type: "symptom", +name: "Exophthalmos", +common_name: "Protruding eye", +}, +{ +id: "s_1165", +type: "symptom", +name: "Burning skin", +common_name: "Burning sensation on skin", +}, +{ +id: "s_1166", +type: "symptom", +name: "Enamel hypoplasia", +common_name: "Enamel hypoplasia", +}, +{ +id: "s_1167", +type: "symptom", +name: "Nail dystrophy", +common_name: "Distortion or discolouration of nail", +}, +{ +id: "s_1170", +type: "symptom", +name: "Hemarthrosis", +common_name: "Bleeding into joints", +}, +{ +id: "s_1171", +type: "symptom", +name: "Darierssign", +common_name: "Darierssign", +}, +{ +id: "s_1173", +type: "symptom", +name: "Lump in scrotum", +common_name: "Lump in scrotum", +}, +{ +id: "s_1175", +type: "symptom", +name: "Feeling of weight in scrotum", +common_name: "Feeling of weight in scrotum", +}, +{ +id: "s_1178", +type: "symptom", +name: "Chest pain, worsens on palpation", +common_name: "Chest pain worsening when touching or pressing", +}, +{ +id: "s_1180", +type: "symptom", +name: "Pain behind ear", +common_name: "Pain behind ear", +}, +{ +id: "s_1181", +type: "symptom", +name: "Redness behind the ear", +common_name: "Redness behind the ear", +}, +{ +id: "s_1182", +type: "symptom", +name: "Swelling in the mastoid region", +common_name: "Swelling behind ear", +}, +{ +id: "s_1183", +type: "symptom", +name: "Winterbottomssign", +common_name: "Winterbottomssign", +}, +{ +id: "s_1184", +type: "symptom", +name: "Coating on tongue", +common_name: "White tongue", +}, +{ +id: "s_1185", +type: "symptom", +name: "Dyspnea, with flare-ups and remissions", +common_name: "Shortness of breath that comes and goes", +}, +{ +id: "s_1189", +type: "symptom", +name: "Back pain, recurrent", +common_name: "Back pain that comes and goes", +}, +{ +id: "s_1190", +type: "symptom", +name: "Back pain", +common_name: "Back pain", +}, +{ +id: "s_1191", +type: "symptom", +name: "Dermatological changes, with flare-ups and remissions", +common_name: "Skin changes that come and go", +}, +{ +id: "s_1192", +type: "symptom", +name: "Back pain, severe", +common_name: "Severe back pain", +}, +{ +id: "s_1193", +type: "symptom", +name: "Headache, severe", +common_name: "Severe headache", +}, +{ +id: "s_1194", +type: "symptom", +name: "Facial pain, severe", +common_name: "Severe face pain", +}, +{ +id: "s_1195", +type: "symptom", +name: "Abdominal pain, severe", +common_name: "Severe abdominal pain", +}, +{ +id: "s_1197", +type: "symptom", +name: "Chest pain, severe", +common_name: "Severe chest pain", +}, +{ +id: "s_1198", +type: "symptom", +name: "Back pain, sudden", +common_name: "Sudden back pain", +}, +{ +id: "s_1200", +type: "symptom", +name: "Chest pain, sudden", +common_name: "Sudden chest pain", +}, +{ +id: "s_1201", +type: "symptom", +name: "Joint pain, sudden", +common_name: "Sudden joint pain", +}, +{ +id: "s_1202", +type: "symptom", +name: "Abdominal pain, exacerbating during deep breath", +common_name: "Abdominal pain worsens with deep breath", +}, +{ +id: "s_1203", +type: "symptom", +name: "Facial pain, more than 2 hours", +common_name: "Face pain lasting more than a couple of hours", +}, +{ +id: "s_1206", +type: "symptom", +name: "Back pain, improves with rest", +common_name: "Back pain decreases during rest", +}, +{ +id: "s_1207", +type: "symptom", +name: "Abdominal pain, exacerbating after caffeine consumption", +common_name: "Abdominal pain worsening after caffeine consumption", +}, +{ +id: "s_1209", +type: "symptom", +name: "Skin pallor, sudden", +common_name: "Sudden paleness of skin", +}, +{ +id: "s_1210", +type: "symptom", +name: "Mucosal pallor", +common_name: "Pale mouth or eyelids", +}, +{ +id: "s_1213", +type: "symptom", +name: "Mucosal pallor, sudden", +common_name: "Sudden paleness of mouth or eyelids", +}, +{ +id: "s_1226", +type: "symptom", +name: "Genu varum", +common_name: "Bowlegs", +}, +{ +id: "s_1227", +type: "symptom", +name: "Impaired lateral eye motion", +common_name: "Difficulty looking sideways away from the nose", +}, +{ +id: "s_1228", +type: "symptom", +name: "Convergent strabismus", +common_name: "Crossed eyes", +}, +{ +id: "s_1229", +type: "symptom", +name: "Diplopia with horizontal image dispersion", +common_name: "Double vision with images appearing side by side", +}, +{ +id: "s_1230", +type: "symptom", +name: "Head tilt in order to avoid diplopia", +common_name: "Double vision improves while tilting head", +}, +{ +id: "s_1232", +type: "symptom", +name: "Diplopia while looking down and medially", +common_name: "Double vision while looking down and toward the nose", +}, +{ +id: "s_1235", +type: "symptom", +name: "Diplopia while looking in any direction", +common_name: "Double vision while looking in any direction", +}, +{ +id: "s_1236", +type: "symptom", +name: "Divergent strabismus", +common_name: "One or both eyes turning outward", +}, +{ +id: "s_1237", +type: "symptom", +name: "Ocular bulb rotation laterally and downward", +common_name: "Eye rotation sideways and downward", +}, +{ +id: "s_1238", +type: "symptom", +name: "Pupil or pupils unreactive to accommodation", +common_name: "Pupil or pupils unreactive to accommodation", +}, +{ +id: "s_1239", +type: "symptom", +name: "Impaired upward eye motion", +common_name: "Difficulty looking up", +}, +{ +id: "s_1240", +type: "symptom", +name: "Impaired medial eye motion", +common_name: "Difficulty looking inwards towards the nose", +}, +{ +id: "s_1241", +type: "symptom", +name: "Impaired downward eye motion", +common_name: "Difficulty looking down", +}, +{ +id: "s_1250", +type: "symptom", +name: "Groin pain, exacerbated by coughing, sneezing, laughing, or exercising", +common_name: "Pain in groin during coughing, sneezing, laughing, or physical exercises", +}, +{ +id: "s_1254", +type: "symptom", +name: "Gordonssign", +common_name: "Gordonssign", +}, +{ +id: "s_1255", +type: "symptom", +name: "Rossolimossign", +common_name: "Rossolimossign", +}, +{ +id: "s_1256", +type: "symptom", +name: "Oppenheimssign", +common_name: "Oppenheimssign", +}, +{ +id: "s_1257", +type: "symptom", +name: "Bingssign", +common_name: "Bingssign", +}, +{ +id: "s_1258", +type: "symptom", +name: "Chaddockssign", +common_name: "Chaddockssign", +}, +{ +id: "s_1259", +type: "symptom", +name: "Schaefferssign", +common_name: "Schaefferssign", +}, +{ +id: "s_1260", +type: "symptom", +name: "Stranskyssign", +common_name: "Stranskyssign", +}, +{ +id: "s_1261", +type: "symptom", +name: "Mendel-Bekhterev sign", +common_name: "Mendel-Bekhterev sign", +}, +{ +id: "s_1262", +type: "symptom", +name: "Tromnerssign", +common_name: "Tromnerssign", +}, +{ +id: "s_1263", +type: "symptom", +name: "Gonda-Allen sign", +common_name: "Gonda-Allen sign", +}, +{ +id: "s_1264", +type: "symptom", +name: "Tremors, intention", +common_name: "Intention tremors", +}, +{ +id: "s_1265", +type: "symptom", +name: "Dissociated sensory loss", +common_name: "Dissociated sensory loss", +}, +{ +id: "s_1268", +type: "symptom", +name: "Corneal reflex weak or absent", +common_name: "Corneal reflex weak or absent", +}, +{ +id: "s_1270", +type: "symptom", +name: "Sterlingssign", +common_name: "Sterlingssign", +}, +{ +id: "s_1271", +type: "symptom", +name: "Jacobsohn sign", +common_name: "Finger flexion when tapping distal base of radius bone", +}, +{ +id: "s_1272", +type: "symptom", +name: "Allen-Cleckley sign", +common_name: "Allen-Cleckley sign", +}, +{ +id: "s_1273", +type: "symptom", +name: "Cornellssign", +common_name: "Cornellssign", +}, +{ +id: "s_1274", +type: "symptom", +name: "Moniz sign", +common_name: "Moniz sign", +}, +{ +id: "s_1275", +type: "symptom", +name: "Strumpellssign", +common_name: "Strumpellssign", +}, +{ +id: "s_1277", +type: "symptom", +name: "Decreased tongue motility", +common_name: "Difficulty moving tongue", +}, +{ +id: "s_1278", +type: "symptom", +name: "Increased palatine reflex", +common_name: "Increased palatine reflex", +}, +{ +id: "s_1279", +type: "symptom", +name: "Increased pharyngeal reflex", +common_name: "Increased pharyngeal reflex", +}, +{ +id: "s_1280", +type: "symptom", +name: "Weak or absent pharyngeal reflex", +common_name: "Weak or absent pharyngeal reflex", +}, +{ +id: "s_1281", +type: "symptom", +name: "Clasp-knife spasticity", +common_name: "Clasp-knife spasticity", +}, +{ +id: "s_1282", +type: "symptom", +name: "Lead-pipe rigidity", +common_name: "Constant muscle stiffness in a limb", +}, +{ +id: "s_1283", +type: "symptom", +name: "Cogwheel muscle rigidity", +common_name: "Cogwheel muscle rigidity", +}, +{ +id: "s_1285", +type: "symptom", +name: "Sagging of the palate ipsilateral to suspected nerve damage", +common_name: "Sagging of the palate ipsilateral to suspected nerve damage", +}, +{ +id: "s_1287", +type: "symptom", +name: "Uvula deviation towards unaffected side", +common_name: "Uvula deviation towards unaffected side", +}, +{ +id: "s_1289", +type: "symptom", +name: "Ovarian enlargement", +common_name: "Ovarian enlargement", +}, +{ +id: "s_1291", +type: "symptom", +name: "Bilateral muscle paralysis", +common_name: "Bilateral muscle paralysis", +}, +{ +id: "s_1295", +type: "symptom", +name: "Hiccups", +common_name: "Hiccups", +}, +{ +id: "s_1297", +type: "symptom", +name: "Motor retardation", +common_name: "Slowed movements", +}, +{ +id: "s_1298", +type: "symptom", +name: "Dystonia", +common_name: "Dystonia", +}, +{ +id: "s_1302", +type: "symptom", +name: "Goldflamssign", +common_name: "Goldflamssign", +}, +{ +id: "s_1303", +type: "symptom", +name: "Nasal speech", +common_name: "Nasal voice", +}, +{ +id: "s_1304", +type: "symptom", +name: "Excessive saliva production", +common_name: "Excessive salivation", +}, +{ +id: "s_1310", +type: "symptom", +name: "Brown nail discolouration", +common_name: "Brown nail discolouration", +}, +{ +id: "s_1311", +type: "symptom", +name: "Edema, finger", +common_name: "Swollen finger", +}, +{ +id: "s_1312", +type: "symptom", +name: "Perionychial pain", +common_name: "Pain of the skin around the nail", +}, +{ +id: "s_1313", +type: "symptom", +name: "Pain in upper limb, one finger", +common_name: "Pain in one finger", +}, +{ +id: "s_1314", +type: "symptom", +name: "Erythema, finger", +common_name: "Red finger", +}, +{ +id: "s_1315", +type: "symptom", +name: "Pus under the skin of the finger", +common_name: "Pus under the skin of the finger", +}, +{ +id: "s_1316", +type: "symptom", +name: "Auscultative rhonchi over the thorax", +common_name: "Auscultative rhonchi over the thorax", +}, +{ +id: "s_1317", +type: "symptom", +name: "Dyspnea, paroxysmal nocturnal", +common_name: "Shortness of breath while sleeping", +}, +{ +id: "s_1322", +type: "symptom", +name: "Axillary or inguinal freckles", +common_name: "Freckles in the groins or armpits", +}, +{ +id: "s_1323", +type: "symptom", +name: "Presence of neurofibromas", +common_name: "Presence of neurofibromas", +}, +{ +id: "s_1324", +type: "symptom", +name: "Lisch nodules", +common_name: "Lisch nodules", +}, +{ +id: "s_1328", +type: "symptom", +name: "Colour vision deficiency", +common_name: "Colour blind", +}, +{ +id: "s_1329", +type: "symptom", +name: "Optic nerve disc pallor", +common_name: "Optic nerve disc pallor", +}, +{ +id: "s_1330", +type: "symptom", +name: "Café au lait macules", +common_name: "At least 6 light brown marks on skin", +}, +{ +id: "s_1332", +type: "symptom", +name: "Fatigue, weakness after exercise", +common_name: "Weakness worsening after exercise", +}, +{ +id: "s_1338", +type: "symptom", +name: "Damage to two separate areas of innervation", +common_name: "Damage to two separate areas of innervation", +}, +{ +id: "s_1340", +type: "symptom", +name: "Westphals sign", +common_name: "Westphals sign", +}, +{ +id: "s_1342", +type: "symptom", +name: "Transilluminable scrotum", +common_name: "Transilluminable scrotum", +}, +{ +id: "s_1344", +type: "symptom", +name: "Retinal hemorrhage", +common_name: "Retinal hemorrhage", +}, +{ +id: "s_1345", +type: "symptom", +name: "Confusion, after trauma", +common_name: "Confusion after an injury", +}, +{ +id: "s_1346", +type: "symptom", +name: "Hard retinal exudates", +common_name: "Hard retinal exudates", +}, +{ +id: "s_1347", +type: "symptom", +name: "Soft retinal exudates", +common_name: "Soft retinal exudates", +}, +{ +id: "s_1348", +type: "symptom", +name: "Weak peripheral pulses", +common_name: "Weak peripheral pulses", +}, +{ +id: "s_1349", +type: "symptom", +name: "Headache, forehead", +common_name: "Headache located near the forehead", +}, +{ +id: "s_1365", +type: "symptom", +name: "Vomiting, more often in the morning", +common_name: "Vomiting more often in the morning", +}, +{ +id: "s_1367", +type: "symptom", +name: "Pharyngeal erythema", +common_name: "Red throat", +}, +{ +id: "s_1369", +type: "symptom", +name: "Abdominal pain, sharp and stabbing", +common_name: "Sharp and stabbing abdominal pain", +}, +{ +id: "s_1371", +type: "symptom", +name: "Palatine petechiae", +common_name: "Pinpoint-size red dots on soft part of roof of mouth", +}, +{ +id: "s_1376", +type: "symptom", +name: "Diarrhea, rice water", +common_name: "Diarrhea that looks like rice water", +}, +{ +id: "s_1377", +type: "symptom", +name: "Rose spots on lower chest and abdomen", +common_name: "Rose spots on lower chest and abdomen", +}, +{ +id: "s_1378", +type: "symptom", +name: "Levines sign", +common_name: "Levines sign", +}, +{ +id: "s_1379", +type: "symptom", +name: "Tremors, pill-rolling", +common_name: "Pill-rolling tremors", +}, +{ +id: "s_1380", +type: "symptom", +name: "Pericardial friction rub", +common_name: "Pericardial friction rub", +}, +{ +id: "s_1381", +type: "symptom", +name: "Sternal rub", +common_name: "Sternal rub", +}, +{ +id: "s_1382", +type: "symptom", +name: "Pain caused by firm pressure on tibia", +common_name: "Pain caused by firm pressure on tibia", +}, +{ +id: "s_1383", +type: "symptom", +name: "Intense, non-committal relationships", +common_name: "Intense, non-committal relationships", +}, +{ +id: "s_1386", +type: "symptom", +name: "Bleeding into muscles", +common_name: "Bleeding into muscles", +}, +{ +id: "s_1387", +type: "symptom", +name: "Abdominal pain, epigastric", +common_name: "Upper central abdominal pain", +}, +{ +id: "s_1388", +type: "symptom", +name: "Neck asymmetry", +common_name: "Asymmetrical neck", +}, +{ +id: "s_1390", +type: "symptom", +name: "Enlargement of palatine tonsil, unilateral", +common_name: "Swollen throat on one side", +}, +{ +id: "s_1392", +type: "symptom", +name: "Abdominal tenderness, right upper quadrant", +common_name: "Pain when pressing upper-right part of the abdomen", +}, +{ +id: "s_1393", +type: "symptom", +name: "Painful defecation", +common_name: "Pain when passing stool", +}, +{ +id: "s_1394", +type: "symptom", +name: "Loss of the lingual papillae", +common_name: "Smooth tongue", +}, +{ +id: "s_1395", +type: "symptom", +name: "Decreased intensity of breath sounds, right basilar lung zones", +common_name: "Decreased intensity of breath sounds, right basilar lung zones", +}, +{ +id: "s_1396", +type: "symptom", +name: "Pleural friction rub", +common_name: "Pleural friction rub", +}, +{ +id: "s_1397", +type: "symptom", +name: "Priapism", +common_name: "Prolonged erection", +}, +{ +id: "s_1398", +type: "symptom", +name: "Vitreous hemorrhage", +common_name: "Vitreous hemorrhage", +}, +{ +id: "s_1399", +type: "symptom", +name: "Shafers sign", +common_name: "Shafers sign", +}, +{ +id: "s_1400", +type: "symptom", +name: "Abdominal tenderness, hypogastric region", +common_name: "Pain when pressing lower part of the abdomen", +}, +{ +id: "s_1402", +type: "symptom", +name: "Weiss ring", +common_name: "Weiss ring", +}, +{ +id: "s_1403", +type: "symptom", +name: "Marcus Gunn pupil", +common_name: "Marcus Gunn pupil", +}, +{ +id: "s_1404", +type: "symptom", +name: "Low intraocular pressure, 4 to 5 mmHg difference in affected eye compared to the other eye", +common_name: "Low intraocular pressure, 4 to 5 mmHg difference in affected eye compared to the other eye", +}, +{ +id: "s_1405", +type: "symptom", +name: "Local elevation of retina", +common_name: "Local elevation of retina", +}, +{ +id: "s_1406", +type: "symptom", +name: "Local grey discolouration of retina", +common_name: "Local grey discolouration of retina", +}, +{ +id: "s_1407", +type: "symptom", +name: "Local dark retinal blood vessels that lie in folds", +common_name: "Local dark retinal blood vessels that lie in folds", +}, +{ +id: "s_1408", +type: "symptom", +name: "Local retinal undulation", +common_name: "Local retinal undulation", +}, +{ +id: "s_1409", +type: "symptom", +name: "Demarcation of retinal detachment (pigmented or nonpigmented)", +common_name: "Demarcation of retinal detachment (pigmented or nonpigmented)", +}, +{ +id: "s_1410", +type: "symptom", +name: "Optic disc neovascularization", +common_name: "Optic disc neovascularization", +}, +{ +id: "s_1411", +type: "symptom", +name: "Iris neovascularization", +common_name: "Iris neovascularization", +}, +{ +id: "s_1412", +type: "symptom", +name: "Retinal microaneurysms", +common_name: "Retinal microaneurysms", +}, +{ +id: "s_1413", +type: "symptom", +name: "Cystoid macular edema", +common_name: "Cystoid macular edema", +}, +{ +id: "s_1414", +type: "symptom", +name: "Retinal swelling", +common_name: "Retinal swelling", +}, +{ +id: "s_1415", +type: "symptom", +name: "Retinal neovascularization elsewhere", +common_name: "Retinal neovascularization elsewhere", +}, +{ +id: "s_1416", +type: "symptom", +name: "Intraretinal microvascular abnormalities", +common_name: "Intraretinal microvascular abnormalities", +}, +{ +id: "s_1417", +type: "symptom", +name: "Dark-red spots in optic disc vessels", +common_name: "Dark-red spots in optic disc vessels", +}, +{ +id: "s_1418", +type: "symptom", +name: "Retinal artery occlusions", +common_name: "Retinal artery occlusions", +}, +{ +id: "s_1421", +type: "symptom", +name: "Tremors, flapping", +common_name: "Flapping tremors", +}, +{ +id: "s_1422", +type: "symptom", +name: "Nipple discharge, other than milk", +common_name: "Leaking from the nipple discharge that is not milk", +}, +{ +id: "s_1425", +type: "symptom", +name: "Facial muscle spasms", +common_name: "Facial muscle spasms", +}, +{ +id: "s_1426", +type: "symptom", +name: "Spasms in upper extremities", +common_name: "Spasms in arms or hands", +}, +{ +id: "s_1429", +type: "symptom", +name: "Nosebleed", +common_name: "Bleeding from nose", +}, +{ +id: "s_1430", +type: "symptom", +name: "Joint pain, wrist", +common_name: "Wrist pain", +}, +{ +id: "s_1431", +type: "symptom", +name: "Edema, wrist joint", +common_name: "Swollen wrist", +}, +{ +id: "s_1432", +type: "symptom", +name: "Dyspepsia", +common_name: "Indigestion", +}, +{ +id: "s_1433", +type: "symptom", +name: "Edema, lip", +common_name: "Swollen lips", +}, +{ +id: "s_1434", +type: "symptom", +name: "Steatorrhea", +common_name: "Fatty stools", +}, +{ +id: "s_1436", +type: "symptom", +name: "Facial pain, paranasal sinus", +common_name: "Sinus pain or pressure", +}, +{ +id: "s_1437", +type: "symptom", +name: "Pleural effusion", +common_name: "Pleural effusion", +}, +{ +id: "s_1442", +type: "symptom", +name: "Edema, periorbital, both eyes", +common_name: "Swelling around both eyes", +}, +{ +id: "s_1447", +type: "symptom", +name: "Edema, upper limb", +common_name: "Swelling of the upper limb", +}, +{ +id: "s_1449", +type: "symptom", +name: "Paresthesia, one upper limb", +common_name: "Tingling or numbness of one upper limb", +}, +{ +id: "s_1451", +type: "symptom", +name: "Kussmaul breathing", +common_name: "Abnormally deep, laboured, and gasping breathing", +}, +{ +id: "s_1452", +type: "symptom", +name: "Pain in both upper limbs", +common_name: "Pain in both upper limbs", +}, +{ +id: "s_1453", +type: "symptom", +name: "Pain in both lower limbs", +common_name: "Pain in both lower limbs", +}, +{ +id: "s_1454", +type: "symptom", +name: "Tremors, kinetic", +common_name: "Trembling during movement", +}, +{ +id: "s_1455", +type: "symptom", +name: "Tremors, resting", +common_name: "Trembling at rest", +}, +{ +id: "s_1456", +type: "symptom", +name: "Chorea", +common_name: "Chorea", +}, +{ +id: "s_1458", +type: "symptom", +name: "Amenorrhea, primary", +common_name: "Absence of first menstrual period at age 16", +}, +{ +id: "s_1462", +type: "symptom", +name: "Shallow breathing", +common_name: "Shallow breathing", +}, +{ +id: "s_1463", +type: "symptom", +name: "Restless legs, nocturnal", +common_name: "Nighttime restless legs", +}, +{ +id: "s_1464", +type: "symptom", +name: "Edema, one hand", +common_name: "Swollen hand", +}, +{ +id: "s_1465", +type: "symptom", +name: "Temporary blindness", +common_name: "Temporary blindness", +}, +{ +id: "s_1466", +type: "symptom", +name: "Tinnitus, pulsatile", +common_name: "Pulsing sound in ears", +}, +{ +id: "s_1467", +type: "symptom", +name: "Strawberry tongue", +common_name: "Strawberry tongue", +}, +{ +id: "s_1468", +type: "symptom", +name: "Erythema, facial", +common_name: "Red skin on face", +}, +{ +id: "s_1469", +type: "symptom", +name: "Erythema, large portion of body", +common_name: "Redness and scaling on almost the entire body", +}, +{ +id: "s_1470", +type: "symptom", +name: "Skin desquamation", +common_name: "Skin shedding", +}, +{ +id: "s_1471", +type: "symptom", +name: "Postnasal drip", +common_name: "Mucus dripping at the back of the throat", +}, +{ +id: "s_1472", +type: "symptom", +name: "Kayser-Fleischer ring", +common_name: "Dark rings appearing around the iris of the eye", +}, +{ +id: "s_1474", +type: "symptom", +name: "Skull lesions", +common_name: "Skull lesions", +}, +{ +id: "s_1476", +type: "symptom", +name: "Myringitis", +common_name: "Myringitis", +}, +{ +id: "s_1479", +type: "symptom", +name: "Dizziness, head rotation", +common_name: "Dizziness while turning the head", +}, +{ +id: "s_1480", +type: "symptom", +name: "Breast pain or tenderness, bilateral", +common_name: "Pain or tenderness in both breasts", +}, +{ +id: "s_1481", +type: "symptom", +name: "Hyperalgesia", +common_name: "Hyperalgesia", +}, +{ +id: "s_1483", +type: "symptom", +name: "Neck pain", +common_name: "Pain in the neck", +}, +{ +id: "s_1484", +type: "symptom", +name: "Decreased hearing, progressive hearing loss", +common_name: "Progressive hearing loss without fluctuation", +}, +{ +id: "s_1486", +type: "symptom", +name: "Paraspinal muscle tenderness", +common_name: "Paraspinal muscle tenderness", +}, +{ +id: "s_1488", +type: "symptom", +name: "Increased expiratory phase", +common_name: "Increased expiratory phase", +}, +{ +id: "s_1492", +type: "symptom", +name: "Scleral icterus", +common_name: "Yellow eyes", +}, +{ +id: "s_1494", +type: "symptom", +name: "Rebound tenderness", +common_name: "Rebound tenderness", +}, +{ +id: "s_1496", +type: "symptom", +name: "Paranasal sinuses tenderness", +common_name: "Paranasal sinuses tender to palpation", +}, +{ +id: "s_1498", +type: "symptom", +name: "Erythematous tonsils", +common_name: "Unusually red tonsils", +}, +{ +id: "s_1502", +type: "symptom", +name: "Achilles tendon hyperreflexia", +common_name: "Achilles tendon hyperreflexia", +}, +{ +id: "s_1508", +type: "symptom", +name: "Prolonged capillary refill time", +common_name: "Prolonged capillary refill time", +}, +{ +id: "s_1509", +type: "symptom", +name: "Chest pain, substernal", +common_name: "Chest pain behind breastbone", +}, +{ +id: "s_1510", +type: "symptom", +name: "Dermatological changes, hot to the touch", +common_name: "Skin change hot to the touch", +}, +{ +id: "s_1514", +type: "symptom", +name: "Abdominal tenderness", +common_name: "Pain when pressing the abdomen", +}, +{ +id: "s_1528", +type: "symptom", +name: "Abdominal pain, right upper quadrant", +common_name: "Upper right side abdominal pain", +}, +{ +id: "s_1531", +type: "symptom", +name: "Abdominal pain, right lower quadrant", +common_name: "Lower right side abdominal pain", +}, +{ +id: "s_1532", +type: "symptom", +name: "Abdominal pain, periumbilical", +common_name: "Central abdominal pain", +}, +{ +id: "s_1533", +type: "symptom", +name: "Rhinitis triggered by environment", +common_name: "Runny or stuffy nose triggered by environment", +}, +{ +id: "s_1534", +type: "symptom", +name: "Tonsil stones", +common_name: "White or yellow formations in tonsils", +}, +{ +id: "s_1535", +type: "symptom", +name: "Headache, chronic", +common_name: "Headaches for 3 months or more", +}, +{ +id: "s_1536", +type: "symptom", +name: "Spine asymmetry", +common_name: "Spine asymmetry", +}, +{ +id: "s_1538", +type: "symptom", +name: "Decreased hearing, sudden hearing loss", +common_name: "Sudden hearing loss without obvious cause", +}, +{ +id: "s_1543", +type: "symptom", +name: "Loss of consciousness", +common_name: "Loss of consciousness", +}, +{ +id: "s_1544", +type: "symptom", +name: "Scarlatiniform rash", +common_name: "Scarlatiniform rash", +}, +{ +id: "s_1546", +type: "symptom", +name: "Cheyne-Stokes respiration", +common_name: "Cheyne-Stokes respiration", +}, +{ +id: "s_1547", +type: "symptom", +name: "Fatigue, more than 6 months", +common_name: "Fatigue lasting more than 6 months", +}, +{ +id: "s_1548", +type: "symptom", +name: "Pseudomembrane in nose or throat", +common_name: "Thick grey layer in nose or throat", +}, +{ +id: "s_1551", +type: "symptom", +name: "Inability to pass flatus", +common_name: "Inability to pass gas", +}, +{ +id: "s_1552", +type: "symptom", +name: "Bowel sounds, hyperactive, high-pitched", +common_name: "Excessive bowel sounds", +}, +{ +id: "s_1553", +type: "symptom", +name: "Bowel sounds, decreased", +common_name: "Decreased bowel sounds", +}, +{ +id: "s_1555", +type: "symptom", +name: "Dances sign", +common_name: "Dances sign", +}, +{ +id: "s_1557", +type: "symptom", +name: "Abdominal pain, diffuse", +common_name: "Widespread abdominal pain", +}, +{ +id: "s_1558", +type: "symptom", +name: "Abdominal guarding", +common_name: "Abdominal guarding", +}, +{ +id: "s_1561", +type: "symptom", +name: "Xanthoma", +common_name: "Yellowish deposits under skin", +}, +{ +id: "s_1562", +type: "symptom", +name: "Wheezing, stridor", +common_name: "Stridor", +}, +{ +id: "s_1563", +type: "symptom", +name: "Itching eye", +common_name: "Itchy eye", +}, +{ +id: "s_1565", +type: "symptom", +name: "Feeling of rectal fullness", +common_name: "Feeling of rectal fullness", +}, +{ +id: "s_1569", +type: "symptom", +name: "Vaginal discharge, white and clumpy", +common_name: "White and clumpy vaginal discharge", +}, +{ +id: "s_1570", +type: "symptom", +name: "Gastric symptoms, after lactose ingestion", +common_name: "Abdominal symptoms after eating or drinking foods containing lactose", +}, +{ +id: "s_1571", +type: "symptom", +name: "Dermatological changes, painful", +common_name: "Painful skin changes", +}, +{ +id: "s_1574", +type: "symptom", +name: "Difficulty achieving orgasm", +common_name: "Difficulty achieving orgasm", +}, +{ +id: "s_1576", +type: "symptom", +name: "Carotid bruit", +common_name: "Cervical artery murmur", +}, +{ +id: "s_1577", +type: "symptom", +name: "Discharge from ear, bloody", +common_name: "Bleeding from ear", +}, +{ +id: "s_1580", +type: "symptom", +name: "Chest pain, worsens on palpation of costochondral joints", +common_name: "Chest pain worsening on palpation of costochondral joints", +}, +{ +id: "s_1581", +type: "symptom", +name: "Edema, costochondral junctions", +common_name: "Swelling in the middle of the chest", +}, +{ +id: "s_1586", +type: "symptom", +name: "Unilateral vulval swelling", +common_name: "Vulval swelling on one side", +}, +{ +id: "s_1587", +type: "symptom", +name: "Depersonalization", +common_name: "Feeling detached from own body", +}, +{ +id: "s_1589", +type: "symptom", +name: "Abdominal tenderness, left upper quadrant", +common_name: "Pain when pressing upper-left part of the abdomen", +}, +{ +id: "s_1591", +type: "symptom", +name: "Abdominal pain, left upper quadrant", +common_name: "Upper left side abdominal pain", +}, +{ +id: "s_1598", +type: "symptom", +name: "Abdominal pain, below navel", +common_name: "Lower abdominal pain", +}, +{ +id: "s_1601", +type: "symptom", +name: "Chest pain, stabbing", +common_name: "Stabbing chest pain", +}, +{ +id: "s_1602", +type: "symptom", +name: "Dermatological changes, located in genital area, chancre", +common_name: "Painless genital ulcer", +}, +{ +id: "s_1603", +type: "symptom", +name: "Delayed language development", +common_name: "Delayed language development", +}, +{ +id: "s_1605", +type: "symptom", +name: "Nose pain", +common_name: "Painful nose", +}, +{ +id: "s_1610", +type: "symptom", +name: "Joint pain, knee, during movement", +common_name: "Pain when moving knee", +}, +{ +id: "s_1616", +type: "symptom", +name: "Dandruff", +common_name: "Dandruff", +}, +{ +id: "s_1617", +type: "symptom", +name: "Pruritus, scalp", +common_name: "Itchy scalp", +}, +{ +id: "s_1618", +type: "symptom", +name: "Lower limb tenderness", +common_name: "Pain when pressing lower limb", +}, +{ +id: "s_1619", +type: "symptom", +name: "Upper limb tenderness", +common_name: "Pain when pressing upper limb", +}, +{ +id: "s_1620", +type: "symptom", +name: "Pain in lower limb, calf", +common_name: "Pain in calf", +}, +{ +id: "s_1621", +type: "symptom", +name: "Joint pain, ankle", +common_name: "Ankle pain", +}, +{ +id: "s_1622", +type: "symptom", +name: "Lower limb tenderness, calf", +common_name: "Pain when pressing calf", +}, +{ +id: "s_1623", +type: "symptom", +name: "Joint pain, during ankle movement", +common_name: "Pain when moving ankle", +}, +{ +id: "s_1625", +type: "symptom", +name: "Dyspnea, lasting more than 4 weeks", +common_name: "Shortness of breath lasting more than 4 weeks", +}, +{ +id: "s_1632", +type: "symptom", +name: "Joint pain, elbow", +common_name: "Elbow pain", +}, +{ +id: "s_1634", +type: "symptom", +name: "Joint pain, during elbow movement", +common_name: "Pain when moving elbow", +}, +{ +id: "s_1635", +type: "symptom", +name: "Edema, elbow joint", +common_name: "Swollen elbow", +}, +{ +id: "s_1636", +type: "symptom", +name: "Joint pain, during wrist movement", +common_name: "Pain when moving wrist", +}, +{ +id: "s_1639", +type: "symptom", +name: "Joint pain, thumb", +common_name: "Thumb pain", +}, +{ +id: "s_1641", +type: "symptom", +name: "Joint pain, during thumb movement", +common_name: "Pain when moving thumb", +}, +{ +id: "s_1645", +type: "symptom", +name: "Foot pain, pain in back of foot during single-leg heel raise", +common_name: "Pain in the back of foot while standing on toes", +}, +{ +id: "s_1647", +type: "symptom", +name: "Annular skin lesions", +common_name: "Ring-shaped skin changes", +}, +{ +id: "s_1650", +type: "symptom", +name: "Skin thickening", +common_name: "Skin thickening", +}, +{ +id: "s_1652", +type: "symptom", +name: "Edema, hip joint", +common_name: "Hip swelling", +}, +{ +id: "s_1654", +type: "symptom", +name: "Joint pain, shoulder", +common_name: "Shoulder pain", +}, +{ +id: "s_1655", +type: "symptom", +name: "Edema, shoulder joint", +common_name: "Swollen shoulder", +}, +{ +id: "s_1656", +type: "symptom", +name: "Joint pain, tenderness", +common_name: "Pain when pressing joint", +}, +{ +id: "s_1665", +type: "symptom", +name: "Hair loss, generalized", +common_name: "Generalized hair volume loss", +}, +{ +id: "s_1671", +type: "symptom", +name: "Broken hair", +common_name: "Broken hair", +}, +{ +id: "s_1673", +type: "symptom", +name: "Oral lesions, white plaques", +common_name: "White patches inside the mouth", +}, +{ +id: "s_1674", +type: "symptom", +name: "Skin pain", +common_name: "Skin pain", +}, +{ +id: "s_1676", +type: "symptom", +name: "Corn or callus", +common_name: "Corn or callus", +}, +{ +id: "s_1680", +type: "symptom", +name: "Dermatological changes, hyperpigmentation of the skin", +common_name: "Dark skin changes", +}, +{ +id: "s_1682", +type: "symptom", +name: "Rhinophyma", +common_name: "Ruddy bulbous nose", +}, +{ +id: "s_1684", +type: "symptom", +name: "Burning skin, face", +common_name: "Burning sensation on face", +}, +{ +id: "s_1685", +type: "symptom", +name: "Telangiectasias, face", +common_name: "Spider veins on the face", +}, +{ +id: "s_1689", +type: "symptom", +name: "Kernigs sign", +common_name: "Kernigs sign", +}, +{ +id: "s_1690", +type: "symptom", +name: "Brudzinskis sign", +common_name: "Brudzinskis sign", +}, +{ +id: "s_1692", +type: "symptom", +name: "Dermatological changes, exacerbated by alcohol consumption", +common_name: "Skin changes worsening after alcohol consumption", +}, +{ +id: "s_1693", +type: "symptom", +name: "Decreased intensity of breath sounds", +common_name: "Decreased intensity of breath sounds", +}, +{ +id: "s_1695", +type: "symptom", +name: "Interpersonal relationship difficulties", +common_name: "Interpersonal relationship difficulties", +}, +{ +id: "s_1696", +type: "symptom", +name: "Echolalia", +common_name: "Unsolicitedly repeating words or phrases", +}, +{ +id: "s_1697", +type: "symptom", +name: "Restricted interests", +common_name: "Having strong, limited, or unusual interests", +}, +{ +id: "s_1698", +type: "symptom", +name: "Lack of eye contact", +common_name: "Avoiding eye contact", +}, +{ +id: "s_1713", +type: "symptom", +name: "Reduced range of joint motion", +common_name: "Joint hard to move", +}, +{ +id: "s_1715", +type: "symptom", +name: "Pathologic fractures", +common_name: "Broken bone not caused by trauma", +}, +{ +id: "s_1716", +type: "symptom", +name: "Feeling of vaginal fullness", +common_name: "Vaginal fullness", +}, +{ +id: "s_1717", +type: "symptom", +name: "Bulge protruding through vaginal opening", +common_name: "Vaginal bulge", +}, +{ +id: "s_1719", +type: "symptom", +name: "Osler nodes", +common_name: "Osler nodes", +}, +{ +id: "s_1720", +type: "symptom", +name: "Cardiac murmurs", +common_name: "Cardiac murmurs", +}, +{ +id: "s_1721", +type: "symptom", +name: "Nystagmus, horizontal", +common_name: "Horizontal nystagmus", +}, +{ +id: "s_1725", +type: "symptom", +name: "Lower limb pallor", +common_name: "Pale leg", +}, +{ +id: "s_1729", +type: "symptom", +name: "Abdominal pain, left lower quadrant", +common_name: "Lower left side abdominal pain", +}, +{ +id: "s_1731", +type: "symptom", +name: "Dix-Hallpike maneuver, rotatory nystagmus", +common_name: "Dix-Hallpike maneuver, rotatory nystagmus", +}, +{ +id: "s_1732", +type: "symptom", +name: "Rovsings sign", +common_name: "Rovsings sign", +}, +{ +id: "s_1733", +type: "symptom", +name: "Lymph node pain", +common_name: "Painful lymph nodes", +}, +{ +id: "s_1738", +type: "symptom", +name: "Rombergs sign", +common_name: "Rombergs sign", +}, +{ +id: "s_1744", +type: "symptom", +name: "Audible popping in knee during injury", +common_name: "Audible popping in knee during injury", +}, +{ +id: "s_1745", +type: "symptom", +name: "Knee instability", +common_name: "Unstable knee", +}, +{ +id: "s_1761", +type: "symptom", +name: "Dermatological changes, aggravated by stress", +common_name: "Skin changes worsening under stress", +}, +{ +id: "s_1762", +type: "symptom", +name: "Headache, exacerbated by increased stress", +common_name: "Headache worsened by stress", +}, +{ +id: "s_1763", +type: "symptom", +name: "Chest pain, exacerbated by stress", +common_name: "Chest pain worsened by stress", +}, +{ +id: "s_1765", +type: "symptom", +name: "Tremors, stress-related", +common_name: "Trembling worsening under stress", +}, +{ +id: "s_1766", +type: "symptom", +name: "Myalgia, exacerbated by stress", +common_name: "Muscle pain triggered by stress", +}, +{ +id: "s_1767", +type: "symptom", +name: "Gastric symptoms, stress-related", +common_name: "Stress-related gastric symptoms", +}, +{ +id: "s_1768", +type: "symptom", +name: "Mental disturbances exacerbated by stress", +common_name: "Mental disturbances exacerbated by stress", +}, +{ +id: "s_1772", +type: "symptom", +name: "Back pain, thoracic", +common_name: "Middle or upper back pain", +}, +{ +id: "s_1776", +type: "symptom", +name: "Dysphagia, oropharyngeal", +common_name: "Difficulty initiating a swallow", +}, +{ +id: "s_1779", +type: "symptom", +name: "Dysphagia, esophageal", +common_name: "Feeling of food getting stuck several seconds after swallowing", +}, +{ +id: "s_1780", +type: "symptom", +name: "Headache, mild", +common_name: "Mild headache", +}, +{ +id: "s_1781", +type: "symptom", +name: "Headache, moderate", +common_name: "Moderate headache", +}, +{ +id: "s_1782", +type: "symptom", +name: "Abdominal pain, mild", +common_name: "Mild abdominal pain", +}, +{ +id: "s_1783", +type: "symptom", +name: "Abdominal pain, moderate", +common_name: "Moderate abdominal pain", +}, +{ +id: "s_1788", +type: "symptom", +name: "White nail discolouration", +common_name: "White spots on nail", +}, +{ +id: "s_1789", +type: "symptom", +name: "Yellow nail discolouration", +common_name: "Yellow nails", +}, +{ +id: "s_1790", +type: "symptom", +name: "Thickened nails", +common_name: "Thickened nails", +}, +{ +id: "s_1791", +type: "symptom", +name: "Erythema, scalp", +common_name: "Red patches on scalp", +}, +{ +id: "s_1792", +type: "symptom", +name: "Visible head lice on scalp or brush", +common_name: "Visible head lice on scalp or brush", +}, +{ +id: "s_1793", +type: "symptom", +name: "Lice eggs or nits on hair shafts", +common_name: "Lice eggs or nits", +}, +{ +id: "s_1795", +type: "symptom", +name: "White-gray burrows in the skin", +common_name: "White-gray burrows in the skin", +}, +{ +id: "s_1796", +type: "symptom", +name: "White patch on cornea", +common_name: "White spot on cornea", +}, +{ +id: "s_1798", +type: "symptom", +name: "Difference in size of testicles", +common_name: "Difference in size of testicles", +}, +{ +id: "s_1799", +type: "symptom", +name: "Pain in upper limb, forearm", +common_name: "Pain in forearm", +}, +{ +id: "s_1800", +type: "symptom", +name: "Past appendectomy", +common_name: "Appendix removal in the past", +}, +{ +id: "s_1802", +type: "symptom", +name: "Abdominal pain, burning or gnawing", +common_name: "Burning or gnawing stomach pain", +}, +{ +id: "s_1805", +type: "symptom", +name: "Joint pain, during shoulder movement", +common_name: "Pain when moving shoulder", +}, +{ +id: "s_1808", +type: "symptom", +name: "Dermatological changes, located on the face", +common_name: "Skin changes on the face", +}, +{ +id: "s_1810", +type: "symptom", +name: "Dermatological changes, located in the genital area", +common_name: "Skin changes on or around genitals", +}, +{ +id: "s_1811", +type: "symptom", +name: "Vaginal dryness", +common_name: "Vaginal dryness", +}, +{ +id: "s_1812", +type: "symptom", +name: "Nasal congestion, chronic", +common_name: "Blocked nose lasting more than 3 months", +}, +{ +id: "s_1819", +type: "symptom", +name: "Impaired vision, one eye", +common_name: "Visual impairment in one eye", +}, +{ +id: "s_1820", +type: "symptom", +name: "Fever, temperature not measured", +common_name: "Fever not measured", +}, +{ +id: "s_1823", +type: "symptom", +name: "Joint pain, during hip movement", +common_name: "Pain when moving hip", +}, +{ +id: "s_1826", +type: "symptom", +name: "Pharyngeal pain, unilateral", +common_name: "One-sided sore throat", +}, +{ +id: "s_1829", +type: "symptom", +name: "Crotch pain, vulvovaginal", +common_name: "Pain in vagina or vulva", +}, +{ +id: "s_1830", +type: "symptom", +name: "Skin mass, larger than 1 cm", +common_name: "Lump larger than 1 cm", +}, +{ +id: "s_1831", +type: "symptom", +name: "Skin mass", +common_name: "Lumps or bumps", +}, +{ +id: "s_1833", +type: "symptom", +name: "Toe pain", +common_name: "Toe pain", +}, +{ +id: "s_1835", +type: "symptom", +name: "Body aches", +common_name: "Body aches", +}, +{ +id: "s_1840", +type: "symptom", +name: "Abdominal pain, lasting less than 2 days", +common_name: "Abdominal pain lasting less than 2 days", +}, +{ +id: "s_1842", +type: "symptom", +name: "Abdominal pain, lasting more than 2 weeks", +common_name: "Abdominal pain lasting more than 2 weeks", +}, +{ +id: "s_1843", +type: "symptom", +name: "Abdominal pain, sudden onset", +common_name: "Sudden abdominal pain", +}, +{ +id: "s_1844", +type: "symptom", +name: "Abdominal pain, gradual onset", +common_name: "Slow and gradual abdominal pain", +}, +{ +id: "s_1845", +type: "symptom", +name: "Abdominal pain, radiating to left shoulder or shoulder blade", +common_name: "Abdominal pain spreading to the left shoulder area", +}, +{ +id: "s_1846", +type: "symptom", +name: "Abdominal pain, radiating to lower or middle part of the back", +common_name: "Abdominal pain spreading to the lower or middle back", +}, +{ +id: "s_1847", +type: "symptom", +name: "Abdominal pain, recurrent", +common_name: "Recurrent abdominal pain", +}, +{ +id: "s_1848", +type: "symptom", +name: "Abdominal pain, colicky", +common_name: "Colic abdominal pain", +}, +{ +id: "s_1851", +type: "symptom", +name: "Abdominal pain, migrating to the right lower quadrant", +common_name: "Stomach pain, moved to the lower right side", +}, +{ +id: "s_1852", +type: "symptom", +name: "Abdominal pain, lasting 2 to 7 days", +common_name: "Abdominal pain lasting 2 to 7 days", +}, +{ +id: "s_1853", +type: "symptom", +name: "Abdominal pain, lasting 8 to 14 days", +common_name: "Abdominal pain lasting 8 to 14 days", +}, +{ +id: "s_1193", +type: "symptom", +name: "Abdominal pain, left side", +common_name: "Left side stomach pain", +}, +{ +id: "s_1855", +type: "symptom", +name: "Abdominal pain, right side", +common_name: "Right side stomach pain", +}, +{ +id: "s_1856", +type: "symptom", +name: "Abdominal tenderness, right lower quadrant", +common_name: "Pain when pressing lower-right part of the abdomen", +}, +{ +id: "s_1858", +type: "symptom", +name: "Cough, lasting 3 to 8 weeks", +common_name: "Cough lasting 3 to 8 weeks", +}, +{ +id: "s_1859", +type: "symptom", +name: "Abdominal pain, midcycle", +common_name: "Painful ovulation", +}, +{ +id: "s_1860", +type: "symptom", +name: "Abdominal pain, crampy", +common_name: "Crampy abdominal pain", +}, +{ +id: "s_1864", +type: "symptom", +name: "Headache, excruciating", +common_name: "Worst headache ever", +}, +{ +id: "s_1868", +type: "symptom", +name: "Headache, chronic, lasting 5 minutes to 4 hours", +common_name: "Headache lasting between 5 minutes and 4 hours", +}, +{ +id: "s_1870", +type: "symptom", +name: "Headache, chronic, lasting 4 to 72 hours", +common_name: "Headache attack lasting 4 to 72 hours", +}, +{ +id: "s_1871", +type: "symptom", +name: "Headache, exacerbated by physical activity", +common_name: "Headache worsened by physical activity", +}, +{ +id: "s_1875", +type: "symptom", +name: "Vulvovaginal burning", +common_name: "Vulvovaginal burning", +}, +{ +id: "s_1878", +type: "symptom", +name: "Calf pain, above the heel", +common_name: "Pain in calf just above the heel", +}, +{ +id: "s_1891", +type: "symptom", +name: "Hypersensitivity to smells", +common_name: "Oversensitivity to smells", +}, +{ +id: "s_1893", +type: "symptom", +name: "Pain in lower limb, thigh", +common_name: "Thigh pain", +}, +{ +id: "s_1899", +type: "symptom", +name: "Tingling fingers, first three digits", +common_name: "Tingling in the thumb, index and middle finger", +}, +{ +id: "s_1900", +type: "symptom", +name: "Tingling fingers, fourth and fifth digits", +common_name: "Tingling in the ring and little finger", +}, +{ +id: "s_1901", +type: "symptom", +name: "Headache, chronic, lasting 3 to 7 days", +common_name: "Headache attacks lasting 3 to 7 days", +}, +{ +id: "s_1903", +type: "symptom", +name: "Reduced range of joint motion, passive", +common_name: "Reduced range of passive joint motion", +}, +{ +id: "s_1905", +type: "symptom", +name: "Headache, sudden onset", +common_name: "Sudden headache", +}, +{ +id: "s_1907", +type: "symptom", +name: "Headache, chronic, lasting less than 5 minutes", +common_name: "Headache lasting less than 5 minutes", +}, +{ +id: "s_1909", +type: "symptom", +name: "Foot drop", +common_name: "Dropping the front of the foot", +}, +{ +id: "s_1910", +type: "symptom", +name: "Wrist drop", +common_name: "Dropping hand", +}, +{ +id: "s_1911", +type: "symptom", +name: "Headache, temporal region", +common_name: "Headache located over the temples", +}, +{ +id: "s_1912", +type: "symptom", +name: "Headache, recent", +common_name: "Headaches history shorter than 3 months", +}, +{ +id: "s_1915", +type: "symptom", +name: "Purpuric rash, palpable", +common_name: "Red or purple spots larger than 3 mm that can be felt", +}, +{ +id: "s_1918", +type: "symptom", +name: "Buttocks pain", +common_name: "Buttocks pain", +}, +{ +id: "s_1921", +type: "symptom", +name: "Dermatological changes, exacerbated by sunlight exposure", +common_name: "Skin changes appearing or worsening after exposure to sunlight", +}, +{ +id: "s_1922", +type: "symptom", +name: "Heel drop test", +common_name: "Abdominal pain after dropping hard on heels", +}, +{ +id: "s_1923", +type: "symptom", +name: "Dermatological changes, feet", +common_name: "Skin changes on feet", +}, +{ +id: "s_1924", +type: "symptom", +name: "Cough, paroxysmal", +common_name: "Severe and sudden coughing attacks", +}, +{ +id: "s_1925", +type: "symptom", +name: "Chest pain, pressure", +common_name: "Pressing chest pain", +}, +{ +id: "s_1926", +type: "symptom", +name: "Cold and clammy skin", +common_name: "Cold and clammy skin", +}, +{ +id: "s_1927", +type: "symptom", +name: "Pain in lower limb, limping due to pain", +common_name: "Limping due to leg pain", +}, +{ +id: "s_1929", +type: "symptom", +name: "Abdominal pain, unbearable", +common_name: "Unbearable stomach pain", +}, +{ +id: "s_1930", +type: "symptom", +name: "Pain in lower limb, severe", +common_name: "Severe pain in lower limb", +}, +{ +id: "s_1931", +type: "symptom", +name: "Skin mass, bleeding", +common_name: "Bleeding lump or bump", +}, +{ +id: "s_1932", +type: "symptom", +name: "Paresthesia, sudden onset", +common_name: "Sudden onset of tingling or numbness", +}, +{ +id: "s_1933", +type: "symptom", +name: "Blood pressure, more than 180 mmHg", +common_name: "Very high blood pressure", +}, +{ +id: "s_1935", +type: "symptom", +name: "Pain in upper limb, severe", +common_name: "Severe pain in upper limb", +}, +{ +id: "s_1937", +type: "symptom", +name: "Worms in stool", +common_name: "Worms in stool or around anus", +}, +{ +id: "s_1943", +type: "symptom", +name: "Sunburn", +common_name: "Sunburn", +}, +{ +id: "s_1949", +type: "symptom", +name: "Vomiting, every time after meal", +common_name: "Vomiting after every meal", +}, +{ +id: "s_1952", +type: "symptom", +name: "Chest pain, recurrent", +common_name: "Recurrent chest pain", +}, +{ +id: "s_1955", +type: "symptom", +name: "Erythema, around both eyes", +common_name: "Redness around both eyes", +}, +{ +id: "s_1957", +type: "symptom", +name: "Destructive thoughts towards other people or things", +common_name: "Destructive thoughts towards other people or things", +}, +{ +id: "s_1958", +type: "symptom", +name: "Dysphonia, more than 2 weeks", +common_name: "Hoarseness lasting more than 2 weeks", +}, +{ +id: "s_1960", +type: "symptom", +name: "Bruising after trauma", +common_name: "Bruise after an injury", +}, +{ +id: "s_1961", +type: "symptom", +name: "Jaw pain", +common_name: "Jaw pain", +}, +{ +id: "s_1973", +type: "symptom", +name: "Skin wound, active bleeding", +common_name: "Actively bleeding wound", +}, +{ +id: "s_1979", +type: "symptom", +name: "Diarrhea, more than 6 stools a day", +common_name: "Diarrhea with more than 6 stools a day", +}, +{ +id: "s_1982", +type: "symptom", +name: "Dermatological changes, hands", +common_name: "Skin changes on hands", +}, +{ +id: "s_1983", +type: "symptom", +name: "Eyelid lesion, itching", +common_name: "Itchy skin changes on eyelid", +}, +{ +id: "s_1985", +type: "symptom", +name: "Cough, nocturnal", +common_name: "Nighttime cough", +}, +{ +id: "s_1988", +type: "symptom", +name: "Dermatological changes, spreading", +common_name: "Enlarging or spreading skin changes", +}, +{ +id: "s_1994", +type: "symptom", +name: "Discharge from ear, purulent", +common_name: "Yellow or green discharge from ear", +}, +{ +id: "s_1995", +type: "symptom", +name: "Edema, both feet", +common_name: "Swollen feet", +}, +{ +id: "s_1996", +type: "symptom", +name: "Edema, nose", +common_name: "Swollen nose", +}, +{ +id: "s_1997", +type: "symptom", +name: "Edema, toe", +common_name: "Swollen toe", +}, +{ +id: "s_1999", +type: "symptom", +name: "Erythema, vulva", +common_name: "Reddened vulva", +}, +{ +id: "s_2000", +type: "symptom", +name: "Fever, higher than 104°F or 40°C", +common_name: "Fever higher than 104°F or 40°C", +}, +{ +id: "s_2001", +type: "symptom", +name: "Paresthesia, one lower limb", +common_name: "Tingling or numbness in one lower limb", +}, +{ +id: "s_2002", +type: "symptom", +name: "Palpitations, lasting more than 5 minutes", +common_name: "Palpitations lasting more than 5 minutes", +}, +{ +id: "s_2003", +type: "symptom", +name: "Erythema, toe", +common_name: "Red toe", +}, +{ +id: "s_2004", +type: "symptom", +name: "Palpitations, recurrent", +common_name: "Recurrent palpitations", +}, +{ +id: "s_2005", +type: "symptom", +name: "Nail pain", +common_name: "Sore nail", +}, +{ +id: "s_2006", +type: "symptom", +name: "Chest pain, exacerbating when lying down", +common_name: "Chest pain worsening when lying down", +}, +{ +id: "s_2008", +type: "symptom", +name: "Regular uterine contractions", +common_name: "Regular uterine contractions", +}, +{ +id: "s_2010", +type: "symptom", +name: "Fetal membranes rupture", +common_name: "Water breaking", +}, +{ +id: "s_2011", +type: "symptom", +name: "Blood glucose level, between 54 and 70 mg/dl or between 3 and 3.9 mmol/l", +common_name: "Low blood sugar level, between 54 and 70 mg/dl or between 3 and 3.9 mmol/l", +}, +{ +id: "s_2014", +type: "symptom", +name: "Blood glucose level, not measured", +common_name: "Blood sugar level not measured", +}, +{ +id: "s_2016", +type: "symptom", +name: "Nosebleed, single episode", +common_name: "One episode of bleeding from nose", +}, +{ +id: "s_2017", +type: "symptom", +name: "Nosebleed, recurrent", +common_name: "Recurrent bleeding from nose", +}, +{ +id: "s_2018", +type: "symptom", +name: "Chest pain, lasting less than 30 minutes", +common_name: "Chest pain lasting less than 30 minutes", +}, +{ +id: "s_2019", +type: "symptom", +name: "Chest pain, lasting between 30 minutes and 8 hours", +common_name: "Chest pain lasting between 30 minutes and 8 hours", +}, +{ +id: "s_2022", +type: "symptom", +name: "Chest pain, lasting more than 8 hours", +common_name: "Chest pain lasting more than 8 hours", +}, +{ +id: "s_2023", +type: "symptom", +name: "Dizziness, recurrent", +common_name: "Recurrent dizziness", +}, +{ +id: "s_2024", +type: "symptom", +name: "Gambling, pathological", +common_name: "Excessive gambling", +}, +{ +id: "s_2029", +type: "symptom", +name: "Gambling, lying about extent", +common_name: "Lying about the extent of gambling", +}, +{ +id: "s_2032", +type: "symptom", +name: "Gambling", +common_name: "Gambling", +}, +{ +id: "s_2033", +type: "symptom", +name: "Pruritus, foot", +common_name: "Itchy foot", +}, +{ +id: "s_2034", +type: "symptom", +name: "Consciousness disturbances", +common_name: "Confusion or disorientation", +}, +{ +id: "s_2041", +type: "symptom", +name: "Halos around lights", +common_name: "Halos around lights", +}, +{ +id: "s_2043", +type: "symptom", +name: "Male genital itching", +common_name: "Itchy penis", +}, +{ +id: "s_2045", +type: "symptom", +name: "Seizures", +common_name: "Seizures", +}, +{ +id: "s_2047", +type: "symptom", +name: "Absence seizure", +common_name: "Blanking out", +}, +{ +id: "s_2048", +type: "symptom", +name: "Bedwetting", +common_name: "Bedwetting", +}, +{ +id: "s_2051", +type: "symptom", +name: "Chest pain, exacerbated by chest wall movement", +common_name: "Chest pain worsening during chest wall movement", +}, +{ +id: "s_2052", +type: "symptom", +name: "Male infertility", +common_name: "Male infertility", +}, +{ +id: "s_2053", +type: "symptom", +name: "Currant jelly stool", +common_name: "Redcurrant jelly stool", +}, +{ +id: "s_2055", +type: "symptom", +name: "Vomiting, bilious", +common_name: "Greenish-yellow vomit", +}, +{ +id: "s_2056", +type: "symptom", +name: "Vomiting, less than 7 days", +common_name: "Vomiting for less than a week", +}, +{ +id: "s_2057", +type: "symptom", +name: "Vomiting, 7 days or more", +common_name: "Vomiting for a week or more", +}, +{ +id: "s_2058", +type: "symptom", +name: "Dermatological changes, flexural surfaces", +common_name: "Skin changes on the inside of joints", +}, +{ +id: "s_2059", +type: "symptom", +name: "Dermatological changes, scalp", +common_name: "Skin changes on the scalp", +}, +{ +id: "s_2060", +type: "symptom", +name: "Dermatological changes, trunk", +common_name: "Skin changes on the neck, chest, belly or back", +}, +{ +id: "s_2063", +type: "symptom", +name: "Fever, unresponsive to treatment", +common_name: "Fever unresponsive to treatment", +}, +{ +id: "s_2064", +type: "symptom", +name: "Foul-smelling urine", +common_name: "Smelly urine", +}, +{ +id: "s_2065", +type: "symptom", +name: "Mouth pain", +common_name: "Pain in mouth", +}, +{ +id: "s_2066", +type: "symptom", +name: "Limb length discrepancy", +common_name: "Uneven limbs", +}, +{ +id: "s_2068", +type: "symptom", +name: "Upper limb pallor", +common_name: "Pale upper limb", +}, +{ +id: "s_2070", +type: "symptom", +name: "Bone pain, lasting less than a week", +common_name: "Bone pain lasting less than a week", +}, +{ +id: "s_2071", +type: "symptom", +name: "Bone pain, 1 week or more", +common_name: "Bone pain lasting 1 week or more", +}, +{ +id: "s_2072", +type: "symptom", +name: "Consciousness disturbances, acute", +common_name: "Disorientation or confusion starting recently", +}, +{ +id: "s_2073", +type: "symptom", +name: "Consciousness disturbances, chronic", +common_name: "Disorientation or confusion lasting more than a week", +}, +{ +id: "s_2074", +type: "symptom", +name: "Chest pain, radiating to left upper limb", +common_name: "Chest pain, spreading to the left upper limb", +}, +{ +id: "s_2076", +type: "symptom", +name: "Respiratory distress, after trauma", +common_name: "Breathing problems after an injury", +}, +{ +id: "s_2077", +type: "symptom", +name: "Skin wound, major bleeding", +common_name: "Major bleeding", +}, +{ +id: "s_2078", +type: "symptom", +name: "Skin wound, minor uncontrollable bleeding", +common_name: "Skin wound with minor uncontrollable bleeding", +}, +{ +id: "s_2079", +type: "symptom", +name: "Recent injury without bleeding", +common_name: "Recent injury without bleeding", +}, +{ +id: "s_2081", +type: "symptom", +name: "Severe pain, after trauma", +common_name: "Severe pain after an injury", +}, +{ +id: "s_2084", +type: "symptom", +name: "Periorbital ecchymosis", +common_name: "Bruising around the eyes", +}, +{ +id: "s_2085", +type: "symptom", +name: "Back pain, worsens on palpation", +common_name: "Back pain worsens by touching or pressing the affected area", +}, +{ +id: "s_2086", +type: "symptom", +name: "Inability to bear weight, after trauma", +common_name: "Inability to stand on either foot after injury", +}, +{ +id: "s_2087", +type: "symptom", +name: "Joint deformity, post-traumatic", +common_name: "Deformed joints after an injury", +}, +{ +id: "s_2088", +type: "symptom", +name: "Physical injury", +common_name: "Injury", +}, +{ +id: "s_2091", +type: "symptom", +name: "Pain in both upper limbs, both hands", +common_name: "Pain in both hands", +}, +{ +id: "s_2092", +type: "symptom", +name: "Pain in both lower limbs, both feet", +common_name: "Pain in both feet", +}, +{ +id: "s_2093", +type: "symptom", +name: "Edema, both hands", +common_name: "Swollen hands", +}, +{ +id: "s_2094", +type: "symptom", +name: "Dry eyes", +common_name: "Dry eyes", +}, +{ +id: "s_2096", +type: "symptom", +name: "Chest pain, burning", +common_name: "Burning chest pain", +}, +{ +id: "s_2097", +type: "symptom", +name: "Re-experiencing trauma, intrusive symptoms", +common_name: "Re-experiencing trauma through flashbacks, memories, or dreams", +}, +{ +id: "s_2100", +type: "symptom", +name: "Fatigue", +common_name: "Fatigue", +}, +{ +id: "s_2103", +type: "symptom", +name: "Edema, one foot", +common_name: "Swollen foot", +}, +{ +id: "s_2105", +type: "symptom", +name: "Re-experiencing trauma, distressing symptoms", +common_name: "Physical and mental distress related to re-experiencing trauma", +}, +{ +id: "s_2107", +type: "symptom", +name: "Waking up during the night", +common_name: "Middle-of-the-night insomnia", +}, +{ +id: "s_2108", +type: "symptom", +name: "Cognitive disturbances", +common_name: "Cognitive disturbances", +}, +{ +id: "s_2109", +type: "symptom", +name: "Coma", +common_name: "Coma", +}, +{ +id: "s_2110", +type: "symptom", +name: "Dermatological changes, female genital area", +common_name: "Skin changes on or around female genital area", +}, +{ +id: "s_2111", +type: "symptom", +name: "Dermatological changes, male genital area", +common_name: "Skin changes on or around male genital area", +}, +{ +id: "s_2112", +type: "symptom", +name: "Pleuritic chest pain, after trauma", +common_name: "Sudden and sharp chest pain after an injury", +}, +{ +id: "s_2115", +type: "symptom", +name: "Abnormal uterine bleeding, pregnancy", +common_name: "Vaginal bleeding during pregnancy", +}, +{ +id: "s_2116", +type: "symptom", +name: "Abnormal uterine spotting, pregnancy", +common_name: "Vaginal spotting during pregnancy", +}, +{ +id: "s_2118", +type: "symptom", +name: "Dizziness, unbearable", +common_name: "Unbearable dizziness", +}, +{ +id: "s_2119", +type: "symptom", +name: "Ulcer, completely painless", +common_name: "Painless ulcer", +}, +{ +id: "s_2121", +type: "symptom", +name: "Acid reflux", +common_name: "Acidic taste in mouth", +}, +{ +id: "s_2122", +type: "symptom", +name: "Rectal mucosal prolapse", +common_name: "Rectal prolapse", +}, +{ +id: "s_2124", +type: "symptom", +name: "Noisy breathing", +common_name: "Noisy breathing", +}, +{ +id: "s_2125", +type: "symptom", +name: "Fetal membranes rupture, purulent or malodorous amniotic fluid", +common_name: "Smelly or coloured waters", +}, +{ +id: "s_2126", +type: "symptom", +name: "Diarrhea, lasting less than 48 hours", +common_name: "Diarrhea lasting less than 48 hours", +}, +{ +id: "s_2129", +type: "symptom", +name: "Somnambulism", +common_name: "Sleepwalking", +}, +{ +id: "s_2132", +type: "symptom", +name: "Bleeding from the umbilical cord stump", +common_name: "Bleeding from the umbilical cord stump", +}, +{ +id: "s_2133", +type: "symptom", +name: "Bulging fontanelle", +common_name: "Bulging soft spot", +}, +{ +id: "s_2134", +type: "symptom", +name: "Chest retractions", +common_name: "Chest retractions", +}, +{ +id: "s_2135", +type: "symptom", +name: "Circumoral pallor", +common_name: "White and light skin around the mouth", +}, +{ +id: "s_2138", +type: "symptom", +name: "Crying without tears", +common_name: "Crying without tears", +}, +{ +id: "s_2139", +type: "symptom", +name: "Dermatological changes, intertriginous", +common_name: "Skin changes between skin folds", +}, +{ +id: "s_2140", +type: "symptom", +name: "Drawing up legs", +common_name: "Drawing up legs", +}, +{ +id: "s_2141", +type: "symptom", +name: "Eye discharge", +common_name: "Eye discharge", +}, +{ +id: "s_2142", +type: "symptom", +name: "Weight faltering", +common_name: "Slow rate of weight gain", +}, +{ +id: "s_2143", +type: "symptom", +name: "Expiratory grunting", +common_name: "Grunting with every breath", +}, +{ +id: "s_2144", +type: "symptom", +name: "Ill appearance", +common_name: "Ill appearance", +}, +{ +id: "s_2145", +type: "symptom", +name: "Ill appearance, serious and strong concern", +common_name: "Ill appearance causing strong concern", +}, +{ +id: "s_2148", +type: "symptom", +name: "Increased head circumference", +common_name: "Increased head circumference", +}, +{ +id: "s_2149", +type: "symptom", +name: "Irritability, lasting more than 3 days", +common_name: "Fussy for more than 3 days", +}, +{ +id: "s_2150", +type: "symptom", +name: "Laboured breathing, nocturnal", +common_name: "Difficulty breathing at night", +}, +{ +id: "s_2151", +type: "symptom", +name: "Lack of eye fixation", +common_name: "Trouble focusing eyes", +}, +{ +id: "s_2153", +type: "symptom", +name: "Nasal catarrh, mucoid", +common_name: "Clear or white nasal discharge", +}, +{ +id: "s_2154", +type: "symptom", +name: "Nasal catarrh, purulent", +common_name: "Yellow or green nasal discharge", +}, +{ +id: "s_2155", +type: "symptom", +name: "Nasal flaring", +common_name: "Nasal flaring", +}, +{ +id: "s_2156", +type: "symptom", +name: "Posttussive vomiting", +common_name: "Coughing followed by vomiting", +}, +{ +id: "s_2157", +type: "symptom", +name: "Presence of the umbilical cord", +common_name: "Presence of the umbilical cord", +}, +{ +id: "s_2159", +type: "symptom", +name: "Sunken fontanelle", +common_name: "Sunken soft spot on infants head", +}, +{ +id: "s_2160", +type: "symptom", +name: "Teething", +common_name: "Teething", +}, +{ +id: "s_2162", +type: "symptom", +name: "Constipation, lasting 3 months or more", +common_name: "Constipation for 3 months or more", +}, +{ +id: "s_2163", +type: "symptom", +name: "Twisted neck", +common_name: "Twisted neck", +}, +{ +id: "s_2164", +type: "symptom", +name: "Consumption of expired food or drink", +common_name: "Spoiled food or drink consumption", +}, +{ +id: "s_2165", +type: "symptom", +name: "Cough, barking", +common_name: "Barking cough", +}, +{ +id: "s_2166", +type: "symptom", +name: "Wheezing, acute", +common_name: "Sudden wheezing", +}, +{ +id: "s_2168", +type: "symptom", +name: "Normal body temperature", +common_name: "Normal body temperature", +}, +{ +id: "s_2169", +type: "symptom", +name: "Normal heart rate", +common_name: "Normal pulse", +}, +{ +id: "s_2170", +type: "symptom", +name: "Anicteric presentation", +common_name: "Anicteric presentation", +}, +{ +id: "s_2171", +type: "symptom", +name: "Normal lung sounds on auscultation", +common_name: "Normal lung sounds on auscultation", +}, +{ +id: "s_2172", +type: "symptom", +name: "No signs of upper respiratory infection", +common_name: "No signs of upper respiratory infection", +}, +{ +id: "s_2173", +type: "symptom", +name: "Neck pain, during head movement", +common_name: "Neck pain when moving the head", +}, +{ +id: "s_2174", +type: "symptom", +name: "Normal vital signs", +common_name: "Normal vital signs", +}, +{ +id: "s_2175", +type: "symptom", +name: "Possible rabies exposure", +common_name: "Possible rabies exposure", +}, +{ +id: "s_2176", +type: "symptom", +name: "Dyspnea, lasting 1 to 24 hours", +common_name: "Shortness of breath lasting 1 to 24 hours", +}, +{ +id: "s_2177", +type: "symptom", +name: "Dermatological changes, bright red or purple", +common_name: "Bright red or purple skin changes", +}, +{ +id: "s_2178", +type: "symptom", +name: "Wheezing, subacute", +common_name: "Wheezing since a couple days to weeks", +}, +{ +id: "s_2180", +type: "symptom", +name: "Bone deformity, non-traumatic", +common_name: "Bone deformity not associated with a recent trauma", +}, +{ +id: "s_2181", +type: "symptom", +name: "Bone deformity, post-traumatic", +common_name: "Bone deformity after a recent injury", +}, +{ +id: "s_2182", +type: "symptom", +name: "Flank pain", +common_name: "Pain on the sides of the body", +}, +{ +id: "s_2188", +type: "symptom", +name: "Eye discharge, purulent", +common_name: "Purulent eye discharge", +}, +{ +id: "s_2189", +type: "symptom", +name: "Headache, recent, lasting less than 1 hour", +common_name: "Headache lasting less than 1 hour", +}, +{ +id: "s_2190", +type: "symptom", +name: "Headache, recent, lasting 1 to 24 hours", +common_name: "Headache lasting between 1 hour and 1 day", +}, +{ +id: "s_2191", +type: "symptom", +name: "Headache, recent, lasting more than 1 day", +common_name: "Headache lasting for more than 1 day", +}, +{ +id: "s_2193", +type: "symptom", +name: "Ear rubbing", +common_name: "Ear pulling or tugging", +}, +{ +id: "s_2194", +type: "symptom", +name: "Diarrhea, lasting 2 to 14 days", +common_name: "Diarrhea lasting 2 to 14 days", +}, +{ +id: "s_2196", +type: "symptom", +name: "Cold feet and toes, unilateral", +common_name: "Cold foot", +}, +{ +id: "s_2200", +type: "symptom", +name: "Diplopia, lasting less than 24 hours", +common_name: "Double vision lasting less than 24 hours", +}, +{ +id: "s_2201", +type: "symptom", +name: "Diplopia, lasting 24 hours or more", +common_name: "Double vision lasting 24 hours or more", +}, +{ +id: "s_2203", +type: "symptom", +name: "Dyspnea, after a few minutes of walking", +common_name: "Shortness of breath after a few minutes of walking", +}, +{ +id: "s_2204", +type: "symptom", +name: "Dyspnea, on exertion", +common_name: "Shortness of breath on effort", +}, +{ +id: "s_2206", +type: "symptom", +name: "Paraphimosis", +common_name: "Retracted and stuck foreskin", +}, +{ +id: "s_2207", +type: "symptom", +name: "Edema, penis", +common_name: "Swollen penis", +}, +{ +id: "s_2208", +type: "symptom", +name: "Ulcer, not healing within 6 weeks", +common_name: "Non-healing ulcers", +}, +{ +id: "s_2209", +type: "symptom", +name: "Seizures, recurrent", +common_name: "Recurrent seizures", +}, +{ +id: "s_2211", +type: "symptom", +name: "Urticaria, lasting more than 6 weeks", +common_name: "Hives lasting more than 6 weeks", +}, +{ +id: "s_2212", +type: "symptom", +name: "Purulent vaginal discharge", +common_name: "Purulent vaginal discharge", +}, +{ +id: "s_2213", +type: "symptom", +name: "Self-injurious thoughts or behaviours", +common_name: "Self-injurious thoughts or behaviours", +}, +{ +id: "s_2222", +type: "symptom", +name: "Wound, lip", +common_name: "Wound on the lip", +}, +{ +id: "s_2226", +type: "symptom", +name: "Nasal congestion, worsens after briefly improving", +common_name: "Stuffy nose worsening after brief improvement", +}, +{ +id: "s_2228", +type: "symptom", +name: "Recent self-injurious behaviour", +common_name: "Recent self-inflicted injury", +}, +{ +id: "s_2230", +type: "symptom", +name: "Recent self-injurious behaviour, severe", +common_name: "Recent severe self-inflicted injury", +}, +{ +id: "s_2231", +type: "symptom", +name: "Dyspnea, unknown severity", +common_name: "Shortness of breath of unknown severity", +}, +{ +id: "s_2234", +type: "symptom", +name: "Breast asymmetry in size or shape", +common_name: "Asymmetrical breasts", +}, +{ +id: "s_2236", +type: "symptom", +name: "Erythema, scrotum", +common_name: "Reddened scrotum", +}, +{ +id: "s_2238", +type: "symptom", +name: "Asymmetrical thigh creases", +common_name: "Asymmetry of thigh folds", +}, +{ +id: "s_2241", +type: "symptom", +name: "Umbilical discharge", +common_name: "Belly button discharge", +}, +{ +id: "s_2242", +type: "symptom", +name: "Eye pain, unbearable", +common_name: "Unbearable eye pain", +}, +{ +id: "s_2245", +type: "symptom", +name: "Genital injury in male", +common_name: "Genital injury in male", +}, +{ +id: "s_2246", +type: "symptom", +name: "Genital injury in female", +common_name: "Genital injury in female", +}, +{ +id: "s_2247", +type: "symptom", +name: "Enlarged front of neck", +common_name: "Swollen front of neck", +}, +{ +id: "s_2248", +type: "symptom", +name: "Enlarged cervical lymph nodes", +common_name: "Enlarged lymph glands in the neck", +}, +{ +id: "s_2251", +type: "symptom", +name: "Unknown heart rate", +common_name: "Unknown pulse", +}, +{ +id: "s_2252", +type: "symptom", +name: "Abdominal tenderness, left lower quadrant", +common_name: "Pain when pressing lower-left part of the abdomen", +}, +{ +id: "s_2253", +type: "symptom", +name: "Flat foot", +common_name: "Flat foot", +}, +{ +id: "s_2259", +type: "symptom", +name: "Seizures, reflex", +common_name: "Reflex seizures", +}, +{ +id: "s_2260", +type: "symptom", +name: "Gingival recession", +common_name: "Receding gums", +}, +{ +id: "s_2261", +type: "symptom", +name: "Calf hypertrophy", +common_name: "Enlarged calves", +}, +{ +id: "s_2262", +type: "symptom", +name: "Gowers sign", +common_name: "Standing up with help of hands 'walking' up legs", +}, +{ +id: "s_2263", +type: "symptom", +name: "Tet spells", +common_name: "Tet spells", +}, +{ +id: "s_2264", +type: "symptom", +name: "Fatigue, during feeding", +common_name: "Fatigue during feeding", +}, +{ +id: "s_2266", +type: "symptom", +name: "Dermatological changes, upper extremities excluding hands", +common_name: "Skin changes on the shoulder, arm, forearm, elbow, or wrist", +}, +{ +id: "s_2267", +type: "symptom", +name: "Dermatological changes, lower extremities excluding feet", +common_name: "Skin changes on the hip, thigh, knee, calf, or ankle", +}, +{ +id: "s_2268", +type: "symptom", +name: "Cough, alternating productivity", +common_name: "Wet and dry cough appearing alternately", +}, +{ +id: "s_2269", +type: "symptom", +name: "Vesicular exanthema of lips or perioral skin", +common_name: "Blisters on the lips or around the mouth", +}, +{ +id: "s_2270", +type: "symptom", +name: "Vesicular exanthema of ear", +common_name: "Blisters on ear", +}, +{ +id: "s_2271", +type: "symptom", +name: "Gastric symptoms, after gluten ingestion", +common_name: "Abdominal symptoms after eating foods containing gluten", +}, +{ +id: "s_2272", +type: "symptom", +name: "Blood pressure, normal or prehypertension", +common_name: "Normal blood pressure", +}, +{ +id: "s_2273", +type: "symptom", +name: "Blood pressure, not measured", +common_name: "Blood pressure not measured", +}, +{ +id: "s_2274", +type: "symptom", +name: "Short stature", +common_name: "Decreased growth", +}, +{ +id: "s_2275", +type: "symptom", +name: "Abdominal pain, localized", +common_name: "Localized abdominal pain", +}, +{ +id: "s_2276", +type: "symptom", +name: "Bleeding from anus, light", +common_name: "Light bleeding from anus", +}, +{ +id: "s_2277", +type: "symptom", +name: "Bleeding from anus, heavy", +common_name: "Heavy bleeding from anus", +}, +{ +id: "s_2278", +type: "symptom", +name: "Ataxia, acute", +common_name: "Recent coordination problems", +}, +{ +id: "s_2279", +type: "symptom", +name: "Ataxia, subacute", +common_name: "Coordination problems since several days, weeks, or months ago", +}, +{ +id: "s_2280", +type: "symptom", +name: "Ataxia, chronic", +common_name: "Coordination problems for more than 1 year", +}, +{ +id: "s_2281", +type: "symptom", +name: "Abdominal pain, unspecified location", +common_name: "Abdominal pain, unspecified location", +}, +{ +id: "s_2282", +type: "symptom", +name: "Pale skin, fingers", +common_name: "Pale fingers", +}, +{ +id: "s_2283", +type: "symptom", +name: "Bruxism", +common_name: "Teeth grinding", +}, +{ +id: "s_2284", +type: "symptom", +name: "Back pain, nocturnal", +common_name: "Nighttime back pain", +}, +{ +id: "s_2285", +type: "symptom", +name: "Skin mass, natal cleft", +common_name: "Lump or bump in groove between buttocks", +}, +{ +id: "s_2288", +type: "symptom", +name: "Abdominal pain, unknown character", +common_name: "Abdominal pain of unspecific character", +}, +{ +id: "s_2289", +type: "symptom", +name: "Excessive fear of separation", +common_name: "Excessive fear of separation", +}, +{ +id: "s_2290", +type: "symptom", +name: "Speech and language impairment, rapid onset", +common_name: "Rapid onset of speech and language impairment", +}, +{ +id: "s_2291", +type: "symptom", +name: "Subungual splinter hemorrhages", +common_name: "Small red spots or lines under the nail", +}, +{ +id: "s_2292", +type: "symptom", +name: "Enlarged axillary lymph nodes", +common_name: "Enlarged lymph nodes in the armpit", +}, +{ +id: "s_2294", +type: "symptom", +name: "Absence seizures, reflex", +common_name: "Reflex absence seizures", +}, +{ +id: "s_2296", +type: "symptom", +name: "Choking", +common_name: "Choking", +}, +{ +id: "s_2298", +type: "symptom", +name: "Joint pain, mechanical", +common_name: "Joint pain worsened by movement and improved with rest", +}, +{ +id: "s_2299", +type: "symptom", +name: "Joint pain, inflammatory", +common_name: "Joint pain worsened by immobility", +}, +{ +id: "s_2300", +type: "symptom", +name: "Swallowed foreign body", +common_name: "Swallowed object", +}, +{ +id: "s_2302", +type: "symptom", +name: "Loss of consciousness, transient", +common_name: "Fainting", +}, +{ +id: "s_2303", +type: "symptom", +name: "Loss of consciousness, more than 1 minute", +common_name: "Loss of consciousness, more than 1 minute", +}, +{ +id: "s_2304", +type: "symptom", +name: "Paresthesia, upper limbs", +common_name: "Tingling and numbness of upper limbs", +}, +{ +id: "s_2306", +type: "symptom", +name: "Paresthesia, lower limbs", +common_name: "Tingling and numbness of lower limbs", +}, +{ +id: "s_2307", +type: "symptom", +name: "Nasal congestion, acute", +common_name: "Stuffy nose lasting less than 10 days", +}, +{ +id: "s_2308", +type: "symptom", +name: "Nasal congestion, subacute", +common_name: "Stuffy nose lasting between 10 days and 3 months", +}, +{ +id: "s_2309", +type: "symptom", +name: "Lump in popliteal region", +common_name: "Lump behind knee", +}, +{ +id: "s_2311", +type: "symptom", +name: "Abdominal pain, not associated with menstrual cycle", +common_name: "Stable abdominal pain unrelated to menstrual cycle", +}, +{ +id: "s_2314", +type: "symptom", +name: "Back pain, lumbar, unknown radiating direction", +common_name: "Lower back pain unknown spreading direction", +}, +{ +id: "s_2315", +type: "symptom", +name: "Paresthesia, one foot", +common_name: "Foot tingling or numbness", +}, +{ +id: "s_2316", +type: "symptom", +name: "Diarrhea, unknown character", +common_name: "Diarrhea, unknown character", +}, +{ +id: "s_2319", +type: "symptom", +name: "Fever, lasting less than 3 days", +common_name: "Fever lasting less than 3 days", +}, +{ +id: "s_2320", +type: "symptom", +name: "Fever, lasting 3 to 7 days", +common_name: "Fever lasting 3 to 7 days", +}, +{ +id: "s_2322", +type: "symptom", +name: "Diarrhea, lasting more than 4 weeks", +common_name: "Diarrhea lasting more than 4 weeks", +}, +{ +id: "s_2328", +type: "symptom", +name: "Diarrhea, lasting 2 to 4 weeks", +common_name: "Diarrhea lasting 2 to 4 weeks", +}, +{ +id: "s_2329", +type: "symptom", +name: "Eye discharge, thick and clear", +common_name: "Non-purulent eye discharge", +}, +{ +id: "s_2330", +type: "symptom", +name: "Muscle weakness, general", +common_name: "General muscle weakness", +}, +{ +id: "s_2335", +type: "symptom", +name: "Pain in lower limb, shin", +common_name: "Shin pain", +}, +{ +id: "s_2336", +type: "symptom", +name: "Galactorrhea in men", +common_name: "Milky discharge from the nipple", +}, +{ +id: "s_2338", +type: "symptom", +name: "Vaginal discharge, grey", +common_name: "Grey vaginal discharge", +}, +{ +id: "s_2341", +type: "symptom", +name: "Bruise", +common_name: "Bruise", +}, +{ +id: "s_2344", +type: "symptom", +name: "Writing difficulties", +common_name: "Writing difficulties", +}, +{ +id: "s_2351", +type: "symptom", +name: "Reading difficulties", +common_name: "Reading difficulties", +}, +{ +id: "s_2352", +type: "symptom", +name: "Mathematics difficulties", +common_name: "Mathematics difficulties", +}, +{ +id: "s_2354", +type: "symptom", +name: "Oral lesions, located in posterior pharynx", +common_name: "Oral lesions located in posterior pharynx", +}, +{ +id: "s_2356", +type: "symptom", +name: "Single red area, larger than 1 cm", +common_name: "Single red area larger than 1 cm", +}, +{ +id: "s_2357", +type: "symptom", +name: "Multiple red areas, larger than 1 cm", +common_name: "Multiple red areas larger than 1 cm", +}, +{ +id: "s_2358", +type: "symptom", +name: "Single red spot, smaller than 1 cm", +common_name: "Single red spot smaller than 1 cm", +}, +{ +id: "s_2359", +type: "symptom", +name: "Multiple red spots, smaller than 1 cm", +common_name: "Multiple red spots smaller than 1 cm", +}, +{ +id: "s_2360", +type: "symptom", +name: "Scalp hematoma", +common_name: "Bruise on scalp", +}, +{ +id: "s_2361", +type: "symptom", +name: "Bone pain, nocturnal", +common_name: "Nighttime bone pain", +}, +{ +id: "s_2362", +type: "symptom", +name: "Battles sign", +common_name: "Bruise behind ear", +}, +{ +id: "s_2363", +type: "symptom", +name: "Rhinorrhea, after trauma", +common_name: "Nasal discharge after trauma", +}, +{ +id: "s_2364", +type: "symptom", +name: "Otorrhea, after trauma", +common_name: "Ear discharge after trauma", +}, +{ +id: "s_2365", +type: "symptom", +name: "Delayed closure of the anterior fontanelle", +common_name: "Delayed closure of the soft spot", +}, +{ +id: "s_2366", +type: "symptom", +name: "Frontal bossing", +common_name: "Protruding forehead", +}, +{ +id: "s_2367", +type: "symptom", +name: "Craniotabes", +common_name: "Soft skull bones", +}, +{ +id: "s_2369", +type: "symptom", +name: "Abnormal wound drainage", +common_name: "Abnormal wound drainage", +}, +{ +id: "s_2370", +type: "symptom", +name: "Multiple red changes, different sizes", +common_name: "Multiple red changes of different sizes", +}, +{ +id: "s_2371", +type: "symptom", +name: "Erythema, unspecified", +common_name: "Unspecified redness of the skin", +}, +{ +id: "s_2373", +type: "symptom", +name: "Decreased head circumference", +common_name: "Abnormally small head", +}, +{ +id: "s_2374", +type: "symptom", +name: "Schematic play", +common_name: "Schematic play", +}, +{ +id: "s_2375", +type: "symptom", +name: "Blood oxygen saturation, not measured", +common_name: "Blood oxygen level not measured", +}, +{ +id: "s_2376", +type: "symptom", +name: "Blood oxygen saturation, normal", +common_name: "Normal blood oxygen level", +}, +{ +id: "s_2377", +type: "symptom", +name: "Skin wound", +common_name: "Skin wound", +}, +{ +id: "s_2378", +type: "symptom", +name: "Skin wound, trauma-related", +common_name: "Skin wound after injury", +}, +{ +id: "s_2379", +type: "symptom", +name: "Skin wound, non-traumatic", +common_name: "Wound unrelated to an injury", +}, +{ +id: "s_2381", +type: "symptom", +name: "Enamel lesions", +common_name: "Tooth lesion", +}, +{ +id: "s_2382", +type: "symptom", +name: "Dermatological changes, localised", +common_name: "Skin changes on specific part of body", +}, +{ +id: "s_2383", +type: "symptom", +name: "Enamel hypomineralization", +common_name: "Enamel hypomineralization", +}, +{ +id: "s_2384", +type: "symptom", +name: "Enamel lesions, symmetrical", +common_name: "Symmetrical tooth lesions", +}, +{ +id: "s_2387", +type: "symptom", +name: "Blood oxygen saturation, between 90% and 94%", +common_name: "Blood oxygen level between 90% and 94%", +}, +{ +id: "s_2388", +type: "symptom", +name: "Blood oxygen saturation, between 80% and 89%", +common_name: "Blood oxygen level between 80 and 89%", +}, +{ +id: "s_2389", +type: "symptom", +name: "Blood oxygen saturation, lower than 80%", +common_name: "Blood oxygen level lower than 80%", +}, +{ +id: "s_2390", +type: "symptom", +name: "Blood oxygen saturation, sudden worsening", +common_name: "Sudden worsening of blood oxygen saturation", +}, +{ +id: "s_2391", +type: "symptom", +name: "Enamel lesions, spots", +common_name: "Spots on tooth", +}, +{ +id: "s_2393", +type: "symptom", +name: "Change in colour of a tooth, white", +common_name: "Change in colour of a tooth, white", +}, +{ +id: "s_2396", +type: "symptom", +name: "Change in colour of a tooth, brown", +common_name: "Change in colour of a tooth, brown", +}, +{ +id: "s_2398", +type: "symptom", +name: "Skin wound, after surgery", +common_name: "Surgical wound", +}, +{ +id: "s_2399", +type: "symptom", +name: "Skin wound, self-inflicted", +common_name: "Self-inflicted wound", +}, +{ +id: "s_2402", +type: "symptom", +name: "Pain in front of ear", +common_name: "Pain in front of ear", +}, +{ +id: "s_2403", +type: "symptom", +name: "Mandibular deviation when opening mouth", +common_name: "Jaw shifts to the side when opening mouth", +}, +{ +id: "s_2405", +type: "symptom", +name: "Tremors, disappears when holding limb or during suckling", +common_name: "Trembling disappears when holding limb or during suckling", +}, +{ +id: "s_2407", +type: "symptom", +name: "Suspicion of intoxication or poisoning", +common_name: "Possible intoxication or poisoning", +}, +{ +id: "s_2408", +type: "symptom", +name: "Blood pressure, between 140 and 179 mmHg", +common_name: "Blood pressure between 140 mmHg and 179 mmHg", +}, +{ +id: "s_2409", +type: "symptom", +name: "Catastrophising", +common_name: "Pessimism", +}, +{ +id: "s_2410", +type: "symptom", +name: "Tenderness in the scrotum", +common_name: "Pain when pressing scrotum", +}, +{ +id: "s_2412", +type: "symptom", +name: "Dermatological changes, tongue", +common_name: "Dermatological changes on the tongue", +}, +{ +id: "s_2413", +type: "symptom", +name: "Oral lesions, well demarcated borders", +common_name: "Oral lesions with clearly defined borders", +}, +{ +id: "s_2414", +type: "symptom", +name: "Oral lesions, multiple", +common_name: "Multiple lesions in the mouth", +}, +{ +id: "s_2416", +type: "symptom", +name: "Oral lesions, red", +common_name: "Red lesions in the mouth", +}, +{ +id: "s_2417", +type: "symptom", +name: "Oral lesions, larger than 1 cm", +common_name: "Lesion in the mouth larger than 1 cm", +}, +{ +id: "s_2421", +type: "symptom", +name: "Mouth pain, after eating spicy or acidic food", +common_name: "Pain in mouth after eating spicy or acidic food", +}, +{ +id: "s_2422", +type: "symptom", +name: "Oral lesions, changes in the location, size, or shape", +common_name: "Change in location, size, or shape of lesions in the mouth", +}, +{ +id: "s_2424", +type: "symptom", +name: "Oral lesions, recurrent", +common_name: "Recurrent lesions in the mouth", +}, +{ +id: "s_2428", +type: "symptom", +name: "Toothache, moderate", +common_name: "Moderate toothache", +}, +{ +id: "s_2429", +type: "symptom", +name: "Toothache, mild", +common_name: "Mild toothache", +}, +{ +id: "s_2430", +type: "symptom", +name: "Toothache, provoked", +common_name: "Provoked toothache", +}, +{ +id: "s_2431", +type: "symptom", +name: "Toothache, spontaneous", +common_name: "Spontaneous toothache", +}, +{ +id: "s_2432", +type: "symptom", +name: "Toothache, associated with cold", +common_name: "Toothache associated with cold", +}, +{ +id: "s_2433", +type: "symptom", +name: "Toothache, transient", +common_name: "Transient toothache", +}, +{ +id: "s_2438", +type: "symptom", +name: "Toothache, dull", +common_name: "Dull toothache", +}, +{ +id: "s_2440", +type: "symptom", +name: "Toothache, sharp", +common_name: "Sharp toothache", +}, +{ +id: "s_2441", +type: "symptom", +name: "Toothache, multiple teeth", +common_name: "Pain in multiple teeth", +}, +{ +id: "s_2442", +type: "symptom", +name: "Toothache, one tooth", +common_name: "Pain in one tooth", +}, +{ +id: "s_2443", +type: "symptom", +name: "Toothache, pulsating", +common_name: "Pulsating toothache", +}, +{ +id: "s_2446", +type: "symptom", +name: "Toothache, radiating", +common_name: "Spreading toothache", +}, +{ +id: "s_2449", +type: "symptom", +name: "Toothache, persistent", +common_name: "Constant toothache", +}, +{ +id: "s_2450", +type: "symptom", +name: "Toothache, lasting 48 hours or more", +common_name: "Toothache lasting 48 hours or more", +}, +{ +id: "s_2451", +type: "symptom", +name: "Toothache, associated with lying down", +common_name: "Toothache when lying down", +}, +{ +id: "s_2452", +type: "symptom", +name: "Toothache, associated with sweet or acidic foods or drinks", +common_name: "Toothache associated with sweet or acidic foods or drinks", +}, +{ +id: "s_2453", +type: "symptom", +name: "Loose dental filling", +common_name: "Loose dental filling", +}, +{ +id: "s_2454", +type: "symptom", +name: "Insertion of foreign body, dangerous object", +common_name: "Insertion of a dangerous object", +}, +{ +id: "s_2455", +type: "symptom", +name: "Myalgia, following intense physical exertion", +common_name: "Muscle pain after intense physical activity", +}, +{ +id: "s_2456", +type: "symptom", +name: "Toothache, lasting less than 48 hours", +common_name: "Toothache lasting less than 48 hours", +}, +{ +id: "s_2461", +type: "symptom", +name: "Pharyngeal swelling", +common_name: "Throat swelling", +}, +{ +id: "s_2462", +type: "symptom", +name: "No history of inflammatory bowel disease", +common_name: "No history of inflammatory bowel disease", +}, +{ +id: "s_2463", +type: "symptom", +name: "Abdominal tenderness, epigastric region", +common_name: "Pain when pressing upper-middle part of the abdomen", +}, +{ +id: "s_2464", +type: "symptom", +name: "Impaired vision, bilateral", +common_name: "Visual impairment in both eyes", +}, +{ +id: "s_2465", +type: "symptom", +name: "Enlarged side of neck", +common_name: "Swollen side of neck", +}, +{ +id: "s_2467", +type: "symptom", +name: "Enlarged whole neck", +common_name: "Swollen whole neck", +}, +{ +id: "s_2468", +type: "symptom", +name: "Loss of consciousness, during prolonged standing", +common_name: "Fainting during prolonged standing", +}, +{ +id: "s_2469", +type: "symptom", +name: "Ceasing or limiting opioid intake", +common_name: "Limiting or stopping opioid use", +}, +{ +id: "s_2470", +type: "symptom", +name: "Fear of ageing", +common_name: "Fear of growing older or ageing", +}, +{ +id: "s_2471", +type: "symptom", +name: "Loss of consciousness, in a sitting or lying position", +common_name: "Fainting while sitting or lying down", +}, +{ +id: "s_2472", +type: "symptom", +name: "Loss of consciousness, during exercise", +common_name: "Fainting during exercise", +}, +{ +id: "s_2473", +type: "symptom", +name: "Drive for muscularity", +common_name: "Desire to be highly muscular", +}, +{ +id: "s_2474", +type: "symptom", +name: "Loss of consciousness, in a warm place", +common_name: "Fainting in a warm place", +}, +{ +id: "s_2475", +type: "symptom", +name: "Loss of consciousness, under stress", +common_name: "Fainting during stress", +}, +{ +id: "s_2477", +type: "symptom", +name: "Erythema, limbs, symmetrical", +common_name: "Symmetrical redness of the limbs", +}, +{ +id: "s_2481", +type: "symptom", +name: "Erythema, neck", +common_name: "Redness of the neck", +}, +{ +id: "s_2484", +type: "symptom", +name: "Erythema, chest", +common_name: "Redness of the chest", +}, +{ +id: "s_2485", +type: "symptom", +name: "Toothache, associated with touch", +common_name: "Toothache associated with touch", +}, +{ +id: "s_2487", +type: "symptom", +name: "Blood glucose level, less than 54 mg/dl or 3 mmol/l", +common_name: "Very low blood sugar level, less than 54 mg/dl or 3 mmol/l", +}, +{ +id: "s_2489", +type: "symptom", +name: "Impaired memory, developed within 24 hours", +common_name: "Memory problems developing in the last 24 hours", +}, +{ +id: "s_2490", +type: "symptom", +name: "Impaired memory, developed more than 24 hours ago", +common_name: "Memory problems developing over a few days or months", +}, +{ +id: "s_2491", +type: "symptom", +name: "Toothache, difficulty determining how many teeth hurt", +common_name: "Difficulty identifying how many teeth hurt", +}, +{ +id: "s_2494", +type: "symptom", +name: "Muscle cramps, nocturnal", +common_name: "Nocturnal muscle cramps", +}, +{ +id: "s_2495", +type: "symptom", +name: "Crenated tongue", +common_name: "Scalloped tongue", +}, +{ +id: "s_2496", +type: "symptom", +name: "Excessive loss of dental hard tissue", +common_name: "Excessive tooth wear", +}, +{ +id: "s_2498", +type: "symptom", +name: "Jaw pain, worse in the morning", +common_name: "Morning jaw pain", +}, +{ +id: "s_2499", +type: "symptom", +name: "Facial pain, bilateral", +common_name: "Face pain on both sides", +}, +{ +id: "s_2501", +type: "symptom", +name: "Jaw pain, associated with touch", +common_name: "Jaw pain associated with touch", +}, +{ +id: "s_2506", +type: "symptom", +name: "Muscle cramps, hypnagogic", +common_name: "Muscle cramps at sleep onset", +}, +{ +id: "s_2507", +type: "symptom", +name: "Hypnagogic hallucinations", +common_name: "Sleep onset hallucinations", +}, +{ +id: "s_2508", +type: "symptom", +name: "Blepharoptosis, acute", +common_name: "Dropping eyelids for less than 1 week", +}, +{ +id: "s_2510", +type: "symptom", +name: "Interdental papilla loss", +common_name: "Black triangles between teeth", +}, +{ +id: "s_2511", +type: "symptom", +name: "Blepharoptosis, chronic", +common_name: "Dropping eyelids for 7 days or more", +}, +{ +id: "s_2512", +type: "symptom", +name: "Nausea, triggered by movement", +common_name: "Nausea while moving", +}, +{ +id: "s_2514", +type: "symptom", +name: "Tooth migration", +common_name: "Teeth changing position", +}, +{ +id: "s_2516", +type: "symptom", +name: "Headache, waking up from sleep", +common_name: "Waking up because of headache", +}, +{ +id: "s_2517", +type: "symptom", +name: "Exaggerated mouthing behaviour", +common_name: "Mouthing hands or items", +}, +{ +id: "s_2518", +type: "symptom", +name: "Transitional stools of newborn", +common_name: "Frequent loose or seedy stools of the infant", +}, +{ +id: "s_2519", +type: "symptom", +name: "Yellow- or green-coloured stool", +common_name: "Yellow or green stool", +}, +{ +id: "s_2520", +type: "symptom", +name: "Hair loss, androgenetic", +common_name: "Hair loss on the temples or at the top of the head", +}, +{ +id: "s_2521", +type: "symptom", +name: "Brown-coloured stool", +common_name: "Brown stool", +}, +{ +id: "s_2523", +type: "symptom", +name: "Black-coloured stool, related to diet or medicine intake", +common_name: "Black stool related to diet or medicine intake", +}, +{ +id: "s_2524", +type: "symptom", +name: "Red eye, bilateral", +common_name: "Bloodshot eyes", +}, +{ +id: "s_2532", +type: "symptom", +name: "Oral lesions, single", +common_name: "Single oral lesion", +}, +{ +id: "s_2533", +type: "symptom", +name: "Oral lesions, smaller than 1 cm", +common_name: "Oral lesion smaller than 1 cm", +}, +{ +id: "s_2535", +type: "symptom", +name: "Oral lesions, painful", +common_name: "Painful lesions in the mouth", +}, +{ +id: "s_2537", +type: "symptom", +name: "Oral lesions, lasting less than 3 weeks", +common_name: "Oral lesions present for less than 3 weeks", +}, +{ +id: "s_2538", +type: "symptom", +name: "Oral lesions, lasting 3 or more weeks", +common_name: "Oral lesions present for 3 weeks or more", +}, +{ +id: "s_2541", +type: "symptom", +name: "Nocturnal emission", +common_name: "Ejaculation during sleep", +}, +{ +id: "s_2543", +type: "symptom", +name: "Facial pain, unprovoked", +common_name: "Spontaneous face pain", +}, +{ +id: "s_2544", +type: "symptom", +name: "Facial pain, constant", +common_name: "Constant face pain", +}, +{ +id: "s_2545", +type: "symptom", +name: "Toothache, sensitivity to percussion", +common_name: "Pain associated with tapping a tooth", +}, +{ +id: "s_2546", +type: "symptom", +name: "Heterochromic irides", +common_name: "Different eye colours", +}, +{ +id: "s_2547", +type: "symptom", +name: "Lack of testicle in the scrotum", +common_name: "Lack of testicle in the scrotum", +}, +{ +id: "s_2548", +type: "symptom", +name: "Testicular retraction", +common_name: "Testicular retraction", +}, +{ +id: "s_2551", +type: "symptom", +name: "Erythema, upper extremities excluding hands", +common_name: "Red skin on the shoulder, arm, forearm, elbow, or wrist", +}, +{ +id: "s_2552", +type: "symptom", +name: "Erythema, lower extremities excluding feet", +common_name: "Red skin on the hip, thigh, knee, calf, or ankle", +}, +{ +id: "s_2553", +type: "symptom", +name: "Oral lesions, trauma-related", +common_name: "Mouth lesion associated with trauma", +}, +{ +id: "s_2557", +type: "symptom", +name: "Dermatological changes, ears", +common_name: "Skin changes on ears", +}, +{ +id: "s_2558", +type: "symptom", +name: "Abdominal pain, unknown onset", +common_name: "Unknown onset of abdominal pain", +}, +{ +id: "s_2559", +type: "symptom", +name: "Erythema, feet", +common_name: "Red skin on foot", +}, +{ +id: "s_2563", +type: "symptom", +name: "Jaundice, recurrent", +common_name: "Recurrent jaundice", +}, +{ +id: "s_2565", +type: "symptom", +name: "Toothache, due to trauma", +common_name: "Toothache caused by trauma", +}, +{ +id: "s_2566", +type: "symptom", +name: "Headache, localised", +common_name: "Headache in a specific area of the head", +}, +{ +id: "s_2567", +type: "symptom", +name: "Headache, unspecified location", +common_name: "Headache location unknown", +}, +{ +id: "s_2568", +type: "symptom", +name: "Headache, parietal", +common_name: "Headache located on top of the head", +}, +{ +id: "s_2569", +type: "symptom", +name: "Jaundice, cutaneous", +common_name: "Yellowing of the skin", +}, +{ +id: "s_2571", +type: "symptom", +name: "Dysphagia, severe", +common_name: "Severe swallowing difficulties", +}, +{ +id: "s_2572", +type: "symptom", +name: "Eye injury", +common_name: "Eye injury", +}, +{ +id: "s_2574", +type: "symptom", +name: "History of hypoglycemic episodes", +common_name: "History of hypoglycemic episodes", +}, +{ +id: "s_2575", +type: "symptom", +name: "Ability to manage hypoglycemia", +common_name: "Ability to manage hypoglycemia", +}, +{ +id: "s_2577", +type: "symptom", +name: "Red eye, unilateral", +common_name: "Bloodshot eye", +}, +{ +id: "s_2579", +type: "symptom", +name: "Enlarged vein of lower limb", +common_name: "Enlarged vein of lower limb", +}, +{ +id: "s_2580", +type: "symptom", +name: "Enlarged vein in the abdomen", +common_name: "Enlarged vein in the abdomen", +}, +{ +id: "s_2581", +type: "symptom", +name: "Lump in scrotum, enlarged vein", +common_name: "Enlarged vein of scrotum", +}, +{ +id: "s_2582", +type: "symptom", +name: "Groin pain", +common_name: "Pain in groin", +}, +{ +id: "s_2584", +type: "symptom", +name: "Snake bite wound", +common_name: "Snake bite wound", +}, +{ +id: "s_2586", +type: "symptom", +name: "Anuria", +common_name: "Lack of urine", +}, +{ +id: "s_2588", +type: "symptom", +name: "Spider bite, unknown type", +common_name: "Unknown venomosity of spider bite", +}, +{ +id: "s_2590", +type: "symptom", +name: "Normal urine colour", +common_name: "Normal urine colour", +}, +{ +id: "s_2591", +type: "symptom", +name: "Joint pain, both knees", +common_name: "Both knees pain", +}, +{ +id: "s_2592", +type: "symptom", +name: "Joint pain, both knees, during movement", +common_name: "Pain when moving both knees", +}, +{ +id: "s_2593", +type: "symptom", +name: "Spider bite, possibly venomous", +common_name: "Possibly venomous spider bite", +}, +{ +id: "s_2594", +type: "symptom", +name: "Spider bite, nonvenomous", +common_name: "Nonvenomous spider bite", +}, +{ +id: "s_2598", +type: "symptom", +name: "Oral blisters", +common_name: "Blisters in the mouth", +}, +{ +id: "s_2599", +type: "symptom", +name: "Skin wound, controllable bleeding", +common_name: "Controllable bleeding wound", +}, +{ +id: "s_2600", +type: "symptom", +name: "Enlarged vein of chest", +common_name: "Enlarged veins on chest", +}, +{ +id: "s_2604", +type: "symptom", +name: "Unknown urine colour", +common_name: "Unknown urine colour", +}, +{ +id: "s_2605", +type: "symptom", +name: "Dermatological changes, located on or around lips", +common_name: "Skin changes on or around the lips", +}, +{ +id: "s_2606", +type: "symptom", +name: "Tenderness of spine", +common_name: "Pain when pressing the spine", +}, +{ +id: "s_2608", +type: "symptom", +name: "Tremors, both legs", +common_name: "Trembling of both legs", +}, +{ +id: "s_2609", +type: "symptom", +name: "Positive tongue blade bite test", +common_name: "Spatula test confirming mandibular fracture", +}, +{ +id: "s_2610", +type: "symptom", +name: "Joint pain, either knee", +common_name: "Joint pain in either knee", +}, +{ +id: "s_2611", +type: "symptom", +name: "Tremors, one leg", +common_name: "Trembling of one leg", +}, +{ +id: "s_2612", +type: "symptom", +name: "Avoiding going home", +common_name: "Avoiding going home", +}, +{ +id: "s_2614", +type: "symptom", +name: "Sublingual hematoma", +common_name: "Hematoma under the tongue", +}, +{ +id: "s_2615", +type: "symptom", +name: "Fear of a particular person", +common_name: "Fear of a particular person or group", +}, +{ +id: "s_2619", +type: "symptom", +name: "Skin pain, associated with swimming in the sea or ocean", +common_name: "Skin pain while swimming in the sea or ocean", +}, +{ +id: "s_2622", +type: "symptom", +name: "Decreased fluid intake", +common_name: "Poor fluid intake", +}, +{ +id: "s_2624", +type: "symptom", +name: "Pain in upper limb, lasting less than 24 hours", +common_name: "Pain in upper limb lasting less than 24 hours", +}, +{ +id: "s_2625", +type: "symptom", +name: "Pain in upper limb, lasting more than 3 months", +common_name: "Pain in upper limb lasting more than 3 months", +}, +{ +id: "s_2626", +type: "symptom", +name: "Constipation, lasting a month or more", +common_name: "Constipation for a month or more", +}, +{ +id: "s_2627", +type: "symptom", +name: "Edema, periorbital, one eye", +common_name: "Swelling around only one eye", +}, +{ +id: "s_2630", +type: "symptom", +name: "Erythema, around one eye", +common_name: "Redness around only one eye", +}, +{ +id: "s_2633", +type: "symptom", +name: "Erythema, around either eye", +common_name: "Redness around either eye", +}, +{ +id: "s_2634", +type: "symptom", +name: "Loss of joint motion", +common_name: "Blocked joint", +}, +{ +id: "s_2635", +type: "symptom", +name: "Acute weight loss", +common_name: "Acute weight loss", +}, +{ +id: "s_2636", +type: "symptom", +name: "Pain in upper limb, lasting 1 to 7 days", +common_name: "Pain in upper limb lasting 1 to 7 days", +}, +{ +id: "s_2637", +type: "symptom", +name: "Pain in upper limb, lasting between 1 week and 3 months", +common_name: "Pain in upper limb lasting between 1 week and 3 months", +}, +{ +id: "s_2638", +type: "symptom", +name: "Muscle cramps, lower limb", +common_name: "Leg cramps", +}, +{ +id: "s_2639", +type: "symptom", +name: "Edema, periorbital, eyes", +common_name: "Swelling around eyes", +}, +{ +id: "s_2641", +type: "symptom", +name: "Well appearance", +common_name: "Well appearance", +}, +{ +id: "s_2643", +type: "symptom", +name: "Sexual activity", +common_name: "Person who had sex", +}, +{ +id: "s_2645", +type: "symptom", +name: "Fatigue, worsening exercise tolerance", +common_name: "Worsening exercise tolerance", +}, +{ +id: "s_2646", +type: "symptom", +name: "Tremors, either hand", +common_name: "Trembling of either hand", +}, +{ +id: "s_2647", +type: "symptom", +name: "Tremors, either leg", +common_name: "Trembling of either leg", +}, +{ +id: "s_2648", +type: "symptom", +name: "Allodynia", +common_name: "Pain sensation disorder", +}, +{ +id: "s_2650", +type: "symptom", +name: "Frequent physical hetero-aggressivity", +common_name: "Frequent physical aggression towards others", +}, +{ +id: "s_2651", +type: "symptom", +name: "Hemoptysis, massive", +common_name: "Coughing up huge amount of blood", +}, +{ +id: "s_2652", +type: "symptom", +name: "Consent to a sexual interview", +common_name: "Agree to answer questions about sex", +}, +{ +id: "s_2658", +type: "symptom", +name: "Vomiting, food", +common_name: "Vomiting, food", +}, +{ +id: "s_2661", +type: "symptom", +name: "Skin mass, with central punctum", +common_name: "Lump on the skin with a central punctum", +}, +{ +id: "s_2663", +type: "symptom", +name: "Episodes of depressed mood, lasting less than 2 weeks", +common_name: "Depressed mood lasting less than 2 weeks", +}, +{ +id: "s_2664", +type: "symptom", +name: "Episodes of depressed mood, lasting more than 2 years", +common_name: "Depressed mood lasting more than 2 years", +}, +{ +id: "s_2665", +type: "symptom", +name: "Episode of depressed mood, peripartum onset", +common_name: "Depressed mood related to childbirth", +}, +{ +id: "s_2666", +type: "symptom", +name: "Episodes of depressed mood, lasting between 2 weeks and 1 year", +common_name: "Depressed mood lasting between 2 weeks and 1 year", +}, +{ +id: "s_2667", +type: "symptom", +name: "Episodes of depressed mood, lasting 1 to 2 years", +common_name: "Depressed mood lasting 1 to 2 years", +}, +{ +id: "s_2668", +type: "symptom", +name: "Skin mass, transilluminable", +common_name: "Transilluminable skin mass", +}, +{ +id: "s_2669", +type: "symptom", +name: "Episode of elevated mood, lasting 3 days or less", +common_name: "Elevated mood lasting 3 days or less", +}, +{ +id: "s_2670", +type: "symptom", +name: "Episode of elevated mood, lasting 4 to 6 days", +common_name: "Elevated mood lasting 4 to 6 days", +}, +{ +id: "s_2671", +type: "symptom", +name: "Episode of elevated mood, lasting 7 days or more", +common_name: "Elevated mood lasting 7 days or more", +}, +{ +id: "s_2672", +type: "symptom", +name: "Episode of elevated mood, substance induced", +common_name: "Elevated mood related to substance use", +}, +{ +id: "s_2673", +type: "symptom", +name: "Dermatological changes, head", +common_name: "Skin changes on the head", +}, +{ +id: "s_2674", +type: "symptom", +name: "Dermatological changes, preceded by fever or other symptoms of respiratory tract infection", +common_name: "Skin changes preceded by fever or other cold symptoms", +}, +{ +id: "s_2675", +type: "symptom", +name: "Mood swings, more than 2 years", +common_name: "Mood swings present for more than 2 years", +}, +{ +id: "s_2676", +type: "symptom", +name: "Mood swings, less than 1 year", +common_name: "Mood swings present for less than 1 year", +}, +{ +id: "s_2677", +type: "symptom", +name: "Episode of depressed mood, substance induced", +common_name: "Depressed mood related to substance use", +}, +{ +id: "s_2678", +type: "symptom", +name: "Toothache, unknown cause", +common_name: "Toothache of unknown reason", +}, +{ +id: "s_2680", +type: "symptom", +name: "Current mood, elevated", +common_name: "Currently elevated mood", +}, +{ +id: "s_2681", +type: "symptom", +name: "Current mood, depressed", +common_name: "Currently depressed mood", +}, +{ +id: "s_2682", +type: "symptom", +name: "Current mood, normal", +common_name: "Currently normal mood", +}, +{ +id: "s_2684", +type: "symptom", +name: "Skin mass, located on the wrist", +common_name: "Skin mass located on the wrist", +}, +{ +id: "s_2686", +type: "symptom", +name: "Mood swings, 1 to 2 years", +common_name: "Mood swings present for 1 to 2 years", +}, +{ +id: "s_2687", +type: "symptom", +name: "Mood swings, extreme rapid pattern", +common_name: "Rapid mood swings", +}, +{ +id: "s_2692", +type: "symptom", +name: "Circumferential burn", +common_name: "Circumferential burn", +}, +{ +id: "s_2696", +type: "symptom", +name: "Sensory loss in one limb, lasting less than 24 hours", +common_name: "Loss of feeling in one arm or leg lasting less than 24 hours", +}, +{ +id: "s_2702", +type: "symptom", +name: "Sensory loss in one limb, lasting between 24 hours and 4 weeks", +common_name: "Loss of feeling in one arm or leg lasting between 24 hours and 4 weeks", +}, +{ +id: "s_2703", +type: "symptom", +name: "Sensory loss in one limb, lasting more than 4 weeks", +common_name: "Loss of feeling in one arm or leg lasting more than 4 weeks", +}, +{ +id: "s_2705", +type: "symptom", +name: "Avoidance behavior related to trauma", +common_name: "Avoidance behavior related to traumatic event", +}, +{ +id: "s_2706", +type: "symptom", +name: "History of being at risk of a death", +common_name: "History of being at risk of a death", +}, +{ +id: "s_2707", +type: "symptom", +name: "History of experiencing or witnessing a natural disaster", +common_name: "Witnessed or experienced a natural disaster", +}, +{ +id: "s_2708", +type: "symptom", +name: "History of experiencing or witnessing a serious traffic accident", +common_name: "History of experiencing or witnessing a serious traffic accident", +}, +{ +id: "s_2709", +type: "symptom", +name: "History of traumatic situation", +common_name: "History of traumatic situation", +}, +{ +id: "s_2710", +type: "symptom", +name: "History of an unexpected death of a loved one", +common_name: "Unexpected death of a loved one", +}, +{ +id: "s_2711", +type: "symptom", +name: "Seizure, first episode", +common_name: "First seizure", +}, +{ +id: "s_2712", +type: "symptom", +name: "Seizure, unspecified number of episodes", +common_name: "Uncertainty about how many previous seizures", +}, +{ +id: "s_2713", +type: "symptom", +name: "Trauma or stressor related disturbances", +common_name: "Trauma or stressor related disturbances", +}, +{ +id: "s_2714", +type: "symptom", +name: "History of a stressful situation", +common_name: "History of stressful situation", +}, +{ +id: "s_2715", +type: "symptom", +name: "Recent physical hetero-aggressivity, health or life-threatening", +common_name: "Recent physical aggression towards others posing a threat to health or life", +}, +{ +id: "s_2717", +type: "symptom", +name: "Pus under the skin of the toe", +common_name: "Pus under the skin of the toe", +}, +{ +id: "s_2718", +type: "symptom", +name: "Edema, entire face", +common_name: "Swollen entire face", +}, +{ +id: "s_2727", +type: "symptom", +name: "Hypervigilance", +common_name: "State of feeling constantly on guard", +}, +{ +id: "s_2729", +type: "symptom", +name: "Cloudy urine", +common_name: "Milky urine", +}, +{ +id: "s_2730", +type: "symptom", +name: "Dermatological changes, buttocks", +common_name: "Skin changes on buttocks", +}, +{ +id: "s_2731", +type: "symptom", +name: "Bunion", +common_name: "Bunion", +}, +{ +id: "s_2733", +type: "symptom", +name: "Manic behaviour", +common_name: "Manic behaviour", +}, +{ +id: "s_2734", +type: "symptom", +name: "Manic behaviour, reckless spending", +common_name: "Excessive spending during mood disturbances", +}, +{ +id: "s_2735", +type: "symptom", +name: "Manic behaviour, frequent loans", +common_name: "Taking loans during mood disturbances", +}, +{ +id: "s_2737", +type: "symptom", +name: "Exaggerated startle response", +common_name: "Jumpiness", +}, +{ +id: "s_2738", +type: "symptom", +name: "Delusion, less than a month", +common_name: "Delusions lasting less than 1 month", +}, +{ +id: "s_2739", +type: "symptom", +name: "Delusion, 1 to 3 months", +common_name: "Delusions lasting 1 to 3 months", +}, +{ +id: "s_2740", +type: "symptom", +name: "Delusion, 4 months or more", +common_name: "Delusions lasting more than 4 months", +}, +{ +id: "s_2741", +type: "symptom", +name: "Hallucinations, less than a month", +common_name: "Hallucinations lasting less than 1 month", +}, +{ +id: "s_2742", +type: "symptom", +name: "Hallucinations, 1 to 3 months", +common_name: "Hallucinations lasting 1 to 3 months", +}, +{ +id: "s_2743", +type: "symptom", +name: "Hallucinations, 4 months or more", +common_name: "Hallucinations lasting 4 months or more", +}, +{ +id: "s_2744", +type: "symptom", +name: "Delusions, theft", +common_name: "Belief of being robbed despite proof of the contrary", +}, +{ +id: "s_2746", +type: "symptom", +name: "Diarrhea, bloody", +common_name: "Bloody diarrhea", +}, +{ +id: "s_2749", +type: "symptom", +name: "Inability to manage hypoglycemia", +common_name: "Inability to manage hypoglycemia", +}, +{ +id: "s_2752", +type: "symptom", +name: "Exhaustion related to studying or work", +common_name: "Exhaustion due to studying or work", +}, +{ +id: "s_2753", +type: "symptom", +name: "Psychological distancing from ones studying or job", +common_name: "Mental distancing from studying or work", +}, +{ +id: "s_2754", +type: "symptom", +name: "Speech and language impairment", +common_name: "Speaking difficulties", +}, +{ +id: "s_2755", +type: "symptom", +name: "Sense of ineffectiveness", +common_name: "Sense of unproductiveness", +}, +{ +id: "s_2758", +type: "symptom", +name: "Excessive motor activity", +common_name: "Excessive motor activity", +}, +{ +id: "s_2759", +type: "symptom", +name: "Excessive motor activity, 3 days or less", +common_name: "Excessive moving or fidgeting lasting 3 days or less", +}, +{ +id: "s_2760", +type: "symptom", +name: "Difficulty organizing objects", +common_name: "Losing or misplacing objects", +}, +{ +id: "s_2761", +type: "symptom", +name: "Excessive motor activity, 4 to 6 days", +common_name: "Excessive moving or fidgeting lasting 4 to 6 days", +}, +{ +id: "s_2762", +type: "symptom", +name: "Excessive motor activity, 7 days to 6 months", +common_name: "Excessive moving or fidgeting lasting between 7 days to 6 months", +}, +{ +id: "s_2763", +type: "symptom", +name: "Excessive motor activity, 6 months or more", +common_name: "Excessive moving or fidgeting lasting 6 months or more", +}, +{ +id: "s_2764", +type: "symptom", +name: "Restlessness", +common_name: "Restlessness", +}, +{ +id: "s_2766", +type: "symptom", +name: "Restlessness, 3 days or less", +common_name: "Restlessness lasting 3 days or less", +}, +{ +id: "s_2767", +type: "symptom", +name: "Restlessness, 4 to 6 days", +common_name: "Restlessness lasting 4 to 6 days", +}, +{ +id: "s_2768", +type: "symptom", +name: "Restlessness, between 7 days and 6 months", +common_name: "Restlessness lasting between 7 days and 6 months", +}, +{ +id: "s_2769", +type: "symptom", +name: "Restlessness, 6 months or more", +common_name: "Restlessness lasting 6 months or more", +}, +{ +id: "s_2771", +type: "symptom", +name: "Difficulty organizing objects, 3 days or less", +common_name: "Losing or misplacing objects lasting 3 days or less", +}, +{ +id: "s_2772", +type: "symptom", +name: "Difficulty organizing objects, 4 to 6 days", +common_name: "Losing or misplacing objects lasting 4 to 6 days", +}, +{ +id: "s_2773", +type: "symptom", +name: "Difficulty organizing objects, between 7 days and 6 months", +common_name: "Losing or misplacing objects lasting between 7 days and 6 months", +}, +{ +id: "s_2774", +type: "symptom", +name: "Difficulty organizing objects, 6 months or more", +common_name: "Losing or misplacing objects lasting 6 months or more", +}, +{ +id: "s_2775", +type: "symptom", +name: "Difficulty organizing tasks or activities", +common_name: "Trouble completing tasks", +}, +{ +id: "s_2778", +type: "symptom", +name: "Difficulty organizing tasks or activities, 3 days or less", +common_name: "Trouble completing tasks lasting 3 days or less", +}, +{ +id: "s_2779", +type: "symptom", +name: "Difficulty organizing tasks or activities, 4 to 6 days", +common_name: "Trouble completing tasks lasting 4 to 6 days", +}, +{ +id: "s_2780", +type: "symptom", +name: "Difficulty organizing tasks or activities, between 7 days and 6 months", +common_name: "Trouble completing tasks lasting between 7 days and 6 months", +}, +{ +id: "s_2781", +type: "symptom", +name: "Difficulty organizing tasks or activities, 6 months or more", +common_name: "Trouble completing tasks lasting more than 6 months", +}, +{ +id: "s_2783", +type: "symptom", +name: "Lack of attention to detail", +common_name: "Difficulty with paying attention to detail", +}, +{ +id: "s_2784", +type: "symptom", +name: "Difficulty waiting turns", +common_name: "Lack of patience", +}, +{ +id: "s_2785", +type: "symptom", +name: "Skin wound, animal bite", +common_name: "Animal bite wound", +}, +{ +id: "s_2786", +type: "symptom", +name: "Mood swings, longstanding pattern", +common_name: "Mood swings, longstanding pattern", +}, +{ +id: "s_2787", +type: "symptom", +name: "Toothache, unbearable", +common_name: "Unbearable toothache", +}, +{ +id: "s_2789", +type: "symptom", +name: "Excessive verbosity", +common_name: "Excessively talkative", +}, +{ +id: "s_2790", +type: "symptom", +name: "Edema, clavicle", +common_name: "Swollen collarbone", +}, +{ +id: "s_2791", +type: "symptom", +name: "Clavicle tenderness", +common_name: "Pain when pressing collarbone", +}, +{ +id: "s_2793", +type: "symptom", +name: "Rebellious behaviour", +common_name: "Rulebreaking", +}, +{ +id: "s_2794", +type: "symptom", +name: "Involuntary repetitive behaviours, motor", +common_name: "Involuntary repetitive motor behaviours", +}, +{ +id: "s_2795", +type: "symptom", +name: "Deceiving", +common_name: "Lying a lot", +}, +{ +id: "s_2796", +type: "symptom", +name: "Involuntary repetitive behaviours", +common_name: "Involuntary repetitive behaviours", +}, +{ +id: "s_2797", +type: "symptom", +name: "Involuntary repetitive behaviours, vocal", +common_name: "Involuntary repetitive vocal behaviours", +}, +{ +id: "s_2806", +type: "symptom", +name: "Breaking the law", +common_name: "Breaking the law", +}, +{ +id: "s_2812", +type: "symptom", +name: "Miscarriage", +common_name: "Pregnancy loss", +}, +{ +id: "s_2816", +type: "symptom", +name: "Weight faltering of newborns", +common_name: "Slow rate of weight gain in newborns", +}, +{ +id: "s_2818", +type: "symptom", +name: "Red-coloured stool, mild bleeding", +common_name: "Red stool with mild bleeding", +}, +{ +id: "s_2819", +type: "symptom", +name: "Red-coloured stool, heavy bleeding", +common_name: "Red stool with heavy bleeding", +}, +{ +id: "s_2820", +type: "symptom", +name: "Back pain, acute", +common_name: "Acute back pain", +}, +{ +id: "s_2821", +type: "symptom", +name: "Back pain, subacute", +common_name: "Subacute back pain", +}, +{ +id: "s_2822", +type: "symptom", +name: "Back pain, chronic", +common_name: "Chronic back pain", +}, +{ +id: "s_2825", +type: "symptom", +name: "Electric shock", +common_name: "Electric shock", +}, +{ +id: "s_2826", +type: "symptom", +name: "Chest pain, resolves with rest", +common_name: "Chest pain going away with rest", +}, +{ +id: "s_2827", +type: "symptom", +name: "Bruise, scrotum", +common_name: "Bruise on scrotum", +}, +{ +id: "s_2828", +type: "symptom", +name: "Firm testicle", +common_name: "One testicle harder than the other", +}, +{ +id: "s_2830", +type: "symptom", +name: "Cough, not improving with time", +common_name: "Cough not improving over time", +}, +{ +id: "s_2831", +type: "symptom", +name: "Fear or avoidance of eating in someone else presence", +common_name: "Fear or avoidance of eating in someone else presence", +}, +{ +id: "s_2832", +type: "symptom", +name: "Fear of social interactions", +common_name: "Fear of social interactions", +}, +{ +id: "s_2833", +type: "symptom", +name: "Cough, whooping", +common_name: "Whooping cough", +}, +{ +id: "s_2834", +type: "symptom", +name: "Dyspnea, lasting more than 4 weeks, sudden worsening", +common_name: "Sudden worsening of shortness of breath lasting more than 4 weeks", +}, +{ +id: "s_2835", +type: "symptom", +name: "Dyspnea, lasting between 1 day and 4 weeks, sudden worsening", +common_name: "Sudden worsening of shortness of breath lasting between 1 day and 4 weeks", +}, +{ +id: "s_2836", +type: "symptom", +name: "Cough, improving with time", +common_name: "Cough improving over time", +}, +{ +id: "s_2837", +type: "symptom", +name: "Edema, one lower limb, acute", +common_name: "Swollen leg lasting less than 3 days", +}, +{ +id: "s_2838", +type: "symptom", +name: "Edema, one lower limb, chronic", +common_name: "Swollen leg lasting 3 days or more", +}, +{ +id: "s_2839", +type: "symptom", +name: "Edema, both lower limbs, acute", +common_name: "Swollen legs lasting less than 3 days", +}, +{ +id: "s_2840", +type: "symptom", +name: "Edema, both lower limbs, chronic", +common_name: "Swollen legs lasting 3 days or more", +}, +{ +id: "s_2843", +type: "symptom", +name: "Chest pain, during physical activity, vigorous", +common_name: "Chest pain during vigorous exercise", +}, +{ +id: "s_2845", +type: "symptom", +name: "Nasal catarrh, acute", +common_name: "Acute runny nose", +}, +{ +id: "s_2846", +type: "symptom", +name: "Nasal catarrh, chronic", +common_name: "Chronic runny nose", +}, +{ +id: "s_2847", +type: "symptom", +name: "Chest pain, during physical activity, light", +common_name: "Chest pain during light physical activity", +}, +{ +id: "s_2849", +type: "symptom", +name: "Edema, vulva", +common_name: "Vulval swelling", +}, +{ +id: "s_2850", +type: "symptom", +name: "Pain in lower limb, lasting less than 24 hours", +common_name: "Pain in lower limb lasting less than 24 hours", +}, +{ +id: "s_2851", +type: "symptom", +name: "Pain in lower limb, lasting between 1 and 7 days", +common_name: "Pain in lower limb lasting between 1 day and 7 days", +}, +{ +id: "s_2852", +type: "symptom", +name: "Pain in lower limb, lasting between 1 week and 3 months", +common_name: "Pain in lower limb lasting between 1 week and 3 months", +}, +{ +id: "s_2853", +type: "symptom", +name: "Pain in lower limb, lasting more than 3 months", +common_name: "Pain in lower limb lasting more than 3 months", +}, +{ +id: "s_2854", +type: "symptom", +name: "Fever, lasting more than 14 days", +common_name: "Fever lasting more than 14 days", +}, +{ +id: "s_2855", +type: "symptom", +name: "Fever, lasting 8 to 14 days", +common_name: "Fever lasting 8 to 14 days", +}, +{ +id: "s_2856", +type: "symptom", +name: "Blisters of skin", +common_name: "Blisters on the skin", +}, +{ +id: "s_2857", +type: "symptom", +name: "Blisters of skin, bulla", +common_name: "Blisters on the skin larger than 0.5 cm", +}, +{ +id: "s_2858", +type: "symptom", +name: "Blisters of skin, vesicle", +common_name: "Blisters on the skin smaller than 0.5 cm", +}, +{ +id: "s_2860", +type: "symptom", +name: "Fever, fully responsive to treatment", +common_name: "Fever fully responsive to treatment", +}, +{ +id: "s_2861", +type: "symptom", +name: "Menstrual period late", +common_name: "Late period", +}, +{ +id: "s_2862", +type: "symptom", +name: "Menstrual period late, 1 to 3 weeks", +common_name: "Period 1 to 3 weeks late", +}, +{ +id: "s_2863", +type: "symptom", +name: "Menstrual period late, between 3 weeks and 3 months", +common_name: "Period between 3 weeks and 3 months late", +}, +{ +id: "s_2864", +type: "symptom", +name: "Menstrual period late, 3 to 12 months", +common_name: "Period 3 to 12 months late", +}, +{ +id: "s_2865", +type: "symptom", +name: "Menstrual period late, more than 12 months", +common_name: "Period more than 12 months late", +}, +{ +id: "s_2866", +type: "symptom", +name: "Fever, partially responsive to treatment", +common_name: "Fever partially responsive to treatment", +}, +{ +id: "s_2867", +type: "symptom", +name: "Edema, either lower limb", +common_name: "Swelling of either lower limb", +}, +{ +id: "s_2871", +type: "symptom", +name: "Decreased fetal movement in the third trimester", +common_name: "Low fetal movement in the third trimester", +}, +{ +id: "s_2872", +type: "symptom", +name: "Menstrual period late, less than 1 week", +common_name: "Period less than 1 week late", +}, +{ +id: "s_2876", +type: "symptom", +name: "Fever, use of antipyretic drug", +common_name: "Use of antipyretic to reduce fever", +}, +{ +id: "s_2877", +type: "symptom", +name: "Tremors, triggered by touch, cold or loud sounds", +common_name: "Trembling triggered by touch, cold or loud sounds", +}, +{ +id: "s_2878", +type: "symptom", +name: "Sudden onset speech and language impairment", +common_name: "Sudden onset speech and language impairment", +}, +{ +id: "s_2879", +type: "symptom", +name: "Fever, continuous", +common_name: "Continuous fever", +}, +{ +id: "s_2880", +type: "symptom", +name: "Status epilepticus", +common_name: "Prolonged seizure for more than 5 minutes", +}, +{ +id: "s_2881", +type: "symptom", +name: "Foreign body insertion, head area", +common_name: "Insertion of foreign body in head area", +}, +{ +id: "s_2883", +type: "symptom", +name: "Foreign body insertion, stuck in vagina", +common_name: "Object stuck in vagina", +}, +{ +id: "s_2884", +type: "symptom", +name: "Foreign body insertion, stuck in anus", +common_name: "Object stuck in anus", +}, +{ +id: "s_2888", +type: "symptom", +name: "Fever, periodic, days or weeks", +common_name: "Periodic fever every few days or weeks", +}, +{ +id: "s_2889", +type: "symptom", +name: "Skin pallor, transient", +common_name: "Transient skin pallor", +}, +{ +id: "s_2890", +type: "symptom", +name: "Fever, relapsing after 24 hours", +common_name: "Fever relapsing after 24 hours", +}, +{ +id: "s_2891", +type: "symptom", +name: "Fever, intermittent", +common_name: "Fever dropping every day", +}, +{ +id: "s_2892", +type: "symptom", +name: "Fetal membranes rupture, between 22nd and 37th weeks of gestation", +common_name: "Water breaking between 22nd and 37th weeks of pregnancy", +}, +{ +id: "s_2893", +type: "symptom", +name: "Regular uterine contractions, before the 37th week of gestation", +common_name: "Regular uterine contractions before the 37th week of pregnancy", +}, +{ +id: "s_2894", +type: "symptom", +name: "Postpartum vaginal bleeding, increasing intensity", +common_name: "Increased postpartum vaginal bleeding", +}, +{ +id: "s_2895", +type: "symptom", +name: "Rigidity and intolerance to change", +common_name: "Rigidity and intolerance to change", +}, +{ +id: "s_2898", +type: "symptom", +name: "Tetanus-prone wound", +common_name: "Tetanus-prone wound", +}, +{ +id: "s_2904", +type: "symptom", +name: "Active suicide attempt", +common_name: "Active suicide attempt", +}, +{ +id: "s_2905", +type: "symptom", +name: "Fetal membranes rupture, before 22 weeks of gestation", +common_name: "Water breaking before 22nd week of pregnancy", +}, +{ +id: "s_2906", +type: "symptom", +name: "Fetal membranes rupture, after 37 weeks of gestation", +common_name: "Water breaking after 37th week of pregnancy", +}, +{ +id: "s_2907", +type: "symptom", +name: "Fever, absent now but present in the past 72 hours", +common_name: "Fever in the past 72 hours that is already finished", +}, +{ +id: "s_2908", +type: "symptom", +name: "Abnormal uterine bleeding, nonmenstrual", +common_name: "Vaginal bleeding other than period", +}, +{ +id: "s_2909", +type: "symptom", +name: "Abnormal uterine spotting, nonmenstrual", +common_name: "Vaginal spotting different than period", +}, +{ +id: "s_2913", +type: "symptom", +name: "No abnormal uterine bleeding or spotting, nonmenstrual", +common_name: "No abnormal uterine bleeding or spotting, nonmenstrual", +}, +{ +id: "s_2914", +type: "symptom", +name: "Physical injury, head", +common_name: "Head injury", +}, +{ +id: "s_2915", +type: "symptom", +name: "Physical injury, trunk", +common_name: "Trunk injury", +}, +{ +id: "s_2916", +type: "symptom", +name: "Physical injury, upper limb", +common_name: "Upper limb injury", +}, +{ +id: "s_2917", +type: "symptom", +name: "Physical injury, lower limb", +common_name: "Lower limb injury", +}, +{ +id: "s_2918", +type: "symptom", +name: "Radicular pain", +common_name: "Radiating pain from the spine", +}, +{ +id: "s_2919", +type: "symptom", +name: "Injury location question", +common_name: "Injury location question", +}, +{ +id: "s_2920", +type: "symptom", +name: "Symptoms related to recent injury", +common_name: "Symptoms related to recent injury", +}, +{ +id: "s_2924", +type: "symptom", +name: "Limping", +common_name: "Limping", +}, +{ +id: "s_2927", +type: "symptom", +name: "Oral lesions, located in the anterior part", +common_name: "Oral lesions located in anterior part", +}, +{ +id: "s_2928", +type: "symptom", +name: "Fall from a height", +common_name: "Fall from a height", +}, +{ +id: "s_2929", +type: "symptom", +name: "Injury in a motorcycle crash", +common_name: "Injury in a motorcycle crash", +}, +{ +id: "s_2930", +type: "symptom", +name: "Pedestrian or cyclist hit by a car", +common_name: "Pedestrian or cyclist hit by a car", +}, +{ +id: "s_2931", +type: "symptom", +name: "Injury in a serious car accident", +common_name: "Injury in a serious car accident", +}, +{ +id: "s_2932", +type: "symptom", +name: "No major force injury", +common_name: "No major force injury", +}, +{ +id: "s_2935", +type: "symptom", +name: "Visual impairment, after trauma", +common_name: "Vision problems after an injury", +}, +{ +id: "s_2936", +type: "symptom", +name: "New neurological deficit, after trauma", +common_name: "New neurological changes after an injury", +}, +{ +id: "s_2937", +type: "symptom", +name: "Sudden drop in blood pressure", +common_name: "Sudden drop in blood pressure", +}, +{ +id: "s_2938", +type: "symptom", +name: "Dermatological changes, perianal region", +common_name: "Skin changes near anus", +}, +{ +id: "s_2939", +type: "symptom", +name: "Neck pain, acute", +common_name: "Acute neck pain", +}, +{ +id: "s_2940", +type: "symptom", +name: "Neck pain, subacute", +common_name: "Subacute neck pain", +}, +{ +id: "s_2941", +type: "symptom", +name: "Neck pain, chronic", +common_name: "Chronic neck pain", +}, +{ +id: "s_2942", +type: "symptom", +name: "Resolved choking", +common_name: "Stopped choking", +}, +{ +id: "s_2945", +type: "symptom", +name: "History of a tick bite, in the past 3 weeks, Europe", +common_name: "History of a tick bite, in the past 3 weeks, Europe", +}, +{ +id: "s_2946", +type: "symptom", +name: "No history of a tick bite", +common_name: "No history of a tick bite", +}, +{ +id: "s_2947", +type: "symptom", +name: "History of a tick bite, in the past 3 weeks, North America", +common_name: "History of a tick bite, in the past 3 weeks, North America", +}, +{ +id: "s_2948", +type: "symptom", +name: "History of a tick bite, in the past 3 weeks, Northern Asia", +common_name: "History of a tick bite, in the past 3 weeks, Northern Asia", +}, +{ +id: "s_2949", +type: "symptom", +name: "History of a tick bite, in the past 3 weeks, Southeast Asia", +common_name: "History of a tick bite, in the past 3 weeks, Southeast Asia", +}, +{ +id: "s_2950", +type: "symptom", +name: "No abnormal uterine bleeding or spotting, pregnancy", +common_name: "No abnormal uterine bleeding or spotting, pregnancy", +}, +{ +id: "s_2953", +type: "symptom", +name: "Neck pain, sudden onset", +common_name: "Sudden neck pain", +}, +{ +id: "s_2954", +type: "symptom", +name: "Limited neck rotation", +common_name: "Limited neck rotation", +}, +{ +id: "s_2955", +type: "symptom", +name: "Burned skin", +common_name: "Burned skin", +}, +{ +id: "s_2956", +type: "symptom", +name: "Burned skin, thermal", +common_name: "Thermal skin burn", +}, +{ +id: "s_2957", +type: "symptom", +name: "Burned skin, chemical", +common_name: "Chemical skin burn", +}, +{ +id: "s_2958", +type: "symptom", +name: "Burned skin, electrical", +common_name: "Electrical skin burn", +}, +{ +id: "s_2959", +type: "symptom", +name: "Burned skin, another cause", +common_name: "Another cause of burn", +}, +{ +id: "s_2960", +type: "symptom", +name: "Severe pain during limb movements, after trauma", +common_name: "Inability to move limb after trauma due to pain", +}, +{ +id: "s_2961", +type: "symptom", +name: "History of falls from a standing height", +common_name: "Sudden spontaneous fall", +}, +{ +id: "s_2962", +type: "symptom", +name: "Burned skin, superficial", +common_name: "Superficial skin burn", +}, +{ +id: "s_2963", +type: "symptom", +name: "Burned skin, partial-thickness", +common_name: "Partial-thickness skin burn", +}, +{ +id: "s_2964", +type: "symptom", +name: "Burned skin, full-thickness", +common_name: "Full-thickness skin burn", +}, +{ +id: "s_2965", +type: "symptom", +name: "Burned skin, deep tissues", +common_name: "Deep tissues skin burn", +}, +{ +id: "s_2966", +type: "symptom", +name: "Burned skin, covering between 1 to 10% of body surface", +common_name: "Skin burn covering between 1 to 10% of body surface", +}, +{ +id: "s_2967", +type: "symptom", +name: "Limb paresis, after trauma", +common_name: "Limb paresis after trauma", +}, +{ +id: "s_2968", +type: "symptom", +name: "Reduced range of joint motion, after trauma", +common_name: "Reduced range of joint motion, after trauma", +}, +{ +id: "s_2969", +type: "symptom", +name: "Bearable pain during limb movements, after trauma", +common_name: "Bearable pain during limb movements after trauma", +}, +{ +id: "s_2970", +type: "symptom", +name: "No pain or restrictions during limb movements, after trauma", +common_name: "No pain or restrictions during limb movements, after trauma", +}, +{ +id: "s_2971", +type: "symptom", +name: "Burned skin, head or neck area", +common_name: "Skin burn of head or neck area", +}, +{ +id: "s_2972", +type: "symptom", +name: "Burned skin, hand", +common_name: "Skin burn of hand", +}, +{ +id: "s_2973", +type: "symptom", +name: "Burned skin, foot", +common_name: "Skin burn of foot", +}, +{ +id: "s_2974", +type: "symptom", +name: "Burned skin, genitalia or perineum", +common_name: "Burned skin of genital region", +}, +{ +id: "s_2975", +type: "symptom", +name: "Burned skin, major joint", +common_name: "Skin burn of major joint", +}, +{ +id: "s_2976", +type: "symptom", +name: "Burned skin, another location", +common_name: "Other location of skin burn", +}, +{ +id: "s_2977", +type: "symptom", +name: "Trouble with urination, after trauma", +common_name: "Trouble with urination after injury", +}, +{ +id: "s_2980", +type: "symptom", +name: "Burned skin, covering between 10 to 20% of body surface", +common_name: "Skin burn covering between 10 to 20% of body surface", +}, +{ +id: "s_2981", +type: "symptom", +name: "Burned skin, covering more than 20% of body surface", +common_name: "Skin burn covering more than 20% of body surface", +}, +{ +id: "s_2982", +type: "symptom", +name: "Trouble with defecation, after trauma", +common_name: "Trouble with defecation after injury", +}, +{ +id: "s_2984", +type: "symptom", +name: "Inability to bear weight", +common_name: "Inability to stand on either foot", +}, +{ +id: "s_2985", +type: "symptom", +name: "No problem with walking", +common_name: "Normal walking", +}, +{ +id: "s_2986", +type: "symptom", +name: "Recent miscarriage", +common_name: "Recent miscarriage", +}, +{ +id: "s_2987", +type: "symptom", +name: "Eye pain, unilateral", +common_name: "Pain in one eye", +}, +{ +id: "s_2988", +type: "symptom", +name: "Eye pain, bilateral", +common_name: "Pain in both eyes", +}, +{ +id: "s_2991", +type: "symptom", +name: "Tenderness of spinous processes", +common_name: "Pain when pressing the spinous processes", +}, +{ +id: "s_2992", +type: "symptom", +name: "Inability to bear weight, non-traumatic", +common_name: "Inability to stand on either foot unrelated to injury", +}, +{ +id: "s_2999", +type: "symptom", +name: "Skin mass, inguinal region", +common_name: "Skin mass in the groin", +}, +{ +id: "s_3000", +type: "symptom", +name: "Skin mass, reducible", +common_name: "Reducible skin mass", +}, +{ +id: "s_3001", +type: "symptom", +name: "Skin mass, irreducible", +common_name: "Irreducible skin mass", +}, +{ +id: "s_3002", +type: "symptom", +name: "Skin mass, umbilical region", +common_name: "Skin mass in the umbilical region", +}, +{ +id: "s_3003", +type: "symptom", +name: "Skin mass, soft", +common_name: "Soft skin mass", +}, +{ +id: "s_3004", +type: "symptom", +name: "Eye burn", +common_name: "Eye burn", +}, +{ +id: "s_3005", +type: "symptom", +name: "Skin mass, dark or bluish", +common_name: "Dark or bluish skin mass", +}, +{ +id: "s_3006", +type: "symptom", +name: "Skin mass, umbilicated", +common_name: "Skin bumps with a dimple in the center", +}, +{ +id: "s_3007", +type: "symptom", +name: "Skin mass, firm", +common_name: "Firm skin mass", +}, +{ +id: "s_3008", +type: "symptom", +name: "Skin mass, unknown consistency", +common_name: "Skin mass of unknown consistency", +}, +{ +id: "s_3009", +type: "symptom", +name: "Skin mass, painful", +common_name: "Painful skin mass", +}, +{ +id: "s_3012", +type: "symptom", +name: "Burned skin, covering less than 1% of body surface", +common_name: "Skin burn covering less than 1% of body surface", +}, +{ +id: "s_3013", +type: "symptom", +name: "Skin wound, clean", +common_name: "Clean wound", +}, +{ +id: "s_3014", +type: "symptom", +name: "Skin wound, contaminated", +common_name: "Contaminated wound", +}, +{ +id: "s_3015", +type: "symptom", +name: "Skin wound, acute", +common_name: "Acute wound", +}, +{ +id: "s_3016", +type: "symptom", +name: "Skin wound, chronic", +common_name: "Chronic wound", +}, +{ +id: "s_3017", +type: "symptom", +name: "Skin wound, laceration", +common_name: "Skin tear", +}, +{ +id: "s_3018", +type: "symptom", +name: "Skin wound, puncture", +common_name: "Puncture wound", +}, +{ +id: "s_3019", +type: "symptom", +name: "Skin wound, incision", +common_name: "Cut", +}, +{ +id: "s_3020", +type: "symptom", +name: "Skin wound, abrasion", +common_name: "Scratch wound", +}, +{ +id: "s_3021", +type: "symptom", +name: "Skin wound, crush", +common_name: "Crush wound", +}, +{ +id: "s_3022", +type: "symptom", +name: "Skin wound, gunshot", +common_name: "Gunshot wound", +}, +{ +id: "s_3025", +type: "symptom", +name: "Skin wound, superficial", +common_name: "Superficial skin wound", +}, +{ +id: "s_3026", +type: "symptom", +name: "Skin wound, partial-thickness", +common_name: "Partial-thickness skin wound", +}, +{ +id: "s_3027", +type: "symptom", +name: "Skin wound, full-thickness", +common_name: "Full-thickness skin wound", +}, +{ +id: "s_3028", +type: "symptom", +name: "Skin wound, deep tissues", +common_name: "Deep tissues skin wound", +}, +{ +id: "s_3030", +type: "symptom", +name: "Dermatological changes, single", +common_name: "Single skin change", +}, +{ +id: "s_3031", +type: "symptom", +name: "Dermatological changes, multiple", +common_name: "Multiple skin changes", +}, +{ +id: "s_3034", +type: "symptom", +name: "Headache, sudden worsening", +common_name: "Suddenly worsening headache", +}, +{ +id: "s_3037", +type: "symptom", +name: "Delusional thinking", +common_name: "Unshakable belief in something thats untrue", +}, +{ +id: "s_3038", +type: "symptom", +name: "Hallucinatory experiences", +common_name: "Experiences of sensing things that do not exist", +}, +{ +id: "s_3039", +type: "symptom", +name: "Unknown tetanus vaccination status", +common_name: "Unknown tetanus vaccination status", +}, +{ +id: "s_3042", +type: "symptom", +name: "Alcohol consumption", +common_name: "Alcohol consumption", +}, +{ +id: "s_3045", +type: "symptom", +name: "Inhalation burn", +common_name: "Airway burn", +}, +{ +id: "s_3046", +type: "symptom", +name: "Knee injury, twisting", +common_name: "Twisting knee injury", +}, +{ +id: "s_3047", +type: "symptom", +name: "Nipple discharge, bloody", +common_name: "Bloody discharge from nipple", +}, +{ +id: "s_3048", +type: "symptom", +name: "Cracked nipple", +common_name: "Damaged nipple", +}, +{ +id: "s_3049", +type: "symptom", +name: "Nipple discharge, purulent", +common_name: "Purulent discharge from nipple", +}, +{ +id: "s_3051", +type: "symptom", +name: "Nipple discharge, watery or serous", +common_name: "Watery or serous discharge from nipple", +}, +{ +id: "s_3052", +type: "symptom", +name: "Blood glucose level, between 71 and 180 mg/dl or between 4 and 9.9 mmol/l", +common_name: "Blood sugar between 71 and 180 mg/dl or between 4 and 9.9 mmol/l", +}, +{ +id: "s_3053", +type: "symptom", +name: "Blood glucose level, between 181 and 250 mg/dl or between 10 and 13.9 mmol/l", +common_name: "High blood sugar, between 181 and 250 mg/dl or between 10 and 13.9 mmol/l", +}, +{ +id: "s_3054", +type: "symptom", +name: "Blood glucose level, between 251 and 350 mg/dl or between 14 and 19.4 mmol/l", +common_name: "Very high blood sugar, between 251 and 350 mg/dl or between 14 and 19.4 mmol/l", +}, +{ +id: "s_3055", +type: "symptom", +name: "Blood glucose level, more than 350 mg/dl or 19.4 mmol/l", +common_name: "Extremely high blood sugar, over 350 mg/dl or 19.4 mmol/l", +}, +{ +id: "s_3056", +type: "symptom", +name: "Blood glucose level in the last 6 hours, more than 250 mg/dl or 13.9 mmol/l", +common_name: "Blood sugar level remaining over 250 mg/dl or 13.9 mmol/l for the past 6 hours", +}, +{ +id: "s_3057", +type: "symptom", +name: "Foreign body insertion, anus", +common_name: "Foreign body insertion, anus", +}, +{ +id: "s_3058", +type: "symptom", +name: "Foreign body insertion, vagina", +common_name: "Foreign body insertion, vagina", +}, +{ +id: "s_3059", +type: "symptom", +name: "Direct trauma to the anterior knee", +common_name: "Direct injury to the front of the knee", +}, +{ +id: "s_3062", +type: "symptom", +name: "Abnormal menstruation, irregular", +common_name: "Irregular periods", +}, +{ +id: "s_3063", +type: "symptom", +name: "Abnormal menstruation, prolonged menstruation", +common_name: "Menstrual bleeding lasting more than 8 days", +}, +{ +id: "s_3064", +type: "symptom", +name: "Abnormal menstruation, menorrhagia", +common_name: "Heavy menstrual bleeding", +}, +{ +id: "s_3065", +type: "symptom", +name: "Abnormal menstruation, hypomenorrhea", +common_name: "Light menstrual bleeding", +}, +{ +id: "s_3066", +type: "symptom", +name: "Abnormal menstruation, dysmenorrhea", +common_name: "Painful menstrual bleeding", +}, +{ +id: "s_3067", +type: "symptom", +name: "Abnormal menstruation, polymenorrhea", +common_name: "Frequent menstrual bleeding", +}, +{ +id: "s_3068", +type: "symptom", +name: "Abnormal menstruation, oligomenorrhea", +common_name: "Rare menstrual bleeding", +}, +{ +id: "s_3069", +type: "symptom", +name: "Abnormal menstruation", +common_name: "Abnormal menstruation", +}, +{ +id: "s_3070", +type: "symptom", +name: "Dermatological changes, unilateral", +common_name: "Skin changes localized on only one side", +}, +{ +id: "s_3071", +type: "symptom", +name: "Inconsolable crying", +common_name: "Unsoothed crying", +}, +{ +id: "s_3072", +type: "symptom", +name: "Recurrent inconsolable crying of unknown cause", +common_name: "Recurrent inconsolable crying of unknown cause", +}, +{ +id: "s_3078", +type: "symptom", +name: "Muscle weakness, non-paresis", +common_name: "Weak muscles with full ability to move", +}, +{ +id: "s_3079", +type: "symptom", +name: "Muscle weakness, paresis", +common_name: "Weak muscles with less ability to move", +}, +{ +id: "s_3080", +type: "symptom", +name: "Muscle weakness, paralysis", +common_name: "Weak muscles with no ability to move", +}, +{ +id: "s_3083", +type: "symptom", +name: "Flank pain, abdomen", +common_name: "Pain on the side of the abdomen", +}, +{ +id: "s_3084", +type: "symptom", +name: "Flank pain, back", +common_name: "Pain on the side of the back", +}, +{ +id: "s_3085", +type: "symptom", +name: "Flank pain, side", +common_name: "Flank pain, side", +}, +{ +id: "s_3087", +type: "symptom", +name: "Protrusion of the auricle", +common_name: "Protruding ear", +}, +{ +id: "s_3089", +type: "symptom", +name: "Dyspnea, severe at rest", +common_name: "Severe shortness of breath at rest", +}, +{ +id: "s_3090", +type: "symptom", +name: "Dyspnea, severe", +common_name: "Severe shortness of breath", +}, +{ +id: "s_3091", +type: "symptom", +name: "Current injury", +common_name: "Current injury", +}, +{ +id: "s_3092", +type: "symptom", +name: "Additional injury", +common_name: "Additional injury", +}, +{ +id: "s_3093", +type: "symptom", +name: "No additional injury", +common_name: "No additional injury", +}, +{ +id: "s_3094", +type: "symptom", +name: "Carbon monoxide exposure for burn cases", +common_name: "Carbon monoxide exposure for burn cases", +}, +{ +id: "s_3096", +type: "symptom", +name: "Muscle weakness, localized", +common_name: "Muscle weakness in a specific part of the body", +}, +{ +id: "s_3097", +type: "symptom", +name: "Muscle weakness, limbs", +common_name: "Limb weakness", +}, +{ +id: "s_3098", +type: "symptom", +name: "Muscle weakness, face", +common_name: "Facial muscle weakness", +}, +{ +id: "s_3099", +type: "symptom", +name: "Eye closure difficulties, one eye", +common_name: "Difficulty completely closing one eye", +}, +{ +id: "s_3100", +type: "symptom", +name: "Muscle weakness, drooping mouth corner on one side", +common_name: "One mouth corner drooping", +}, +{ +id: "s_3101", +type: "symptom", +name: "Muscle weakness, one side of the face", +common_name: "Facial muscle weakness on one side", +}, +{ +id: "s_3104", +type: "symptom", +name: "Muscle weakness, both upper limbs", +common_name: "Weakness in both upper limbs", +}, +{ +id: "s_3105", +type: "symptom", +name: "Muscle weakness, one upper limb", +common_name: "Weakness in one upper limb", +}, +{ +id: "s_3106", +type: "symptom", +name: "Muscle weakness, lasting less than 24 hours", +common_name: "Muscle weakness lasting less than 24 hours", +}, +{ +id: "s_3107", +type: "symptom", +name: "Muscle weakness, one lower limb", +common_name: "Weakness in one lower limb", +}, +{ +id: "s_3108", +type: "symptom", +name: "Muscle weakness, both lower limbs", +common_name: "Weakness in both lower limbs", +}, +{ +id: "s_3109", +type: "symptom", +name: "Muscle weakness, tetraparesis", +common_name: "Weakness of all limbs", +}, +{ +id: "s_3110", +type: "symptom", +name: "Muscle weakness, hemiparesis", +common_name: "Weakness on one side of the body", +}, +{ +id: "s_3111", +type: "symptom", +name: "Muscle weakness, limbs, other", +common_name: "Muscle weakness, limbs, other", +}, +{ +id: "s_3112", +type: "symptom", +name: "Muscle weakness, ascending", +common_name: "Ascending muscle weakness", +}, +{ +id: "s_3113", +type: "symptom", +name: "Muscle weakness, lasting between 24 hours and 1 week", +common_name: "Muscle weakness lasting between 24 hours and 1 week", +}, +{ +id: "s_3115", +type: "symptom", +name: "Fever, unknown reaction to antipyretics", +common_name: "Fever with unknown reaction to antipyretics", +}, +{ +id: "s_3116", +type: "symptom", +name: "Injury, no information", +common_name: "Injury, no information", +}, +{ +id: "s_3117", +type: "symptom", +name: "Muscle weakness, lasting between 1 and 4 weeks", +common_name: "Muscle weakness lasting between 1 and 4 weeks", +}, +{ +id: "s_3118", +type: "symptom", +name: "Muscle weakness, lasting more than 4 weeks", +common_name: "Muscle weakness lasting more than 4 weeks", +}, +{ +id: "s_3120", +type: "symptom", +name: "Nipple pain or tenderness", +common_name: "Nipple pain or tenderness", +}, +{ +id: "s_3121", +type: "symptom", +name: "Suicide attempt in the past", +common_name: "Suicide attempt in the past", +}, +{ +id: "s_3122", +type: "symptom", +name: "Eye closure difficulties, both eyes", +common_name: "Difficulty completely closing both eyes", +}, +{ +id: "s_3123", +type: "symptom", +name: "Muscle weakness, drooping mouth corner on both sides", +common_name: "Both mouth corners dropping", +}, +{ +id: "s_3124", +type: "symptom", +name: "Muscle weakness, face, other", +common_name: "Muscle weakness, face, other", +}, +{ +id: "s_3125", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, large amount", +common_name: "Alcohol consumption, less than 24 hours ago, large amount", +}, +{ +id: "s_3126", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, small amount", +common_name: "Alcohol consumption, less than 24 hours ago, small amount", +}, +{ +id: "s_3127", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, amount unknown", +common_name: "Alcohol consumption, less than 24 hours ago, amount unknown", +}, +{ +id: "s_3128", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, large amount in man", +common_name: "Alcohol consumption, less than 24 hours ago, large amount in man", +}, +{ +id: "s_3129", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, large amount in woman", +common_name: "Alcohol consumption, less than 24 hours ago, large amount in woman", +}, +{ +id: "s_3130", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, small amount in man", +common_name: "Alcohol consumption, less than 24 hours ago, small amount in man", +}, +{ +id: "s_3131", +type: "symptom", +name: "Alcohol consumption, less than 24 hours ago, small amount in woman", +common_name: "Alcohol consumption, less than 24 hours ago, small amount in woman", +}, +{ +id: "s_3133", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, risky drinking in men", +common_name: "Alcohol consumption, more than 24 hours ago, risky drinking in men", +}, +{ +id: "s_3134", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, risky drinking in women", +common_name: "Alcohol consumption, more than 24 hours ago, risky drinking in women", +}, +{ +id: "s_3135", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, risky drinking", +common_name: "Alcohol consumption, more than 24 hours ago, risky drinking", +}, +{ +id: "s_3136", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, heavy drinking", +common_name: "Alcohol consumption, more than 24 hours ago, heavy drinking", +}, +{ +id: "s_3137", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, heavy drinking in men", +common_name: "Alcohol consumption, more than 24 hours ago, heavy drinking in men", +}, +{ +id: "s_3138", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, heavy drinking in women", +common_name: "Alcohol consumption, more than 24 hours ago, heavy drinking in women", +}, +{ +id: "s_3139", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, binge drinking", +common_name: "Alcohol consumption, more than 24 hours ago, binge drinking", +}, +{ +id: "s_3140", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, binge drinking in men", +common_name: "Alcohol consumption, more than 24 hours ago, binge drinking in men", +}, +{ +id: "s_3141", +type: "symptom", +name: "Alcohol consumption, more than 24 hours ago, binge drinking in women", +common_name: "Alcohol consumption, more than 24 hours ago, binge drinking in women", +}, +{ +id: "s_3144", +type: "symptom", +name: "Breast pain or tenderness, either breast", +common_name: "Breast pain or tenderness in either breast", +}, +{ +id: "s_3145", +type: "symptom", +name: "No eye injury", +common_name: "Lack of eye injury", +}, +{ +id: "s_3146", +type: "symptom", +name: "Jaundice, less than 72 hours", +common_name: "Jaundice for less than 3 days", +}, +{ +id: "s_3147", +type: "symptom", +name: "Jaundice, lasting between 3 days and 3 weeks", +common_name: "Jaundice, lasting between 3 days and 3 weeks", +}, +{ +id: "s_3148", +type: "symptom", +name: "Jaundice, lasting between 3 weeks and 3 months", +common_name: "Jaundice, lasting between 3 weeks and 3 months", +}, +{ +id: "s_3149", +type: "symptom", +name: "Jaundice, lasting more than 3 months", +common_name: "Jaundice for more than 3 months", +}, +{ +id: "s_3150", +type: "symptom", +name: "Jaundice, onset within 24 hours after birth", +common_name: "Jaundice less than 24 hours after birth", +}, +{ +id: "s_3151", +type: "symptom", +name: "Erythema, well demarcated borders", +common_name: "Well demarcated erythema", +}, +{ +id: "s_3154", +type: "symptom", +name: "Skin necrosis", +common_name: "Skin necrosis", +}, +{ +id: "s_3156", +type: "symptom", +name: "Swallowed foreign body, battery", +common_name: "Swallowed battery", +}, +{ +id: "s_3157", +type: "symptom", +name: "Swallowed foreign body, chemical substances", +common_name: "Swallowed chemical substance", +}, +{ +id: "s_3158", +type: "symptom", +name: "Swallowed foreign body, dangerous", +common_name: "Swallowed dangerous foreign body", +}, +{ +id: "s_3159", +type: "symptom", +name: "Swallowed foreign body, little and blunt", +common_name: "Swallowed little and blunt foreign body", +}, +{ +id: "s_3162", +type: "symptom", +name: "Skin wound, burn", +common_name: "Burn wound", +}, +{ +id: "s_3166", +type: "symptom", +name: "Alcohol consumption, signs of withdrawal at present", +common_name: "Alcohol consumption, signs of withdrawal at present", +}, +{ +id: "s_3167", +type: "symptom", +name: "Skin wound, inflamed", +common_name: "Inflamed wound", +}, +{ +id: "s_3168", +type: "symptom", +name: "Skin wound, not inflamed", +common_name: "Skin wound, not inflamed", +}, +{ +id: "s_3171", +type: "symptom", +name: "Vascular compromise, limb, related to trauma", +common_name: "Limited blood flow past the injured limb", +}, +{ +id: "s_3173", +type: "symptom", +name: "Skin wound, animal scratch", +common_name: "Skin scratch caused by animal", +}, +{ +id: "s_3174", +type: "symptom", +name: "Blood pressure, elevated in children", +common_name: "High blood pressure in children", +}, +{ +id: "s_3176", +type: "symptom", +name: "Hypotension in children", +common_name: "Low blood pressure in children", +}, +{ +id: "s_3178", +type: "symptom", +name: "Alcohol misuse", +common_name: "Alcohol misuse", +}, +{ +id: "s_3179", +type: "symptom", +name: "Swallowed foreign body, unknown", +common_name: "Swallowed unknown foreign body", +}, +{ +id: "s_3188", +type: "symptom", +name: "Dizziness, sudden and severe", +common_name: "Sudden and severe dizziness", +}, +{ +id: "s_3189", +type: "symptom", +name: "Impaired vision, loss of part of visual field", +common_name: "Loss of part of visual field", +}, +{ +id: "s_3190", +type: "symptom", +name: "Impaired vision, sudden onset", +common_name: "Sudden vision impairment", +}, +{ +id: "s_3193", +type: "symptom", +name: "Anisocoria, lasting less than 3 days", +common_name: "Anisocoria with sudden onset", +}, +{ +id: "s_3194", +type: "symptom", +name: "Anisocoria, lasting 3 days or more", +common_name: "Anisocoria lasting more 3 days", +}, +{ +id: "s_3195", +type: "symptom", +name: "The setting-sun phenomenon", +common_name: "The setting-sun phenomenon", +}, +{ +id: "s_3197", +type: "symptom", +name: "Loss of consciousness, after trauma", +common_name: "Loss of consciousness after an injury", +}, +{ +id: "s_3199", +type: "symptom", +name: "Impaired vision, gradual", +common_name: "Progressive vision loss", +}, +{ +id: "s_3200", +type: "symptom", +name: "Impaired vision, subjective visual disturbance", +common_name: "Vision problems due to unusual visual experiences", +}, +{ +id: "s_3201", +type: "symptom", +name: "Impaired vision, complete blindness", +common_name: "Complete vision lost", +}, +{ +id: "s_3205", +type: "symptom", +name: "Nosebleed, uncontrollable", +common_name: "Uncontrollable bleeding from nose", +}, +{ +id: "s_3206", +type: "symptom", +name: "Eye closure difficulties", +common_name: "Trouble with eye closure", +}, +{ +id: "s_3208", +type: "symptom", +name: "Reduced mobility of body parts", +common_name: "Trouble moving body parts", +}, +{ +id: "s_3209", +type: "symptom", +name: "Electric shock resulting in respiratory or cardiovascular complications", +common_name: "Respiratory or cardiovascular complications after electric shock", +}, +{ +id: "s_3210", +type: "symptom", +name: "Pain in limb", +common_name: "Limb pain", +}, +{ +id: "s_3212", +type: "symptom", +name: "No hormonal contraception, HRT, or IUD usage", +common_name: "No hormonal contraception, HRT, or IUD usage", +}, +]; +export const SymptomsArData = [ +{ +id: "s_1", +type: "symptom", +name: "قرحة فموية", +common_name: "قرحات في الفم", +}, +{ +id: "s_3", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، القيام بنشاط جنسي رغم عواقبه السلبية", +common_name: "القيام بنشاط متعلّق بالجنس بالرغم من نتائجه السلبية", +}, +{ +id: "s_4", +type: "symptom", +name: "لامبالاة", +common_name: "عدم الاهتمام بشؤون الحياة اليومية", +}, +{ +id: "s_6", +type: "symptom", +name: "اشتهاء الأطعمة المالحة", +common_name: "اشتهاء الأطعمة المالحة", +}, +{ +id: "s_7", +type: "symptom", +name: "عقم أنثوي", +common_name: "عقم أنثوي", +}, +{ +id: "s_8", +type: "symptom", +name: "إسهال", +common_name: "إسهال", +}, +{ +id: "s_9", +type: "symptom", +name: "شحوب الجلد", +common_name: "جلد شاحب", +}, +{ +id: "s_10", +type: "symptom", +name: "أظافر هشة شاحبة", +common_name: "أظافر هشة شاحبة", +}, +{ +id: "s_11", +type: "symptom", +name: "ألم مفصلي، في الورك", +common_name: "ألم في الورك", +}, +{ +id: "s_13", +type: "symptom", +name: "ألم بطني", +common_name: "ألم في البطن", +}, +{ +id: "s_14", +type: "symptom", +name: "ألم بطني، يشتد عندما تكون المعدة فارغة", +common_name: "ألم في البطن يزداد عندما تكون المعدة فارغة", +}, +{ +id: "s_15", +type: "symptom", +name: "ألم بطني، يشتد أثناء السعال أو الحركة", +common_name: "ألم في البطن يزداد عند السعال أو الحركة", +}, +{ +id: "s_16", +type: "symptom", +name: "ألم بطني، يشتد بعد تناول الطعام", +common_name: "ألم في البطن يزداد بعد تناول الطعام", +}, +{ +id: "s_17", +type: "symptom", +name: "ألم بطني، يسبق الطمث", +common_name: "ألم تشنجي في البطن يسبق حدوث الحيض", +}, +{ +id: "s_19", +type: "symptom", +name: "ألم في اللثة", +common_name: "ألم في اللثة", +}, +{ +id: "s_20", +type: "symptom", +name: "ألم في البلعوم", +common_name: "ألم في الحلق", +}, +{ +id: "s_21", +type: "symptom", +name: "صداع", +common_name: "ألم في الرأس", +}, +{ +id: "s_22", +type: "symptom", +name: "صداع، أحادي الجانب", +common_name: "ألم في جهة واحدة من الرأس", +}, +{ +id: "s_23", +type: "symptom", +name: "صداع، ضاغط", +common_name: "ألم ضاغط أو عاصر على الرأس", +}, +{ +id: "s_24", +type: "symptom", +name: "صداع، معمم", +common_name: "ألم يشمل كامل الرأس", +}, +{ +id: "s_25", +type: "symptom", +name: "صداع، نابض", +common_name: "ألم رأس نابض", +}, +{ +id: "s_28", +type: "symptom", +name: "ألم العجان", +common_name: "ألم في الفرج", +}, +{ +id: "s_30", +type: "symptom", +name: "ألم صدري، يشتد بالشهيق العميق أو السعال", +common_name: "ألم في الصدر يزداد بالشهيق العميق أو بالسعال", +}, +{ +id: "s_31", +type: "symptom", +name: "ألم صدري، يستمر حتى بعد الراحة", +common_name: "ألم في الصدر يستمر حتى بعد الراحة", +}, +{ +id: "s_32", +type: "symptom", +name: "عسر الجماع", +common_name: "ألم أثناء الجماع", +}, +{ +id: "s_33", +type: "symptom", +name: "قذف مؤلم", +common_name: "ألم أثناء قذف المني", +}, +{ +id: "s_34", +type: "symptom", +name: "ألم في العجان، فجائي", +common_name: "ألم فرج فجائي", +}, +{ +id: "s_35", +type: "symptom", +name: "ألم صدري، أثناء الجهد", +common_name: "ألم في الصدر يظهر عند القيام بمجهود جسدي", +}, +{ +id: "s_36", +type: "symptom", +name: "ألم صدري، ينتشر إلى العنق", +common_name: "ألم في الصدر ينتشر إلى العنق", +}, +{ +id: "s_37", +type: "symptom", +name: "ألم صدري، ينتشر إلى ما بين لوحي الكتف", +common_name: "ألم في الصدر ينتشر إلى ما بين لوحي الكتف", +}, +{ +id: "s_38", +type: "symptom", +name: "ألم في الظهر، قطني، ينتشر إلى الوجه الخلفي من الفخذ", +common_name: "ألم في الجزء السفلي من الظهر ينتشر إلى السطح الخلفي من الفخذ أو الركبة", +}, +{ +id: "s_39", +type: "symptom", +name: "تبوُّل مؤلم", +common_name: "ألم أثناء التبول", +}, +{ +id: "s_41", +type: "symptom", +name: "ألم مفصلي، شديد، ناتج عن رض", +common_name: "ألم مفصلي شديد بعد أذية أو رض", +}, +{ +id: "s_43", +type: "symptom", +name: "ألم في الجلد، شديد", +common_name: "ألم شديد في الجلد", +}, +{ +id: "s_44", +type: "symptom", +name: "ألم مفصلي", +common_name: "ألم في المفصل", +}, +{ +id: "s_47", +type: "symptom", +name: "ألم في الأذن", +common_name: "ألم في الأذن", +}, +{ +id: "s_50", +type: "symptom", +name: "ألم صدري", +common_name: "ألم في الصدر", +}, +{ +id: "s_51", +type: "symptom", +name: "ألم صدري، منتشر", +common_name: "ألم منتشر في كامل الصدر", +}, +{ +id: "s_52", +type: "symptom", +name: "ألم في الصفن", +common_name: "ألم في كيس الصفن", +}, +{ +id: "s_53", +type: "symptom", +name: "ألم في الظهر، قطني", +common_name: "ألم في أسفل الظهر", +}, +{ +id: "s_54", +type: "symptom", +name: "ألم قرب جوف الحجاج", +common_name: "ألم حول العين أو خلفها", +}, +{ +id: "s_56", +type: "symptom", +name: "ألم سني، مترافق مع المضغ", +common_name: "ألم في الأسنان عند المضغ", +}, +{ +id: "s_57", +type: "symptom", +name: "ألم بطني، يخف بعد التغوُّط أو إخراج الغازات", +common_name: "ألم في البطن يخف بعد التبرّز أو إخراج الغازات", +}, +{ +id: "s_60", +type: "symptom", +name: "ألم في العجان، في حشفة القضيب", +common_name: "ألم في رأس القضيب", +}, +{ +id: "s_64", +type: "symptom", +name: "مفرزات مهبلية، ذات رائحة كريهة", +common_name: "إفرازات كريهة الرائحة من المهبل", +}, +{ +id: "s_65", +type: "symptom", +name: "البخر الفموي", +common_name: "رائحة كريهة من الفم", +}, +{ +id: "s_67", +type: "symptom", +name: "شخير", +common_name: "شخير", +}, +{ +id: "s_68", +type: "symptom", +name: "عسر التصويت", +common_name: "صوت أجش", +}, +{ +id: "s_69", +type: "symptom", +name: "الانشغال بالطعام", +common_name: "الانشغال بالطعام", +}, +{ +id: "s_71", +type: "symptom", +name: "براز أسود", +common_name: "خروج أسود", +}, +{ +id: "s_72", +type: "symptom", +name: "احمرار وحرقة في الملتحمة", +common_name: "عينين محمرتين ولاذعتين", +}, +{ +id: "s_73", +type: "symptom", +name: "فُزر جلدية في البطن أو الوركين أو الفخذين", +common_name: "علامات تمدد جلدي أو تشققات جلدية في البطن أو الردفين أو الفخذين", +}, +{ +id: "s_74", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، ممارسات جنسية غير مضبوطة", +common_name: "نشاط جنسي متكرر أو مع شركاء جنسيين أكثر من المراد", +}, +{ +id: "s_75", +type: "symptom", +name: "بوال", +common_name: "تبول كمية كبيرة في اليوم الواحد بالمقارنة مع المعتاد", +}, +{ +id: "s_79", +type: "symptom", +name: "ألم مفصلي، في إبهام القدم", +common_name: "ألم في إصبع القدم الكبير", +}, +{ +id: "s_80", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، التهيج عند عدم القدرة على ممارسة نشاط يتعلّق بالجنس", +common_name: "العصبية عند عدم القدرة على ممارسة الجنس", +}, +{ +id: "s_81", +type: "symptom", +name: "قشعريرة", +common_name: "رجفة", +}, +{ +id: "s_84", +type: "symptom", +name: "رجفان يخف بعد شرب الكحول", +common_name: "ارتعاش يخف بعد تناول الكحول", +}, +{ +id: "s_85", +type: "symptom", +name: "رجفان، في الرأس", +common_name: "رجفة في الرأس", +}, +{ +id: "s_86", +type: "symptom", +name: "رجفان، في يد واحدة", +common_name: "رجفة في يد واحدة", +}, +{ +id: "s_87", +type: "symptom", +name: "رجفان، في كلتا اليدين", +common_name: "رجفة في كلتا اليدين", +}, +{ +id: "s_88", +type: "symptom", +name: "زلة تنفسية", +common_name: "ضيق في التنفس", +}, +{ +id: "s_90", +type: "symptom", +name: "زلة تنفسية تدوم بين يوم و4 أسابيع", +common_name: "ضيق تنفس يستمر فترة تتراوح بين يوم و4 أسابيع", +}, +{ +id: "s_92", +type: "symptom", +name: "زلة تنفسية، بدأت منذ أقل من ساعة", +common_name: "ضيق تنفس ظهر منذ أقل من ساعة", +}, +{ +id: "s_93", +type: "symptom", +name: "تدخين عدد كبير من السجائر", +common_name: "تدخين أكثر من 20 سيجارة في اليوم الواحد", +}, +{ +id: "s_95", +type: "symptom", +name: "انزعاج أثناء التكلم، في الوجه والفكين", +common_name: "الشعور بانزعاج في الجزء السفلي من الوجه أو الفم أثناء التكلم", +}, +{ +id: "s_97", +type: "symptom", +name: "حشوة عميقة لسن تمت معالجته", +common_name: "حشوة عميقة لسن تمت معالجته", +}, +{ +id: "s_98", +type: "symptom", +name: "حمى", +common_name: "ارتفاع درجة حرارة الجسم", +}, +{ +id: "s_99", +type: "symptom", +name: "حمى تتراوح بين 37 و38° درجة مئوية، أي بين 98.6 و100.4° درجة فهرنهايتية", +common_name: "ارتفاع درجة حرارة الجسم بين 37 و38° درجة مئوية، أي بين 98.6 و100.4° درجة فهرنهايتية", +}, +{ +id: "s_100", +type: "symptom", +name: "حمى تتراوح بين 38 و40° درجة مئوية (أو ما بين 100.4 و104° درجة فهرنهايتية)", +common_name: "ارتفاع درجة حرارة الجسم بين 38 و40° درجة مئوية (أو ما بين 100.4 و104° درجة فهرنهايتية)", +}, +{ +id: "s_101", +type: "symptom", +name: "كتلة جلدية، قطرها أصغر من 1 سم", +common_name: "نتوءات على الجلد بقطر أقل من 1 سم", +}, +{ +id: "s_102", +type: "symptom", +name: "سعال", +common_name: "سعال", +}, +{ +id: "s_103", +type: "symptom", +name: "سعال، يدوم أقل من ثلاثة أسابيع", +common_name: "سعال يستمر أقل من ثلاثة أسابيع", +}, +{ +id: "s_104", +type: "symptom", +name: "سعال، مُنتج", +common_name: "سعال منتج للبلغم", +}, +{ +id: "s_105", +type: "symptom", +name: "سعال، جاف", +common_name: "سعال جاف", +}, +{ +id: "s_106", +type: "symptom", +name: "سعال، يدوم لأكثر من ثمانية أسابيع", +common_name: "سعال يستمر لأكثر من ثمانية أسابيع", +}, +{ +id: "s_107", +type: "symptom", +name: "سيلان أنفي", +common_name: "سيلان من الأنف", +}, +{ +id: "s_108", +type: "symptom", +name: "زيادة عمق الجيوب حول السنية", +common_name: "فراغات عميقة بين اللثة والأسنان", +}, +{ +id: "s_109", +type: "symptom", +name: "شرب الكحول، الشرب لتخفيف آثار الثمالة", +common_name: "شرب الكحول لتخفيف آثار الثمالة", +}, +{ +id: "s_110", +type: "symptom", +name: "الخفقان", +common_name: "خفقان القلب", +}, +{ +id: "s_111", +type: "symptom", +name: "نزف من اللثة", +common_name: "نزف من اللثة", +}, +{ +id: "s_112", +type: "symptom", +name: "براز أحمر اللون", +common_name: "براز أحمر", +}, +{ +id: "s_113", +type: "symptom", +name: "بول أحمر اللون", +common_name: "بول أحمر", +}, +{ +id: "s_115", +type: "symptom", +name: "نزيف من الشرج", +common_name: "نزيف من الشرج", +}, +{ +id: "s_116", +type: "symptom", +name: "نفث الدم", +common_name: "بصق الدم", +}, +{ +id: "s_118", +type: "symptom", +name: "حساسية تجاه البرد", +common_name: "حساسية تجاه البرد", +}, +{ +id: "s_120", +type: "symptom", +name: "قلق", +common_name: "قلق", +}, +{ +id: "s_121", +type: "symptom", +name: "فقدان الشعر", +common_name: "تساقط الشعر", +}, +{ +id: "s_122", +type: "symptom", +name: "دُماع", +common_name: "زيادة إفراز الدمع", +}, +{ +id: "s_123", +type: "symptom", +name: "إهمال الذات", +common_name: "نقص الاهتمام بالذات", +}, +{ +id: "s_124", +type: "symptom", +name: "عتمة، أجسام طافية أمام العينين", +common_name: "رؤية بقع سوداء", +}, +{ +id: "s_125", +type: "symptom", +name: "خدر، في كلا القدمين", +common_name: "تنميل في القدمين", +}, +{ +id: "s_126", +type: "symptom", +name: "خدر حول الفم", +common_name: "تنميل حول الفم", +}, +{ +id: "s_127", +type: "symptom", +name: "وساوس", +common_name: "أفكار وسواسية", +}, +{ +id: "s_131", +type: "symptom", +name: "نوبات النوم", +common_name: "النوم فجأة خلال النهار", +}, +{ +id: "s_132", +type: "symptom", +name: "شعرانية", +common_name: "زيادة نمو الأشعار", +}, +{ +id: "s_134", +type: "symptom", +name: "التدخين، الحاجة لتدخين سيجارة أول اليوم", +common_name: "صعوبة التخلي عن سيجارة أول اليوم", +}, +{ +id: "s_136", +type: "symptom", +name: "نوبات من العطاس", +common_name: "نوبات من العطاس", +}, +{ +id: "s_137", +type: "symptom", +name: "تناول الطعام المفرط", +common_name: "الإفراط في تناول الطعام", +}, +{ +id: "s_139", +type: "symptom", +name: "التهاب لوزتين ناكس", +common_name: "التهاب لوزتين ناكس", +}, +{ +id: "s_142", +type: "symptom", +name: "قرحات معدية ناكسة", +common_name: "قرحات معدية ناكسة", +}, +{ +id: "s_146", +type: "symptom", +name: "فقدان في الذاكرة، عدم تذكر أسماء العائلة والأصدقاء", +common_name: "نسيان أسماء العائلة والأصدقاء", +}, +{ +id: "s_147", +type: "symptom", +name: "فقر دم", +common_name: "فقر دم", +}, +{ +id: "s_150", +type: "symptom", +name: "شرب الكحول، عدم القدرة على التوقف عن الشرب", +common_name: "عدم القدرة على التوقف عن شرب الكحول", +}, +{ +id: "s_151", +type: "symptom", +name: "نزيف أو تمشيح تناسلي غير طبيعي بعد سن اليأس", +common_name: "نزف أو تمشيح من المهبل بعد تجاوز سن اليأس", +}, +{ +id: "s_152", +type: "symptom", +name: "نزف مهبلي بعد الجماع", +common_name: "نزف من المهبل بعد الجماع", +}, +{ +id: "s_153", +type: "symptom", +name: "سلس بولي", +common_name: "سلس البول", +}, +{ +id: "s_155", +type: "symptom", +name: "انخفاض الثقة بالنفس", +common_name: "انخفاض احترام الذات", +}, +{ +id: "s_156", +type: "symptom", +name: "غثيان", +common_name: "الشعور برغبة في التقيؤ", +}, +{ +id: "s_157", +type: "symptom", +name: "رهاب السمنة", +common_name: "الخوف من البدانة", +}, +{ +id: "s_159", +type: "symptom", +name: "ألم في الظهر، يشتد عند القيام بمجهود فيزيائي", +common_name: "ألم في الظهر يزداد بعد القيام بمجهود جسدي", +}, +{ +id: "s_161", +type: "symptom", +name: "تظهر الأعراض بانتظام قبل عدة أيام من الدورة الشهرية", +common_name: "تظهر الأعراض بانتظام قبل عدة أيام من الحيض", +}, +{ +id: "s_169", +type: "symptom", +name: "نوبات مزاج اكتئابي", +common_name: "مزاج اكتئابي", +}, +{ +id: "s_170", +type: "symptom", +name: "وذمة، في مفصل الركبة", +common_name: "تورم في الركبة", +}, +{ +id: "s_171", +type: "symptom", +name: "وذمة، في مفصل الكاحل في جانب واحد", +common_name: "تورم في أحد الكاحلين", +}, +{ +id: "s_172", +type: "symptom", +name: "تورم في اللثة", +common_name: "تورم في اللثة", +}, +{ +id: "s_173", +type: "symptom", +name: "وذمة، في طرف سفلي واحد", +common_name: "تورم في الساق", +}, +{ +id: "s_175", +type: "symptom", +name: "وذمة، في كلا الطرفين السفليين", +common_name: "تورم في كلا الساقين", +}, +{ +id: "s_176", +type: "symptom", +name: "وذمة، في كيس الصفن", +common_name: "تورم في كيس الصفن", +}, +{ +id: "s_177", +type: "symptom", +name: "توذّم الوجنة", +common_name: "تورم الخد", +}, +{ +id: "s_180", +type: "symptom", +name: "نقص تصبّغ الجلد", +common_name: "بهوت لون الجلد", +}, +{ +id: "s_181", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، رغبة جنسية مستمرة", +common_name: "الشعور بحاجة مستمرة لممارسة الجنس", +}, +{ +id: "s_182", +type: "symptom", +name: "بوال ليلي", +common_name: "تكرر التبول في الليل", +}, +{ +id: "s_183", +type: "symptom", +name: "التبول أثناء السعال أو الضحك أو عند القيام بمجهود بدني", +common_name: "التبول أثناء السعال أو الضحك أو عند القيام بمجهود بدني", +}, +{ +id: "s_185", +type: "symptom", +name: "قلة البول", +common_name: "تبول كمية أقل من المعتاد", +}, +{ +id: "s_186", +type: "symptom", +name: "تحدد الحركة، صعوبة في الانحناء", +common_name: "صعوبة في الانحناء", +}, +{ +id: "s_189", +type: "symptom", +name: "نوبات صرع، مع فقدان وعي", +common_name: "نوبات اختلاج مع غياب عن الوعي", +}, +{ +id: "s_190", +type: "symptom", +name: "فقدان للوعي مع تبول أو تغوط", +common_name: "غياب عن الوعي مع فقدان القدرة على ضبط عملية التبول أو التغوط", +}, +{ +id: "s_191", +type: "symptom", +name: "تدلي الرأس", +common_name: "هبوط الرأس", +}, +{ +id: "s_192", +type: "symptom", +name: "إطراق جفني", +common_name: "هبوط الأجفان", +}, +{ +id: "s_194", +type: "symptom", +name: "قرحة، في حلمة الثدي", +common_name: "قرحة في حلمة الثدي", +}, +{ +id: "s_195", +type: "symptom", +name: "تدخين حالي للسجائر", +common_name: "تدخين حالي للسجائر", +}, +{ +id: "s_196", +type: "symptom", +name: "تدخين السجائر أثناء المرض", +common_name: "التدخين حتى أثناء المرض", +}, +{ +id: "s_200", +type: "symptom", +name: "حرقة في اللسان", +common_name: "شعور بالحرق في اللسان", +}, +{ +id: "s_201", +type: "symptom", +name: "الشعور بوجود رمل أسفل الأجفان", +common_name: "الشعور بوجود رمل أسفل الأجفان", +}, +{ +id: "s_202", +type: "symptom", +name: "حمامى هاجرة", +common_name: "بقعة حمراء متوسّعة في مركزها جلد طبيعي سليم", +}, +{ +id: "s_203", +type: "symptom", +name: "قلح", +common_name: "جير الأسنان", +}, +{ +id: "s_204", +type: "symptom", +name: "انحناء الجسم للأمام", +common_name: "انحناء الجسم للأمام", +}, +{ +id: "s_205", +type: "symptom", +name: "الشعور بالذنب", +common_name: "الشعور بالذنب", +}, +{ +id: "s_207", +type: "symptom", +name: "الشفع", +common_name: "ازدواج الرؤية", +}, +{ +id: "s_208", +type: "symptom", +name: "ضعف حاسة السمع", +common_name: "ضعف حاسة السمع", +}, +{ +id: "s_213", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، قضاء وقت طويل في ممارسات متعلقة بالجنس", +common_name: "قضاء وقت طويل في أنشطة متعلقة بالجنس", +}, +{ +id: "s_214", +type: "symptom", +name: "تعرق في الجبهة في الجانب المؤلم", +common_name: "تعرق في الجبهة في الجانب المؤلم", +}, +{ +id: "s_215", +type: "symptom", +name: "كثرة عدد مرات التبول", +common_name: "كثرة عدد مرات التبول", +}, +{ +id: "s_216", +type: "symptom", +name: "تعرق مفرط", +common_name: "كثرة التعرق", +}, +{ +id: "s_217", +type: "symptom", +name: "تعرق ليلي", +common_name: "تعرق في الليل", +}, +{ +id: "s_219", +type: "symptom", +name: "تضخم الثديين", +common_name: "تضخم الثديين", +}, +{ +id: "s_220", +type: "symptom", +name: "تضخم في العقد اللمفاوية", +common_name: "تضخم في العقد اللمفاوية", +}, +{ +id: "s_221", +type: "symptom", +name: "آفات جلدية على الأعضاء التناسلية تشبه القرنبيط", +common_name: "بروزات على الأعضاء التناسلية تشبه القرنبيط", +}, +{ +id: "s_223", +type: "symptom", +name: "عدم القدرة على إيقاف التبوّل", +common_name: "عدم القدرة على إيقاف التبوّل", +}, +{ +id: "s_225", +type: "symptom", +name: "الشيب المبكر", +common_name: "الشيب المبكر", +}, +{ +id: "s_226", +type: "symptom", +name: "زيادة الوزن", +common_name: "زيادة الوزن", +}, +{ +id: "s_227", +type: "symptom", +name: "تسرع التنفس", +common_name: "تنفّس سريع", +}, +{ +id: "s_228", +type: "symptom", +name: "أسنان متقلقلة", +common_name: "أسنان متحركة", +}, +{ +id: "s_229", +type: "symptom", +name: "حمامى", +common_name: "احمرار الجلد", +}, +{ +id: "s_230", +type: "symptom", +name: "حمامى، على الوجه بشكل فراشة", +common_name: "احمرار على الوجه يشمل الخدين والأنف فقط", +}, +{ +id: "s_231", +type: "symptom", +name: "ألم سني، مترافق مع الحرارة", +common_name: "ألم في سن يزداد بالحرارة", +}, +{ +id: "s_232", +type: "symptom", +name: "ألم في الطرف السفلي، في الربلة، شديد أثناء المشي", +common_name: "ألم شديد في بطة الساق أثناء المشي", +}, +{ +id: "s_233", +type: "symptom", +name: "ألم سني، شديد", +common_name: "ألم شديد في سن", +}, +{ +id: "s_234", +type: "symptom", +name: "كدمات سهلة الظهور", +common_name: "كدمات سهلة الظهور", +}, +{ +id: "s_235", +type: "symptom", +name: "نفضات في الأجفان", +common_name: "تقلصات في الأجفان", +}, +{ +id: "s_236", +type: "symptom", +name: "انخفاض الشبق", +common_name: "فقدان الرغبة الجنسية", +}, +{ +id: "s_237", +type: "symptom", +name: "نقص في الوزن، دون انخفاض الشهية", +common_name: "نقص في الوزن دون انخفاض في الشهية", +}, +{ +id: "s_238", +type: "symptom", +name: "مشية بطيئة", +common_name: "بطء المشي", +}, +{ +id: "s_241", +type: "symptom", +name: "تغيرات جلدية", +common_name: "تغيرات في الجلد", +}, +{ +id: "s_243", +type: "symptom", +name: "استخدام وسائل غير صحية لإنقاص الوزن", +common_name: "استخدام وسائل غير صحية لإنقاص الوزن", +}, +{ +id: "s_244", +type: "symptom", +name: "الخوف من أشياء أو مواقف أو تصرفات معينة", +common_name: "خوف من أشياء محددة", +}, +{ +id: "s_245", +type: "symptom", +name: "تغيرات جلدية، توسفية", +common_name: "قشور جلدية", +}, +{ +id: "s_247", +type: "symptom", +name: "جفاف الفم", +common_name: "جفاف الفم", +}, +{ +id: "s_249", +type: "symptom", +name: "حكة حول الشرج", +common_name: "حكة في الشرج", +}, +{ +id: "s_250", +type: "symptom", +name: "حكة جلدية، تشتد في الليل", +common_name: "حكة جلدية تزداد في الليل", +}, +{ +id: "s_251", +type: "symptom", +name: "حكة جلدية، تتحرّض بتغيرات درجة الحرارة أو التعرّق أو لبس الصوف", +common_name: "حكة في الجلد تتحرض بتغيرات درجة الحرارة أو التعرق أو لبس الصوف", +}, +{ +id: "s_252", +type: "symptom", +name: "حكة في الأنف أو الحلق", +common_name: "شعور بالحكة في الأنف أو الحلق", +}, +{ +id: "s_253", +type: "symptom", +name: "حكة في المغبن", +common_name: "حكة في المنطقة التناسلية", +}, +{ +id: "s_254", +type: "symptom", +name: "حكة جلدية", +common_name: "جلد حاك", +}, +{ +id: "s_255", +type: "symptom", +name: "حكة في الأذن", +common_name: "حكة في الأذن", +}, +{ +id: "s_256", +type: "symptom", +name: "الضزز", +common_name: "صعوبة في فتح الفم", +}, +{ +id: "s_257", +type: "symptom", +name: "تيبس العمود الفقري صباحاً", +common_name: "تصلب العمود الفقري صباحاً", +}, +{ +id: "s_258", +type: "symptom", +name: "تيبس صباحي لمفاصل اليد", +common_name: "تيبس في مفاصل اليد صباحاً", +}, +{ +id: "s_259", +type: "symptom", +name: "تيبس مفصلي، يزول بعد تحريك المفصل", +common_name: "تيبس في مفصل يزول بعد ممارسة التمارين", +}, +{ +id: "s_261", +type: "symptom", +name: "تسرع القلب", +common_name: "تسارع نبضات القلب", +}, +{ +id: "s_263", +type: "symptom", +name: "تضيق القلفة", +common_name: "صعوبة في إرجاع القلفة", +}, +{ +id: "s_265", +type: "symptom", +name: "التدخين في الأماكن الغير مسموح فيها بذلك", +common_name: "التدخين في الأماكن الغير مسموح فيها بذلك", +}, +{ +id: "s_266", +type: "symptom", +name: "صعوبة في القضم والمضغ", +common_name: "صعوبة في القضم والمضغ", +}, +{ +id: "s_267", +type: "symptom", +name: "ألم سني، صعوبة في تحديد السن الذي يسبب الألم", +common_name: "صعوبة في تحديد السن الذي يسبب الألم", +}, +{ +id: "s_269", +type: "symptom", +name: "صعوبة التعلم", +common_name: "صعوبة في تعلم الأشياء الجديدة", +}, +{ +id: "s_270", +type: "symptom", +name: "صرير مفصلي أثناء الحركة", +common_name: "صدور صوت صرير من مفصل عند تحريكه", +}, +{ +id: "s_271", +type: "symptom", +name: "وجه أملس بدون تجاعيد", +common_name: "وجه أملس بدون تجاعيد", +}, +{ +id: "s_272", +type: "symptom", +name: "آفات في الميناء، نخر سني", +common_name: "نخور في الأسنان", +}, +{ +id: "s_273", +type: "symptom", +name: "الشعور بثقل في الساقين في نهاية اليوم", +common_name: "الشعور بثقل في الساقين في نهاية اليوم", +}, +{ +id: "s_274", +type: "symptom", +name: "الشعور بالحر", +common_name: "الشعور بالحر", +}, +{ +id: "s_276", +type: "symptom", +name: "انسداد في الأذن", +common_name: "أذن مسدودة", +}, +{ +id: "s_277", +type: "symptom", +name: "زيادة محيط البطن", +common_name: "زيادة حجم البطن", +}, +{ +id: "s_279", +type: "symptom", +name: "الشعور بضغط أو خفقان داخل السن", +common_name: "الشعور بضغط أو خفقان داخل السن", +}, +{ +id: "s_280", +type: "symptom", +name: "هبات ساخنة", +common_name: "هبات ساخنة", +}, +{ +id: "s_284", +type: "symptom", +name: "نقص الشهية", +common_name: "نقص الشهية", +}, +{ +id: "s_285", +type: "symptom", +name: "نقص الوزن", +common_name: "نقص الوزن", +}, +{ +id: "s_287", +type: "symptom", +name: "فقدان لذة الحياة، يدوم أسبوعين على الأقل", +common_name: "نقص الاهتمام بالأنشطة التي كانت ممتعة سابقاً بحيث استمر ذلك أسبوعين على الأقل", +}, +{ +id: "s_289", +type: "symptom", +name: "سوء الإطباق", +common_name: "سوء الإطباق", +}, +{ +id: "s_291", +type: "symptom", +name: "توذم في مجرى السمع الخارجي", +common_name: "تورم القناة السمعية داخل الأذن", +}, +{ +id: "s_297", +type: "symptom", +name: "سيلان من الأذن", +common_name: "خروج مفرزات من الأذن", +}, +{ +id: "s_299", +type: "symptom", +name: "كتلة بطنيّة", +common_name: "كتلة في البطن", +}, +{ +id: "s_300", +type: "symptom", +name: "عقيدة في الثدي", +common_name: "كتلة في الثدي", +}, +{ +id: "s_301", +type: "symptom", +name: "إفرازات تحت القلفة", +common_name: "إفرازات تحت القلفة", +}, +{ +id: "s_302", +type: "symptom", +name: "خروج مفرزات من الجيوب اللثوية", +common_name: "خروج مفرزات من الجيوب حول السنية بين اللثة والأسنان", +}, +{ +id: "s_303", +type: "symptom", +name: "سلوك قهري", +common_name: "سلوك قهري", +}, +{ +id: "s_305", +type: "symptom", +name: "إقياء", +common_name: "تقيؤ", +}, +{ +id: "s_306", +type: "symptom", +name: "إقياء مدمى", +common_name: "تقيؤ مصحوب بدم", +}, +{ +id: "s_308", +type: "symptom", +name: "تدخين العدد الأكبر من السجائر في اليوم صباحاً", +common_name: "تدخين العدد الأكبر من السجائر في اليوم صباحاً", +}, +{ +id: "s_309", +type: "symptom", +name: "نفخة", +common_name: "نفخة", +}, +{ +id: "s_310", +type: "symptom", +name: "زيادة العطش", +common_name: "الشعور بعطش زائد عن المعتاد", +}, +{ +id: "s_311", +type: "symptom", +name: "زيادة الشهية", +common_name: "الشعور بجوعٍ زائد عن المعتاد", +}, +{ +id: "s_313", +type: "symptom", +name: "فقدان الحس في طرف واحد", +common_name: "غياب الحس في ذراع أو ساق واحدة", +}, +{ +id: "s_316", +type: "symptom", +name: "ضعف الذاكرة", +common_name: "ضعف الذاكرة", +}, +{ +id: "s_317", +type: "symptom", +name: "ضعف التوازن أثناء المشي", +common_name: "التعثر أو فقدان التوازن أثناء المشي", +}, +{ +id: "s_319", +type: "symptom", +name: "اضطراب النوم", +common_name: "تغيّر في أنماط النوم أو عاداته أو صعوبة النوم", +}, +{ +id: "s_320", +type: "symptom", +name: "ضعف بصري", +common_name: "ضعف الرؤية", +}, +{ +id: "s_322", +type: "symptom", +name: "حمامى لثوية", +common_name: "لثة حمراء", +}, +{ +id: "s_323", +type: "symptom", +name: "حمامى، في الجلد الواقع فوق مفصل", +common_name: "احمرار في مفصل", +}, +{ +id: "s_325", +type: "symptom", +name: "حمامى، على الأطراف", +common_name: "احمرار في جلد اليد أو الساق", +}, +{ +id: "s_326", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، إعطاء الجنس الأولوية على حساب المسؤوليات والهوايات", +common_name: "إهمال الالتزامات كالعمل أو الدراسة أو العائلة بسبب الجنس", +}, +{ +id: "s_327", +type: "symptom", +name: "الحاجة لتدخين سيجارة عند الاستيقاظ من النوم", +common_name: "التدخين فور الاستيقاظ", +}, +{ +id: "s_328", +type: "symptom", +name: "ضائعات مهبلية غير طبيعية", +common_name: "ضائعات مهبلية غير طبيعية", +}, +{ +id: "s_329", +type: "symptom", +name: "إمساك", +common_name: "إمساك", +}, +{ +id: "s_330", +type: "symptom", +name: "قلس", +common_name: "عودة الطعام المبتلع إلى الفم", +}, +{ +id: "s_331", +type: "symptom", +name: "احتقان أنفي", +common_name: "انسداد الأنف", +}, +{ +id: "s_332", +type: "symptom", +name: "يرقان", +common_name: "يرقان", +}, +{ +id: "s_334", +type: "symptom", +name: "يرقان يظهر أثناء التوتر", +common_name: "اصفرار في الجلد يحدث أثناء التوتر أو الضغط النفسي", +}, +{ +id: "s_335", +type: "symptom", +name: "يرقان يظهر بعد القيام بمجهود فيزيائي شديد", +common_name: "اصفرار في الجلد أو العينين بعد القيام بمجهود بدني", +}, +{ +id: "s_336", +type: "symptom", +name: "يرقان يظهر عند الإصابة بالأمراض الخمجية", +common_name: "اصفرار في الجلد أو العينين يظهر أثناء الأمراض المُعدية", +}, +{ +id: "s_338", +type: "symptom", +name: "حرقة الفؤاد", +common_name: "حرقة بمنطقة الصدر", +}, +{ +id: "s_341", +type: "symptom", +name: "تخيل أن الأشياء المحيطة أكبر أو أصغر مما هي في الواقع", +common_name: "تخيل أن الأشياء المحيطة أكبر أو أصغر مما هي في الواقع", +}, +{ +id: "s_342", +type: "symptom", +name: "تجاعيد أو تنقّر في جلد الثدي", +common_name: "تجاعيد أو تنقّر في جلد الثدي", +}, +{ +id: "s_343", +type: "symptom", +name: "غؤور في الحلمة أو تغير في شكلها", +common_name: "تغير شكل الحلمة", +}, +{ +id: "s_345", +type: "symptom", +name: "تغير في خط اليد", +common_name: "تغير في خط اليد", +}, +{ +id: "s_346", +type: "symptom", +name: "تغير في لون سن", +common_name: "تغير في لون سن", +}, +{ +id: "s_348", +type: "symptom", +name: "تغيرات الشخصيّة", +common_name: "تغيرات الشخصيّة", +}, +{ +id: "s_350", +type: "symptom", +name: "تغيرات جلدية، تتوضع بشكل خطي", +common_name: "تغيرات جلدية تأخذ شكل خط", +}, +{ +id: "s_351", +type: "symptom", +name: "تَقَرُّح أو خراج قرب فتحة الشرج", +common_name: "تَقَرُّح أو خراج قرب فتحة الشرج", +}, +{ +id: "s_352", +type: "symptom", +name: "تغيرات جلدية، في مكان التماس مع الأزرار أو الأحزمة أو مستحضرات التجميل", +common_name: "تغيرات في الجلد المماس للأزرار أو الأحزمة أو المجوهرات أو مستحضرات التجميل", +}, +{ +id: "s_358", +type: "symptom", +name: "تدفّق متقطع للبول", +common_name: "تقطع تدفق البول", +}, +{ +id: "s_359", +type: "symptom", +name: "تشوه مفصلي، غير رضي", +common_name: "تشوّه مفصل لا يترافق مع أي إصابة حديثة", +}, +{ +id: "s_360", +type: "symptom", +name: "صغر الفم", +common_name: "تضيق الفم أو صعوبة في فتحه", +}, +{ +id: "s_361", +type: "symptom", +name: "اضطراب الوظيفة الجنسية، زيادة الحاجة للمنبهات الجنسية للوصول إلى التأثير المرغوب", +common_name: "زيادة الحاجة للممارسات والتجارب الجنسية للوصول إلى التأثير المرغوب", +}, +{ +id: "s_362", +type: "symptom", +name: "بشرة دهنية", +common_name: "بشرة دهنية", +}, +{ +id: "s_363", +type: "symptom", +name: "توذّم، في الرقبة", +common_name: "تورم في العنق", +}, +{ +id: "s_369", +type: "symptom", +name: "سيلان من الإحليل", +common_name: "خروج مفرزات من الإحليل", +}, +{ +id: "s_370", +type: "symptom", +name: "دوخة", +common_name: "دوخة", +}, +{ +id: "s_371", +type: "symptom", +name: "العمل الزائد", +common_name: "العمل الزائد", +}, +{ +id: "s_373", +type: "symptom", +name: "قشور عسلية اللون على الجلد", +common_name: "قشور عسلية اللون على الجلد", +}, +{ +id: "s_376", +type: "symptom", +name: "جلد من النمط I أو II", +common_name: "جلد من النمط الأول أو الثاني", +}, +{ +id: "s_377", +type: "symptom", +name: "عدد كبير من الشامات", +common_name: "عدد كبير من وحمات الولادة", +}, +{ +id: "s_380", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة، غير متناظرة", +common_name: "عدم تناظر وحمة الولادة أو شامة جلديّة", +}, +{ +id: "s_381", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة، غير منتظمة الحواف", +common_name: "شامة أو وحمة ولادة غير منتظمة الحواف", +}, +{ +id: "s_382", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة، قطرها أكبر من 6 مم", +common_name: "شامة أو وحمة ولادة بقطر أكبر من 6 مم", +}, +{ +id: "s_383", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة", +common_name: "شامة أو وحمة مشبوهة المنظر", +}, +{ +id: "s_384", +type: "symptom", +name: "بقع حمراء بقشور بيضاء فضية", +common_name: "بقع حمراء مع وسوف قشرية بيضاء فضية", +}, +{ +id: "s_385", +type: "symptom", +name: "جلد جاف متشقق وينزف أحياناً", +common_name: "جلد جاف متشقق وينزف أحياناً", +}, +{ +id: "s_386", +type: "symptom", +name: "أظافر سميكة بحفر أو أثلام", +common_name: "أظافر سميكة مع حفر وأثلام على سطحها", +}, +{ +id: "s_388", +type: "symptom", +name: "بثرة", +common_name: "حويصلات مليئة بالقيح قطر أحدها لا يتجاوز الـ1 سم", +}, +{ +id: "s_389", +type: "symptom", +name: "رؤوس سوداء", +common_name: "رؤوس سوداء", +}, +{ +id: "s_393", +type: "symptom", +name: "شرى", +common_name: "طفح جلدي حاك", +}, +{ +id: "s_398", +type: "symptom", +name: "تغيرات جلدية، تشمل الجسم كله", +common_name: "تغيرات في كامل جلد الجسم", +}, +{ +id: "s_400", +type: "symptom", +name: "تغيرات جلدية، تُسبق بألم أو حكّة", +common_name: "ألم وحكة يليها ظهور تغيرات جلدية", +}, +{ +id: "s_402", +type: "symptom", +name: "تغيرات جلدية، تنكس خلال الأخماج أو الدورة الطمثية", +common_name: "تغيرات جلدية تتكرر أثناء العدوى الجرثومية أو الدورة الشهرية", +}, +{ +id: "s_404", +type: "symptom", +name: "تغيرات جلدية، ذات سطح خشن وغير منتظم", +common_name: "تغيرات جلدية بسطح خشن وغير منتظم", +}, +{ +id: "s_407", +type: "symptom", +name: "طنين", +common_name: "طنين في الأذن", +}, +{ +id: "s_408", +type: "symptom", +name: "برودة في القدم وأصابعها", +common_name: "برودة في القدم وأصابعها", +}, +{ +id: "s_410", +type: "symptom", +name: "انخفاض حرارة الجسم", +common_name: "انخفاض حرارة الجسم", +}, +{ +id: "s_412", +type: "symptom", +name: "إسهال، رغوي", +common_name: "إسهال رغوي", +}, +{ +id: "s_418", +type: "symptom", +name: "تيبس العنق", +common_name: "تصلب العنق", +}, +{ +id: "s_419", +type: "symptom", +name: "الشعور بزيادة في الوزن رغم أنه منخفض", +common_name: "الشعور بزيادة في الوزن رغم أنه منخفض", +}, +{ +id: "s_420", +type: "symptom", +name: "الكذب بشأن تناول الطعام أو إخفاء الطعام", +common_name: "الكذب بشأن تناول الطعام أو إخفاء الطعام", +}, +{ +id: "s_421", +type: "symptom", +name: "زيادة الشهوة الجنسية", +common_name: "زيادة الشهوة الجنسية", +}, +{ +id: "s_422", +type: "symptom", +name: "صوت رخيم", +common_name: "صوت عميق", +}, +{ +id: "s_423", +type: "symptom", +name: "تعلّق شعور تقدير الذات بالوزن", +common_name: "تقدير الذات يعتمد على الوزن", +}, +{ +id: "s_424", +type: "symptom", +name: "ألم وجهي، في جانب واحد", +common_name: "ألم في جانب واحد من الوجه", +}, +{ +id: "s_425", +type: "symptom", +name: "ألم وجهي، طاعن واخز", +common_name: "ألم طاعن في الوجه", +}, +{ +id: "s_426", +type: "symptom", +name: "ألم وجهي، يتحرّض بتناول الطعام أو اللمس أو تنظيف الأسنان", +common_name: "ألم في الوجه يتحرض بتناول الطعام أو اللمس أو تنظيف الأسنان", +}, +{ +id: "s_427", +type: "symptom", +name: "ألم وجهي، دوري", +common_name: "ألم وجهي متكرر", +}, +{ +id: "s_429", +type: "symptom", +name: "أصوات فرقعة في المفصل الفكي عند فتح الفم أو إغلاقه", +common_name: "أصوات فرقعة في المفصل الفكي عند فتح الفم أو إغلاقه", +}, +{ +id: "s_430", +type: "symptom", +name: "ألم في المفصل الصدغي الفكي عند تحريكه", +common_name: "ألم في الفك أثناء تحريكه", +}, +{ +id: "s_433", +type: "symptom", +name: "حمامى، على القلفة أو الحشفة", +common_name: "احمرار في جلد القلفة أو رأس القضيب", +}, +{ +id: "s_435", +type: "symptom", +name: "عدم انفراغ المثانة بشكل كامل", +common_name: "لا تفرغ المثانة كلياً بعد التبوّل", +}, +{ +id: "s_436", +type: "symptom", +name: "ألم شرجي مستقيمي", +common_name: "ألم شرجي مستقيمي", +}, +{ +id: "s_437", +type: "symptom", +name: "زُرقة", +common_name: "جلد ذو لون أزرق رمادي", +}, +{ +id: "s_471", +type: "symptom", +name: "ألم بطني، ينتشر إلى الكتف الأيمن أو لوح الكتف الأيمن", +common_name: "ألم في البطن ينتشر إلى منطقة الكتف الأيمن", +}, +{ +id: "s_474", +type: "symptom", +name: "وزيز مسموع", +common_name: "صوت صفير يصدر أثناء التنفس", +}, +{ +id: "s_476", +type: "symptom", +name: "مضض حول الأذن", +common_name: "ألم عند لمس المنطقة المحيطة بالأذن", +}, +{ +id: "s_477", +type: "symptom", +name: "فقد الصوت", +common_name: "فقدان الصوت", +}, +{ +id: "s_478", +type: "symptom", +name: "ألم وجهي", +common_name: "ألم في الوجه", +}, +{ +id: "s_479", +type: "symptom", +name: "رأرأة", +common_name: "رأرأة", +}, +{ +id: "s_480", +type: "symptom", +name: "تصخم في اليدين أو القدمين أو الوجه", +common_name: "تصخم في اليدين أو القدمين أو الوجه", +}, +{ +id: "s_483", +type: "symptom", +name: "تغيرات جلدية، على الجفن", +common_name: "تغيرات جلدية متوضعة على الجفن", +}, +{ +id: "s_484", +type: "symptom", +name: "آفات جفنية، تورم أحمر اللون وطرفها أصفر", +common_name: "كتلة حمراء اللون ذات طرف أصفر اللون", +}, +{ +id: "s_485", +type: "symptom", +name: "آفات على الجفن، مؤلمة", +common_name: "تغيرات جلديّة مؤلمة على الأجفان", +}, +{ +id: "s_486", +type: "symptom", +name: "آفات على الجفن، حمراء ودافئة", +common_name: "احمرار ودفئ في جلد الأجفان", +}, +{ +id: "s_488", +type: "symptom", +name: "حساسية العينين للضياء", +common_name: "حساسية للضوء", +}, +{ +id: "s_489", +type: "symptom", +name: "مفرزات جافة على الأجفان", +common_name: "مفرزات جافة على أطراف الجفن", +}, +{ +id: "s_492", +type: "symptom", +name: "احمرار في العين", +common_name: "عين محمرّة", +}, +{ +id: "s_493", +type: "symptom", +name: "ألم عيني", +common_name: "ألم في العين", +}, +{ +id: "s_494", +type: "symptom", +name: "فقدان الرؤية المحيطية", +common_name: "الرؤية النفقية", +}, +{ +id: "s_497", +type: "symptom", +name: "حدقتان غير متناظرتان", +common_name: "حدقتان غير متماثلتان", +}, +{ +id: "s_501", +type: "symptom", +name: "سوء في تقدير المسافات", +common_name: "خطأ في تقدير المسافات", +}, +{ +id: "s_503", +type: "symptom", +name: "تشنجات عضلية", +common_name: "تشنجات عضلية", +}, +{ +id: "s_504", +type: "symptom", +name: "بول رغوي", +common_name: "بول رغوي", +}, +{ +id: "s_505", +type: "symptom", +name: "إنتانات متكررة", +common_name: "عدوى متكررة", +}, +{ +id: "s_506", +type: "symptom", +name: "علامة جلدية تدل على لدغ حشرة", +common_name: "لدغة حشرة", +}, +{ +id: "s_507", +type: "symptom", +name: "الشعور بالاستسلام", +common_name: "عدم الرغبة بالاستمرار في العيش", +}, +{ +id: "s_508", +type: "symptom", +name: "فقدان لذة الحياة", +common_name: "عدم القدرة على الاستمتاع بالحياة", +}, +{ +id: "s_509", +type: "symptom", +name: "ألم عند البلع", +common_name: "بلع مؤلم", +}, +{ +id: "s_510", +type: "symptom", +name: "إفرازات إحليلية عند الضغط على القضيب", +common_name: "خروج مفرزات عند الضغط على القضيب", +}, +{ +id: "s_513", +type: "symptom", +name: "اللقمة الهستيرية", +common_name: "الشعور بوجود جسم غريب عالق في الحلق", +}, +{ +id: "s_514", +type: "symptom", +name: "تبدد الواقع", +common_name: "الشعور بالانفصال عن العالم المحيط بالشخص", +}, +{ +id: "s_518", +type: "symptom", +name: "خدر", +common_name: "تنميل", +}, +{ +id: "s_524", +type: "symptom", +name: "سليلة أنفية", +common_name: "بوليب أنفي", +}, +{ +id: "s_525", +type: "symptom", +name: "براز كريه الرائحة", +common_name: "براز كريه الرائحة", +}, +{ +id: "s_526", +type: "symptom", +name: "سعال، منتج لقشع أخضر أو أصفر", +common_name: "سعال منتج لمخاط سميك أخضر أو أصفر اللون", +}, +{ +id: "s_528", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة", +common_name: "شرب الكحول منذ أقل من 24 ساعة", +}, +{ +id: "s_529", +type: "symptom", +name: "تضخم في الغدة النكفية", +common_name: "تضخم في الغدة النكفية", +}, +{ +id: "s_530", +type: "symptom", +name: "ارتفاع مفاجئ في ضغط الدم", +common_name: "ارتفاع مفاجئ في ضغط الدم", +}, +{ +id: "s_531", +type: "symptom", +name: "أخماج متكررة، في السبيل التنفسي العلوي", +common_name: "سيلان أنف وسعال متكررين", +}, +{ +id: "s_532", +type: "symptom", +name: "أخماج متكررة، في السبيل التنفس السفلي", +common_name: "التهاب القصبات المتكرر", +}, +{ +id: "s_533", +type: "symptom", +name: "انخفاض ضغط الدم", +common_name: "ضغط دم منخفض", +}, +{ +id: "s_534", +type: "symptom", +name: "بطء القلب", +common_name: "انخفاض معدّل ضربات القلب", +}, +{ +id: "s_535", +type: "symptom", +name: "ضعف منعكس الحدقة تجاه الضوء", +common_name: "ضعف منعكس الحدقة تجاه الضوء", +}, +{ +id: "s_536", +type: "symptom", +name: "توسع الحدقتين", +common_name: "حدقتين متوسعتين", +}, +{ +id: "s_537", +type: "symptom", +name: "تضيق الحدقتين", +common_name: "صغر حجم البؤبؤين", +}, +{ +id: "s_538", +type: "symptom", +name: "رجفان", +common_name: "رجفة في العضلات", +}, +{ +id: "s_539", +type: "symptom", +name: "صرع دون فقدان للوعي", +common_name: "اختلاج دون فقدان للوعي", +}, +{ +id: "s_540", +type: "symptom", +name: "تهيّج", +common_name: "سرعة الغضب", +}, +{ +id: "s_541", +type: "symptom", +name: "هبوط الضغط الانتصابي", +common_name: "الشعور بالدوخة أو الإغماء بعد الوقوف بسرعة", +}, +{ +id: "s_542", +type: "symptom", +name: "جفاف الجلد", +common_name: "جفاف الجلد", +}, +{ +id: "s_543", +type: "symptom", +name: "ارتفاع التوتر الشرياني", +common_name: "ارتفاع ضغط الدم", +}, +{ +id: "s_545", +type: "symptom", +name: "توسع الشعريات", +common_name: "أوعية عنكبوتية", +}, +{ +id: "s_547", +type: "symptom", +name: "ثر للحليب عند امرأة", +common_name: "سيلان الحليب من الحلمة خارج أوقات الإرضاع", +}, +{ +id: "s_550", +type: "symptom", +name: "ضبابية عدسة العين", +common_name: "غباشة في إحدى أو كلتا العينين", +}, +{ +id: "s_551", +type: "symptom", +name: "ألم سني", +common_name: "وجع في سن", +}, +{ +id: "s_553", +type: "symptom", +name: "زرقة، في الأصابع", +common_name: "أصابع ذات لون أزرق مائل للرمادي", +}, +{ +id: "s_554", +type: "symptom", +name: "ألم في الطرف العلوي، في الأصابع أو اليد", +common_name: "ألم في اليد أو الأصابع", +}, +{ +id: "s_555", +type: "symptom", +name: "خدر في أصابع اليد", +common_name: "خدر في أصابع اليد", +}, +{ +id: "s_556", +type: "symptom", +name: "برودة في اليد وأصابعها", +common_name: "برودة في اليد وأصابعها", +}, +{ +id: "s_557", +type: "symptom", +name: "حمامى، في اليد", +common_name: "احمرار في اليد", +}, +{ +id: "s_558", +type: "symptom", +name: "تشتد الأعراض بالبرد", +common_name: "زيادة الأعراض بالبرد", +}, +{ +id: "s_561", +type: "symptom", +name: "تجشؤ", +common_name: "تجشؤ", +}, +{ +id: "s_562", +type: "symptom", +name: "وذمة، انطباعيّة", +common_name: "وذمة انطباعية", +}, +{ +id: "s_563", +type: "symptom", +name: "زلة تنفسية، اضطجاعية", +common_name: "ضيق في التنفس أثناء الاستلقاء", +}, +{ +id: "s_564", +type: "symptom", +name: "ضمور عضلات اليدين", +common_name: "ضمور في عضلات اليدين", +}, +{ +id: "s_567", +type: "symptom", +name: "علامة مورفي", +common_name: "ألم في البطن عند الشهيق العميق ويتحرض بالضغط على الجزء العلوي الأيمن من البطن", +}, +{ +id: "s_568", +type: "symptom", +name: "الاشمئزاز من النفس بعد الإفراط في تناول الطعام", +common_name: "الاشمئزاز من النفس بعد الإفراط في تناول الطعام", +}, +{ +id: "s_569", +type: "symptom", +name: "براز شاحب أو بلون الطين", +common_name: "براز شاحب", +}, +{ +id: "s_570", +type: "symptom", +name: "قيح عيني", +common_name: "تجمع للقيح في مقدمة العين", +}, +{ +id: "s_571", +type: "symptom", +name: "صلابة", +common_name: "فرط توتر العضلات", +}, +{ +id: "s_572", +type: "symptom", +name: "نقص التعابير الوجهية", +common_name: "وجه جامد بدون تعابير أو حركات", +}, +{ +id: "s_575", +type: "symptom", +name: "تيبس مفصلي", +common_name: "تيبس في حركة المفاصل", +}, +{ +id: "s_576", +type: "symptom", +name: "ألم مفصلي، يشتد خلال الطقس البارد والرطب", +common_name: "ألم في المفاصل يزداد في الطقس البارد والرطب", +}, +{ +id: "s_578", +type: "symptom", +name: "ألم في إحدى القدمين", +common_name: "قدم مؤلمة", +}, +{ +id: "s_579", +type: "symptom", +name: "ألم في الطرف السفلي", +common_name: "ألم في الطرف السفلي", +}, +{ +id: "s_580", +type: "symptom", +name: "ألم في الطرف العلوي", +common_name: "ألم في الطرف العلوي", +}, +{ +id: "s_581", +type: "symptom", +name: "ألم مفصلي، في ركبة واحدة", +common_name: "ألم في ركبة واحدة", +}, +{ +id: "s_582", +type: "symptom", +name: "نوبة قلق‎", +common_name: "نوبة قلق‎", +}, +{ +id: "s_583", +type: "symptom", +name: "قلق عام", +common_name: "قلق عام", +}, +{ +id: "s_584", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة، تغير في شكلها", +common_name: "تغير في شكل شامة أو وحمة الولادة", +}, +{ +id: "s_585", +type: "symptom", +name: "شامة أو وحمة غريبة ومشبوهة، تغير لونها", +common_name: "تغيّر في لون شامة أو وحمة", +}, +{ +id: "s_586", +type: "symptom", +name: "التثدي", +common_name: "تضخم الثدي عند رجل", +}, +{ +id: "s_588", +type: "symptom", +name: "شرب الكحول، زيادة تحمُّل الكحول", +common_name: "الحاجة لشرب كميات أكبر من الكحول للوصول إلى حالة السُكر", +}, +{ +id: "s_590", +type: "symptom", +name: "رجفان في اللسان", +common_name: "رجفة في اللسان", +}, +{ +id: "s_593", +type: "symptom", +name: "تطاول زمن النزف", +common_name: "تطاول زمن النزف", +}, +{ +id: "s_594", +type: "symptom", +name: "نمش", +common_name: "نقاط حمراء على الجلد قطرها أقل من 3 ميليمتر لا تختفي بعد الضغط عليها", +}, +{ +id: "s_598", +type: "symptom", +name: "خرّاج", +common_name: "تورّم في الجلد مصحوب باحمرار وألم فيه", +}, +{ +id: "s_603", +type: "symptom", +name: "تبقرط الأظافر", +common_name: "تضخم أطرف الأصابع", +}, +{ +id: "s_604", +type: "symptom", +name: "صداع، واخز", +common_name: "صداع طاعن", +}, +{ +id: "s_605", +type: "symptom", +name: "نوب من الصداع خلال فترة معينة", +common_name: "نوب من الصداع", +}, +{ +id: "s_606", +type: "symptom", +name: "رؤية لمعان أمام العين", +common_name: "ومضات في العين", +}, +{ +id: "s_607", +type: "symptom", +name: "احمرار اللسان", +common_name: "لسان محمر بشكل غير طبيعي", +}, +{ +id: "s_608", +type: "symptom", +name: "التهاب الشفة الزاوي", +common_name: "تشقق زوايا الشفتين", +}, +{ +id: "s_609", +type: "symptom", +name: "مضض في الثدي، أحادي الجانب", +common_name: "ألم في واحد فقط من الثديين عند الضغط عليه", +}, +{ +id: "s_610", +type: "symptom", +name: "غشاء على اللوزتين", +common_name: "بقع بيضاء على اللوزتين", +}, +{ +id: "s_611", +type: "symptom", +name: "بول داكن", +common_name: "بول غامق اللون", +}, +{ +id: "s_612", +type: "symptom", +name: "ألم عظمي", +common_name: "ألم في العظام", +}, +{ +id: "s_613", +type: "symptom", +name: "لويحة صفراء", +common_name: "آفات جلدية صفراء على الجفنين", +}, +{ +id: "s_614", +type: "symptom", +name: "حكة بعد حمام ساخن", +common_name: "حكة بعد حمام ساخن", +}, +{ +id: "s_616", +type: "symptom", +name: "وذمة، في الوجه", +common_name: "تورّم في الوجه", +}, +{ +id: "s_618", +type: "symptom", +name: "الطلوان المشعر", +common_name: "الصداف", +}, +{ +id: "s_622", +type: "symptom", +name: "ضمور الكتلة العضلية", +common_name: "ضمور العضلات", +}, +{ +id: "s_623", +type: "symptom", +name: "وذمة، في الكاحلين", +common_name: "كاحلين متورمين", +}, +{ +id: "s_625", +type: "symptom", +name: "صداع، يشتد بثني الرأس نحو الأمام", +common_name: "ألم رأس عند إمالة الرأس إلى الإمام", +}, +{ +id: "s_629", +type: "symptom", +name: "الشعور بالعجز", +common_name: "الشعور بالعجز", +}, +{ +id: "s_630", +type: "symptom", +name: "حكة فرجية مهبلية", +common_name: "حكة فرجية مهبلية", +}, +{ +id: "s_631", +type: "symptom", +name: "ضعف التركيز", +common_name: "ضعف الانتباه", +}, +{ +id: "s_632", +type: "symptom", +name: "الشعور باليأس", +common_name: "الشعور باليأس", +}, +{ +id: "s_633", +type: "symptom", +name: "نوبة مزاج مرتفع", +common_name: "مزاج مرتفع", +}, +{ +id: "s_634", +type: "symptom", +name: "نقص الحاجة للنوم", +common_name: "نقص الحاجة للنوم", +}, +{ +id: "s_635", +type: "symptom", +name: "المجادلة", +common_name: "الرغبة بالجدال والدخول في نزاع ونقاش مع الآخرين", +}, +{ +id: "s_636", +type: "symptom", +name: "تهوّر مالي", +common_name: "تهوّر مالي", +}, +{ +id: "s_637", +type: "symptom", +name: "تسارع وتيرة التفكير والكلام", +common_name: "تسارع وتيرة التفكير والكلام", +}, +{ +id: "s_640", +type: "symptom", +name: "زحير", +common_name: "الشعور بتغوّط غير تام", +}, +{ +id: "s_641", +type: "symptom", +name: "عدم استمساك برازي", +common_name: "تسرّب غير إرادي للبراز", +}, +{ +id: "s_642", +type: "symptom", +name: "إفرازات مخاطية في البراز", +common_name: "مخاط في البراز", +}, +{ +id: "s_646", +type: "symptom", +name: "تقلبات المزاج", +common_name: "تقلبات المزاج", +}, +{ +id: "s_647", +type: "symptom", +name: "توهمات بصرية بسيطة", +common_name: "توهمات بصرية بسيطة", +}, +{ +id: "s_648", +type: "symptom", +name: "توهمات سمعية بسيطة", +common_name: "توهمات سمعية بسيطة", +}, +{ +id: "s_649", +type: "symptom", +name: "بطء حركي نفسي", +common_name: "بطء حركي نفسي", +}, +{ +id: "s_650", +type: "symptom", +name: "ضعف عضلي", +common_name: "ضعف في العضلات", +}, +{ +id: "s_651", +type: "symptom", +name: "رَنَح", +common_name: "اضطرابات في التناسق الحركي", +}, +{ +id: "s_652", +type: "symptom", +name: "المُنعكسات الوترِية العميقة، ضعيفة", +common_name: "ضعف المنعكسات الوترية العميقة", +}, +{ +id: "s_653", +type: "symptom", +name: "تغير في اتساع حدقة العين", +common_name: "تغير في اتساع حدقة العين", +}, +{ +id: "s_659", +type: "symptom", +name: "العزلة الاجتماعية", +common_name: "العزلة الاجتماعية", +}, +{ +id: "s_660", +type: "symptom", +name: "نوبات غضب", +common_name: "نوبات غضب", +}, +{ +id: "s_662", +type: "symptom", +name: "سعال، منتج صباحاً", +common_name: "سعال منتج لبلغم في الصباح", +}, +{ +id: "s_663", +type: "symptom", +name: "ألم في الظهر، قطني، ينتشر إلى المنطقة الإربيّة", +common_name: "ألم في أسفل الظهر ينتشر إلى المغبن", +}, +{ +id: "s_664", +type: "symptom", +name: "بقع كوبليك", +common_name: "بقع بيضاء صغيرة بحواف حمراء في الفم على الوجه الداخلي للخدين", +}, +{ +id: "s_665", +type: "symptom", +name: "طفح الحصبة", +common_name: "طفح الحصبة", +}, +{ +id: "s_666", +type: "symptom", +name: "بقع مرقطة كالفهد على الجلد", +common_name: "بقع بلون الطوب تشبه الفهد المرقط", +}, +{ +id: "s_668", +type: "symptom", +name: "خوص وحيد الجانب", +common_name: "عين غائرة", +}, +{ +id: "s_669", +type: "symptom", +name: "لاتعرّق، في الوجه، أحادي الجانب", +common_name: "غياب ظاهرة التعرق على أحد جانبي الوجه", +}, +{ +id: "s_670", +type: "symptom", +name: "سعال، منتج لقشع رغوي وردي اللون", +common_name: "سعال منتج لبلغم زهري اللون", +}, +{ +id: "s_671", +type: "symptom", +name: "توسّع أوردة العنق", +common_name: "انتفاخ أوردة الرقبة", +}, +{ +id: "s_673", +type: "symptom", +name: "تضخم اللسان", +common_name: "انتفاخ اللسان", +}, +{ +id: "s_675", +type: "symptom", +name: "وهم الاضطهاد", +common_name: "الاعتقاد بأن الشخص مراقب أو أن الآخرين يتآمرون عليه أو يحاولون إعاقته ومنعه من الوصول لمبتغاه", +}, +{ +id: "s_676", +type: "symptom", +name: "وهم الإسناد", +common_name: "الاعتقاد بوجود رسائل سرية خاصة موجهة للشخص", +}, +{ +id: "s_677", +type: "symptom", +name: "توهم العظمة", +common_name: "جنون العظمة", +}, +{ +id: "s_678", +type: "symptom", +name: "الوهم العدمي", +common_name: "الاعتقاد بأن الشخص أو جزء منه ميت أو غير موجود كلياً", +}, +{ +id: "s_679", +type: "symptom", +name: "الوهم المَرَضي", +common_name: "الاعتقاد بالإصابة بمرض رغم نفي الأطباء ذلك", +}, +{ +id: "s_680", +type: "symptom", +name: "وهم التأثير", +common_name: "الاعتقاد بأن أفكار الشخص أو تصرفاته يتحكم بها شخص أو جهة خارجية", +}, +{ +id: "s_681", +type: "symptom", +name: "هلوسات، بصرية", +common_name: "رؤية أشياء لا يراها الآخرون", +}, +{ +id: "s_682", +type: "symptom", +name: "هلوسات، سمعية", +common_name: "سماع كلام أو أصوات لا يسمعها الآخرون", +}, +{ +id: "s_689", +type: "symptom", +name: "التبول بكميات صغيرة", +common_name: "التبول بكميات صغيرة", +}, +{ +id: "s_690", +type: "symptom", +name: "الإلحاح البولي", +common_name: "رغبة ملحة بالتبول", +}, +{ +id: "s_691", +type: "symptom", +name: "صعوبة البدء في التبول", +common_name: "صعوبة البدء في التبول", +}, +{ +id: "s_692", +type: "symptom", +name: "احمرار وتوذّم في مخاطية الفم", +common_name: "احمرار وتورم داخل الفم", +}, +{ +id: "s_694", +type: "symptom", +name: "آفات فموية", +common_name: "تغيرات داخل الفم", +}, +{ +id: "s_696", +type: "symptom", +name: "احتباس البول", +common_name: "عدم القدرة على التبول عندما تكون المثانة ممتلئة", +}, +{ +id: "s_697", +type: "symptom", +name: "مرونة الجلد منخفضة", +common_name: "انخفاض مرونة الجلد", +}, +{ +id: "s_698", +type: "symptom", +name: "غؤور ثنائي الجانب في العينين", +common_name: "غؤور كلا العينين", +}, +{ +id: "s_699", +type: "symptom", +name: "وذمة، تتعلّق بوضعية الجسم", +common_name: "تورم يعتمد على وضعية الجسم", +}, +{ +id: "s_700", +type: "symptom", +name: "وذمة", +common_name: "تورم", +}, +{ +id: "s_701", +type: "symptom", +name: "وذمة، تشتد أثناء النهار", +common_name: "تورم يزداد خلال النهار", +}, +{ +id: "s_711", +type: "symptom", +name: "نساوة تفارقية لحادث رضي", +common_name: "صعوبة تذكّر تفاصيل الحدث الراض", +}, +{ +id: "s_715", +type: "symptom", +name: "عطاس", +common_name: "عطاس", +}, +{ +id: "s_716", +type: "symptom", +name: "ضعف في الوظائف الاجتماعية", +common_name: "صعوبة في أداء المهام في المنزل أو العمل أو المدرسة", +}, +{ +id: "s_725", +type: "symptom", +name: "المبالغة في القلق على صحة الطفل", +common_name: "المبالغة في القلق على صحة الطفل", +}, +{ +id: "s_727", +type: "symptom", +name: "صعوبة في توثيق العلاقة مع رضيع", +common_name: "صعوبة في توثيق العلاقة مع طفل", +}, +{ +id: "s_728", +type: "symptom", +name: "أفكار تتعلق بإيذاء طفلك", +common_name: "أفكار تتعلق بإيذاء طفلك", +}, +{ +id: "s_729", +type: "symptom", +name: "أفكار تتعلّق بالرغبة في قتل طفلك", +common_name: "أفكار تتعلّق بالرغبة في قتل طفلك", +}, +{ +id: "s_730", +type: "symptom", +name: "تقلبات مزاج، ذات نمط نهاري", +common_name: "نفسية ومزاج أفضل في الليل منه في النهار", +}, +{ +id: "s_732", +type: "symptom", +name: "ألم في الطرف السفلي، في الربلة، شديد أثناء المشي، عرج متقطع", +common_name: "ألم في الساق أثناء القيام بمجهود ويخف بالراحة", +}, +{ +id: "s_733", +type: "symptom", +name: "اضطراب الانتصاب", +common_name: "ضعف الانتصاب", +}, +{ +id: "s_734", +type: "symptom", +name: "عرج متقطع في القسم العلوي من الطرف السفلي", +common_name: "ألم في الأرداف والفخذين يظهر عند القيام بمجهود جسدي ويختفي عند الراحة لفترة قصيرة", +}, +{ +id: "s_735", +type: "symptom", +name: "ضعف النبض في الساقين", +common_name: "ضعف النبض في الساقين", +}, +{ +id: "s_746", +type: "symptom", +name: "اضطراب أو ضعف الحس العميق", +common_name: "اضطراب أو ضعف الحس العميق", +}, +{ +id: "s_747", +type: "symptom", +name: "غياب أو اضطراب حس الحرارة", +common_name: "غياب أو اضطراب حس الحرارة", +}, +{ +id: "s_750", +type: "symptom", +name: "اضطراب في حركة كرة العين", +common_name: "صعوبة في تحريك العينين", +}, +{ +id: "s_756", +type: "symptom", +name: "حطاطات غوترون", +common_name: "نتوءات حمراء مؤلمة على الجلد الذي يغطي مفاصل اليد والأصابع", +}, +{ +id: "s_757", +type: "symptom", +name: "علامة هولستر", +common_name: "احمرار السطح الجانبي للفخذ والوركين", +}, +{ +id: "s_758", +type: "symptom", +name: "حمامى على الكتفين ومؤخرة العنق", +common_name: "احمرار في الكتفين والوجه الخلفي من الرقبة", +}, +{ +id: "s_759", +type: "symptom", +name: "حمامى بشكل V على الصدر", +common_name: "احمرار بشكل V على الصدر", +}, +{ +id: "s_760", +type: "symptom", +name: "يد الميكانيكي", +common_name: "تسمك وتشقق في جلد اليدين", +}, +{ +id: "s_762", +type: "symptom", +name: "طفح فرفري", +common_name: "طفح بشكل بقع حمراء أو زهرية يزيد قطرها عن 3 مم ولا يزول لونها بالضغط عليها", +}, +{ +id: "s_763", +type: "symptom", +name: "تزرق شبكي", +common_name: "جلد مبقع", +}, +{ +id: "s_768", +type: "symptom", +name: "وهم الخطيئة", +common_name: "الاعتقاد بأن الشخص شرير أو مذنب أو أنه مسؤول عن كارثة كبيرة", +}, +{ +id: "s_769", +type: "symptom", +name: "الوهم الغريب", +common_name: "معتقدات غريبة أو مستحيلة الحدوث، كالاعتقاد بوجود كائنات فضائية أو الاستنساخ أو الانتقال الفوري من مكان لآخر", +}, +{ +id: "s_770", +type: "symptom", +name: "إهمال النظافة الشخصية", +common_name: "إهمال النظافة الشخصية", +}, +{ +id: "s_773", +type: "symptom", +name: "سوء التوافق الاجتماعي", +common_name: "سوء التوافق الاجتماعي", +}, +{ +id: "s_776", +type: "symptom", +name: "الاستيقاظ المبكر", +common_name: "الاستيقاظ المبكر", +}, +{ +id: "s_777", +type: "symptom", +name: "النوم لفترات طويلة", +common_name: "النوم لفترات طويلة", +}, +{ +id: "s_778", +type: "symptom", +name: "انعدام الاحترام في العلاقات الاجتماعية", +common_name: "انعدام التكلف في العلاقات الاجتماعية", +}, +{ +id: "s_779", +type: "symptom", +name: "اتخاذ قرارات طائشة أو متهوّرة", +common_name: "اتخاذ قرارات طائشة أو متهوّرة", +}, +{ +id: "s_780", +type: "symptom", +name: "وهم ديني", +common_name: "الاعتقاد بأن الشخص نبي مرسل من الله أو أنه إله", +}, +{ +id: "s_789", +type: "symptom", +name: "شرى يتحرّض بالخدش", +common_name: "طفح جلدي حاك بعد الخدش", +}, +{ +id: "s_790", +type: "symptom", +name: "شرى يتحرض بالضغط المديد على الجلد", +common_name: "طفح جلدي حاك يظهر بعد الضغط المديد على الجلد", +}, +{ +id: "s_791", +type: "symptom", +name: "شرى يتحرّض بالبرد", +common_name: "طفح جلدي حاك يظهر بعد التعرض للبرد أو الماء أو الرياح", +}, +{ +id: "s_793", +type: "symptom", +name: "شرى يتحرّض بالحرارة", +common_name: "طفح جلدي حاك يظهر بعد التعرض للحرارة", +}, +{ +id: "s_795", +type: "symptom", +name: "براز رفيع كالقلم", +common_name: "براز رفيع كالقلم", +}, +{ +id: "s_799", +type: "symptom", +name: "صداع، يشتد صباحاً", +common_name: "ألم رأس صباحي", +}, +{ +id: "s_801", +type: "symptom", +name: "إقياء قذفي", +common_name: "إقياء يقذف بقوة كبيرة", +}, +{ +id: "s_803", +type: "symptom", +name: "وذمة الحليمة البصرية", +common_name: "وذمة الحليمة البصرية", +}, +{ +id: "s_814", +type: "symptom", +name: "عمى شقي صدغي مزدوج", +common_name: "عمى شقي صدغي مزدوج", +}, +{ +id: "s_817", +type: "symptom", +name: "شرب الكحول، توق شديد للشرب", +common_name: "رغبة شديدة ومستمرة بشرب الكحول", +}, +{ +id: "s_818", +type: "symptom", +name: "شرب الكحول، متلازمة السحب", +common_name: "متلازمة الانسحاب الكحولي", +}, +{ +id: "s_820", +type: "symptom", +name: "شرب الكحول، إهمال الواجبات بسبب الكحول", +common_name: "إهمال العائلة أو العمل أو الهوايات بسبب الكحول", +}, +{ +id: "s_824", +type: "symptom", +name: "شرب الكحول، انتهاك المعايير الاجتماعية تحت تأثير الكحول", +common_name: "انتهاك التقاليد الاجتماعية بعد شرب الكحول", +}, +{ +id: "s_825", +type: "symptom", +name: "ضعف الذاكرة، المتعلقة بالكحول", +common_name: "نساوة متعلقة بالكحول", +}, +{ +id: "s_828", +type: "symptom", +name: "شرب الكحول، وحيداً", +common_name: "شرب الكحول وحيداً", +}, +{ +id: "s_829", +type: "symptom", +name: "شرب الكحول، سراً", +common_name: "شرب الكحول سراً", +}, +{ +id: "s_830", +type: "symptom", +name: "ضعف الذاكرة، قصيرة الأمد", +common_name: "ضعف الذاكرة قصيرة الأمد", +}, +{ +id: "s_831", +type: "symptom", +name: "تخريف", +common_name: "تخريف", +}, +{ +id: "s_833", +type: "symptom", +name: "عَمَه", +common_name: "عدم القدرة على التعرف على الأشياء أو الأشخاص أو الأصوات أو الأشكال أو الروائح", +}, +{ +id: "s_835", +type: "symptom", +name: "نوبات مزاج اكتئابي، نمط موسمي", +common_name: "أعراض اكتئاب تحدث في نفس الوقت كل سنة", +}, +{ +id: "s_836", +type: "symptom", +name: "لجلجة فصامية", +common_name: "لجلجة فصامية", +}, +{ +id: "s_837", +type: "symptom", +name: "حبسة كلامية", +common_name: "عسر النطق", +}, +{ +id: "s_838", +type: "symptom", +name: "اضطراب التفكير المنطقي", +common_name: "اضطراب التفكير المنطقي", +}, +{ +id: "s_856", +type: "symptom", +name: "وزيز بإصغاء الصدر", +common_name: "وزيز بإصغاء الصدر", +}, +{ +id: "s_857", +type: "symptom", +name: "خراخر ناعمة بإصغاء الصدر", +common_name: "خراخر ناعمة بإصغاء الصدر", +}, +{ +id: "s_866", +type: "symptom", +name: "علامة تروسو للتكزز الكامن", +common_name: "علامة تروسو للتكزز الكامن", +}, +{ +id: "s_867", +type: "symptom", +name: "علامة شيفوستيك", +common_name: "علامة شيفوستيك", +}, +{ +id: "s_868", +type: "symptom", +name: "تشنجات في العضلة الدويرية الفموية", +common_name: "تشنجات في العضلة الدويرية الفموية", +}, +{ +id: "s_869", +type: "symptom", +name: "القدم القفداء الفحجاء", +common_name: "القدم القفداء الفحجاء", +}, +{ +id: "s_878", +type: "symptom", +name: "المنعكسات الوترية العميقة، مشتدة", +common_name: "اشتداد المنعكسات الوترية العميقة", +}, +{ +id: "s_884", +type: "symptom", +name: "رُهاب الخلاء", +common_name: "رهاب الساح", +}, +{ +id: "s_917", +type: "symptom", +name: "الأرق", +common_name: "الأرق", +}, +{ +id: "s_935", +type: "symptom", +name: "ضعف حاسة السمع، بشدّة ومُدد متفاوتة", +common_name: "ضعف حاسة السمع بدرجات متفاوتة في الشدة وفترات زمنيّة متغيّرة", +}, +{ +id: "s_936", +type: "symptom", +name: "دوار، الشعور بدوران المحيط", +common_name: "الشعور بأن المحيط يدور", +}, +{ +id: "s_957", +type: "symptom", +name: "عمى شقي توافقي", +common_name: "فقدان الساحة البصرية في نفس الجانب من كلتا العينين", +}, +{ +id: "s_959", +type: "symptom", +name: "فقدان الحس في الوجه", +common_name: "غياب الإحساس في الوجه", +}, +{ +id: "s_962", +type: "symptom", +name: "عسر البلع", +common_name: "صعوبة في البلع", +}, +{ +id: "s_964", +type: "symptom", +name: "انحراف الجسم لأحد الجانبين", +common_name: "السقوط أو ترنّح المشي باتجاه معين", +}, +{ +id: "s_965", +type: "symptom", +name: "ألم في العنق، أحادي الجانب", +common_name: "ألم أحادي الجانب في الرقبة", +}, +{ +id: "s_967", +type: "symptom", +name: "انخفاض في حدة البصر", +common_name: "انخفاض في حدة الرؤية", +}, +{ +id: "s_970", +type: "symptom", +name: "صداع، قفوي", +common_name: "ألم في الرأس في الجزء الخلفي منه", +}, +{ +id: "s_971", +type: "symptom", +name: "خدر، في الوجه", +common_name: "تنميل في الوجه", +}, +{ +id: "s_972", +type: "symptom", +name: "غياب الحس في كلا الذراعين", +common_name: "نقص الإحساس في كلا الذراعين", +}, +{ +id: "s_973", +type: "symptom", +name: "خدر، في كلا الطرفين العلويين", +common_name: "تنميل في كلا الطرفين العلويين", +}, +{ +id: "s_989", +type: "symptom", +name: "علامات هرمية", +common_name: "علامات هرمية", +}, +{ +id: "s_990", +type: "symptom", +name: "علامات جبهية", +common_name: "علامات جبهية", +}, +{ +id: "s_991", +type: "symptom", +name: "اشتداد منعكس الفك السفلي", +common_name: "منعكس رجفاني فكي", +}, +{ +id: "s_995", +type: "symptom", +name: "ضمور عضلة اللسان", +common_name: "صغر في حجم اللسان", +}, +{ +id: "s_996", +type: "symptom", +name: "خلل المقوية الرقبية", +common_name: "خلل المقوية الرقبية", +}, +{ +id: "s_1006", +type: "symptom", +name: "غياب الدافع أو المحفز", +common_name: "غياب الدافع أو المحفز", +}, +{ +id: "s_1007", +type: "symptom", +name: "غياب الوازع", +common_name: "غياب الوازع", +}, +{ +id: "s_1010", +type: "symptom", +name: "اللاأدائية", +common_name: "العمه الحركي", +}, +{ +id: "s_1012", +type: "symptom", +name: "اللاكتابيّة", +common_name: "فقدان القدرة على الكتابة", +}, +{ +id: "s_1013", +type: "symptom", +name: "لاأدائيّة في عضلات الوجه والشدق المحيطة بالفم", +common_name: "لاأدائيّة في عضلات الوجه والشدق المحيطة بالفم", +}, +{ +id: "s_1018", +type: "symptom", +name: "المداومة", +common_name: "المداومة", +}, +{ +id: "s_1021", +type: "symptom", +name: "ضعف المنعكسات السطحية", +common_name: "ضعف المنعكسات السطحية", +}, +{ +id: "s_1023", +type: "symptom", +name: "علامة بابنسكي", +common_name: "علامة بابنسكي", +}, +{ +id: "s_1027", +type: "symptom", +name: "غياب الرؤية في ربع علوي", +common_name: "غياب الرؤية في ربع علوي", +}, +{ +id: "s_1028", +type: "symptom", +name: "العمه اللفظي السمعي", +common_name: "العمه اللفظي السمعي", +}, +{ +id: "s_1032", +type: "symptom", +name: "عمه الموسيقى", +common_name: "فقدان القدرة على تمييز أو إصدار الأصوات الموسيقية", +}, +{ +id: "s_1034", +type: "symptom", +name: "عمه بصري", +common_name: "عمه بصري", +}, +{ +id: "s_1035", +type: "symptom", +name: "ضعف الاستجابة بالخوف", +common_name: "عدم وجود الخوف", +}, +{ +id: "s_1045", +type: "symptom", +name: "تضخم الطحال", +common_name: "طحال متضخم", +}, +{ +id: "s_1050", +type: "symptom", +name: "سقوط الأسنان", +common_name: "فقدان أسنان", +}, +{ +id: "s_1051", +type: "symptom", +name: "ضخامة كبدية", +common_name: "ضخامة كبدية", +}, +{ +id: "s_1052", +type: "symptom", +name: "تضخم الكليتين", +common_name: "تضخم الكليتين", +}, +{ +id: "s_1054", +type: "symptom", +name: "علامة ليرميت", +common_name: "علامة ليرميت", +}, +{ +id: "s_1055", +type: "symptom", +name: "التهاب العصب خلف المقلة", +common_name: "التهاب العصب خلف المقلة", +}, +{ +id: "s_1056", +type: "symptom", +name: "ألم العصب مثلث التوائم", +common_name: "ألم العصب مثلث التوائم", +}, +{ +id: "s_1057", +type: "symptom", +name: "تضخم في الغدد اللعابية", +common_name: "تضخم في الغدد اللعابية", +}, +{ +id: "s_1063", +type: "symptom", +name: "خدر، في كلا الطرفين السفليين", +common_name: "تنميل في كلا الطرفين السفليين", +}, +{ +id: "s_1066", +type: "symptom", +name: "خدر في كلا الطرفين العلويين، بشكل القفاز", +common_name: "خدر في كلا الطرفين العلويين، بشكل القفاز", +}, +{ +id: "s_1067", +type: "symptom", +name: "احمرار الوجه المفاجىء", +common_name: "احمرار الوجه بشكل مفاجىء", +}, +{ +id: "s_1068", +type: "symptom", +name: "خدر، متناظر", +common_name: "تنميل متناظر", +}, +{ +id: "s_1069", +type: "symptom", +name: "خدر صاعد", +common_name: "تنميل صاعد في الجسم", +}, +{ +id: "s_1070", +type: "symptom", +name: "غياب شعور الاهتزاز في نهايات الأطراف", +common_name: "غياب شعور الاهتزاز في نهايات الأطراف", +}, +{ +id: "s_1072", +type: "symptom", +name: "غياب المُنعكسات العميقة", +common_name: "غياب المُنعكسات العميقة", +}, +{ +id: "s_1073", +type: "symptom", +name: "غياب منعكس وتر أشيل في الجهتين", +common_name: "غياب منعكس وتر أشيل في الجهتين", +}, +{ +id: "s_1074", +type: "symptom", +name: "تغيرات تغذوية", +common_name: "تغيرات تغذوية", +}, +{ +id: "s_1076", +type: "symptom", +name: "قرحة اغتذائية", +common_name: "قرحة اغتذائية", +}, +{ +id: "s_1078", +type: "symptom", +name: "قرحة اغتذائية، في أخمص القدم", +common_name: "قرحة تغذوية عصبية في أخمص القدم", +}, +{ +id: "s_1083", +type: "symptom", +name: "ضمور العضلات بين العظام في اليدين", +common_name: "ضمور العضلات بين العظام في اليدين", +}, +{ +id: "s_1084", +type: "symptom", +name: "ضمور العضلات بين العظام في القدمين", +common_name: "ضمور العضلات بين العظام في القدمين", +}, +{ +id: "s_1087", +type: "symptom", +name: "الخوف من الجنون", +common_name: "الخوف من الجنون", +}, +{ +id: "s_1088", +type: "symptom", +name: "الخوف من فقدان السيطرة على الأمور", +common_name: "الخوف من فقدان السيطرة على الأمور", +}, +{ +id: "s_1089", +type: "symptom", +name: "تضخم البروستات", +common_name: "تضخم البروستات", +}, +{ +id: "s_1090", +type: "symptom", +name: "عيون زجاجية", +common_name: "عيون زجاجية", +}, +{ +id: "s_1091", +type: "symptom", +name: "قضأ الملتحمة", +common_name: "قضأ الملتحمة", +}, +{ +id: "s_1092", +type: "symptom", +name: "إيجابية اختبارات الحساسية الجلدية (بالوخز أو البقع)", +common_name: "إيجابية اختبارات الحساسية الجلدية (بالوخز أو البقع)", +}, +{ +id: "s_1093", +type: "symptom", +name: "إيجابية اختبار الحساسية", +common_name: "إيجابية اختبار الحساسية", +}, +{ +id: "s_1094", +type: "symptom", +name: "تقشع", +common_name: "تنخم", +}, +{ +id: "s_1095", +type: "symptom", +name: "ضعف حاسة الشم", +common_name: "نقص حاسة الشم", +}, +{ +id: "s_1096", +type: "symptom", +name: "اضطرابات حاسة الذوق", +common_name: "اضطراب أو فقدان حاسة التذوق", +}, +{ +id: "s_1097", +type: "symptom", +name: "تورم في الغشاء المخاطي للأنف", +common_name: "تورم في الغشاء المخاطي للأنف", +}, +{ +id: "s_1098", +type: "symptom", +name: "توذم في الغشاء المخاطي وتلونه بالأزرق أو الأزرق المخضر", +common_name: "توذم في الغشاء المخاطي وتلونه بالأزرق أو الأزرق المخضر", +}, +{ +id: "s_1099", +type: "symptom", +name: "توذّم القرينات الأنفية", +common_name: "توذّم القرينات الأنفية", +}, +{ +id: "s_1100", +type: "symptom", +name: "ثلم مستعرض على الأنف", +common_name: "ثلم مستعرض على الأنف", +}, +{ +id: "s_1102", +type: "symptom", +name: "تضخم العقد اللمفاوية الحنكية، ثنائي الجانب", +common_name: "تورم في جانبي الحلق", +}, +{ +id: "s_1103", +type: "symptom", +name: "تضخم في النسج اللمفاوية في البلعوم", +common_name: "تضخم في النسج اللمفاوية في البلعوم", +}, +{ +id: "s_1104", +type: "symptom", +name: "تنفس فموي", +common_name: "التنفس من الفم", +}, +{ +id: "s_1105", +type: "symptom", +name: "زرقة تحت العينين", +common_name: "دوائر سوداء تحت العينين", +}, +{ +id: "s_1106", +type: "symptom", +name: "طيّة ديني-مورغان", +common_name: "طيّة ديني-مورغان", +}, +{ +id: "s_1107", +type: "symptom", +name: "غشاء طبل معتم", +common_name: "غشاء طبل معتم", +}, +{ +id: "s_1108", +type: "symptom", +name: "تحدّب قبة الحنك", +common_name: "تحدّب قبة الحنك", +}, +{ +id: "s_1109", +type: "symptom", +name: "مفرزات في الأذن الوسطى", +common_name: "مفرزات في الأذن الوسطى", +}, +{ +id: "s_1110", +type: "symptom", +name: "عضة عميقة", +common_name: "عضة عميقة", +}, +{ +id: "s_1111", +type: "symptom", +name: "سحنة غُدانيّة‎", +common_name: "سحنة غُدانيّة‎", +}, +{ +id: "s_1112", +type: "symptom", +name: "ألم في كلا الطرفين السفليين، بتوزّع الجوارب", +common_name: "ألم في كلا الطرفين السفليين مكان الجوارب", +}, +{ +id: "s_1114", +type: "symptom", +name: "أظافر تيري", +common_name: "أظافر تيري", +}, +{ +id: "s_1115", +type: "symptom", +name: "نقص أشعار الجسم", +common_name: "نقص أشعار الجسم", +}, +{ +id: "s_1116", +type: "symptom", +name: "حَبَن", +common_name: "تجمع سائل في البطن", +}, +{ +id: "s_1117", +type: "symptom", +name: "ضمور أو صِغَر في كلتا الخصيتين", +common_name: "خصيتان صغيرتان", +}, +{ +id: "s_1119", +type: "symptom", +name: "ضعف عضلة المثانة العاصرة", +common_name: "ضعف عضلة المثانة العاصرة", +}, +{ +id: "s_1123", +type: "symptom", +name: "لاتعرّق", +common_name: "نقص التعرق", +}, +{ +id: "s_1125", +type: "symptom", +name: "حمامى، راحيّة", +common_name: "احمرار في راحتي اليدين", +}, +{ +id: "s_1139", +type: "symptom", +name: "أفكار انتحارية", +common_name: "أفكار انتحارية", +}, +{ +id: "s_1140", +type: "symptom", +name: "نية انتحارية", +common_name: "أفكار وخطوات متبعة نحو الانتحار", +}, +{ +id: "s_1141", +type: "symptom", +name: "علامة روسيل", +common_name: "علامة روسيل", +}, +{ +id: "s_1142", +type: "symptom", +name: "ألم عضلي", +common_name: "ألم في العضلات", +}, +{ +id: "s_1144", +type: "symptom", +name: "تورم الشريان الصدغي", +common_name: "تورم الشريان الصدغي", +}, +{ +id: "s_1145", +type: "symptom", +name: "احمرار في المنطقة الصدغية", +common_name: "احمرار أعلى الأذن", +}, +{ +id: "s_1146", +type: "symptom", +name: "ضعف الرؤية، مع ألم صدغي في نفس جانب ضعف الرؤية", +common_name: "ألم في جانب الرأس وضعف في الرؤية في نفس الجانب", +}, +{ +id: "s_1147", +type: "symptom", +name: "شلل العصب محرّك العين", +common_name: "شلل العصب محرّك العين", +}, +{ +id: "s_1148", +type: "symptom", +name: "خدر في اللسان", +common_name: "تنميل في اللسان", +}, +{ +id: "s_1150", +type: "symptom", +name: "فرط حساسية للأصوات", +common_name: "زيادة الحساسية للأصوات", +}, +{ +id: "s_1153", +type: "symptom", +name: "اضطراب حاسة الذوق في الثلثين الأماميين من اللسان", +common_name: "اضطراب حاسة الذوق في الثلثين الأماميين من اللسان", +}, +{ +id: "s_1159", +type: "symptom", +name: "نقص الحس في نصف الوجه", +common_name: "نقص الإحساس في جانب واحد من الوجه", +}, +{ +id: "s_1162", +type: "symptom", +name: "وذمة مخاطية أمام الظنبوب", +common_name: "وذمة مخاطية أمام الظنبوب", +}, +{ +id: "s_1163", +type: "symptom", +name: "جحوظ العين", +common_name: "بروز إحدى أو كلا العينين", +}, +{ +id: "s_1165", +type: "symptom", +name: "شعور بحرقة جلديّة", +common_name: "الشعور بحرقة في الجلد", +}, +{ +id: "s_1166", +type: "symptom", +name: "نقص تنسج ميناء الأسنان", +common_name: "نقص تنسج ميناء الأسنان", +}, +{ +id: "s_1167", +type: "symptom", +name: "ضمور الأظافر", +common_name: "تشوّه الأظافر أو تغير لونها", +}, +{ +id: "s_1170", +type: "symptom", +name: "انصباب دموي مفصلي", +common_name: "نزف في المفصل", +}, +{ +id: "s_1171", +type: "symptom", +name: "علامة دارييه", +common_name: "علامة دارييه", +}, +{ +id: "s_1173", +type: "symptom", +name: "كتلة في كيس الصفن", +common_name: "كتلة في كيس الصفن", +}, +{ +id: "s_1175", +type: "symptom", +name: "الشعور بثقل في الصفن", +common_name: "الشعور بثقل في الصفن", +}, +{ +id: "s_1178", +type: "symptom", +name: "ألم صدري، يشتد بالجس", +common_name: "ألم في الصدر يزداد عند اللمس أو الضغط", +}, +{ +id: "s_1180", +type: "symptom", +name: "ألم خلف الأذن", +common_name: "ألم خلف الأذن", +}, +{ +id: "s_1181", +type: "symptom", +name: "احمرار خلف الأذن", +common_name: "احمرار خلف الأذن", +}, +{ +id: "s_1182", +type: "symptom", +name: "تورم الخشاء", +common_name: "تورم خلف الأذن", +}, +{ +id: "s_1183", +type: "symptom", +name: "علامة وينتربوتوم", +common_name: "علامة وينتربوتوم", +}, +{ +id: "s_1184", +type: "symptom", +name: "غلاف أو غشاء على اللسان", +common_name: "لسان أبيض", +}, +{ +id: "s_1185", +type: "symptom", +name: "زلة تنفسية، بفترات اشتداد وهجوع", +common_name: "ضيق تنفس يزداد تارةً ويتحسّن أخرى", +}, +{ +id: "s_1189", +type: "symptom", +name: "ألم في الظهر، ناكس", +common_name: "ألم متكرر في الظهر", +}, +{ +id: "s_1190", +type: "symptom", +name: "ألم في الظهر", +common_name: "ألم في الظهر", +}, +{ +id: "s_1191", +type: "symptom", +name: "تغيرات جلدية، بنوبات هجوع واشتداد", +common_name: "تغيرات جلدية تشتد تارة وتخف تارة أخرى", +}, +{ +id: "s_1192", +type: "symptom", +name: "ألم في الظهر، شديد", +common_name: "ألم شديد في الظهر", +}, +{ +id: "s_1193", +type: "symptom", +name: "صداع، شديد", +common_name: "ألم رأس شديد", +}, +{ +id: "s_1194", +type: "symptom", +name: "ألم وجهي، شديد", +common_name: "ألم شديد في الوجه", +}, +{ +id: "s_1195", +type: "symptom", +name: "ألم بطني، شديد", +common_name: "ألم شديد في البطن", +}, +{ +id: "s_1197", +type: "symptom", +name: "ألم صدري، شديد", +common_name: "ألم شديد في الصدر", +}, +{ +id: "s_1198", +type: "symptom", +name: "ألم في الظهر، مفاجئ", +common_name: "ألم مفاجئ في الظهر", +}, +{ +id: "s_1200", +type: "symptom", +name: "ألم صدري، مفاجئ", +common_name: "ألم مفاجئ في الصدر", +}, +{ +id: "s_1201", +type: "symptom", +name: "ألم مفصلي، مفاجئ", +common_name: "ألم مفاجئ في مفصل", +}, +{ +id: "s_1202", +type: "symptom", +name: "ألم بطني، يشتد عند الشهيق العميق", +common_name: "ألم في البطن يزداد عند أخذ شهيق عميق", +}, +{ +id: "s_1203", +type: "symptom", +name: "ألم وجهي، يدوم لأكثر من ساعتين", +common_name: "ألم في الوجه يستمر لأكثر من ساعتين", +}, +{ +id: "s_1206", +type: "symptom", +name: "ألم في الظهر، يتحسّن بالراحة", +common_name: "ألم في الظهر يخف عند الراحة", +}, +{ +id: "s_1207", +type: "symptom", +name: "ألم بطني، يشتد بعد تناول الكافيين", +common_name: "ألم في البطن يزداد بعد تناول المشاريب الحاوية على الكافيين", +}, +{ +id: "s_1209", +type: "symptom", +name: "شحوب الجلد، فجائي", +common_name: "شحوب فجائي للجلد", +}, +{ +id: "s_1210", +type: "symptom", +name: "شحوب في الغشاء المخاطي", +common_name: "شحوب في الفم أو الأجفان", +}, +{ +id: "s_1213", +type: "symptom", +name: "شحوب في الغشاء المخاطي، فجائي", +common_name: "شحوب مفاجئ في الأغشية المخاطية", +}, +{ +id: "s_1226", +type: "symptom", +name: "ركبة فحجاء‎", +common_name: "تقوس الساقين", +}, +{ +id: "s_1227", +type: "symptom", +name: "ضعف تحريك العين نحو الوحشي", +common_name: "ضعف تحريك العين نحو الخارج", +}, +{ +id: "s_1228", +type: "symptom", +name: "حول أُنسي", +common_name: "حول", +}, +{ +id: "s_1229", +type: "symptom", +name: "شفع بافتراق أفقي", +common_name: "رؤية مزدوجة مع افتراق أفقي", +}, +{ +id: "s_1230", +type: "symptom", +name: "إمالة الرأس لتجنب حدوث الشفع", +common_name: "ازدواجية في الرؤية تزول بإمالة الرأس", +}, +{ +id: "s_1232", +type: "symptom", +name: "شفع أثناء النظر إلى الأسفل والأنسي", +common_name: "رؤية مزدوجة عند النظر إلى الأسفل والأنسي", +}, +{ +id: "s_1235", +type: "symptom", +name: "شفع عند النظر في كل الاتجاهات", +common_name: "رؤية مزدوجة عند النظر في كل الاتجاهات", +}, +{ +id: "s_1236", +type: "symptom", +name: "حَوَل خارجي", +common_name: "حول في عين واحدة أو كلا العينين نحو الخارج", +}, +{ +id: "s_1237", +type: "symptom", +name: "دوران مقلة العين نحو الوحشي والأسفل", +common_name: "دوران العين إلى الوحشي والأسفل", +}, +{ +id: "s_1238", +type: "symptom", +name: "الحدقة أو الحدقتين غير متفاعلتين مع المطابقة", +common_name: "الحدقة أو الحدقتين غير متفاعلتين مع المطابقة", +}, +{ +id: "s_1239", +type: "symptom", +name: "ضعف تحريك العين إلى الأعلى", +common_name: "صعوبة في النظر للأعلى", +}, +{ +id: "s_1240", +type: "symptom", +name: "ضعف تحريك العين للأنسي", +common_name: "ضعف تحريك العين إلى الداخل", +}, +{ +id: "s_1241", +type: "symptom", +name: "ضعف تحريك العين للأسفل", +common_name: "صعوبة في النظر للأسفل", +}, +{ +id: "s_1250", +type: "symptom", +name: "ألم في المنطقة الإربية يسوء عند العطاس أو السعال أو الضحك أو القيام بالتمارين الرياضية", +common_name: "ألم أعلى الفخذ عند العطاس أو السعال أو الضحك أو القيام بالتمارين الرياضية", +}, +{ +id: "s_1254", +type: "symptom", +name: "علامة غوردون", +common_name: "علامة غوردون", +}, +{ +id: "s_1255", +type: "symptom", +name: "علامة روسوليمو", +common_name: "علامة روسوليمو", +}, +{ +id: "s_1256", +type: "symptom", +name: "علامة أوبنهايم", +common_name: "علامة أوبنهايم", +}, +{ +id: "s_1257", +type: "symptom", +name: "علامة بينغ", +common_name: "علامة بينغ", +}, +{ +id: "s_1258", +type: "symptom", +name: "علامة تشادوك", +common_name: "علامة تشادوك", +}, +{ +id: "s_1259", +type: "symptom", +name: "علامة شيفير", +common_name: "علامة شيفير", +}, +{ +id: "s_1260", +type: "symptom", +name: "علامة سترانسكي", +common_name: "علامة سترانسكي", +}, +{ +id: "s_1261", +type: "symptom", +name: "علامة مندل-بيكتريف", +common_name: "علامة مندل-بيكتريف", +}, +{ +id: "s_1262", +type: "symptom", +name: "علامة ترومنر", +common_name: "علامة ترومنر", +}, +{ +id: "s_1263", +type: "symptom", +name: "علامة غوندا-ألين", +common_name: "علامة غوندا-ألين", +}, +{ +id: "s_1264", +type: "symptom", +name: "رعاش الحركة", +common_name: "رعاش حركي", +}, +{ +id: "s_1265", +type: "symptom", +name: "غياب الحس المتفارق", +common_name: "غياب الحس المتفارق", +}, +{ +id: "s_1268", +type: "symptom", +name: "غياب أو ضعف منعكس القرنية", +common_name: "غياب أو ضعف منعكس القرنية", +}, +{ +id: "s_1270", +type: "symptom", +name: "علامة ستيرلنغ", +common_name: "علامة ستيرلنغ", +}, +{ +id: "s_1271", +type: "symptom", +name: "علامة جاكوبسون", +common_name: "عطف لأصابع اليد عند النقر على النهاية البعيدة للكعبرة", +}, +{ +id: "s_1272", +type: "symptom", +name: "علامة ألين-كليكلي", +common_name: "علامة ألين-كليكلي", +}, +{ +id: "s_1273", +type: "symptom", +name: "علامة كورنيل", +common_name: "علامة كورنيل", +}, +{ +id: "s_1274", +type: "symptom", +name: "علامة مونيز", +common_name: "علامة مونيز", +}, +{ +id: "s_1275", +type: "symptom", +name: "علامة سترومبل", +common_name: "علامة سترومبل", +}, +{ +id: "s_1277", +type: "symptom", +name: "ضعف القدرة على تحريك اللسان", +common_name: "صعوبة في تحريك اللسان", +}, +{ +id: "s_1278", +type: "symptom", +name: "اشتداد المنعكس الحنكي", +common_name: "اشتداد المنعكس الحنكي", +}, +{ +id: "s_1279", +type: "symptom", +name: "اشتداد المنعكس البلعومي", +common_name: "اشتداد المنعكس البلعومي", +}, +{ +id: "s_1280", +type: "symptom", +name: "ضعف أو غياب المنعكس البلعومي", +common_name: "ضعف أو غياب منعكس التهوع", +}, +{ +id: "s_1281", +type: "symptom", +name: "ظاهرة الموس الكباس", +common_name: "ظاهرة الموس الكباس", +}, +{ +id: "s_1282", +type: "symptom", +name: "صمل قضيب الرصاص", +common_name: "تيبس عضلي مستمر وثابت في طرف", +}, +{ +id: "s_1283", +type: "symptom", +name: "صمل الدولاب المسنن", +common_name: "صمل الدولاب المسنن", +}, +{ +id: "s_1285", +type: "symptom", +name: "ضعف الحنك وترهله في نفس الجهة التي يشتبه فيها بحدوث أذية للعصب", +common_name: "ضعف الحنك وترهله في نفس الجهة التي يشتبه فيها بحدوث أذية للعصب", +}, +{ +id: "s_1287", +type: "symptom", +name: "انحراف اللهاة نحو الجهة السليمة", +common_name: "انحراف اللهاة نحو الجهة السليمة", +}, +{ +id: "s_1289", +type: "symptom", +name: "تضخم مبيضي", +common_name: "تضخم مبيضي", +}, +{ +id: "s_1291", +type: "symptom", +name: "شلل عضلي ثنائي الجانب", +common_name: "شلل عضلي ثنائي الجانب", +}, +{ +id: "s_1295", +type: "symptom", +name: "فواق", +common_name: "حازوقة", +}, +{ +id: "s_1297", +type: "symptom", +name: "تباطؤ الحركة", +common_name: "بطء الحركة", +}, +{ +id: "s_1298", +type: "symptom", +name: "عسر المقوية", +common_name: "عسر المقوية", +}, +{ +id: "s_1302", +type: "symptom", +name: "علامة غولدفلام", +common_name: "علامة غولدفلام", +}, +{ +id: "s_1303", +type: "symptom", +name: "الكلام الأنفي", +common_name: "صوت أنفي", +}, +{ +id: "s_1304", +type: "symptom", +name: "إلعاب", +common_name: "إنتاج مفرط للعاب", +}, +{ +id: "s_1310", +type: "symptom", +name: "تلون الأظافر بالبني", +common_name: "تلون الأظافر بالبني", +}, +{ +id: "s_1311", +type: "symptom", +name: "وذمة، في إصبع", +common_name: "إصبع متورم", +}, +{ +id: "s_1312", +type: "symptom", +name: "ألم في منطقة ما حول الظفر", +common_name: "ألم في البشرة المحيطة بالظفر", +}, +{ +id: "s_1313", +type: "symptom", +name: "ألم في الطرف العلوي، في إصبع واحد", +common_name: "ألم في إصبع واحد", +}, +{ +id: "s_1314", +type: "symptom", +name: "حمامى، في إصبع", +common_name: "احمرار في إصبع", +}, +{ +id: "s_1315", +type: "symptom", +name: "قيح تحت جلد أصابع اليد", +common_name: "قيح تحت جلد أصابع اليد", +}, +{ +id: "s_1316", +type: "symptom", +name: "خراخر غاططة بإصغاء الصدر", +common_name: "خراخر غاططة بإصغاء الصدر", +}, +{ +id: "s_1317", +type: "symptom", +name: "زلة تنفسية، انتيابية ليلية", +common_name: "ضيق تنفس أثناء النوم", +}, +{ +id: "s_1322", +type: "symptom", +name: "نمش إبطي أو إربي", +common_name: "نمشات في الإبط وأعلى الفخذ", +}, +{ +id: "s_1323", +type: "symptom", +name: "وجود أورام ليفية عصبية", +common_name: "وجود أورام ليفية عصبية", +}, +{ +id: "s_1324", +type: "symptom", +name: "عقد ليش", +common_name: "عقد ليش", +}, +{ +id: "s_1328", +type: "symptom", +name: "عمى الألوان", +common_name: "صعوبة في تمييز الالوان", +}, +{ +id: "s_1329", +type: "symptom", +name: "شحوب القرص البصري في منطقة دخول العصب البصري", +common_name: "شحوب القرص البصري في منطقة دخول العصب البصري", +}, +{ +id: "s_1330", +type: "symptom", +name: "بقع القهوة بالحليب", +common_name: "6 بقع على الأقل بلون بني فاتح على الجلد", +}, +{ +id: "s_1332", +type: "symptom", +name: "تعب أو ضعف يحدث بعد القيام بالتمارين", +common_name: "شعور بالضعف يزداد بعد القيام بالتمارين الرياضية", +}, +{ +id: "s_1338", +type: "symptom", +name: "أذية لتعصيب منطقتين منفصلتين", +common_name: "أذية لتعصيب منطقتين منفصلتين", +}, +{ +id: "s_1340", +type: "symptom", +name: "علامة ويستفال", +common_name: "علامة ويستفال", +}, +{ +id: "s_1342", +type: "symptom", +name: "فحص الشفوفية في كيس الصفن", +common_name: "فحص الشفوفية في كيس الصفن", +}, +{ +id: "s_1344", +type: "symptom", +name: "نزف شبكي", +common_name: "نزف شبكي", +}, +{ +id: "s_1345", +type: "symptom", +name: "تخليط ذهني ناتج عن رض", +common_name: "تخليط ذهني ناتج عن إصابة", +}, +{ +id: "s_1346", +type: "symptom", +name: "نضحة شبكية صلبة", +common_name: "نضحة شبكية صلبة", +}, +{ +id: "s_1347", +type: "symptom", +name: "نضحة شبكية ناعمة", +common_name: "نضحة شبكية ناعمة", +}, +{ +id: "s_1348", +type: "symptom", +name: "ضعف في النبض المحيطي", +common_name: "ضعف في النبض المحيطي", +}, +{ +id: "s_1349", +type: "symptom", +name: "صداع، جبهي", +common_name: "ألم في الرأس يتوضع قرب الجبهة", +}, +{ +id: "s_1365", +type: "symptom", +name: "إقياء، غالباً في الصباح", +common_name: "إقياء يحدث غالباً في الصباح", +}, +{ +id: "s_1367", +type: "symptom", +name: "احمرار البلعوم", +common_name: "احمرار في الحلق", +}, +{ +id: "s_1369", +type: "symptom", +name: "ألم بطني، حاد وطاعن", +common_name: "ألم في البطن حاد وطاعن كالسكين", +}, +{ +id: "s_1371", +type: "symptom", +name: "حَبَرات على الحنك", +common_name: "بقع صغيرة على الحنك الرخو", +}, +{ +id: "s_1376", +type: "symptom", +name: "إسهال رزي مائي", +common_name: "إسهال يشبه منظر ماء الأرز المنقوع", +}, +{ +id: "s_1377", +type: "symptom", +name: "بقع وردية أسفل الصدر والبطن", +common_name: "بقع وردية أسفل الصدر والبطن", +}, +{ +id: "s_1378", +type: "symptom", +name: "علامة ليفين", +common_name: "علامة ليفين", +}, +{ +id: "s_1379", +type: "symptom", +name: "رجفان عضلي بشكل تدوير حبة الدواء", +common_name: "رجفان بشكل تدوير حبة الدواء", +}, +{ +id: "s_1380", +type: "symptom", +name: "احتكاكات تامورية", +common_name: "احتكاكات تامورية", +}, +{ +id: "s_1381", +type: "symptom", +name: "ألم عند الضغط على القص", +common_name: "ألم عند الضغط على القص", +}, +{ +id: "s_1382", +type: "symptom", +name: "ألم عند الضغط بقوّة على الظنبوب", +common_name: "ألم عند الضغط بقوّة على الظنبوب", +}, +{ +id: "s_1383", +type: "symptom", +name: "علاقات كثيرة غير مستقرة", +common_name: "علاقات كثيرة غير مستقرة", +}, +{ +id: "s_1386", +type: "symptom", +name: "نزف داخل العضلات", +common_name: "نزف داخل العضلات", +}, +{ +id: "s_1387", +type: "symptom", +name: "ألم بطني، شرسوفي", +common_name: "ألم في منتصف القسم العلوي من البطن", +}, +{ +id: "s_1388", +type: "symptom", +name: "عدم تناظر في العنق", +common_name: "رقبة غير متناظرة", +}, +{ +id: "s_1390", +type: "symptom", +name: "توذم البلعوم، في جهة واحدة", +common_name: "تورّم في جانب واحد من الحلق", +}, +{ +id: "s_1392", +type: "symptom", +name: "مضض بطني، في الربع العلوي الأيمن", +common_name: "ألم في البطن عند الضغط على الربع العلوي الأيمن منه", +}, +{ +id: "s_1393", +type: "symptom", +name: "تغوُّط مؤلم", +common_name: "ألم أثناء التغوط", +}, +{ +id: "s_1394", +type: "symptom", +name: "غياب الحليمات الذوقية", +common_name: "غياب البراعم الذوقية", +}, +{ +id: "s_1395", +type: "symptom", +name: "انخفاض شدّة الأصوات التنفسيّة، في قاعدة الرئة اليمنى", +common_name: "انخفاض شدّة الأصوات التنفسيّة، في قاعدة الرئة اليمنى", +}, +{ +id: "s_1396", +type: "symptom", +name: "احتكاكات جنبية", +common_name: "احتكاكات جنبية", +}, +{ +id: "s_1397", +type: "symptom", +name: "نعوظ مستمر", +common_name: "انتصاب لفترة طويلة", +}, +{ +id: "s_1398", +type: "symptom", +name: "النزف الزجاجي", +common_name: "النزف الزجاجي", +}, +{ +id: "s_1399", +type: "symptom", +name: "علامة شافير", +common_name: "علامة شافير", +}, +{ +id: "s_1400", +type: "symptom", +name: "مضض بطني، فوق العانة", +common_name: "ألم في البطن عند الضغط على الجزء السفلي منه", +}, +{ +id: "s_1402", +type: "symptom", +name: "حلقة ويس", +common_name: "حلقة ويس", +}, +{ +id: "s_1403", +type: "symptom", +name: "حدقة ماركوس غن", +common_name: "حدقة ماركوس غن", +}, +{ +id: "s_1404", +type: "symptom", +name: "انخفاض الضغط داخل الحجاج، بفارق أكبر من 4-5 ملم زئبقي بين العين المصابة والأخرى السليمة", +common_name: "انخفاض الضغط داخل الحجاج، بفارق أكبر من 4-5 ملم زئبقي بين العين المصابة والأخرى السليمة", +}, +{ +id: "s_1405", +type: "symptom", +name: "انفصال موضع في الشبكية", +common_name: "انفصال موضع في الشبكية", +}, +{ +id: "s_1406", +type: "symptom", +name: "تلون رمادي موضعي في الشبكية", +common_name: "تلون رمادي موضعي في الشبكية", +}, +{ +id: "s_1407", +type: "symptom", +name: "أوعية شبكية موضعة داكنة تتوضع في الطيات", +common_name: "أوعية شبكية موضعة داكنة تتوضع في الطيات", +}, +{ +id: "s_1408", +type: "symptom", +name: "تموج موضعي في الشبكية", +common_name: "تموج موضعي في الشبكية", +}, +{ +id: "s_1409", +type: "symptom", +name: "خط التحديد للشبكية المنفصلة (مُصطبغة أو غير مصطبغة)", +common_name: "خط التحديد للشبكية المنفصلة (مُصطبغة أو غير مصطبغة)", +}, +{ +id: "s_1410", +type: "symptom", +name: "استحداث أوعية جديدة في القرص البصري", +common_name: "استحداث أوعية جديدة في القرص البصري", +}, +{ +id: "s_1411", +type: "symptom", +name: "تشكل أوعية دموية جديدة في القزحية", +common_name: "تشكل أوعية دموية جديدة في القزحية", +}, +{ +id: "s_1412", +type: "symptom", +name: "أمهات دم مجهرية في الشبكية", +common_name: "أمهات دم مجهرية في الشبكية", +}, +{ +id: "s_1413", +type: "symptom", +name: "وذمة بقعية كيسية", +common_name: "وذمة بقعية كيسية", +}, +{ +id: "s_1414", +type: "symptom", +name: "وذمة الشبكية", +common_name: "وذمة الشبكية", +}, +{ +id: "s_1415", +type: "symptom", +name: "استحداث أوعية شبكية جديدة في أماكن غير طبيعية", +common_name: "استحداث أوعية شبكية جديدة في أماكن غير طبيعية", +}, +{ +id: "s_1416", +type: "symptom", +name: "تشوه الأوعية داخل الشبكية", +common_name: "تشوه الأوعية داخل الشبكية", +}, +{ +id: "s_1417", +type: "symptom", +name: "بقع حمراء داكنة في أوعية القرص البصري", +common_name: "بقع حمراء داكنة في أوعية القرص البصري", +}, +{ +id: "s_1418", +type: "symptom", +name: "انسداد الشرايين الشبكية", +common_name: "انسداد الشرايين الشبكية", +}, +{ +id: "s_1421", +type: "symptom", +name: "ارتعاش خافق", +common_name: "رعاش خافق", +}, +{ +id: "s_1422", +type: "symptom", +name: "نز من الحلمة، مفرزات غير حليبية", +common_name: "سيلان مفرزات غير الحليب من الحلمة", +}, +{ +id: "s_1425", +type: "symptom", +name: "تشنجات في عضلات الوجه", +common_name: "تشنجات في عضلات الوجه", +}, +{ +id: "s_1426", +type: "symptom", +name: "تشنج في عضلات الطرفين العلويين", +common_name: "تشنج في عضلات الذراعين واليدين", +}, +{ +id: "s_1429", +type: "symptom", +name: "رُعاف", +common_name: "نزيف من الأنف", +}, +{ +id: "s_1430", +type: "symptom", +name: "ألم مفصلي، في الرسغ", +common_name: "ألم في المعصم", +}, +{ +id: "s_1431", +type: "symptom", +name: "وذمة، في المعصم", +common_name: "تورم في المعصم", +}, +{ +id: "s_1432", +type: "symptom", +name: "عسر الهضم", +common_name: "سوء الهضم", +}, +{ +id: "s_1433", +type: "symptom", +name: "وذمة، في الشفتين", +common_name: "تورم في الشفاه", +}, +{ +id: "s_1434", +type: "symptom", +name: "إسهال دهني", +common_name: "تغوط دهني", +}, +{ +id: "s_1436", +type: "symptom", +name: "ألم وجهي، في مناطق الجيوب المجاورة للأنف", +common_name: "ألم أو حس بالضغط في الجيوب", +}, +{ +id: "s_1437", +type: "symptom", +name: "انصباب جنبي", +common_name: "انصباب جنبي", +}, +{ +id: "s_1442", +type: "symptom", +name: "وذمة، حول الحجاج، في كلا العينين", +common_name: "تورم حول كلا العينين", +}, +{ +id: "s_1447", +type: "symptom", +name: "وذمة، في الطرف العلوي", +common_name: "تورم في الطرف العلوي", +}, +{ +id: "s_1449", +type: "symptom", +name: "خدر، في طرف علوي واحد", +common_name: "تنميل في طرف علوي واحد", +}, +{ +id: "s_1451", +type: "symptom", +name: "تنفس كوسماول", +common_name: "تنفس غير طبيعي عميق وشاق مع لهاث", +}, +{ +id: "s_1452", +type: "symptom", +name: "ألم في كلا الطرفين العلويين", +common_name: "ألم في كلا الطرفين العلويين", +}, +{ +id: "s_1453", +type: "symptom", +name: "ألم في كلا الطرفين السفليين", +common_name: "ألم في كلا الطرفين السفليين", +}, +{ +id: "s_1454", +type: "symptom", +name: "رعاش حركي", +common_name: "رعاش أثناء الحركة", +}, +{ +id: "s_1455", +type: "symptom", +name: "رجفان، أثناء الراحة", +common_name: "رجفة أثناء الراحة", +}, +{ +id: "s_1456", +type: "symptom", +name: "الرقص", +common_name: "الرقص", +}, +{ +id: "s_1458", +type: "symptom", +name: "انقطاع الطمث، الأولي", +common_name: "عدم حدوث الدورة الشهرية حتى بعد بلوغ سن الـ16", +}, +{ +id: "s_1462", +type: "symptom", +name: "تنفس سطحي", +common_name: "تنفس سطحي", +}, +{ +id: "s_1463", +type: "symptom", +name: "تململ الساقين، ليلاً", +common_name: "تململ الساقين في الليل", +}, +{ +id: "s_1464", +type: "symptom", +name: "وذمة، في اليد", +common_name: "يد متورمة", +}, +{ +id: "s_1465", +type: "symptom", +name: "فقدان مؤقت للرؤية", +common_name: "فقدان مؤقت للبصر", +}, +{ +id: "s_1466", +type: "symptom", +name: "طنين في الأذن, نابض", +common_name: "طنين نابض في الأذن", +}, +{ +id: "s_1467", +type: "symptom", +name: "لسان الفريز", +common_name: "لسان بلون الفريز", +}, +{ +id: "s_1468", +type: "symptom", +name: "حمامى، على الوجه", +common_name: "احمرار على الوجه", +}, +{ +id: "s_1469", +type: "symptom", +name: "حمامى وتوسّف في معظم الجسم", +common_name: "احمرار وتقشر كل الجلد تقريباً", +}, +{ +id: "s_1470", +type: "symptom", +name: "تقشر الجلد", +common_name: "توسف الجلد", +}, +{ +id: "s_1471", +type: "symptom", +name: "سيلان المفرزات الأنفية من الخلف", +common_name: "سيلان المخاط إلى الحلق", +}, +{ +id: "s_1472", +type: "symptom", +name: "حلقة كايزر-فيشر", +common_name: "حلقات داكنة تظهر حول قزحية العين", +}, +{ +id: "s_1474", +type: "symptom", +name: "آفات في الجمجمة", +common_name: "آفات في الجمجمة", +}, +{ +id: "s_1476", +type: "symptom", +name: "التهاب غشاء الطبل", +common_name: "التهاب غشاء الطبل", +}, +{ +id: "s_1479", +type: "symptom", +name: "دوخة، عند تدوير الرأس", +common_name: "دوخة عند تدوير الرأس", +}, +{ +id: "s_1480", +type: "symptom", +name: "مضض بالثدي، ثنائي الجانب", +common_name: "ألم في كلا الثديين عند الضغط عليهما", +}, +{ +id: "s_1481", +type: "symptom", +name: "فرط حس الألم", +common_name: "فرط حس الألم", +}, +{ +id: "s_1483", +type: "symptom", +name: "ألم في العنق", +common_name: "ألم في الرقبة", +}, +{ +id: "s_1484", +type: "symptom", +name: "ضعف حاسة السمع، صَمم متفاقم", +common_name: "نقص متزايد في السمع بدون أي تحسّن", +}, +{ +id: "s_1486", +type: "symptom", +name: "ألم ومضض في العضلات المجاورة للعمود الفقري", +common_name: "ألم ومضض في العضلات المجاورة للعمود الفقري", +}, +{ +id: "s_1488", +type: "symptom", +name: "زيادة زمن الزفير", +common_name: "زيادة زمن الزفير", +}, +{ +id: "s_1492", +type: "symptom", +name: "اصفرار الصلبة اليرقاني", +common_name: "اصفرار العينين", +}, +{ +id: "s_1494", +type: "symptom", +name: "ألم ارتدادي", +common_name: "ألم ارتدادي", +}, +{ +id: "s_1496", +type: "symptom", +name: "ألم عند جس الجيوب جانب الأنفية", +common_name: "ألم عند جس الجيوب جانب الأنفية", +}, +{ +id: "s_1498", +type: "symptom", +name: "احمرار في اللوزتين", +common_name: "لوزتين محمرتين بشكل غير طبيعي", +}, +{ +id: "s_1502", +type: "symptom", +name: "اشتداد مُنعكس وتر أشيل", +common_name: "اشتداد مُنعكس وتر أشيل", +}, +{ +id: "s_1508", +type: "symptom", +name: "تطاول زمن امتلاء الشعريات", +common_name: "تطاول زمن امتلاء الشعريات", +}, +{ +id: "s_1509", +type: "symptom", +name: "ألم صدري، خلف القص", +common_name: "ألم في الصدر خلف عظم القص", +}, +{ +id: "s_1510", +type: "symptom", +name: "تغيّرات جلدية، دافئة عند لمسها", +common_name: "تغيرات جلدية تبدو دافئة عند لمسها", +}, +{ +id: "s_1514", +type: "symptom", +name: "مضض بطني", +common_name: "ألم في البطن عند الضغط عليه", +}, +{ +id: "s_1528", +type: "symptom", +name: "ألم بطني، في الربع العلوي الأيمن", +common_name: "ألم في الجزء العلوي الأيمن من البطن", +}, +{ +id: "s_1531", +type: "symptom", +name: "ألم بطني، في الربع السفلي الأيمن", +common_name: "ألم في الجزء السفلي الأيمن من البطن", +}, +{ +id: "s_1532", +type: "symptom", +name: "ألم بطني، حول السُّرَّة‎", +common_name: "ألم في منتصف البطن", +}, +{ +id: "s_1533", +type: "symptom", +name: "التهاب الأنف البيئي", +common_name: "سيلان أو انسداد في الأنف ناتج عن البيئة", +}, +{ +id: "s_1534", +type: "symptom", +name: "حصى اللوزتين", +common_name: "تشكلات بيضاء أو صفراء في اللوزتين", +}, +{ +id: "s_1535", +type: "symptom", +name: "صداع، مزمن", +common_name: "ألم في الرأس يستمر 3 أشهر أو أكثر", +}, +{ +id: "s_1536", +type: "symptom", +name: "عدم تناظر العمود الفقري", +common_name: "عدم تناظر العمود الفقري", +}, +{ +id: "s_1538", +type: "symptom", +name: "ضعف حاسة السمع، صَمم مُفاجئ", +common_name: "فقدان مفاجئ للسمع", +}, +{ +id: "s_1543", +type: "symptom", +name: "غياب الوعي", +common_name: "فقدان الوعي", +}, +{ +id: "s_1544", +type: "symptom", +name: "طفح الحمى القرمزية", +common_name: "طفح الحمى القرمزية", +}, +{ +id: "s_1546", +type: "symptom", +name: "تنفس شاين-ستوكس", +common_name: "تنفس شاين-ستوكس", +}, +{ +id: "s_1547", +type: "symptom", +name: "تعب، استمر أكثر من 6 أشهر", +common_name: "الشعور بالضعف والتعب لأكثر من 6 أشهر", +}, +{ +id: "s_1548", +type: "symptom", +name: "غشاء كاذب على البلعوم أو الأنف", +common_name: "طبقة رمادية سميكة في الأنف أو على الحلق", +}, +{ +id: "s_1551", +type: "symptom", +name: "عدم القدرة على إخراج الغازات", +common_name: "عدم القدرة على إخراج الغازات", +}, +{ +id: "s_1552", +type: "symptom", +name: "أصوات معويّة عالية ذات تردد عالي", +common_name: "أصوات معويّة زائدة", +}, +{ +id: "s_1553", +type: "symptom", +name: "خفوت الأصوات المعويّة", +common_name: "انخفاض في الأصوات المعويّة", +}, +{ +id: "s_1555", +type: "symptom", +name: "علامة دانس", +common_name: "علامة دانس", +}, +{ +id: "s_1557", +type: "symptom", +name: "ألم بطني، مُنتشر", +common_name: "ألم شامل لكامل البطن", +}, +{ +id: "s_1558", +type: "symptom", +name: "دفاع بطني", +common_name: "ازدياد قساوة عضلات البطن", +}, +{ +id: "s_1561", +type: "symptom", +name: "ورم أصفر", +common_name: "ترسبات صفراء تحت الجلد", +}, +{ +id: "s_1562", +type: "symptom", +name: "صرير", +common_name: "صرير", +}, +{ +id: "s_1563", +type: "symptom", +name: "حكة في العينين", +common_name: "حكة في العينين", +}, +{ +id: "s_1565", +type: "symptom", +name: "الشعور بامتلاء في المستقيم", +common_name: "الشعور بامتلاء في المستقيم", +}, +{ +id: "s_1569", +type: "symptom", +name: "إفرازات مهبلية، بيضاء ولزجة", +common_name: "مفرزات مهبلية بيضاء ولزجة", +}, +{ +id: "s_1570", +type: "symptom", +name: "أعراض هضمية تظهر بعد تناول الأطعمة الحاوية على اللاكتوز", +common_name: "أعراض بطنية تظهر بعد شرب أو تناول الأطعمة الحاوية على اللاكتوز", +}, +{ +id: "s_1571", +type: "symptom", +name: "تغيرات جلدية، مؤلمة", +common_name: "تغيرات موْلمة على الجلد", +}, +{ +id: "s_1574", +type: "symptom", +name: "صعوبة في الوصول إلى النشوة الجنسية", +common_name: "صعوبة في الوصول إلى النشوة الجنسية", +}, +{ +id: "s_1576", +type: "symptom", +name: "نفخة السباتي", +common_name: "نفخة الشريان السباتي الرقبي", +}, +{ +id: "s_1577", +type: "symptom", +name: "سيلان من الأذن، مفرزات دموية", +common_name: "نزف من الأذن", +}, +{ +id: "s_1580", +type: "symptom", +name: "ألم صدري، يشتد بجس المفاصل الغضروفية الضلعية", +common_name: "ألم في الصدر يزداد بالضغط على المفاصل الغضروفية الضلعية", +}, +{ +id: "s_1581", +type: "symptom", +name: "وذمة، في المفاصل الغضروفية الضلعيّة", +common_name: "تورم في منتصف الصدر", +}, +{ +id: "s_1586", +type: "symptom", +name: "توذّم فرجي أحادي الجانب", +common_name: "تورم في أحد جوانب الفرج", +}, +{ +id: "s_1587", +type: "symptom", +name: "تبدد الشخصية", +common_name: "الشعور بالانفصال عن الجسد", +}, +{ +id: "s_1589", +type: "symptom", +name: "مضض بطني، في الربع العلوي الأيسر", +common_name: "ألم في البطن عند الضغط على الجزء العلوي الأيسر منه", +}, +{ +id: "s_1591", +type: "symptom", +name: "ألم بطني، في الربع العلوي الأيسر", +common_name: "ألم في الجزء العلوي الأيسر من البطن", +}, +{ +id: "s_1598", +type: "symptom", +name: "ألم بطني، أسفل السرّة", +common_name: "ألم في الجزء السفلي من البطن", +}, +{ +id: "s_1601", +type: "symptom", +name: "ألم صدري، طاعن", +common_name: "ألم طاعن في الصدر", +}, +{ +id: "s_1602", +type: "symptom", +name: "تغيرات جلدية، قرح", +common_name: "قرحة تناسلية غير مؤلمة", +}, +{ +id: "s_1603", +type: "symptom", +name: "تأخر تطور اللغة", +common_name: "تأخر الكلام", +}, +{ +id: "s_1605", +type: "symptom", +name: "ألم أنفي", +common_name: "ألم في الأنف", +}, +{ +id: "s_1610", +type: "symptom", +name: "ألم مفصلي، عند تحريك الركبة", +common_name: "ألم في الركبة عند تحريكها", +}, +{ +id: "s_1616", +type: "symptom", +name: "قشرة الرأس", +common_name: "قشرة الرأس", +}, +{ +id: "s_1617", +type: "symptom", +name: "حكة جلدية، في الفروة", +common_name: "حكة في جلد الرأس", +}, +{ +id: "s_1618", +type: "symptom", +name: "مضض في الطرف السفلي", +common_name: "ألم في الساق عند الضغط عليها", +}, +{ +id: "s_1619", +type: "symptom", +name: "مضض في الطرف العلوي", +common_name: "ألم عند الضغط على الطرف العلوي", +}, +{ +id: "s_1620", +type: "symptom", +name: "ألم في الطرف السفلي، في الربلة", +common_name: "ألم في بطة الساق", +}, +{ +id: "s_1621", +type: "symptom", +name: "ألم مفصلي، في الكاحل", +common_name: "ألم في الكاحل", +}, +{ +id: "s_1622", +type: "symptom", +name: "مضض في الطرف السفلي، في ربلة القدم", +common_name: "ألم عند الضغط على بطة القدم", +}, +{ +id: "s_1623", +type: "symptom", +name: "ألم مفصلي، عند تحريك الكاحل", +common_name: "ألم في الكاحل عند تحريكه", +}, +{ +id: "s_1625", +type: "symptom", +name: "زلة تنفسية تستمر أكثر من 4 أسابيع", +common_name: "ضيق في التنفس يستمر فترة أطول من 4 أسابيع", +}, +{ +id: "s_1632", +type: "symptom", +name: "ألم مفصلي، في المرفق", +common_name: "ألم في المرفق", +}, +{ +id: "s_1634", +type: "symptom", +name: "ألم مفصلي، عند تحريك المرفق", +common_name: "ألم في المرفق عند تحريكه", +}, +{ +id: "s_1635", +type: "symptom", +name: "وذمة، في المرفق", +common_name: "تورم في المرفق", +}, +{ +id: "s_1636", +type: "symptom", +name: "ألم مفصلي، عند تحريك الرسغ", +common_name: "ألم في المعصم عند تحريكه", +}, +{ +id: "s_1639", +type: "symptom", +name: "ألم مفصلي، في الإبهام", +common_name: "ألم في الإبهام", +}, +{ +id: "s_1641", +type: "symptom", +name: "ألم مفصلي، عند تحريك الإبهام", +common_name: "ألم في الإبهام عند تحريكه", +}, +{ +id: "s_1645", +type: "symptom", +name: "ألم في القدم، في مؤخرة القدم عند الوقوف على أصابع إحدى القدمين", +common_name: "ألم في الجزء الخلفي من القدم عند الوقوف على الأصابع", +}, +{ +id: "s_1647", +type: "symptom", +name: "آفات حلقية جلدية", +common_name: "تغيرات جلدية حلقية الشكل", +}, +{ +id: "s_1650", +type: "symptom", +name: "تسمك الجلد", +common_name: "زيادة سماكة الجلد", +}, +{ +id: "s_1652", +type: "symptom", +name: "وذمة، في مفصل الورك", +common_name: "تورم في الورك", +}, +{ +id: "s_1654", +type: "symptom", +name: "ألم مفصلي، في الكتف", +common_name: "ألم في الكتف", +}, +{ +id: "s_1655", +type: "symptom", +name: "وذمة، في مفصل الكتف", +common_name: "تورم في الكتف", +}, +{ +id: "s_1656", +type: "symptom", +name: "مضض مفصلي", +common_name: "ألم في المفصل عند الضغط عليه", +}, +{ +id: "s_1665", +type: "symptom", +name: "صَلَع، معمم", +common_name: "تساقط شعر كل أجزاء الرأس", +}, +{ +id: "s_1671", +type: "symptom", +name: "شعر متقصّف", +common_name: "شعر متقصف", +}, +{ +id: "s_1673", +type: "symptom", +name: "بقع بيضاء في الفم", +common_name: "لطخ بيضاء في الغشاء المخاطي الفموي", +}, +{ +id: "s_1674", +type: "symptom", +name: "ألم في الجلد", +common_name: "ألم في الجلد", +}, +{ +id: "s_1676", +type: "symptom", +name: "الثفن", +common_name: "الثفن", +}, +{ +id: "s_1680", +type: "symptom", +name: "تغيرات جلديّة، فرط تصبّغ للجلد", +common_name: "اسمرار الجلد", +}, +{ +id: "s_1682", +type: "symptom", +name: "فيمة الأنف", +common_name: "أنف محمر منتفخ", +}, +{ +id: "s_1684", +type: "symptom", +name: "حرقة جلديّة، في الوجه", +common_name: "شعور بالحرقة في الوجه", +}, +{ +id: "s_1685", +type: "symptom", +name: "توسع الشعريات الدموية، في الوجه", +common_name: "أوعية عنكبوتية على الوجه", +}, +{ +id: "s_1689", +type: "symptom", +name: "علامة كيرينغ", +common_name: "علامة كيرينغ", +}, +{ +id: "s_1690", +type: "symptom", +name: "علامة برودزنسكي", +common_name: "علامة برودزنسكي", +}, +{ +id: "s_1692", +type: "symptom", +name: "تغيرات جلدية، تسوء بعد تناول الكحول", +common_name: "تغيرات جلدية تزداد بعد شرب الكحول", +}, +{ +id: "s_1693", +type: "symptom", +name: "انخفاض شدة الأصوات التنفسية", +common_name: "انخفاض شدة الأصوات التنفسية", +}, +{ +id: "s_1695", +type: "symptom", +name: "مشكلات في العلاقات الشخصية", +common_name: "مشكلات في العلاقات الشخصية", +}, +{ +id: "s_1696", +type: "symptom", +name: "المحاكاة الصوتية", +common_name: "تقليد الأصوات", +}, +{ +id: "s_1697", +type: "symptom", +name: "اهتمامات ضيقة الأفق", +common_name: "اهتمامات قليلة ومحدودة وغير طبيعية ومتعلق بها بشدة", +}, +{ +id: "s_1698", +type: "symptom", +name: "تغيرات سلوكية، تجنّب التواصل البصري", +common_name: "تجنّب التواصل البصري", +}, +{ +id: "s_1713", +type: "symptom", +name: "تحدد مجال حركة مفصل", +common_name: "صعوبة تحريك مفصل", +}, +{ +id: "s_1715", +type: "symptom", +name: "كسور مرضية", +common_name: "كسر عظمي بدون أي رض", +}, +{ +id: "s_1716", +type: "symptom", +name: "الشعور بالامتلاء في المهبل", +common_name: "الشعور بامتلاء في المهبل", +}, +{ +id: "s_1717", +type: "symptom", +name: "انتفاخ متبارز من فوهة المهبل", +common_name: "انتفاخ خارج من المهبل", +}, +{ +id: "s_1719", +type: "symptom", +name: "عقد أوسلر", +common_name: "عقد أوسلر", +}, +{ +id: "s_1720", +type: "symptom", +name: "نفخات قلبية", +common_name: "نفخات قلبية", +}, +{ +id: "s_1721", +type: "symptom", +name: "رأرأة، أفقية", +common_name: "رأرأة أفقية", +}, +{ +id: "s_1725", +type: "symptom", +name: "شحوب في الطرف السفلي", +common_name: "ساق شاحبة", +}, +{ +id: "s_1729", +type: "symptom", +name: "ألم بطني، في الربع السفلي الأيسر", +common_name: "ألم في الجزء السفلي الأيسر من البطن", +}, +{ +id: "s_1731", +type: "symptom", +name: "مناورة ديكس-هولبايك، رأرأة تدويريّة", +common_name: "مناورة ديكس-هولبايك، رأرأة تدويريّة", +}, +{ +id: "s_1732", +type: "symptom", +name: "علامة روفسينغ", +common_name: "علامة روفسينغ", +}, +{ +id: "s_1733", +type: "symptom", +name: "ألم في العقد اللمفاوية", +common_name: "عقد لمفاوية مؤلمة", +}, +{ +id: "s_1738", +type: "symptom", +name: "علامة رومبيرغ", +common_name: "علامة رومبيرغ", +}, +{ +id: "s_1744", +type: "symptom", +name: "سماع صوت فرقعة في الركبة عند حدوث الإصابة", +common_name: "سماع صوت فرقعة في الركبة عند حدوث الإصابة", +}, +{ +id: "s_1745", +type: "symptom", +name: "عدم ثباتية الركبة", +common_name: "ركبة غير ثابتة", +}, +{ +id: "s_1761", +type: "symptom", +name: "تغيرات جلدية، تزداد بالتوتر النفسي", +common_name: "تغيرات جلدية تزداد بالتوتر", +}, +{ +id: "s_1762", +type: "symptom", +name: "صداع، يشتد بالتوتر", +common_name: "ألم رأس يزداد بالتوتر والضغط", +}, +{ +id: "s_1763", +type: "symptom", +name: "ألم صدري، يشتد بالشدة النفسية", +common_name: "ألم في الصدر يزداد عند التوتر والضغط النفسي", +}, +{ +id: "s_1765", +type: "symptom", +name: "رجفان يحدث أثناء التوتر", +common_name: "رجفة تسوء بالتوتر", +}, +{ +id: "s_1766", +type: "symptom", +name: "ألم عضلي، يشتد بالتوتر", +common_name: "ألم عضلي يتحرّض بزيادة التوتر", +}, +{ +id: "s_1767", +type: "symptom", +name: "أعراض هضمية، متعلقة بالتوتر", +common_name: "أعراض هضمية تظهر عند التوتر أو الإجهاد", +}, +{ +id: "s_1768", +type: "symptom", +name: "اضطرابات نفسية تشتد بالتوتر", +common_name: "اضطرابات نفسية تزداد بالضغط النفسي", +}, +{ +id: "s_1772", +type: "symptom", +name: "ألم في الظهر، صدري", +common_name: "ألم في الظهر في الجزء العلوي أو الأوسط منه", +}, +{ +id: "s_1776", +type: "symptom", +name: "عسر البلع، الفموي البلعومي", +common_name: "صعوبة في بداية البلع", +}, +{ +id: "s_1779", +type: "symptom", +name: "عسر البلع، المريئي", +common_name: "الشعور بأن الطعام عالق بعد عدة ثوان من بلعه", +}, +{ +id: "s_1780", +type: "symptom", +name: "صداع، خفيف", +common_name: "ألم رأس خفيف", +}, +{ +id: "s_1781", +type: "symptom", +name: "صداع، معتدل", +common_name: "ألم رأس معتدل", +}, +{ +id: "s_1782", +type: "symptom", +name: "ألم بطني، خفيف", +common_name: "ألم خفيف الشدة في البطن", +}, +{ +id: "s_1783", +type: "symptom", +name: "ألم بطني، معتدل", +common_name: "ألم متوسط الشدة في البطن", +}, +{ +id: "s_1788", +type: "symptom", +name: "تغيرات لونية بيضاء على الأظافر", +common_name: "بقع بيضاء على الظفر", +}, +{ +id: "s_1789", +type: "symptom", +name: "اصفرار الأظافر", +common_name: "أظافر صفراء", +}, +{ +id: "s_1790", +type: "symptom", +name: "تسمّك في الأظافر", +common_name: "زيادة في سماكة الأظافر", +}, +{ +id: "s_1791", +type: "symptom", +name: "حمامى، على فروة الرأس", +common_name: "بقع حمراء على الفروة", +}, +{ +id: "s_1792", +type: "symptom", +name: "قمل رأس مرئي على الفروة", +common_name: "قمل رأس مرئي على الفروة", +}, +{ +id: "s_1793", +type: "symptom", +name: "بيض قمل أو صئبان على جذر الشعر", +common_name: "بيض صغير على قاعدة الشعرة", +}, +{ +id: "s_1795", +type: "symptom", +name: "أنفاق في الجلد", +common_name: "أخاديد في الجلد", +}, +{ +id: "s_1796", +type: "symptom", +name: "بقعة بيضاء على القرنية", +common_name: "بقعة بيضاء على قرنية العين", +}, +{ +id: "s_1798", +type: "symptom", +name: "اختلاف في حجم الخصيتين", +common_name: "اختلاف في حجم الخصيتين", +}, +{ +id: "s_1799", +type: "symptom", +name: "ألم في الساعد", +common_name: "ألم في الساعد", +}, +{ +id: "s_1800", +type: "symptom", +name: "استئصال سابق للزائدة الدودية", +common_name: "إزالة الزائدة الدودية في الماضي", +}, +{ +id: "s_1802", +type: "symptom", +name: "ألم بطني، حارق أو لاذع", +common_name: "ألم في المعدة حارق أو لاذع", +}, +{ +id: "s_1805", +type: "symptom", +name: "ألم مفصلي، عند تحريك الكتف", +common_name: "ألم في الكتف عند تحريكه", +}, +{ +id: "s_1808", +type: "symptom", +name: "تغيرات جلدية، على الوجه", +common_name: "تغيرات في جلد الوجه", +}, +{ +id: "s_1810", +type: "symptom", +name: "تغيرات جلدية، في منطقة الأعضاء التناسلية", +common_name: "تغيرات جلدية على الأعضاء التناسلية أو حولها", +}, +{ +id: "s_1811", +type: "symptom", +name: "جفاف مهبلي", +common_name: "جفاف بالمهبل", +}, +{ +id: "s_1812", +type: "symptom", +name: "احتقان أنفي، مزمن", +common_name: "انسداد في الأنف منذ أكثر من 3 أشهر", +}, +{ +id: "s_1819", +type: "symptom", +name: "ضعف بصري، في عين واحدة", +common_name: "ضعف الرؤية في عين واحدة", +}, +{ +id: "s_1820", +type: "symptom", +name: "حمى، لم يتم قياس درجة الحرارة", +common_name: "ارتفاع في درجة حرارة الجسم لم يتم قياسه", +}, +{ +id: "s_1823", +type: "symptom", +name: "ألم مفصلي، عند تحريك الورك", +common_name: "ألم في الورك عند تحريكه", +}, +{ +id: "s_1826", +type: "symptom", +name: "ألم في البلعوم، أحادي الجانب", +common_name: "ألم أحادي الجانب في الحلق", +}, +{ +id: "s_1829", +type: "symptom", +name: "ألم فرجي مهبلي", +common_name: "ألم في الفرج أو المهبل", +}, +{ +id: "s_1830", +type: "symptom", +name: "كتلة جلدية، أكبر من 1 سم", +common_name: "بروز على الجلد قطره أكبر من 1 سم", +}, +{ +id: "s_1831", +type: "symptom", +name: "كتلة جلدية", +common_name: "كتل أو نتوء في الجلد", +}, +{ +id: "s_1833", +type: "symptom", +name: "ألم في أحد الأباخس", +common_name: "ألم في أحد أصابع القدم", +}, +{ +id: "s_1835", +type: "symptom", +name: "ألم في كامل الجسم", +common_name: "ألم في كامل الجسم", +}, +{ +id: "s_1840", +type: "symptom", +name: "ألم بطني، يستمر أقل من يومين", +common_name: "ألم في البطن يستمر أقل من يومين", +}, +{ +id: "s_1842", +type: "symptom", +name: "ألم بطني، يستمر لأكثر من أسبوعين", +common_name: "ألم في البطن يستمر لأكثر من أسبوعين", +}, +{ +id: "s_1843", +type: "symptom", +name: "ألم بطني، ذو بدء مفاجئ", +common_name: "ألم بطني بدأ فجأةً", +}, +{ +id: "s_1844", +type: "symptom", +name: "ألم بطني، ذو بدء تدريجي", +common_name: "ألم في البطن تزداد شدته بشكل تدريجي بطيء", +}, +{ +id: "s_1845", +type: "symptom", +name: "ألم بطني، ينتشر إلى الكتف الأيسر أو لوح الكتف الأيسر", +common_name: "ألم في البطن ينتشر إلى الكتف الأيسر أو عظم الكتف الأيسر", +}, +{ +id: "s_1846", +type: "symptom", +name: "ألم بطني، ينتشر إلى منتصف أو أسفل الظهر", +common_name: "ألم في البطن ينتشر إلى منتصف أو أسفل الظهر", +}, +{ +id: "s_1847", +type: "symptom", +name: "ألم بطني، ناكس", +common_name: "ألم متكرر في البطن", +}, +{ +id: "s_1848", +type: "symptom", +name: "ألم بطني، قولنجي", +common_name: "ألم ماغص في البطن", +}, +{ +id: "s_1851", +type: "symptom", +name: "ألم بطني، ينتقل ويتوضّع في الربع السفلي الأيمن", +common_name: "ألم في البطن انتقل إلى الجزء السفلي الأيمن", +}, +{ +id: "s_1852", +type: "symptom", +name: "ألم بطني، يستمر لـ2-7 أيام", +common_name: "ألم في البطن يستمر فترة تتراوح بين يومين و7 أيام", +}, +{ +id: "s_1853", +type: "symptom", +name: "ألم بطني، يستمر لـ8-14 أيام", +common_name: "ألم في البطن يستمر لـ8-14 أيام", +}, +{ +id: "s_1193", +type: "symptom", +name: "ألم بطني، في الجانب الأيسر", +common_name: "ألم في الجانب الأيسر من البطن", +}, +{ +id: "s_1855", +type: "symptom", +name: "ألم بطني، في الجانب الأيمن", +common_name: "ألم في الجانب الأيمن من البطن", +}, +{ +id: "s_1856", +type: "symptom", +name: "مضض بطني، في الربع السفلي الأيمن", +common_name: "ألم في البطن عند الضغط على الجزء السفلي الأيمن منه", +}, +{ +id: "s_1858", +type: "symptom", +name: "سعال، يدوم بين ثلاث وثمان أسابيع", +common_name: "سعال يستمر بين ثلاث وثمان أسابيع", +}, +{ +id: "s_1859", +type: "symptom", +name: "ألم بطني، في منتصف الدورة الطمثيّة", +common_name: "إباضة مؤلمة", +}, +{ +id: "s_1860", +type: "symptom", +name: "ألم بطني، تشنجي", +common_name: "ألم تشنجي في البطن", +}, +{ +id: "s_1864", +type: "symptom", +name: "صداع، أسوأ صداع في الحياة", +common_name: "أسوأ ألم رأس على الإطلاق", +}, +{ +id: "s_1868", +type: "symptom", +name: "صداع، مزمن، بنوبة تستمر من 5 دقائق إلى 4 ساعات", +common_name: "نوبات ألم في الرأس تستمر من 5 دقائق إلى 4 ساعات", +}, +{ +id: "s_1870", +type: "symptom", +name: "صداع، مزمن، بنوبة تستمر 4-72 ساعة", +common_name: "نوبات ألم في الرأس تستمر من4 إلى 72 ساعة", +}, +{ +id: "s_1871", +type: "symptom", +name: "صداع، يشتد بالنشاط الفيزيائي", +common_name: "ألم رأس يزداد عند ممارسة نشاط جسدي", +}, +{ +id: "s_1875", +type: "symptom", +name: "حرقة فرجية مهبلية", +common_name: "حرقة فرجية مهبلية", +}, +{ +id: "s_1878", +type: "symptom", +name: "ألم في الربلة، أعلى العقب", +common_name: "ألم في الجزء الخلفي من الساق أعلى العقب", +}, +{ +id: "s_1891", +type: "symptom", +name: "فرط الحساسية للروائح", +common_name: "فرط التحسس للروائح", +}, +{ +id: "s_1893", +type: "symptom", +name: "ألم في الطرف السفلي، في الفخذ", +common_name: "ألم في الفخذ", +}, +{ +id: "s_1899", +type: "symptom", +name: "خدر في الأصابع الثلاثة الأولى", +common_name: "تنميل في الإبهام والسبابة والإصبع الوسطى", +}, +{ +id: "s_1900", +type: "symptom", +name: "خدر في أصابع اليد، في الإصبعين الرابع والخامس", +common_name: "تنميل في الخنصر والبنصر في اليد", +}, +{ +id: "s_1901", +type: "symptom", +name: "صداع، مزمن، بنوبات تستمر 3-7 أيام", +common_name: "نوبات ألم في الرأس تستمر 3-7 أيام", +}, +{ +id: "s_1903", +type: "symptom", +name: "تحدد مجال الحركة المنفعلة لمفصل", +common_name: "تحدد مجال الحركة المنفعلة لمفصل", +}, +{ +id: "s_1905", +type: "symptom", +name: "صداع، ذو بدء مفاجئ", +common_name: "صداع يصل لذروته خلال عدّة دقائق", +}, +{ +id: "s_1907", +type: "symptom", +name: "صداع، مزمن، بنوبة تستمر حتى 5 دقائق", +common_name: "نوبات ألم في الرأس تدوم لفترة لا تتجاوز 5 دقائق", +}, +{ +id: "s_1909", +type: "symptom", +name: "القدم الهابطة", +common_name: "انخفاض القدم", +}, +{ +id: "s_1910", +type: "symptom", +name: "هبوط الرسغ", +common_name: "هبوط المعصم", +}, +{ +id: "s_1911", +type: "symptom", +name: "صداع، في المنطقة الصدغية", +common_name: "ألم في الصدغ", +}, +{ +id: "s_1912", +type: "symptom", +name: "صداع، حديث", +common_name: "ألم رأس منذ فترة لا تتجاوز 3 أشهر", +}, +{ +id: "s_1915", +type: "symptom", +name: "طفح فرفري، مجسوس", +common_name: "بقع صغيرة حمراء أو أرجوانية يزيد قطرها عن 3 مم ويمكن الإحساس بها", +}, +{ +id: "s_1918", +type: "symptom", +name: "ألم في الردفين", +common_name: "ألم في الردفين", +}, +{ +id: "s_1921", +type: "symptom", +name: "تغيّرات جلدية، تزداد بالتعرّض لضوء الشمس", +common_name: "تغيرات في الجلد تظهر أو تزداد بعد التعرض لضوء الشمس", +}, +{ +id: "s_1922", +type: "symptom", +name: "إيلام ارتجاجي", +common_name: "ألم في البطن بعد الهبوط بقوّة على القدمين", +}, +{ +id: "s_1923", +type: "symptom", +name: "تغيرات جلدية، في القدم", +common_name: "تغيرات جلدية في القدم", +}, +{ +id: "s_1924", +type: "symptom", +name: "سعال، انتيابي", +common_name: "نوبات سعال شديدة ومفاجئة", +}, +{ +id: "s_1925", +type: "symptom", +name: "ألم صدري، ضاغط", +common_name: "ألم ضاغط في الصدر", +}, +{ +id: "s_1926", +type: "symptom", +name: "جلد بارد ومتعرّق", +common_name: "جلد بارد ومتعرّق", +}, +{ +id: "s_1927", +type: "symptom", +name: "ألم في الطرف السفلي، عرج بسبب الألم", +common_name: "عرج بسبب ألم في الساق", +}, +{ +id: "s_1929", +type: "symptom", +name: "ألم بطني، شديد لا يمكن تحمّله", +common_name: "ألم لا يطاق في البطن", +}, +{ +id: "s_1930", +type: "symptom", +name: "ألم في الطرف السفلي، شديد", +common_name: "ألم شديد في الطرف السفلي", +}, +{ +id: "s_1931", +type: "symptom", +name: "كتلة جلدية، نازفة", +common_name: "كتلة جلدية نازفة", +}, +{ +id: "s_1932", +type: "symptom", +name: "خدر، ذو بدء مفاجئ", +common_name: "الشعور فجأةً بتنميل أو وخز أو خدر", +}, +{ +id: "s_1933", +type: "symptom", +name: "ارتفاع التوتر الشرياني، فوق 180 ملم زئبقي", +common_name: "ارتفاع ضغط الدم كثيراً", +}, +{ +id: "s_1935", +type: "symptom", +name: "ألم في الطرف العلوي، شديد", +common_name: "ألم شديد في الطرف العلوي", +}, +{ +id: "s_1937", +type: "symptom", +name: "ديدان في البراز", +common_name: "ديدان في البراز أو حول الشرج", +}, +{ +id: "s_1943", +type: "symptom", +name: "حروق الشمس", +common_name: "حروق الشمس", +}, +{ +id: "s_1949", +type: "symptom", +name: "إقياء، تال لكل وارد طعامي", +common_name: "إقياء بعد تناول كل وجبة", +}, +{ +id: "s_1952", +type: "symptom", +name: "ألم صدري، ناكس", +common_name: "ألم متكرر في الصدر", +}, +{ +id: "s_1955", +type: "symptom", +name: "حمامى، حول كلا العينين", +common_name: "احمرار حول كلا العينين", +}, +{ +id: "s_1957", +type: "symptom", +name: "أفكار هدّامة، تجاه الآخرين أو الأشياء", +common_name: "أفكار هدّامة، تجاه الآخرين أو الأشياء", +}, +{ +id: "s_1958", +type: "symptom", +name: "بحة في الصوت، تدوم أكثر من أسبوعين", +common_name: "بحة في الصوت تستمر أكثر من أسبوعين", +}, +{ +id: "s_1960", +type: "symptom", +name: "تكدّم بعد رض", +common_name: "كدمة بعد إصابة", +}, +{ +id: "s_1961", +type: "symptom", +name: "ألم في الفك", +common_name: "ألم في الفك", +}, +{ +id: "s_1973", +type: "symptom", +name: "جرح، نزف فعال", +common_name: "نزف مستمر من جرح", +}, +{ +id: "s_1979", +type: "symptom", +name: "إسهال، أكثر من 6 مرات باليوم", +common_name: "إسهال لأكثر من 6 مرات في اليوم", +}, +{ +id: "s_1982", +type: "symptom", +name: "تغيرات جلدية، في اليدين", +common_name: "تغيرات جلدية على إحدى أو كلتا اليدين", +}, +{ +id: "s_1983", +type: "symptom", +name: "آفة جفنيّة، حاكّة", +common_name: "تغيرات جلدية حاكة على الجفن", +}, +{ +id: "s_1985", +type: "symptom", +name: "سعال، ليلي", +common_name: "سعال في الليل", +}, +{ +id: "s_1988", +type: "symptom", +name: "تغيرات جلدية، متوسعة", +common_name: "تغيرات جلدية تزداد بحجمها وانتشارها", +}, +{ +id: "s_1994", +type: "symptom", +name: "سيلان من الأذن، مفرزات قيحية", +common_name: "خروج سائل أخضر أو أصفر اللون من الأذن", +}, +{ +id: "s_1995", +type: "symptom", +name: "وذمة، في القدمين", +common_name: "قدمان متورمتان", +}, +{ +id: "s_1996", +type: "symptom", +name: "وذمة، في الأنف", +common_name: "تورم في الأنف", +}, +{ +id: "s_1997", +type: "symptom", +name: "وذمة، في إصبع القدم", +common_name: "تورم في إصبع من أصابع القدم", +}, +{ +id: "s_1999", +type: "symptom", +name: "حمامى، في الفرج", +common_name: "احمرار في الفرج", +}, +{ +id: "s_2000", +type: "symptom", +name: "حمى تتجاوز 40° درجة مئوية (أي 104° درجة فهرنهايتية)", +common_name: "ارتفاع درجة حرارة الجسم فوق 40° درجة مئوية (أي فوق 104° درجة فهرنهايتية)", +}, +{ +id: "s_2001", +type: "symptom", +name: "خدر، في طرف سفلي واحد", +common_name: "تنميل في طرف سفلي واحد", +}, +{ +id: "s_2002", +type: "symptom", +name: "خفقان، لأكثر من 5 دقائق", +common_name: "خفقان يستمر أكثر من 5 دقائق", +}, +{ +id: "s_2003", +type: "symptom", +name: "حمامى، على إصبع من أصابع القدم", +common_name: "إصبع محمر", +}, +{ +id: "s_2004", +type: "symptom", +name: "خفقان، ناكس", +common_name: "تكرر حالات الخفقان", +}, +{ +id: "s_2005", +type: "symptom", +name: "ألم في الظفر", +common_name: "ظفر مؤلم", +}, +{ +id: "s_2006", +type: "symptom", +name: "ألم صدري، يشتد بالاستلقاء", +common_name: "ألم في الصدر يزداد عند الاستلقاء", +}, +{ +id: "s_2008", +type: "symptom", +name: "تقلصات رحمية منتظمة", +common_name: "تقلصات رحمية منتظمة", +}, +{ +id: "s_2010", +type: "symptom", +name: "تمزق السلى", +common_name: "نزول ماء الجنين", +}, +{ +id: "s_2011", +type: "symptom", +name: "مستوى جلوكوز الدم، بين 54 و70 ملغ/دل أو بين 3.0 و3.9 ممول/ل", +common_name: "مستوى السكر في الدم بين 54 و70 ملغ/دل", +}, +{ +id: "s_2014", +type: "symptom", +name: "مستوى جلوكوز الدم، غير مقيس", +common_name: "لم يتم قياس مستوى السكر في الدم", +}, +{ +id: "s_2016", +type: "symptom", +name: "رُعاف، مرة واحدة", +common_name: "نزف من الأنف لمرة واحدة", +}, +{ +id: "s_2017", +type: "symptom", +name: "رُعاف، متكرر", +common_name: "نزيف متكرر من الأنف", +}, +{ +id: "s_2018", +type: "symptom", +name: "ألم صدري، يستمر أقل من 30 دقيقة", +common_name: "ألم في الصدر يستمر لأقل من 30 دقيقة", +}, +{ +id: "s_2019", +type: "symptom", +name: "ألم صدري، يستمر بين 30 دقيقة و8 ساعات", +common_name: "ألم في الصدر يستمر بين 30 دقيقة و8 ساعات", +}, +{ +id: "s_2022", +type: "symptom", +name: "ألم صدري، يستمر أكثر من 8 ساعات", +common_name: "ألم في الصدر يستمر أكثر من 8 ساعات", +}, +{ +id: "s_2023", +type: "symptom", +name: "دوخة، ناكسة", +common_name: "دوخة ناكسة", +}, +{ +id: "s_2024", +type: "symptom", +name: "القمار المرضي", +common_name: "القمار المفرط", +}, +{ +id: "s_2029", +type: "symptom", +name: "لعب القمار، مع الكذب فيما يتعلق به", +common_name: "الكذب فيما يتعلق بالقمار والمبالغ التي تنفق فيه", +}, +{ +id: "s_2032", +type: "symptom", +name: "لعب القمار", +common_name: "لعب القمار", +}, +{ +id: "s_2033", +type: "symptom", +name: "حكة جلدية، في القدم", +common_name: "حكة في قدم واحدة أو كلتيهما", +}, +{ +id: "s_2034", +type: "symptom", +name: "اضطرابات في الوعي", +common_name: "عدم التوجه أو التشوش", +}, +{ +id: "s_2041", +type: "symptom", +name: "هالات حول الأضواء", +common_name: "هالات حول الأضواء", +}, +{ +id: "s_2043", +type: "symptom", +name: "حكة قضيبية", +common_name: "حكة في القضيب", +}, +{ +id: "s_2045", +type: "symptom", +name: "صرع", +common_name: "اختلاج", +}, +{ +id: "s_2047", +type: "symptom", +name: "نوب الغياب", +common_name: "نوب الغياب", +}, +{ +id: "s_2048", +type: "symptom", +name: "السلس البولي الليلي", +common_name: "تبليل الفراش", +}, +{ +id: "s_2051", +type: "symptom", +name: "ألم صدري، يشتد بحركة جدار الصدر", +common_name: "ألم في الصدر يزداد عند تحريك الجذع", +}, +{ +id: "s_2052", +type: "symptom", +name: "عقم ذكري", +common_name: "عقم ذكري", +}, +{ +id: "s_2053", +type: "symptom", +name: "غائط هلامي أحمر عنبي", +common_name: "براز هلامي أحمر عنبي كمربى التوت", +}, +{ +id: "s_2055", +type: "symptom", +name: "إقياء، صفراوي", +common_name: "تقيؤ لونه أصفر مخضر", +}, +{ +id: "s_2056", +type: "symptom", +name: "إقياء، لأقل من 7 أيام", +common_name: "إقياء استمر أقل من أسبوع", +}, +{ +id: "s_2057", +type: "symptom", +name: "إقياء، استمر لأكثر من 7 أيام", +common_name: "تقيؤ استمر لأكثر من 7 أيام", +}, +{ +id: "s_2058", +type: "symptom", +name: "تغيرات جلدية، على الأسطح العاطفة", +common_name: "تغيرات جلدية على الوجه الداخلي من المفاصل", +}, +{ +id: "s_2059", +type: "symptom", +name: "تغيرات جلدية، على الفروة", +common_name: "تغيرات جلدية على الفروة", +}, +{ +id: "s_2060", +type: "symptom", +name: "تغيرات جلدية، على الجذع", +common_name: "تغيرات في جلد الرقبة أو الصدر أو البطن أو الظهر", +}, +{ +id: "s_2063", +type: "symptom", +name: "حمى، لا تستجيب للعلاج", +common_name: "ارتفاع في درجة حرارة الجسم لا تخف على خافضات الحرارة", +}, +{ +id: "s_2064", +type: "symptom", +name: "بول ذو رائحة كريهة", +common_name: "بول كريه الرائحة", +}, +{ +id: "s_2065", +type: "symptom", +name: "ألم في الفم", +common_name: "ألم في الفم", +}, +{ +id: "s_2066", +type: "symptom", +name: "اختلاف في طول الأطرف", +common_name: "عدم تساوي طول الأطراف", +}, +{ +id: "s_2068", +type: "symptom", +name: "شحوب في الطرف العلوي", +common_name: "ذراع شاحبة", +}, +{ +id: "s_2070", +type: "symptom", +name: "ألم عظمي، يستمر لأقل من أسبوع", +common_name: "ألم في العظم يستمر لأقل من أسبوع", +}, +{ +id: "s_2071", +type: "symptom", +name: "ألم عظمي، يدوم أسبوعاً أو أكثر", +common_name: "ألم في العظام يستمر أسبوعاً أو أكثر", +}, +{ +id: "s_2072", +type: "symptom", +name: "اضطرابات وعي، حادّة", +common_name: "عدم توجه أو تشوش ذهني بدأ مؤخراً", +}, +{ +id: "s_2073", +type: "symptom", +name: "اضطرابات وعي، مزمنة", +common_name: "عدم توجه أو تشوش ذهني يستمر لأكثر من أسبوع", +}, +{ +id: "s_2074", +type: "symptom", +name: "ألم صدري، ينتشر إلى الطرف العلوي الأيسر", +common_name: "ألم في الصدر ينتشر إلى الطرف العلوي الأيسر", +}, +{ +id: "s_2076", +type: "symptom", +name: "ضائقة تنفسية، بعد رض", +common_name: "اضطرابات تنفسية بعد التعرض لإصابة", +}, +{ +id: "s_2077", +type: "symptom", +name: "جرح، بنزف شديد", +common_name: "جرح نازف بشدة", +}, +{ +id: "s_2078", +type: "symptom", +name: "جرح، بنزيف بسيط لا يمكن إيقافه", +common_name: "جرح نازف بشكل بسيط ولكن لا يمكن إيقافه", +}, +{ +id: "s_2079", +type: "symptom", +name: "رض حديث بدون نزف", +common_name: "رض حديث بدون نزف", +}, +{ +id: "s_2081", +type: "symptom", +name: "ألم شديد، بعد رض", +common_name: "ألم شديد بعد حادث", +}, +{ +id: "s_2084", +type: "symptom", +name: "تكدّم حول الحجاج", +common_name: "تكدّم حول العينين", +}, +{ +id: "s_2085", +type: "symptom", +name: "ألم في الظهر، يشتد بالجس", +common_name: "ألم في الظهر يشتد عند لمس أو ضغط المنطقة المؤلمة", +}, +{ +id: "s_2086", +type: "symptom", +name: "عدم القدرة على حمل ثقل الجسم، بعد رض", +common_name: "عدم القدرة على الوقوف على أي من القدمين بعد التعرض لإصابة", +}, +{ +id: "s_2087", +type: "symptom", +name: "تشوه مفصلي، بعد رض", +common_name: "تشوه مفصل بعد التعرض لإصابة ما", +}, +{ +id: "s_2088", +type: "symptom", +name: "أذية جسدية", +common_name: "إصابة", +}, +{ +id: "s_2091", +type: "symptom", +name: "ألم في كلا الطرفين العلويين، في كلتا اليدين", +common_name: "ألم في كلتا اليدين", +}, +{ +id: "s_2092", +type: "symptom", +name: "ألم في كلا الطرفين السفليين، في كلا القدمين", +common_name: "ألم في كلا القدمين", +}, +{ +id: "s_2093", +type: "symptom", +name: "وذمة، في كلتا اليدين", +common_name: "تورّم في كلتا اليدين", +}, +{ +id: "s_2094", +type: "symptom", +name: "جفاف العينين", +common_name: "عينين جافتين", +}, +{ +id: "s_2096", +type: "symptom", +name: "ألم صدري، حارق", +common_name: "ألم حارق في الصدر", +}, +{ +id: "s_2097", +type: "symptom", +name: "إعادة تذكر حدث راض، يؤدي لأعراض تطفلية", +common_name: "إعادة تذكر حدث راض من خلال ومضات من الذاكرة أو أحلام", +}, +{ +id: "s_2100", +type: "symptom", +name: "تعب", +common_name: "تعب", +}, +{ +id: "s_2103", +type: "symptom", +name: "وذمة، في القدم", +common_name: "تورم في القدم", +}, +{ +id: "s_2105", +type: "symptom", +name: "إعادة تذكر حدث راض، يؤدي لأعراض جسدية أو نفسية", +common_name: "المعاناة من أعراض جسدية أو نفسية نتيجة إعادة تذكر حدث راض", +}, +{ +id: "s_2107", +type: "symptom", +name: "الاستيقاظ في الليل", +common_name: "الاستيقاظ في الليل", +}, +{ +id: "s_2108", +type: "symptom", +name: "اضطرابات معرفية", +common_name: "اضطرابات معرفية", +}, +{ +id: "s_2109", +type: "symptom", +name: "غيبوبة", +common_name: "غيبوبة", +}, +{ +id: "s_2110", +type: "symptom", +name: "تغيرات جلدية، في المنطقة التناسلية الأنثوية", +common_name: "تغيرات جلدية على أو حول الأعضاء التناسلية الأنثوية", +}, +{ +id: "s_2111", +type: "symptom", +name: "تغيرات جلدية، في المنطقة التناسلية الذكرية", +common_name: "تغيرات جلدية على الأعضاء التناسلية الذكرية أو حولها", +}, +{ +id: "s_2112", +type: "symptom", +name: "ألم صدري جنبي بعد رض", +common_name: "ألم صدري حاد ومفاجئ بعد أذية", +}, +{ +id: "s_2115", +type: "symptom", +name: "نزف مهبلي، أثناء الحمل", +common_name: "نزف من المهبل أثناء الحمل", +}, +{ +id: "s_2116", +type: "symptom", +name: "نزيف مهبلي أثناء الحمل، خفيف", +common_name: "تمشيح من المهبل أثناء الحمل", +}, +{ +id: "s_2118", +type: "symptom", +name: "دوخة لا تُحتمل", +common_name: "دوخة لا تحتمل", +}, +{ +id: "s_2119", +type: "symptom", +name: "قرحة، غير مؤلمة", +common_name: "قرحة غير مؤلمة", +}, +{ +id: "s_2121", +type: "symptom", +name: "القلس", +common_name: "ارتجاع حمض المعدة", +}, +{ +id: "s_2122", +type: "symptom", +name: "هبوط المستقيم", +common_name: "هبوط المستقيم", +}, +{ +id: "s_2124", +type: "symptom", +name: "تنفّس صاخب", +common_name: "تنفّس صاخب", +}, +{ +id: "s_2125", +type: "symptom", +name: "انبثاق الأغشية الجنينية، سائل أمنيوسي قيحي أو كريه الرائحة", +common_name: "ماء جنيني متلوّن أو كريه الرائحة", +}, +{ +id: "s_2126", +type: "symptom", +name: "إسهال، يستمر أقل من 48 ساعة", +common_name: "إسهال يستمر أقل من 48 ساعة", +}, +{ +id: "s_2129", +type: "symptom", +name: "المشي أثناء النوم", +common_name: "مشي أثناء النوم", +}, +{ +id: "s_2132", +type: "symptom", +name: "نزف من جذع الحبل السري", +common_name: "نزف من جذع الحبل السري", +}, +{ +id: "s_2133", +type: "symptom", +name: "انتباج اليافوخ", +common_name: "انتباج الأماكن اللينة من رأس الطفل", +}, +{ +id: "s_2134", +type: "symptom", +name: "سحب ضلعي", +common_name: "سحب ضلعي", +}, +{ +id: "s_2135", +type: "symptom", +name: "شحوب حول الفم", +common_name: "جلد أبيض فاتح حول الفم", +}, +{ +id: "s_2138", +type: "symptom", +name: "بكاء دون انهمار للدموع", +common_name: "بكاء دون انهمار للدموع", +}, +{ +id: "s_2139", +type: "symptom", +name: "تغيرات جلدية، في الطيات", +common_name: "تغيرات جلدية بين الثنيات", +}, +{ +id: "s_2140", +type: "symptom", +name: "رفع الساقين لتكون الركبة ملاصقة للجذع", +common_name: "رفع الساقين لتكون الركبة ملاصقة للجذع", +}, +{ +id: "s_2141", +type: "symptom", +name: "مفرزات عينية", +common_name: "خروج مفرزات من العين", +}, +{ +id: "s_2142", +type: "symptom", +name: "عدم كسب الوزن", +common_name: "زيادة الوزن بوتيرة بطيئة", +}, +{ +id: "s_2143", +type: "symptom", +name: "طحّة زفيرية", +common_name: "إصدار صوت شخير مع كل نَفَس", +}, +{ +id: "s_2144", +type: "symptom", +name: "مظهر المريض", +common_name: "مظهر المريض", +}, +{ +id: "s_2145", +type: "symptom", +name: "مظهر المريض، يبعث على القلق الشديد", +common_name: "مظهر المريض الذي يبعث على القلق الشديد", +}, +{ +id: "s_2148", +type: "symptom", +name: "زيادة مُحيط الرأس", +common_name: "زيادة مُحيط الرأس", +}, +{ +id: "s_2149", +type: "symptom", +name: "تهيّج، يدوم أكثر من 3 أيام", +common_name: "سرعة في الغضب تستمر أكثر من 3 أشهر", +}, +{ +id: "s_2150", +type: "symptom", +name: "زلة تنفسية، في الليل", +common_name: "صعوبة تنفس في الليل", +}, +{ +id: "s_2151", +type: "symptom", +name: "خلل القدرة على تثبيت العينين", +common_name: "عدم القدرة على تثبيت العينين", +}, +{ +id: "s_2153", +type: "symptom", +name: "سيلان أنفي، مخاطي", +common_name: "سيلان مفرزات رائقة أو بيضاء من الأنف", +}, +{ +id: "s_2154", +type: "symptom", +name: "سيلان أنفي، قيحي", +common_name: "سيلان مفرزات صفراء أو خضراء من الأنف", +}, +{ +id: "s_2155", +type: "symptom", +name: "رفرفة المنخرين", +common_name: "رفرفة المنخرين", +}, +{ +id: "s_2156", +type: "symptom", +name: "إقياء يلي السعال", +common_name: "إقياء بعد السعال", +}, +{ +id: "s_2157", +type: "symptom", +name: "بقاء الحبل السري", +common_name: "بقاء الحبل السري", +}, +{ +id: "s_2159", +type: "symptom", +name: "غؤور اليافوخ", +common_name: "انخفاض اليافوخ في رأس طفل رضيع", +}, +{ +id: "s_2160", +type: "symptom", +name: "بزوغ الأسنان", +common_name: "ظهور الأسنان", +}, +{ +id: "s_2162", +type: "symptom", +name: "إمساك، يدوم 3 أشهر أو أكثر", +common_name: "إمساك يستمر 3 أشهر أو أكثر", +}, +{ +id: "s_2163", +type: "symptom", +name: "التواء عنق", +common_name: "التواء عنق", +}, +{ +id: "s_2164", +type: "symptom", +name: "تناول طعام أو شراب منتهي الصلاحية", +common_name: "تناول أطعمة أو مشاريب فاسدة", +}, +{ +id: "s_2165", +type: "symptom", +name: "سعال، ضباحي", +common_name: "سعال كالنباح", +}, +{ +id: "s_2166", +type: "symptom", +name: "وزيز، حاد", +common_name: "وزيز حاد", +}, +{ +id: "s_2168", +type: "symptom", +name: "درجة حرارة الجسم طبيعية", +common_name: "درجة حرارة الجسم طبيعية", +}, +{ +id: "s_2169", +type: "symptom", +name: "معدل ضربات قلب طبيعي", +common_name: "نبض طبيعي", +}, +{ +id: "s_2170", +type: "symptom", +name: "تظاهر لايرقاني", +common_name: "تظاهر لايرقاني", +}, +{ +id: "s_2171", +type: "symptom", +name: "أصوات تنفسية طبيعية بإصغاء الصدر", +common_name: "أصوات تنفسية طبيعية بإصغاء الصدر", +}, +{ +id: "s_2172", +type: "symptom", +name: "غياب أي علامات لإنتان طرق تنفسية علوية", +common_name: "غياب أي علامات لإنتان طرق تنفسية علوية", +}, +{ +id: "s_2173", +type: "symptom", +name: "ألم في العنق، عند تحريك الرأس", +common_name: "ألم في الرقبة عند تحريك الرأس", +}, +{ +id: "s_2174", +type: "symptom", +name: "علامات حيوية طبيعية", +common_name: "علامات حيوية طبيعية", +}, +{ +id: "s_2175", +type: "symptom", +name: "احتمال إصابة بالكَلَب", +common_name: "عضّة حيوان", +}, +{ +id: "s_2176", +type: "symptom", +name: "زلة تنفسية، تستمر بين ساعة و24 ساعة", +common_name: "ضيق تنفس يستمر ما بين ساعة و24 ساعة", +}, +{ +id: "s_2177", +type: "symptom", +name: "تغيّرات جلديّة، بلون أحمر فاتح أو زهري", +common_name: "تغيّرات في الجلد باللون الأحمر الفاتح أو الزهري", +}, +{ +id: "s_2178", +type: "symptom", +name: "وزيز، تحت حاد", +common_name: "وزيز بدأ منذ بضعة أيام أو أسابيع", +}, +{ +id: "s_2180", +type: "symptom", +name: "تشوه عظمي، غير رضي", +common_name: "تشوّه في العظام غير مترافق مع أي إصابة حديثة", +}, +{ +id: "s_2181", +type: "symptom", +name: "تشوّه عظمي، تالي لرض", +common_name: "تشوه في العظام بعد التعرض لإصابة حديثة", +}, +{ +id: "s_2182", +type: "symptom", +name: "ألم في الخاصرة", +common_name: "ألم في إحدى أو كلا الخاصرتين", +}, +{ +id: "s_2188", +type: "symptom", +name: "سيلان عيني، قيحي", +common_name: "خروج مفرزات قيحية من العين", +}, +{ +id: "s_2189", +type: "symptom", +name: "صداع، حديث، يستمر لأقل من ساعة", +common_name: "وجع في الرأس يستمر لأقل من ساعة", +}, +{ +id: "s_2190", +type: "symptom", +name: "صداع، حديث، يستمر أكثر من ساعة وأقل من يوم", +common_name: "ألم في الرأس يستمر لأكثر من ساعة وأقل من يوم", +}, +{ +id: "s_2191", +type: "symptom", +name: "صداع، حديث، يستمر لأكثر من يوم", +common_name: "وجع في الرأس يستمر لأكثر من يوم", +}, +{ +id: "s_2193", +type: "symptom", +name: "فرك الأذن", +common_name: "شد الأذن", +}, +{ +id: "s_2194", +type: "symptom", +name: "إسهال، يستمر بين 2 و14 يوماً", +common_name: "إسهال يستمر بين 2 و14 يوماً", +}, +{ +id: "s_2196", +type: "symptom", +name: "برودة في القدم وأصابعها، أحادي الجانب", +common_name: "قدم باردة", +}, +{ +id: "s_2200", +type: "symptom", +name: "شفع، يستمر أقل من 24 ساعة", +common_name: "رؤية مزدوجة تستمر أقل من 24 ساعة", +}, +{ +id: "s_2201", +type: "symptom", +name: "شفع، يستمر لأكثر من 24 ساعة", +common_name: "رؤية مزدوجة تستمر لأكثر من 24 ساعة", +}, +{ +id: "s_2203", +type: "symptom", +name: "زلة تنفسية، بعد عدّة دقائق من المشي", +common_name: "ضيق في التنفس بعد المشي لعدة دقائق", +}, +{ +id: "s_2204", +type: "symptom", +name: "زلة تنفسية، على الجهد", +common_name: "ضيق في التنفس أثناء الجهد", +}, +{ +id: "s_2206", +type: "symptom", +name: "الجُلاع", +common_name: "تضيق جلد القلفة وتراجعها للخلف", +}, +{ +id: "s_2207", +type: "symptom", +name: "وذمة، في القضيب", +common_name: "قضيب متورم", +}, +{ +id: "s_2208", +type: "symptom", +name: "قرحة، لم تشفى خلال 6 أسابيع", +common_name: "قرحة لا تشفى", +}, +{ +id: "s_2209", +type: "symptom", +name: "نوبات صرعية متكررة", +common_name: "اختلاجات متكررة", +}, +{ +id: "s_2211", +type: "symptom", +name: "شرى، استمر أكثر من 6 أسابيع", +common_name: "حكّة استمرت أكثر من 6 أسابيع", +}, +{ +id: "s_2212", +type: "symptom", +name: "مفرزات مهبلية قيحية", +common_name: "مفرزات مهبلية قيحية", +}, +{ +id: "s_2213", +type: "symptom", +name: "سلوك مؤذي للنفس أو التفكير بذلك", +common_name: "إيذاء للنفس أو التفكير بذلك", +}, +{ +id: "s_2222", +type: "symptom", +name: "جرح، في الشفة", +common_name: "جرح في الشفة", +}, +{ +id: "s_2226", +type: "symptom", +name: "احتقان أنفي، ساء بعد تحسّنه لفترة قصيرة", +common_name: "أنف مسدود يزداد سوءاً بعد تحسّنه لفترة قصيرة", +}, +{ +id: "s_2228", +type: "symptom", +name: "إيذاء حديث للنفس", +common_name: "القيام بسلوك مؤذي للنفس حديثاً", +}, +{ +id: "s_2230", +type: "symptom", +name: "إيذاء حديث للنفس، شديد", +common_name: "إيذاء حديث وشديد للنفس", +}, +{ +id: "s_2231", +type: "symptom", +name: "زلة تنفسيّة، غير معروفة الشدة", +common_name: "ضيق في التنفس ذو شدة غير معروفة", +}, +{ +id: "s_2234", +type: "symptom", +name: "عدم تناظر في حجم أو شكل الثديين", +common_name: "ثديين غير متماثلين", +}, +{ +id: "s_2236", +type: "symptom", +name: "حمامى، في الصفن", +common_name: "احمرار في الصفن", +}, +{ +id: "s_2238", +type: "symptom", +name: "عدم تناظر الثنيات الجلدية الفخذية", +common_name: "عدم تناظر الثنيات الجلدية في الفخذ", +}, +{ +id: "s_2241", +type: "symptom", +name: "نز مفرزات من السرة", +common_name: "سيلان مفرزات من السرة", +}, +{ +id: "s_2242", +type: "symptom", +name: "ألم عيني، لا يُحتمل", +common_name: "ألم غير محتمل في العين", +}, +{ +id: "s_2245", +type: "symptom", +name: "أذية للأعضاء التناسلية الذكريّة", +common_name: "أذية للأعضاء التناسلية الذكريّة", +}, +{ +id: "s_2246", +type: "symptom", +name: "أذية للأعضاء التناسلية الأنثوية", +common_name: "أذية للأعضاء التناسلية الأنثوية", +}, +{ +id: "s_2247", +type: "symptom", +name: "تضخّم مقدمة العنق", +common_name: "تورم في مقدمة الرقبة", +}, +{ +id: "s_2248", +type: "symptom", +name: "تضخّم العقد اللمفاوية الرقبية", +common_name: "تضخّم العقد اللمفاوية في الرقبة", +}, +{ +id: "s_2251", +type: "symptom", +name: "معدل ضربات قلب مجهول", +common_name: "سرعة النبض مجهولة", +}, +{ +id: "s_2252", +type: "symptom", +name: "مضض بطني، في الربع السفلي الأيسر", +common_name: "ألم في البطن عند الضغط على الجزء السفلي الأيسر منه", +}, +{ +id: "s_2253", +type: "symptom", +name: "القدم المسطحة", +common_name: "القدم المسحاء", +}, +{ +id: "s_2259", +type: "symptom", +name: "صرع انعكاسي", +common_name: "اختلاج انعكاسي", +}, +{ +id: "s_2260", +type: "symptom", +name: "تراجع اللثة", +common_name: "لثة متراجعة", +}, +{ +id: "s_2261", +type: "symptom", +name: "ضخامة في عضلات الساق", +common_name: "زيادة في حجم عضلات الساق", +}, +{ +id: "s_2262", +type: "symptom", +name: "علامة جاور", +common_name: "النهوض من وضعية الجلوس بمساعدة اليدين واستنادهما على الساقين", +}, +{ +id: "s_2263", +type: "symptom", +name: "نوبات تيت", +common_name: "نوبات تيت", +}, +{ +id: "s_2264", +type: "symptom", +name: "تعب، أثناء تناول الطعام", +common_name: "تعب أثناء تناول الطعام", +}, +{ +id: "s_2266", +type: "symptom", +name: "تغيرات جلدية، على الطرفين العلويين وتعف عن اليدين", +common_name: "تغيرات على جلد الكتف أو الذراع أو الساعد أو المرفق أو المعصم", +}, +{ +id: "s_2267", +type: "symptom", +name: "تغيرات جلدية، على الطرفين السفليين وتعف عن القدمين", +common_name: "تغيرات جلدية على الورك أو الفخذ أو الركبة أو الساق أو الكاحل", +}, +{ +id: "s_2268", +type: "symptom", +name: "سعال، متغيّر الإنتاج", +common_name: "سعال مع خروج لبلغم أو مخاط بين الفينة والأخرى", +}, +{ +id: "s_2269", +type: "symptom", +name: "طفح حويصلي على الشفتين أو في الجلد حول الفم", +common_name: "بثرات على الشفتين أو حول الفم", +}, +{ +id: "s_2270", +type: "symptom", +name: "طفح حويصلي في الأذن", +common_name: "بثرات على الأذن", +}, +{ +id: "s_2271", +type: "symptom", +name: "أعراض هضمية بعد تناول أطعمة حاوية على الغلوتين", +common_name: "حدوث أعراض بطنية بعد تناول طعام حاو على الغلوتين", +}, +{ +id: "s_2272", +type: "symptom", +name: "ضغط الدم، طبيعي أو ما قبل ارتفاع الضغط الشرياني", +common_name: "ضغط دم طبيعي", +}, +{ +id: "s_2273", +type: "symptom", +name: "ضغط الدم، غير مُقاس", +common_name: "لم يتم قياس ضغط الدم", +}, +{ +id: "s_2274", +type: "symptom", +name: "تباطؤ في النمو", +common_name: "بطء النمو", +}, +{ +id: "s_2275", +type: "symptom", +name: "ألم بطني، موضّع", +common_name: "ألم متوضع في جزء من البطن", +}, +{ +id: "s_2276", +type: "symptom", +name: "نزف شرجي، خفيف", +common_name: "نزف خفيف من الشرج", +}, +{ +id: "s_2277", +type: "symptom", +name: "نزف شرجي، شديد", +common_name: "نزف شديد من الشرج", +}, +{ +id: "s_2278", +type: "symptom", +name: "رنح حاد", +common_name: "صعوبات حديثة بتنسيق الحركات", +}, +{ +id: "s_2279", +type: "symptom", +name: "رنح تحت حاد", +common_name: "صعوبات في تنسيق الحركات منذ بضعة أيام أو أسابيع أو أشهر", +}, +{ +id: "s_2280", +type: "symptom", +name: "رنح مزمن", +common_name: "صعوبات بتنسيق الحركات منذ أكثر من سنة", +}, +{ +id: "s_2281", +type: "symptom", +name: "ألم بطني، غير محدد الموضع", +common_name: "ألم بطني، غير محدد الموضع", +}, +{ +id: "s_2282", +type: "symptom", +name: "شحوب الجلد، في أصابع اليدين", +common_name: "أصابع يدين شاحبة", +}, +{ +id: "s_2283", +type: "symptom", +name: "صرير الأسنان", +common_name: "احتكاك الأسنان ببعضها", +}, +{ +id: "s_2284", +type: "symptom", +name: "ألم في الظهر، ليلي", +common_name: "ألم في الظهر أثناء الليل", +}, +{ +id: "s_2285", +type: "symptom", +name: "كتلة جلدية، في الثلم بين الإليتين", +common_name: "كتلة أو نتوء في الشق بين الإليتين", +}, +{ +id: "s_2288", +type: "symptom", +name: "ألم بطني، ذو نمط غير معروف", +common_name: "ألم غير محدد النمط في البطن", +}, +{ +id: "s_2289", +type: "symptom", +name: "قلق الانفصال", +common_name: "الخوف من الانفصال", +}, +{ +id: "s_2290", +type: "symptom", +name: "ضعف القدرات الكلامية واللغوية، بدء سريع", +common_name: "صعوبة حديثة الظهور في التكلّم أو فهم اللغة", +}, +{ +id: "s_2291", +type: "symptom", +name: "نزوف شظوية تحت الظفر", +common_name: "بقع أو خطوط حمراء تحت الظفر", +}, +{ +id: "s_2292", +type: "symptom", +name: "ضخامة العقد اللمفاوية الإبطية", +common_name: "تضخّم العقد اللمفاوية الموجودة في الإبط", +}, +{ +id: "s_2294", +type: "symptom", +name: "نوب غياب، انعكاسية", +common_name: "نوب غياب انعكاسية", +}, +{ +id: "s_2296", +type: "symptom", +name: "غصص", +common_name: "اختناق", +}, +{ +id: "s_2298", +type: "symptom", +name: "ألم مفصلي، ميكانيكي الطبيعة", +common_name: "ألم في مفصل يزداد بالحركة ويخف عند الراحة", +}, +{ +id: "s_2299", +type: "symptom", +name: "ألم مفصلي، التهابي الطبيعة", +common_name: "ألم مفاصل يزداد بقلّة الحركة", +}, +{ +id: "s_2300", +type: "symptom", +name: "ابتلاع جسم أجنبي", +common_name: "ابتلاع شيء ما", +}, +{ +id: "s_2302", +type: "symptom", +name: "فقدان الوعي، عابر", +common_name: "إغماء", +}, +{ +id: "s_2303", +type: "symptom", +name: "فقدان الوعي، دام أكثر من دقيقة واحدة", +common_name: "فقدان الوعي، دام أكثر من دقيقة واحدة", +}, +{ +id: "s_2304", +type: "symptom", +name: "خدر، في الطرفين العلويين", +common_name: "تنميل في الطرفين العلويين", +}, +{ +id: "s_2306", +type: "symptom", +name: "خدر، في الطرفين السفليين", +common_name: "تنميل في الطرفين السفليين", +}, +{ +id: "s_2307", +type: "symptom", +name: "احتفان أنفي، حاد", +common_name: "انسداد في الأنف استمر أقل من 10 أيام", +}, +{ +id: "s_2308", +type: "symptom", +name: "احتقان أنفي، تحت حاد", +common_name: "انسداد في الأنف استمر أكثر من 10 أيام وأقل من 3 أشهر", +}, +{ +id: "s_2309", +type: "symptom", +name: "كتلة في الناحية المأبضية", +common_name: "كتلة خلف الركبة", +}, +{ +id: "s_2311", +type: "symptom", +name: "ألم بطني، لا علاقة له بالدورة الشهرية", +common_name: "ألم ثابت في البطن لا يتغير خلال الدورة الشهرية", +}, +{ +id: "s_2314", +type: "symptom", +name: "ألم في الظهر، قطني، ينتشر بشكل غير معروف", +common_name: "ألم أسفل الظهر ينتشر بشكل غير معروف", +}, +{ +id: "s_2315", +type: "symptom", +name: "خدر، في قدم واحدة", +common_name: "تنميل في قدم واحدة", +}, +{ +id: "s_2316", +type: "symptom", +name: "إسهال، ذو نمط غير معروف", +common_name: "إسهال، ذو نمط غير معروف", +}, +{ +id: "s_2319", +type: "symptom", +name: "حمى، تدوم أقل من 3 أيام", +common_name: "ارتفاع درجة حرارة الجسم يستمر أقل من 3 أيام", +}, +{ +id: "s_2320", +type: "symptom", +name: "حمى، تدوم 3-7 أيام", +common_name: "ارتفاع في درجة حرارة الجسم يستمر فترة تتراوح بين 3 و7 أيام", +}, +{ +id: "s_2322", +type: "symptom", +name: "إسهال، يدوم أكثر من 4 أسابيع", +common_name: "إسهال يستمر أكثر من 4 أسابيع", +}, +{ +id: "s_2328", +type: "symptom", +name: "إسهال، يدوم 2-4 أسبوعاً", +common_name: "إسهال يستمر ما بين أسبوعين و4 أسابيع", +}, +{ +id: "s_2329", +type: "symptom", +name: "سيلان عيني، سميك ورائق", +common_name: "خروج مفرزات غير قيحية من العين", +}, +{ +id: "s_2330", +type: "symptom", +name: "ضعف عضلي، معمم", +common_name: "ضعف في كل عضلات الجسم", +}, +{ +id: "s_2335", +type: "symptom", +name: "ألم في الطرف السفلي، في القصبة", +common_name: "ألم في قصبة الساق", +}, +{ +id: "s_2336", +type: "symptom", +name: "ثر الحليب عند رجل", +common_name: "خروج مفرزات حليبية من الحلمة", +}, +{ +id: "s_2338", +type: "symptom", +name: "مفرزات مهبلية، رمادية اللون", +common_name: "مفرزات مهبلية رمادية اللون", +}, +{ +id: "s_2341", +type: "symptom", +name: "كدمة", +common_name: "كدمة", +}, +{ +id: "s_2344", +type: "symptom", +name: "صعوبات في الكتابة", +common_name: "صعوبات في الكتابة", +}, +{ +id: "s_2351", +type: "symptom", +name: "صعوبة في القراءة", +common_name: "صعوبة في القراءة", +}, +{ +id: "s_2352", +type: "symptom", +name: "صعوبات رياضية", +common_name: "صعوبة في تعلّم مادة الرياضيات", +}, +{ +id: "s_2354", +type: "symptom", +name: "آفات فموية، متوضعة على البلعوم الخلفي", +common_name: "آفات في الجزء الخلفي من الحلق", +}, +{ +id: "s_2356", +type: "symptom", +name: "منطقة حمراء وحيدة، بقطر أكبر من 1 سم", +common_name: "منطقة حمراء وحيدة بقطر أكبر من 1 سم", +}, +{ +id: "s_2357", +type: "symptom", +name: "بقع حمراء متعددة، بقطر أكبر من 1 سم", +common_name: "بقع حمراء متعددة بقطر أكبر من 1 سم", +}, +{ +id: "s_2358", +type: "symptom", +name: "بقعة حمراء وحيدة، بقطر أقل من 1 سم", +common_name: "بقعة حمراء وحيدة بقطر أقل من 1 سم", +}, +{ +id: "s_2359", +type: "symptom", +name: "عدة بقع حمراء، بقطر أقل من 1 سم", +common_name: "عدة بقع حمراء بقطر أقل من 1 سم", +}, +{ +id: "s_2360", +type: "symptom", +name: "ورم دموي في الفروة", +common_name: "كدمة في فروة الرأس", +}, +{ +id: "s_2361", +type: "symptom", +name: "ألم عظمي، ليلي", +common_name: "ألم في عظم يحدث أثناء الليل", +}, +{ +id: "s_2362", +type: "symptom", +name: "علامة المعركة", +common_name: "كدمة خلف الأذن", +}, +{ +id: "s_2363", +type: "symptom", +name: "نز من الأنف، بعد رض", +common_name: "خروج سائل من الأنف بعد رض", +}, +{ +id: "s_2364", +type: "symptom", +name: "نز من الأذن، بعد رض", +common_name: "خروج سائل من الأذن بعد التعرّض لرض", +}, +{ +id: "s_2365", +type: "symptom", +name: "تأخّر انغلاق اليافوخ الأمامي", +common_name: "تأخر التحام اليافوخ الأمامي", +}, +{ +id: "s_2366", +type: "symptom", +name: "الحدبة الجبهية", +common_name: "جبهة بارزة", +}, +{ +id: "s_2367", +type: "symptom", +name: "التابس القحفي", +common_name: "عظام جمجمة طريّة", +}, +{ +id: "s_2369", +type: "symptom", +name: "خروج مفرزات غير طبيعية من جرح", +common_name: "خروج مفرزات غير طبيعية من جرح", +}, +{ +id: "s_2370", +type: "symptom", +name: "تغيرات جلدية حمراء، بأقطار مختلفة", +common_name: "تغيرات جلدية حمراء،د بأقطار مختلفة", +}, +{ +id: "s_2371", +type: "symptom", +name: "حمامى، غير محددة", +common_name: "احمرار غير محدد الطبيعة في الجلد", +}, +{ +id: "s_2373", +type: "symptom", +name: "نقص محيط الرأس", +common_name: "صغر الرأس", +}, +{ +id: "s_2374", +type: "symptom", +name: "لعب بنمط متكرر", +common_name: "لعب وسلوك متكرر", +}, +{ +id: "s_2375", +type: "symptom", +name: "الأكسجة الدموية غير مقاسة", +common_name: "أكسجة الدم غير مُقاسَة", +}, +{ +id: "s_2376", +type: "symptom", +name: "الأكسجة الدموية طبيعية", +common_name: "مستوى أكسجة الدم طبيعية", +}, +{ +id: "s_2377", +type: "symptom", +name: "جرح", +common_name: "جرح", +}, +{ +id: "s_2378", +type: "symptom", +name: "جرح في الجلد، رضي المنشأ", +common_name: "جرح في الجلد بعد إصابة", +}, +{ +id: "s_2379", +type: "symptom", +name: "جرح في الجلد، غير رضي", +common_name: "جرح غير ناتج عن إصابة", +}, +{ +id: "s_2381", +type: "symptom", +name: "عيوب في الميناء", +common_name: "عيب في سن", +}, +{ +id: "s_2382", +type: "symptom", +name: "تغيرات جلدية، موضّعة", +common_name: "تغيرات جلدية محصورة في جزء محدد من الجسم", +}, +{ +id: "s_2383", +type: "symptom", +name: "نقص تمعدن الميناء", +common_name: "نقص تمعدن الميناء", +}, +{ +id: "s_2384", +type: "symptom", +name: "عيوب في الميناء، متناظرة", +common_name: "عيوب متناظرة في الأسنان", +}, +{ +id: "s_2387", +type: "symptom", +name: "الأكسجة الدموية، بين 90% و94%", +common_name: "أكسجة الدم بين 90% و94%", +}, +{ +id: "s_2388", +type: "symptom", +name: "الأكسجة الدموية، بين 80% و89%", +common_name: "أكسجة الدم بين 80% و89%", +}, +{ +id: "s_2389", +type: "symptom", +name: "الأكسجة الدموية، أقل من 80%", +common_name: "أكسجة الدم أقل من 80%", +}, +{ +id: "s_2390", +type: "symptom", +name: "الأكسجة الدموية، متدهورة بشكل فجائي", +common_name: "انخفاض مفاجئ في نسبة الأوكسجين في الدم", +}, +{ +id: "s_2391", +type: "symptom", +name: "عيوب في الميناء، بقع", +common_name: "بقع في سن", +}, +{ +id: "s_2393", +type: "symptom", +name: "تغيّر لون سن إلى اللون الأبيض", +common_name: "تغيّر لون سن إلى اللون الأبيض", +}, +{ +id: "s_2396", +type: "symptom", +name: "تغيّر لون سن إلى اللون البني", +common_name: "تلوّن سن باللون البني", +}, +{ +id: "s_2398", +type: "symptom", +name: "جرح في الجلد، بعد جراحة", +common_name: "جرح بعد عمل جراحي", +}, +{ +id: "s_2399", +type: "symptom", +name: "جرح في الجلد، محدث ذاتياً", +common_name: "جرح الذات", +}, +{ +id: "s_2402", +type: "symptom", +name: "ألم أمام الأذن", +common_name: "ألم أمام الأذن", +}, +{ +id: "s_2403", +type: "symptom", +name: "انحراف الفك السفلي عند فتح الفم", +common_name: "ميلان الفك السفلي عند فتح الفم", +}, +{ +id: "s_2405", +type: "symptom", +name: "رجفان، يختفي عند إمساك الطرف أو أثناء الرضاعة", +common_name: "رجفة تختفي عند إمساك الطرف أو أثناء الرضاعة", +}, +{ +id: "s_2407", +type: "symptom", +name: "اشتباه بحالة تسمم", +common_name: "حالة تسمم محتملة", +}, +{ +id: "s_2408", +type: "symptom", +name: "التوتر الشرياني، بين 140 و179 ملم زئبقي", +common_name: "ارتفاع ضغط الدم لما بين 140 و179 ملم زئبقي", +}, +{ +id: "s_2409", +type: "symptom", +name: "التشاؤم", +common_name: "التشاؤم", +}, +{ +id: "s_2410", +type: "symptom", +name: "مضض بجس الصفن", +common_name: "ألم عند الضغط على الصفن", +}, +{ +id: "s_2412", +type: "symptom", +name: "تغيرات جلدية، على اللسان", +common_name: "تغيرات جلدية على اللسان", +}, +{ +id: "s_2413", +type: "symptom", +name: "آفات فموية، ذات حدود واضحة", +common_name: "آفات واضحة الحدود في الفم", +}, +{ +id: "s_2414", +type: "symptom", +name: "آفات فموية، متعددة", +common_name: "آفات متعددة في الفم", +}, +{ +id: "s_2416", +type: "symptom", +name: "آفات فموية، حمراء اللون", +common_name: "آفات حمراء اللون في الفم", +}, +{ +id: "s_2417", +type: "symptom", +name: "آفات فموية، أكبر من 1 سم", +common_name: "آفات في الفم قطرها أكبر من 1 سم", +}, +{ +id: "s_2421", +type: "symptom", +name: "ألم في الفم، بعد تناول طعام حار أو حامض", +common_name: "ألم في الفم بعد تناول طعام حار أو حامض", +}, +{ +id: "s_2422", +type: "symptom", +name: "آفات في الفم، تتغيّر بالموقع أو الحجم أو الشكل", +common_name: "آفات في الفم تتغيّر بالمكان أو الحجم أو الشكل", +}, +{ +id: "s_2424", +type: "symptom", +name: "آفات فموية، ناكسة", +common_name: "آفات معاودة الظهور في الفم", +}, +{ +id: "s_2428", +type: "symptom", +name: "ألم سني، متوسط الشدة", +common_name: "ألم متوسط الشدة في سن", +}, +{ +id: "s_2429", +type: "symptom", +name: "ألم سني، خفيف الشدة", +common_name: "ألم خفيف الشدة في سن", +}, +{ +id: "s_2430", +type: "symptom", +name: "ألم سني، محرض بسبب ما", +common_name: "ألم في سن محرض بسبب ما", +}, +{ +id: "s_2431", +type: "symptom", +name: "ألم سني، عفوي", +common_name: "ألم عفوي في الأسنان", +}, +{ +id: "s_2432", +type: "symptom", +name: "ألم سني، مترافق مع التعرّض لشيء بارد", +common_name: "ألم في سن على البارد", +}, +{ +id: "s_2433", +type: "symptom", +name: "ألم سني، عابر", +common_name: "ألم عابر في الأسنان", +}, +{ +id: "s_2438", +type: "symptom", +name: "ألم سني، ممض", +common_name: "ألم ممض في سن", +}, +{ +id: "s_2440", +type: "symptom", +name: "ألم سني، حاد", +common_name: "ألم حاد في الأسنان", +}, +{ +id: "s_2441", +type: "symptom", +name: "ألم سني، في أكثر من سن", +common_name: "ألم في عدة أسنان", +}, +{ +id: "s_2442", +type: "symptom", +name: "ألم سني، في سن واحد", +common_name: "ألم في سن واحد", +}, +{ +id: "s_2443", +type: "symptom", +name: "ألم سني، نابض", +common_name: "ألم نابض في سن", +}, +{ +id: "s_2446", +type: "symptom", +name: "ألم سني، منتشر", +common_name: "ألم في الأسنان منتشر", +}, +{ +id: "s_2449", +type: "symptom", +name: "ألم سني، مستمر", +common_name: "ألم مستمر في الأسنان", +}, +{ +id: "s_2450", +type: "symptom", +name: "ألم سني، يستمر 48 ساعة أو أكثر", +common_name: "ألم في سن يستمر 48 ساعة أو أكثر", +}, +{ +id: "s_2451", +type: "symptom", +name: "ألم سني، يترافق مع الاستلقاء", +common_name: "ألم في سن يزداد عند الاستلقاء", +}, +{ +id: "s_2452", +type: "symptom", +name: "ألم سني، يترافق مع تناول الحلويات أو الأطعمة والمشاريب الحامضية", +common_name: "ألم في سن يترافق مع تناول الحلويات أو الأطعمة والمشاريب الحامضية", +}, +{ +id: "s_2453", +type: "symptom", +name: "حشوة أسنان رخوة", +common_name: "حشوة أسنان رخوة", +}, +{ +id: "s_2454", +type: "symptom", +name: "إدخال جسم أجنبي، خطير", +common_name: "إدخال جسم أجنبي خطير", +}, +{ +id: "s_2455", +type: "symptom", +name: "ألم عضلي، بعد القيام بتمارين فيزيائية شديدة", +common_name: "ألم في العضلات بعد القيام بتمارين رياضية شديدة", +}, +{ +id: "s_2456", +type: "symptom", +name: "ألم سني، يستمر أقل من 48 ساعة", +common_name: "ألم في سن يستمر أقل من 48 ساعة", +}, +{ +id: "s_2461", +type: "symptom", +name: "توذّم في البلعوم", +common_name: "تورّم في الحلق", +}, +{ +id: "s_2462", +type: "symptom", +name: "لا قصة سابقة للإصابة بداء الأمعاء الالتهابي", +common_name: "لا إصابة سابقة بداء الأمعاء الالتهابي", +}, +{ +id: "s_2463", +type: "symptom", +name: "مضض بطني، في المنطقة الشرسوفية", +common_name: "ألم في البطن عند الضغط على الجزء العلوي المتوسط منه", +}, +{ +id: "s_2464", +type: "symptom", +name: "ضعف الرؤية، ثنائي الجانب", +common_name: "ضعف في الرؤية في كلتا العينين", +}, +{ +id: "s_2465", +type: "symptom", +name: "تورّم في أحد جانبي العنق", +common_name: "انتفاخ في أحد جانبي العنق", +}, +{ +id: "s_2467", +type: "symptom", +name: "تورم كل العنق", +common_name: "انتفاخ كل الرقبة", +}, +{ +id: "s_2468", +type: "symptom", +name: "غياب الوعي، عند الوقوف لفترة طويلة", +common_name: "فقدان الوعي عند الوقوف لفترة طويلة", +}, +{ +id: "s_2469", +type: "symptom", +name: "إيقاف أو تقليل كمية الأفيون المتناولة", +common_name: "إيقاف أو تقليل كمية الأفيون المتناولة", +}, +{ +id: "s_2470", +type: "symptom", +name: "رهاب الشيخوخة", +common_name: "الخوف من التقدم بالعمر أو الشيخوخة", +}, +{ +id: "s_2471", +type: "symptom", +name: "غياب الوعي، أثناء الجلوس أو الاستلقاء", +common_name: "فقدان الوعي أثناء الجلوس أو الاستلقاء", +}, +{ +id: "s_2472", +type: "symptom", +name: "غياب الوعي، أثناء التمارين", +common_name: "فقدان الوعي أثناء إجراء التمارين", +}, +{ +id: "s_2473", +type: "symptom", +name: "الرغبة بزيادة الكتلة العضلية", +common_name: "وجود رغبة كبيرة لزيادة الكتلة العضلية", +}, +{ +id: "s_2474", +type: "symptom", +name: "غياب الوعي، في مكان دافئ", +common_name: "فقدان الوعي في مكان دافئ", +}, +{ +id: "s_2475", +type: "symptom", +name: "غياب الوعي، عند التوتر", +common_name: "فقدان الوعي عند التوتر", +}, +{ +id: "s_2477", +type: "symptom", +name: "حمامى، في الأطراف، متناظرة", +common_name: "احمرار متناظر في جلد الأطراف", +}, +{ +id: "s_2481", +type: "symptom", +name: "حمامى، في العنق", +common_name: "احمرار في الرقبة", +}, +{ +id: "s_2484", +type: "symptom", +name: "حمامى، في الصدر", +common_name: "احمرار في جلد الصدر", +}, +{ +id: "s_2485", +type: "symptom", +name: "ألم سنّي، مترافق مع اللمس", +common_name: "ألم في سن يترافق مع اللمس", +}, +{ +id: "s_2487", +type: "symptom", +name: "مستوى جلوكوز الدم، أقل من 54 ملغ/دل أو أقل من 3 ممول/ل", +common_name: "انخفاض شديد في مستوى سكر الدم، أقل من 54 ملغ/دل", +}, +{ +id: "s_2489", +type: "symptom", +name: "ضعف في الذاكرة، ظهر في غضون أقل من 24 ساعة", +common_name: "فقدان في الذاكرة ظهر خلال الساعات الـ24 الماضية", +}, +{ +id: "s_2490", +type: "symptom", +name: "ضعف في الذاكرة، ظهر منذ أكثر من 24 ساعة", +common_name: "فقدان في الذاكرة ظهر بشكل تدريجي خلال عدة أيام أو أشهر", +}, +{ +id: "s_2491", +type: "symptom", +name: "ألم سني، مع صعوبة في تحديد عدد الأسنان المؤلمة", +common_name: "صعوبة في تحديد عدد الأسنان المؤلمة", +}, +{ +id: "s_2494", +type: "symptom", +name: "تشنجات عضلية، في الليل", +common_name: "تشنجات عضلية أثناء الليل", +}, +{ +id: "s_2495", +type: "symptom", +name: "لسان متعرّج", +common_name: "لسان صدفي", +}, +{ +id: "s_2496", +type: "symptom", +name: "انسحال شديد في النسج الصلبة للسن", +common_name: "تآكل شديد في السن", +}, +{ +id: "s_2498", +type: "symptom", +name: "ألم في الفك، يشتد صباحاً", +common_name: "ألم في الفك يحدث صباحاً", +}, +{ +id: "s_2499", +type: "symptom", +name: "ألم وجهي، ثنائي الجانب", +common_name: "ألم في كلا جانبي الوجه", +}, +{ +id: "s_2501", +type: "symptom", +name: "ألم في الفك، عند اللمس", +common_name: "ألم في الفك يظهر عند لمسه", +}, +{ +id: "s_2506", +type: "symptom", +name: "تشنجات عضلية، عند بداية النوم", +common_name: "تشنجات عضلية عند بدء النوم", +}, +{ +id: "s_2507", +type: "symptom", +name: "الهلوسة التنويرية", +common_name: "هلوسات عند بداية النوم", +}, +{ +id: "s_2508", +type: "symptom", +name: "إطراق، حاد", +common_name: "تدلي في الجفنين منذ أقل من أسبوع واحد", +}, +{ +id: "s_2510", +type: "symptom", +name: "تراجع الحليمات بين السنيّة", +common_name: "ظهور مثلثات سوداء بين الأسنان", +}, +{ +id: "s_2511", +type: "symptom", +name: "إطراق، مزمن", +common_name: "تدلي في الجفنين لأكثر من 7 أيام", +}, +{ +id: "s_2512", +type: "symptom", +name: "غثيان، محرّض بالحركة", +common_name: "الشعور برغبة بالتقيؤ عند الحركة", +}, +{ +id: "s_2514", +type: "symptom", +name: "هجرة الأسنان", +common_name: "تغيّر مكان الأسنان", +}, +{ +id: "s_2516", +type: "symptom", +name: "صداع، يوقظ من النوم", +common_name: "الاستيقاظ من النوم بسبب ألم الرأس", +}, +{ +id: "s_2517", +type: "symptom", +name: "وضع الأشياء أو اليد في الفم بشكل مبالغ به", +common_name: "وضع الأشياء أو اليد في الفم", +}, +{ +id: "s_2518", +type: "symptom", +name: "البراز الانتقالي لحديث الولادة", +common_name: "براز مائي أو محبب متكرر عند وليد", +}, +{ +id: "s_2519", +type: "symptom", +name: "براز أصفر أو أخضر اللون", +common_name: "غائط أصفر أو أخضر", +}, +{ +id: "s_2520", +type: "symptom", +name: "صَلَع أندروجيني", +common_name: "تساقط شعر الرأس الموجود على جانبيه أو في قمّته", +}, +{ +id: "s_2521", +type: "symptom", +name: "غائط ذو لون بني", +common_name: "براز بني اللون", +}, +{ +id: "s_2523", +type: "symptom", +name: "براز أسود اللون، متعلّق بنوعية الطعام أو الأدوية المتناولة", +common_name: "خروج أسود اللون ناتج عن نوعية الطعام أو الأدوية المتناولة", +}, +{ +id: "s_2524", +type: "symptom", +name: "عينان محرّتان", +common_name: "احمرار في كلتا العينين", +}, +{ +id: "s_2532", +type: "symptom", +name: "آفة في الفم، مفردة", +common_name: "آفة وحيدة في الفم", +}, +{ +id: "s_2533", +type: "symptom", +name: "آفات فموية، قطرها أقل من 1 سم", +common_name: "آفات في الفم قطرها أقل من 1 سم", +}, +{ +id: "s_2535", +type: "symptom", +name: "آفات فموية، مؤلمة", +common_name: "آفات مؤلمة في الفم", +}, +{ +id: "s_2537", +type: "symptom", +name: "آفات فموية، تدوم أقل من 3 أسابيع", +common_name: "آفات في الفم تستمر فترة لا تزيد عن 3 أسابيع", +}, +{ +id: "s_2538", +type: "symptom", +name: "آفات فمويّة، تدوم 3 أسابيع على الأقل", +common_name: "آفات في الفم تستمر لـ3 أسابيع على الأقل", +}, +{ +id: "s_2541", +type: "symptom", +name: "احتلام", +common_name: "قذف المني أثناء النوم", +}, +{ +id: "s_2543", +type: "symptom", +name: "ألم وجهي، غير مُحرَّض", +common_name: "ألم في الوجه عفوي من دون سبب", +}, +{ +id: "s_2544", +type: "symptom", +name: "ألم وجهي، مستمر", +common_name: "ألم مستمر في الوجه", +}, +{ +id: "s_2545", +type: "symptom", +name: "ألم سني، حساسية للقرع", +common_name: "ألم في سن يتحرّض بنقره", +}, +{ +id: "s_2546", +type: "symptom", +name: "تغاير لون القزحيتين", +common_name: "اختلاف لون العينين", +}, +{ +id: "s_2547", +type: "symptom", +name: "غياب الخصية من كيس الصفن", +common_name: "غياب الخصية من كيس الصفن", +}, +{ +id: "s_2548", +type: "symptom", +name: "خصية نطاطة", +common_name: "خصية قابلة للانكماش", +}, +{ +id: "s_2551", +type: "symptom", +name: "حمامى، في الطرفين العلويين وتعف عن اليدين", +common_name: "احمرار في جلد الكتف أو الذراع أو الساعد أو المرفق أو المعصم", +}, +{ +id: "s_2552", +type: "symptom", +name: "حمامى، في الطرفين السفليين وتعف عن القدمين", +common_name: "احمرار في جلد الورك أو الفخذ أو الركبة أو الساق أو الكاحل", +}, +{ +id: "s_2553", +type: "symptom", +name: "آفات فموية، ناتجة عن رض", +common_name: "آفات في الفم ناتجة عن التعرض لإصابة ما", +}, +{ +id: "s_2557", +type: "symptom", +name: "تغيرات جلدية، في الأذنين", +common_name: "تغيرات جلدية على الأذنين", +}, +{ +id: "s_2558", +type: "symptom", +name: "ألم بطني، ذو بدء غير محدد", +common_name: "ألم في البطن غير معروف متى وكيف بدأ", +}, +{ +id: "s_2559", +type: "symptom", +name: "حمامى، في القدم", +common_name: "احمرار في القدم", +}, +{ +id: "s_2563", +type: "symptom", +name: "يرقان، ناكس", +common_name: "يرقان ناكس", +}, +{ +id: "s_2565", +type: "symptom", +name: "ألم سنّي، ناتج عن رض", +common_name: "ألم في سن بسبب التعرّض لرض عليه", +}, +{ +id: "s_2566", +type: "symptom", +name: "صُداع، موضّع", +common_name: "ألم في الرأس يتوضّع في مكان محدد منه", +}, +{ +id: "s_2567", +type: "symptom", +name: "صُداع، في مكان غير محدد", +common_name: "ألم في الرأس يتوضّع في مكان غير محدد منه", +}, +{ +id: "s_2568", +type: "symptom", +name: "صُداع، جداري", +common_name: "ألم في الرأس في الجزء العلوي منه", +}, +{ +id: "s_2569", +type: "symptom", +name: "يرقان، جلدي", +common_name: "اصفرار الجلد", +}, +{ +id: "s_2571", +type: "symptom", +name: "عسر البلع، شديد", +common_name: "صعوبة شديدة في البلع", +}, +{ +id: "s_2572", +type: "symptom", +name: "أذيّة عينية", +common_name: "أذية للعين", +}, +{ +id: "s_2574", +type: "symptom", +name: "إصابة سابقة بنوب نقص السكر", +common_name: "إصابة سابقة بنوب نقص السكر", +}, +{ +id: "s_2575", +type: "symptom", +name: "القدرة على تدبير انخفاض سكر الدم", +common_name: "القدرة على علاج انخفاض جلوكوز الدم", +}, +{ +id: "s_2577", +type: "symptom", +name: "عين واحدة محمرّة", +common_name: "احمرار في عين واحدة", +}, +{ +id: "s_2579", +type: "symptom", +name: "توسع في أوردة الساق", +common_name: "دوالي الساقين", +}, +{ +id: "s_2580", +type: "symptom", +name: "توسع في أوردة البطن", +common_name: "دوالي البطن", +}, +{ +id: "s_2581", +type: "symptom", +name: "كتلة في كيس الصفن، توسع في الأوردة", +common_name: "دوالي الخصية", +}, +{ +id: "s_2582", +type: "symptom", +name: "ألم في المنطقة الإربية", +common_name: "ألم في ثنية الفخذ", +}, +{ +id: "s_2584", +type: "symptom", +name: "جرح ناتج عن لدغة أفعى", +common_name: "عضة أفعى", +}, +{ +id: "s_2586", +type: "symptom", +name: "الزرام", +common_name: "انقطاع البول", +}, +{ +id: "s_2588", +type: "symptom", +name: "لدغة عنكبوت، من نوع غير معروف", +common_name: "لدغة عنكبوت لا يُعرف إن كان ساماً أم لا", +}, +{ +id: "s_2590", +type: "symptom", +name: "لون البول طبيعي", +common_name: "لون البول طبيعي", +}, +{ +id: "s_2591", +type: "symptom", +name: "ألم مفصلي، في كلتا الركبتين", +common_name: "ألم في كلتا الركبتين", +}, +{ +id: "s_2592", +type: "symptom", +name: "ألم مفصلي، في كلا الركبتين، أثناء الحركة", +common_name: "ألم في كلا الركبتين عند تحريكهما", +}, +{ +id: "s_2593", +type: "symptom", +name: "لدغة عنكبوت قد يكون ساماً", +common_name: "لدغة عنكبوت قد يكون ساماً", +}, +{ +id: "s_2594", +type: "symptom", +name: "لدغة عنكبوت، غير سام", +common_name: "لدغة عنكبوت غير سام", +}, +{ +id: "s_2598", +type: "symptom", +name: "بثور فموية", +common_name: "بثور في الفم", +}, +{ +id: "s_2599", +type: "symptom", +name: "جرح، بنزيف يمكن إيقافه", +common_name: "جرح نازف بنزيف يمكن إيقافه", +}, +{ +id: "s_2600", +type: "symptom", +name: "تضخّم في أحد أوردة الصدر", +common_name: "تضخم أوردة الصدر", +}, +{ +id: "s_2604", +type: "symptom", +name: "لون البول غير معروف", +common_name: "لون البول غير معروف", +}, +{ +id: "s_2605", +type: "symptom", +name: "تغيرات جلدية، تتوضع على الشفتين أو حولهما", +common_name: "تغيرات جلدية متوضعة على الشفتين أو حولهما", +}, +{ +id: "s_2606", +type: "symptom", +name: "مضض في العمود الفقري", +common_name: "ألم عند الضغط على العمود الفقري", +}, +{ +id: "s_2608", +type: "symptom", +name: "رجفان، في كلا الساقين", +common_name: "رجفة في كلا الساقين", +}, +{ +id: "s_2609", +type: "symptom", +name: "اختبار تحرّي كسر الفك السفلي باستخدام خافض اللسان", +common_name: "اختبار كشف كسر الفك باستخدام خافض اللسان", +}, +{ +id: "s_2610", +type: "symptom", +name: "ألم مفصلي، في إحدى أو كلتا الركبتين", +common_name: "ألم في إحدى أو كلتا الركبتين", +}, +{ +id: "s_2611", +type: "symptom", +name: "رجفان، في إحدى الساقين فقط", +common_name: "رجفة في إحدى الساقين فقط", +}, +{ +id: "s_2612", +type: "symptom", +name: "تجنّب الذهاب إلى المنزل", +common_name: "تجنّب الذهاب إلى المنزل", +}, +{ +id: "s_2614", +type: "symptom", +name: "ورم دموي تحت اللسان", +common_name: "تجمّع دموي تحت اللسان", +}, +{ +id: "s_2615", +type: "symptom", +name: "الخوف من شخص محدد", +common_name: "الخوف من شخص أو أشخاص محددين", +}, +{ +id: "s_2619", +type: "symptom", +name: "ألم في الجلد، يتحرّض بالسباحة في البحر أو المحيط", +common_name: "ألم في الجلد عند السباحة في مياه البحر أو المحيط", +}, +{ +id: "s_2622", +type: "symptom", +name: "نقص الوارد من السوائل", +common_name: "عدم شرب ما يكفي من السوائل", +}, +{ +id: "s_2624", +type: "symptom", +name: "ألم في الطرف العلوي، يدوم أقل من 24 ساعة", +common_name: "ألم في الطرف العلوي يستمر أقل من 24 ساعة", +}, +{ +id: "s_2625", +type: "symptom", +name: "ألم في الطرف العلوي، يدوم أكثر من 3 أشهر", +common_name: "ألم في الطرف العلوي يستمر أكثر من 3 أشهر", +}, +{ +id: "s_2626", +type: "symptom", +name: "إمساك، يدوم شهراً أو أكثر", +common_name: "إمساك يستمر شهراً أو أكثر", +}, +{ +id: "s_2627", +type: "symptom", +name: "وذمة، حول الحجاج، في عين واحدة", +common_name: "تورم حول إحدى العينين", +}, +{ +id: "s_2630", +type: "symptom", +name: "حمامى، حول إحدى العينين", +common_name: "احمرار حول إحدى العينين فقط", +}, +{ +id: "s_2633", +type: "symptom", +name: "حمامى، حول إحدى أو كلتا العينين", +common_name: "احمرار حول إحدى أو كلتا العينين", +}, +{ +id: "s_2634", +type: "symptom", +name: "فقدان القدرة على تحريك مفصل", +common_name: "عدم القدرة على تحريك مفصل", +}, +{ +id: "s_2635", +type: "symptom", +name: "نقص حاد في الوزن", +common_name: "نقص حاد في الوزن", +}, +{ +id: "s_2636", +type: "symptom", +name: "ألم في الطرف العلوي، يدوم فترة تتراوح بين يوم واحد و7 أيام", +common_name: "ألم في الطرف العلوي يستمر فترة تتراوح بين يوم واحد و7 أيام", +}, +{ +id: "s_2637", +type: "symptom", +name: "ألم في الطرف العلوي، يدوم فترة تتراوح بين أسبوع واحد و3 أشهر", +common_name: "ألم في الطرف العلوي يستمر فترة تتراوح بين أسبوع واحد و3 أشهر", +}, +{ +id: "s_2638", +type: "symptom", +name: "تشنجات عضلية، في الطرف السفلي", +common_name: "تشنجات في الساق", +}, +{ +id: "s_2639", +type: "symptom", +name: "وذمة، حول الحجاج، في العينين", +common_name: "تورّم حول العينين", +}, +{ +id: "s_2641", +type: "symptom", +name: "مظهر السليم", +common_name: "مظهر السليم", +}, +{ +id: "s_2643", +type: "symptom", +name: "نشاط جنسي", +common_name: "شخص مارس الجنس في الماضي", +}, +{ +id: "s_2645", +type: "symptom", +name: "تعب، نقص اللياقة البدنية", +common_name: "تناقص اللياقة البدنية وضعف القدرة على تحمل الجهد", +}, +{ +id: "s_2646", +type: "symptom", +name: "رجفان، في إحدى أو كلتا اليدين", +common_name: "رجفة في إحدى أو كلتا اليدين", +}, +{ +id: "s_2647", +type: "symptom", +name: "رجفان، في إحدى أو كلا الساقين", +common_name: "رجفة في إحدى أو كلا الساقين", +}, +{ +id: "s_2648", +type: "symptom", +name: "الألم الخيفي", +common_name: "اضطراب حاسة الألم", +}, +{ +id: "s_2650", +type: "symptom", +name: "الاعتداء الجسدي المتكرر على الآخرين", +common_name: "الاعتداء الجسدي المتكرر على الآخرين", +}, +{ +id: "s_2651", +type: "symptom", +name: "نفث الدم، شديد", +common_name: "بصق كميات كبيرة من الدم", +}, +{ +id: "s_2652", +type: "symptom", +name: "الموافقة على طرح أسئلة متعلقة بالحياة الجنسية", +common_name: "الموافقة على الإجابة عن أسئلة متعلقة بالحياة الجنسية", +}, +{ +id: "s_2658", +type: "symptom", +name: "إقياء، طعامي", +common_name: "تقيؤ لطعام", +}, +{ +id: "s_2661", +type: "symptom", +name: "كتلة جلدية، مع نقطة مركزية", +common_name: "كتلة في الجلد تحتوي نقطة في مركزها", +}, +{ +id: "s_2663", +type: "symptom", +name: "نوبات مزاج اكتئابي، تدوم أقل من أسبوعين", +common_name: "مزاج اكتئابي يستمر أقل من أسبوعين", +}, +{ +id: "s_2664", +type: "symptom", +name: "نوبات مزاج اكتئابي، تدوم فترة أطول من سنتين", +common_name: "مزاج اكتئابي يستمر فترة أطول من سنتين", +}, +{ +id: "s_2665", +type: "symptom", +name: "نوبة مزاج اكتئابي، بدأت في الفترة ما حول الولادة", +common_name: "اكتئاب متعلّق بالولادة", +}, +{ +id: "s_2666", +type: "symptom", +name: "نوبات مزاج اكتئابي، تدوم فترة تتراوح بين أسبوعين وسنة واحدة", +common_name: "مزاج اكتئابي يستمر فترة تتراوح بين أسبوعين وسنة واحدة", +}, +{ +id: "s_2667", +type: "symptom", +name: "نوبات مزاج اكتئابي، تدوم فترة تتراوح بين سنة وسنتين", +common_name: "مزاج اكتئابي يستمر فترة تتراوح بين سنة وسنتين", +}, +{ +id: "s_2668", +type: "symptom", +name: "كتلة جلدية، شفافة للضوء", +common_name: "كتلة في الجلد شفافة عند تسليط الضوء عليها", +}, +{ +id: "s_2669", +type: "symptom", +name: "نوبة مزاج مرتفع، تستمر 3 أيام أو أقل", +common_name: "مزاج مرتفع يستمر 3 أيام أو أقل", +}, +{ +id: "s_2670", +type: "symptom", +name: "نوبة مزاج مرتفع، تستمر فترة بين 4 و6 أيام", +common_name: "مزاج مرتفع يستمر فترة تتراوح بين 4 و6 أيام", +}, +{ +id: "s_2671", +type: "symptom", +name: "نوبة مزاج مرتفع، تستمر 7 أيام أو أكثر", +common_name: "مزاج مرتفع يستمر 7 أيام أو أكثر", +}, +{ +id: "s_2672", +type: "symptom", +name: "نوبة مزاج مرتفع، محرّضة باستعمال مادة معيّنة", +common_name: "مزاج مرتفع ناتج عن استخدام مادة ما", +}, +{ +id: "s_2673", +type: "symptom", +name: "تغيرات جلدية، على الرأس", +common_name: "تغيرات جلدية على الرأس", +}, +{ +id: "s_2674", +type: "symptom", +name: "تغيرات جلدية، تُسبق بحُمّى أو أي أعراض أخرى تدل على الإصابة بعدوى في الجهاز التنفسي", +common_name: "تغيرات في الجلد تُسبق بحمى أو غيرها من أعراض الرشح", +}, +{ +id: "s_2675", +type: "symptom", +name: "تقلبات المزاج، تدوم أكثر من سنتين", +common_name: "تقلبات في المزاج تستمر أكثر من سنتين", +}, +{ +id: "s_2676", +type: "symptom", +name: "تقلبات المزاج، تدوم أقل من سنة واحدة", +common_name: "تقلبات في المزاج تستمر أقل من سنة واحدة", +}, +{ +id: "s_2677", +type: "symptom", +name: "نوبة مزاج اكتئابي، محرّضة باستعمال مادة معيّنة", +common_name: "اكتئاب متعلق بسوء استخدام مادة ما", +}, +{ +id: "s_2678", +type: "symptom", +name: "ألم سني، غير معروف السبب", +common_name: "ألم في الأسنان لا يعرف سببه", +}, +{ +id: "s_2680", +type: "symptom", +name: "المزاج الحالي، مرتفع", +common_name: "مزاج مرتفع حالياً", +}, +{ +id: "s_2681", +type: "symptom", +name: "المزاج الحالي، اكتئابي", +common_name: "مزاج اكتئابي حالياً", +}, +{ +id: "s_2682", +type: "symptom", +name: "المزاج الحالي، سوي", +common_name: "مزاج طبيعي حالياً", +}, +{ +id: "s_2684", +type: "symptom", +name: "كتلة جلدية، تتوضع على المعصم", +common_name: "كتلة أو نتوء في المعصم", +}, +{ +id: "s_2686", +type: "symptom", +name: "تقلبات المزاج، تدوم فترة تتراوح بين سنة وسنتين", +common_name: "تقلبات في المزاج تستمر فترة تتراوح بين سنة وسنتين", +}, +{ +id: "s_2687", +type: "symptom", +name: "تقلبات مزاجية، سريعة للغاية", +common_name: "تقلبات مزاجية سريعة", +}, +{ +id: "s_2692", +type: "symptom", +name: "حرق كامل الاستدارة", +common_name: "حرق يشمل كامل المحيط", +}, +{ +id: "s_2696", +type: "symptom", +name: "فقدان الحس في طرف واحد، يدوم أقل من 24 ساعة", +common_name: "غياب الحس في ذراع واحدة أو ساق واحدة يستمر أقل من 24 ساعة", +}, +{ +id: "s_2702", +type: "symptom", +name: "فقدان الحس في طرف واحد، يدوم فترة تتراوح بين 24 ساعة و4 أسابيع", +common_name: "غياب الحس في ذراع واحدة أو ساق واحدة يستمر فترة تتراوح بين 24 ساعة و4 أسابيع", +}, +{ +id: "s_2703", +type: "symptom", +name: "فقدان الحس في طرف واحد، يدوم أكثر من 4 أسابيع", +common_name: "غياب الحس في ذراع واحدة أو ساق واحدة يستمر أكثر من 4 أسابيع", +}, +{ +id: "s_2705", +type: "symptom", +name: "سلوك التجنّب، متعلّق بحدث صادم سابق", +common_name: "سلوك التهرّب من حدث صادم سابق", +}, +{ +id: "s_2706", +type: "symptom", +name: "المشارفة على الموت في الماضي", +common_name: "المشارفة على الموت في الماضي", +}, +{ +id: "s_2707", +type: "symptom", +name: "التعرّض لكارثة طبيعية في الماضي", +common_name: "مشاهدة أو التعرّض لكارثة طبيعية في الماضي", +}, +{ +id: "s_2708", +type: "symptom", +name: "التعرّض لحادث مروري خطير", +common_name: "مشاهدة أو التعرّض لحادث مروري خطير", +}, +{ +id: "s_2709", +type: "symptom", +name: "قصة سابقة للتعرض لحدث راض أو عنيف", +common_name: "التعرض لحدث راض أو عنيف في الماضي", +}, +{ +id: "s_2710", +type: "symptom", +name: "قصة سابقة لوفاة شخص مقرّب بشكل مفاجئ", +common_name: "وفاة مفاجئة لشخص مقرّب في الماضي", +}, +{ +id: "s_2711", +type: "symptom", +name: "نوبات صرعية، النوبة الأولى", +common_name: "أول نوبة صرعية", +}, +{ +id: "s_2712", +type: "symptom", +name: "نوبات صرعية، عدد غير محدد", +common_name: "عدم التأكد من عدد الاختلاجات التي حدثت في الماضي", +}, +{ +id: "s_2713", +type: "symptom", +name: "اضطرابات متعلقة بضغوط أو حدث صادم", +common_name: "اضطرابات متعلقة بضغوط أو حدث صادم", +}, +{ +id: "s_2714", +type: "symptom", +name: "قصة سابقة للتعرض لصدمة نفسية", +common_name: "التعرض لصدمة نفسية في الماضي", +}, +{ +id: "s_2715", +type: "symptom", +name: "اعتداء جسدي حديث على الآخرين، مهدد للحياة أو الصحة", +common_name: "اعتداء جسدي حديث على الآخرين بحيث يكون مهدداً للحياة أو مؤثراً على الصحة", +}, +{ +id: "s_2717", +type: "symptom", +name: "قيح متجمع تحت جلد أحد أصابع القدمين", +common_name: "قيح متجمع تحت جلد أحد أصابع القدمين", +}, +{ +id: "s_2718", +type: "symptom", +name: "وذمة، في كل الوجه", +common_name: "تورم كامل الوجه", +}, +{ +id: "s_2727", +type: "symptom", +name: "فرط اليقظة", +common_name: "حالة من التيقظ والحذر الدائمين", +}, +{ +id: "s_2729", +type: "symptom", +name: "بول عكر", +common_name: "بول أبيض حليبي", +}, +{ +id: "s_2730", +type: "symptom", +name: "تغيرات جلدية، على الردفين", +common_name: "تغيرات جلدية على الردفين", +}, +{ +id: "s_2731", +type: "symptom", +name: "الوكعة", +common_name: "ورم في إبهام القدم", +}, +{ +id: "s_2733", +type: "symptom", +name: "سلوك هوسي", +common_name: "سلوك هوسي", +}, +{ +id: "s_2734", +type: "symptom", +name: "سلوك هوسي، إسراف في إنفاق المال", +common_name: "إنفاق المال بإسراف أثناء المرور بحالة مزاجية مضطربة", +}, +{ +id: "s_2735", +type: "symptom", +name: "سلوك هوسي، ديون متكررة", +common_name: "اقتراض المال بشكل متكرر أثناء المرور بحالة مزاجية مضطربة", +}, +{ +id: "s_2737", +type: "symptom", +name: "استجابة إجفالية مبالغ بها", +common_name: "جفل", +}, +{ +id: "s_2738", +type: "symptom", +name: "وهم، يدوم أقل من شهر واحد", +common_name: "توهمات تستمر لأقل من شهر واحد", +}, +{ +id: "s_2739", +type: "symptom", +name: "وهم، يدوم فترة تتراوح بين شهر و3 أشهر", +common_name: "توهمات تستمر فترة تتراوح بين شهر و3 أشهر", +}, +{ +id: "s_2740", +type: "symptom", +name: "وهم، يدوم 4 أشهر أو أكثر", +common_name: "توهمات تستمر 4 أشهر أو أكثر", +}, +{ +id: "s_2741", +type: "symptom", +name: "هلوسات، تدوم أقل من شهر", +common_name: "هلوسات تستمر أقل من شهر", +}, +{ +id: "s_2742", +type: "symptom", +name: "هلوسات، تدوم فترة تتراوح بين شهر واحد و3 أشهر", +common_name: "هلوسات تستمر فترة تتراوح بين شهر واحد و3 أشهر", +}, +{ +id: "s_2743", +type: "symptom", +name: "هلوسات، تدوم 4 أشهر أو أكثر", +common_name: "هلوسات تستمر 4 أشهر أو أكثر", +}, +{ +id: "s_2744", +type: "symptom", +name: "وهم السرقة", +common_name: "الاعتقاد بأن الشخص تعرَّض للسرقة رغم أن الأدلة تنفي ذلك", +}, +{ +id: "s_2746", +type: "symptom", +name: "إسهال، مُدمّى", +common_name: "إسهال يحتوي دماً", +}, +{ +id: "s_2749", +type: "symptom", +name: "عدم القدرة على تدبير انخفاض سكر الدم", +common_name: "عدم القدرة على تدبير انخفاض سكر الدم", +}, +{ +id: "s_2752", +type: "symptom", +name: "الشعور بالاستنزاف بسبب العمل أو الدراسة", +common_name: "الشعور بالإنهاك الشديد بسبب العمل أو الدراسة", +}, +{ +id: "s_2753", +type: "symptom", +name: "الانفصال نفسياً عن العمل أو الدراسة", +common_name: "الانفصال ذهنياً عن العمل أو الدراسة", +}, +{ +id: "s_2754", +type: "symptom", +name: "ضعف القدرات الكلامية واللغوية", +common_name: "صعوبة في التكلم", +}, +{ +id: "s_2755", +type: "symptom", +name: "الشعور بانعدام القيمة", +common_name: "الشعور بعدم الفعالية", +}, +{ +id: "s_2758", +type: "symptom", +name: "زيادة النشاط الحركي", +common_name: "الحركة الزائدة", +}, +{ +id: "s_2759", +type: "symptom", +name: "زيادة النشاط الحركي، يستمر 3 أيام أو أقل", +common_name: "حركة زائدة أو تململ يستمر 3 أيام أو أقل", +}, +{ +id: "s_2760", +type: "symptom", +name: "صعوبة تنظيم الأشياء", +common_name: "ضياع الأشياء أو وضعها في غير مكانها", +}, +{ +id: "s_2761", +type: "symptom", +name: "زيادة النشاط الحركي، يستمر فترة تتراوح بين 4 و6 أيام", +common_name: "حركة زائدة أو تململ يستمر فترة تتراوح بين 4 و6 أيام", +}, +{ +id: "s_2762", +type: "symptom", +name: "زيادة النشاط الحركي، يستمر فترة تتراوح بين 7 أيام و6 أشهر", +common_name: "حركة زائدة أو تململ يستمر فترة تتراوح بين 7 أيام و6 أشهر", +}, +{ +id: "s_2763", +type: "symptom", +name: "زيادة النشاط الحركي، يستمر 6 أشهر أو أكثر", +common_name: "حركة زائدة أو تململ يستمر 6 أشهر أو أكثر", +}, +{ +id: "s_2764", +type: "symptom", +name: "القلق", +common_name: "العصبية", +}, +{ +id: "s_2766", +type: "symptom", +name: "قلق، يدوم 3 أيام أو أقل", +common_name: "عصبية تستمر 3 أيام أو أقل", +}, +{ +id: "s_2767", +type: "symptom", +name: "قلق، يدوم فترة تتراوح بين 4 و6 أيام", +common_name: "عصبية تستمر فترة تتراوح بين 4 و6 أيام", +}, +{ +id: "s_2768", +type: "symptom", +name: "قلق، يدوم فترة تتراوح بين 7 أيام و6 أشهر", +common_name: "عصبية تستمر فترة تتراوح بين 7 أيام و6 أشهر", +}, +{ +id: "s_2769", +type: "symptom", +name: "قلق، يدوم 6 أشهر أو أكثر", +common_name: "عصبية تستمر 6 أشهر على الأقل", +}, +{ +id: "s_2771", +type: "symptom", +name: "صعوبة تنظيم الأشياء، تدوم 3 أيام أو أقل", +common_name: "ضياع الأشياء أو وضعها في غير مكانها بحيث يستمر ذلك 3 أيام أو أقل", +}, +{ +id: "s_2772", +type: "symptom", +name: "صعوبة تنظيم الأشياء، تدوم فترة تتراوح بين 4 و6 أيام", +common_name: "ضياع الأشياء أو وضعها في غير مكانها بحيث يستمر ذلك فترة تتراوح بين 4 و6 أيام", +}, +{ +id: "s_2773", +type: "symptom", +name: "صعوبة تنظيم الأشياء، تدوم فترة تتراوح بين 7 أيام و6 أشهر", +common_name: "ضياع الأشياء أو وضعها في غير مكانها بحيث يستمر ذلك فترة تتراوح بين 7 أيام و6 أشهر", +}, +{ +id: "s_2774", +type: "symptom", +name: "صعوبة تنظيم الأشياء، تدوم 6 أشهر على الأقل", +common_name: "ضياع الأشياء أو وضعها في غير مكانها بحيث يستمر ذلك 6 أشهر على الأقل", +}, +{ +id: "s_2775", +type: "symptom", +name: "صعوبة في تنظيم المهام أو الأنشطة", +common_name: "عدم القدرة على إكمال المهام", +}, +{ +id: "s_2778", +type: "symptom", +name: "صعوبة تنظيم المهام أو النشاطات، تدوم 3 أيام على الأكثر", +common_name: "صعوبة إتمام المهام أو النشاطات بحيث يستمر ذلك 3 أيام على الأكثر", +}, +{ +id: "s_2779", +type: "symptom", +name: "صعوبة تنظيم المهام أو النشاطات، تدوم 4-6 أيام", +common_name: "صعوبة إتمام المهام أو النشاطات بحيث يستمر ذلك 4-6 أيام", +}, +{ +id: "s_2780", +type: "symptom", +name: "صعوبة تنظيم المهام أو النشاطات، تدوم فترة تتراوح بين 7 أيام و6 أشهر", +common_name: "صعوبة إتمام المهام أو النشاطات بحيث يستمر ذلك فترة تتراوح بين 7 أيام و6 أشهر", +}, +{ +id: "s_2781", +type: "symptom", +name: "صعوبة تنظيم المهام أو النشاطات، تدوم 6 أشهر أو أكثر", +common_name: "صعوبة إتمام المهام أو النشاطات بحيث يستمر ذلك 6 أشهر أو أكثر", +}, +{ +id: "s_2783", +type: "symptom", +name: "نقص الانتباه للتفاصيل", +common_name: "صعوبة الانتباه للتفاصيل", +}, +{ +id: "s_2784", +type: "symptom", +name: "انعدام الصبر", +common_name: "عدم الصبر", +}, +{ +id: "s_2785", +type: "symptom", +name: "جرح، ناجم عن عضة حيوان", +common_name: "جرح ناتج عن عضة حيوان", +}, +{ +id: "s_2786", +type: "symptom", +name: "تقلبات مزاجية، تستمر فترة طويلة", +common_name: "تقلبات مزاجية، تستمر فترة طويلة", +}, +{ +id: "s_2787", +type: "symptom", +name: "ألم سني، لا يُطاق", +common_name: "ألم لا يطاق في الأسنان", +}, +{ +id: "s_2789", +type: "symptom", +name: "الثرثرة", +common_name: "كثرة الكلام", +}, +{ +id: "s_2790", +type: "symptom", +name: "وذمة، في الترقوة", +common_name: "تورم في عظم الترقوة", +}, +{ +id: "s_2791", +type: "symptom", +name: "مضض في الترقوة", +common_name: "ألم عند الضغط على الترقوة", +}, +{ +id: "s_2793", +type: "symptom", +name: "سلوك تمردي", +common_name: "تمرد", +}, +{ +id: "s_2794", +type: "symptom", +name: "سلوكيات متكررة لاإرادية، حركية", +common_name: "حركات متكررة لاإرادية", +}, +{ +id: "s_2795", +type: "symptom", +name: "الخداع", +common_name: "الكذب بكثرة", +}, +{ +id: "s_2796", +type: "symptom", +name: "سلوكيات متكررة لاإرادية", +common_name: "سلوكيات متكررة لاإرادية", +}, +{ +id: "s_2797", +type: "symptom", +name: "سلوكيات متكررة لاإرادية، صوتية", +common_name: "إصدار أصوات لا إرادية بشكل متكرر", +}, +{ +id: "s_2806", +type: "symptom", +name: "انتهاك القانون", +common_name: "تجاوز القانون", +}, +{ +id: "s_2812", +type: "symptom", +name: "إجهاض", +common_name: "إجهاض", +}, +{ +id: "s_2816", +type: "symptom", +name: "بطء في كسب الوزن عند حديثي الولادة", +common_name: "بطء في زيادة الوزن والنمو عند الرضع", +}, +{ +id: "s_2818", +type: "symptom", +name: "براز أحمر اللون، نتيجة نزف خفيف", +common_name: "براز يحتوي على كميات قليلة من الدم", +}, +{ +id: "s_2819", +type: "symptom", +name: "براز أحمر اللون، نتيجة نزف غزير", +common_name: "براز يحتوي على كميات كبيرة من الدم", +}, +{ +id: "s_2820", +type: "symptom", +name: "ألم في الظهر، حاد", +common_name: "ألم حاد في الظهر", +}, +{ +id: "s_2821", +type: "symptom", +name: "ألم في الظهر، تحت حاد", +common_name: "ألم تحت حاد في الظهر", +}, +{ +id: "s_2822", +type: "symptom", +name: "ألم في الظهر، مزمن", +common_name: "ألم مزمن في الظهر", +}, +{ +id: "s_2825", +type: "symptom", +name: "صعق بالتيار الكهربائي", +common_name: "صعق بالتيار الكهربائي", +}, +{ +id: "s_2826", +type: "symptom", +name: "ألم صدري، يزول عند الراحة", +common_name: "ألم في الصدر يزول عند الراحة", +}, +{ +id: "s_2827", +type: "symptom", +name: "تكدم، في الصفن", +common_name: "كدمة في الصفن", +}, +{ +id: "s_2828", +type: "symptom", +name: "قساوة في خصية", +common_name: "إحدى الخصيتين أقسى من الأخرى", +}, +{ +id: "s_2830", +type: "symptom", +name: "سعال، لا يخف مع مرور الوقت", +common_name: "سعال لا يخف مع مرور الوقت", +}, +{ +id: "s_2831", +type: "symptom", +name: "الخوف من تناول الطعام أمام الآخرين أو محاولة تجنب ذلك", +common_name: "الخوف من تناول الطعام أمام الآخرين أو محاولة تجنب ذلك", +}, +{ +id: "s_2832", +type: "symptom", +name: "الرهاب الاجتماعي", +common_name: "الرهاب الاجتماعي", +}, +{ +id: "s_2833", +type: "symptom", +name: "سعال، ديكي", +common_name: "سعال ديكي", +}, +{ +id: "s_2834", +type: "symptom", +name: "زلة تنفسية تستمر أكثر من 4 أسابيع، ساءَت فجأة", +common_name: "تفاقم مفاجئ في ضيق التنفس الذي ظهر لأول مرة منذ أكثر من 4 أسابيع", +}, +{ +id: "s_2835", +type: "symptom", +name: "زلة تنفسية تدوم بين يوم و4 أسابيع، ساءَت فجأةً", +common_name: "تفاقم مفاجئ في ضيق التنفس الذي ظهر لأول مرة منذ فترة تتراوح بين يوم واحد و4 أسابيع", +}, +{ +id: "s_2836", +type: "symptom", +name: "سعال، يخف مع مرور الوقت", +common_name: "سعال يخف مع مرور الوقت", +}, +{ +id: "s_2837", +type: "symptom", +name: "وذمة حادة، في طرف سفلي واحد", +common_name: "تورم في الساق منذ أقل من 3 أيام", +}, +{ +id: "s_2838", +type: "symptom", +name: "وذمة مزمنة، في طرف سفلي واحد", +common_name: "تورم في الساق منذ 3 أيام أو أكثر", +}, +{ +id: "s_2839", +type: "symptom", +name: "وذمة، في كلا الطرفين السفليين، حادة", +common_name: "تورم في كلتا الساقين استمر أقل من 3 أيام", +}, +{ +id: "s_2840", +type: "symptom", +name: "وذمة، في كلا الطرفين السفليين، مزمنة", +common_name: "تورم في كلتا الساقين استمر 3 أيام أو أكثر", +}, +{ +id: "s_2843", +type: "symptom", +name: "ألم صدري، عند القيام بجهد شديد", +common_name: "ألم في الصدر عند القيام بمجهود جسدي شديد", +}, +{ +id: "s_2845", +type: "symptom", +name: "سيلان أنفي، حاد", +common_name: "سيلان حديث من الأنف", +}, +{ +id: "s_2846", +type: "symptom", +name: "سيلان أنفي، مزمن", +common_name: "سيلان مزمن من الأنف", +}, +{ +id: "s_2847", +type: "symptom", +name: "ألم صدري، أثناء الجهد الخفيف", +common_name: "ألم في الصدر يظهر عند القيام بأدنى مجهود جسدي", +}, +{ +id: "s_2849", +type: "symptom", +name: "وذمة، في الفرج", +common_name: "تورم في الفرج", +}, +{ +id: "s_2850", +type: "symptom", +name: "ألم في الطرف السفلي، يستمر أقل من 24 ساعة", +common_name: "ألم في الطرف السفلي يستمر أقل من 24 ساعة", +}, +{ +id: "s_2851", +type: "symptom", +name: "ألم في الطرف السفلي، يستمر بين يوم واحد و7 أيام", +common_name: "ألم في الطرف السفلي يستمر بين يوم واحد و7 أيام", +}, +{ +id: "s_2852", +type: "symptom", +name: "ألم في الطرف السفلي، يستمر بين أسبوع واحد و3 أشهر", +common_name: "ألم في الطرف السفلي يستمر بين أسبوع واحد و3 أشهر", +}, +{ +id: "s_2853", +type: "symptom", +name: "ألم في الطرف السفلي، يستمر أكثر من 3 أشهر", +common_name: "ألم في الطرف السفلي يستمر أكثر من 3 أشهر", +}, +{ +id: "s_2854", +type: "symptom", +name: "حمى، تدوم أكثر من 14 يوماً", +common_name: "ارتفاع في درجة حرارة الجسم يستمر أكثر من 14 يوماً", +}, +{ +id: "s_2855", +type: "symptom", +name: "حمى، تدوم بين 8 و14 يوماً", +common_name: "ارتفاع في درجة حرارة الجسم يستمر بين 8 و14 يوماً", +}, +{ +id: "s_2856", +type: "symptom", +name: "بثور جلدية", +common_name: "بثور على الجلد", +}, +{ +id: "s_2857", +type: "symptom", +name: "بثور جلدية، فقاعات", +common_name: "بثور على الجلد قطرها أكبر من 0.5 سم", +}, +{ +id: "s_2858", +type: "symptom", +name: "بثور جلدية، حويصلات", +common_name: "بثور على الجلد قطرها أصغر من 0.5 سم", +}, +{ +id: "s_2860", +type: "symptom", +name: "حمى، مستجيبة كلياً على العلاج", +common_name: "ارتفاع في درجة حرارة الجسم بحيث تنخفض كلياً بالعلاج", +}, +{ +id: "s_2861", +type: "symptom", +name: "تأخر الدورة الشهرية", +common_name: "تأخر الدورة", +}, +{ +id: "s_2862", +type: "symptom", +name: "تأخر الدورة الشهرية، بين أسبوع واحد و3 أسابيع", +common_name: "تأخر الدورة فترة تتراوح بين أسبوع واحد و3 أسابيع", +}, +{ +id: "s_2863", +type: "symptom", +name: "تأخر الدورة الشهرية، بين 3 أسابيع و3 أشهر", +common_name: "تأخر الدورة فترة تتراوح بين 3 أسابيع و3 أشهر", +}, +{ +id: "s_2864", +type: "symptom", +name: "تأخر الدورة الشهرية، بين 3 أشهر و12 شهراً", +common_name: "تأخر الدورة فترة تتراوح بين 3 أشهر و12 شهراً", +}, +{ +id: "s_2865", +type: "symptom", +name: "تأخر الدورة الشهرية، أكثر من 12 شهراً", +common_name: "تأخر الدورة أكثر من 12 شهراً", +}, +{ +id: "s_2866", +type: "symptom", +name: "حمى، مستجيبة جزئياً على العلاج", +common_name: "ارتفاع في درجة حرارة الجسم بحيث تنخفض جزئياً بالعلاج", +}, +{ +id: "s_2867", +type: "symptom", +name: "وذمة، في أحد أو كلا الطرفين السفليين", +common_name: "تورم في إحدى أو كلتا الساقين", +}, +{ +id: "s_2871", +type: "symptom", +name: "قلة حركات الجنين في الثلث الثالث من الحمل", +common_name: "قلة حركات الجنين في الثلث الثالث من الحمل", +}, +{ +id: "s_2872", +type: "symptom", +name: "تأخر الدورة الشهرية، أقل من أسبوع واحد", +common_name: "تأخر الدورة أقل من أسبوع واحد", +}, +{ +id: "s_2876", +type: "symptom", +name: "حمى، مع محاولة تخفيضها باستخدام خافضات الحرارة", +common_name: "إعطاء خافضات حرارة لتخفيض درجة حرارة الجسم", +}, +{ +id: "s_2877", +type: "symptom", +name: "رجفان، يتحرض باللمس أو البرد أو الأصوات العالية", +common_name: "رجفة تتحرض باللمس أو البرد أو الأصوات العالية", +}, +{ +id: "s_2878", +type: "symptom", +name: "بدء مفاجئ لضعف القدرات الكلامية واللغوية", +common_name: "بدء مفاجئ لضعف القدرات الكلامية واللغوية", +}, +{ +id: "s_2879", +type: "symptom", +name: "حمى، مستمرة", +common_name: "ارتفاع مستمر في درجة حرارة الجسم", +}, +{ +id: "s_2880", +type: "symptom", +name: "حالة صرعية", +common_name: "نوبة اختلاج طويلة استمرت لأكثر من 5 دقائق", +}, +{ +id: "s_2881", +type: "symptom", +name: "إدخال جسم أجنبي، في منطقة الرأس", +common_name: "إدخال جسم غريب في أحد الفوهات في منطقة الرأس", +}, +{ +id: "s_2883", +type: "symptom", +name: "إدخال جسم أجنبي، عالق في المهبل", +common_name: "شيء عالق في المهبل", +}, +{ +id: "s_2884", +type: "symptom", +name: "إدخال جسم أجنبي، عالق في الشرج", +common_name: "شيء عالق في الشرج", +}, +{ +id: "s_2888", +type: "symptom", +name: "حمى، دورية، كل بضعة أيام أو أسابيع", +common_name: "حمى دورية تظهر كل بضعة أيام أو أسابيع", +}, +{ +id: "s_2889", +type: "symptom", +name: "شحوب الجلد، عابر", +common_name: "شحوب عابر في الجلد", +}, +{ +id: "s_2890", +type: "symptom", +name: "حمى، ناكسة بعد 24 ساعة", +common_name: "ارتفاع في درجة حرارة الجسم تنكس بعد مضي 24 ساعة على انخفاضها", +}, +{ +id: "s_2891", +type: "symptom", +name: "حمى، متقطعة", +common_name: "ارتفاع في درجة حرارة الجسم بحيث تنخفض كل يوم", +}, +{ +id: "s_2892", +type: "symptom", +name: "تمزق السلى، بين الأسبوع 22 و37 الحملي", +common_name: "نزول ماء الجنين بين الأسبوع 22 و37 من الحمل", +}, +{ +id: "s_2893", +type: "symptom", +name: "تقلصات رحمية منتظمة، قبل الأسبوع 37 الحملي", +common_name: "تقلصات رحمية منتظمة قبل الأسبوع 37 من الحمل", +}, +{ +id: "s_2894", +type: "symptom", +name: "نزف مهبلي نفاسي، ازدادت شدته", +common_name: "زيادة في النزيف التالي للولادة", +}, +{ +id: "s_2895", +type: "symptom", +name: "عدم تحمل التغيير على النظام اليومي", +common_name: "عدم تحمل التغيير على النظام اليومي", +}, +{ +id: "s_2898", +type: "symptom", +name: "جرح مؤهب للإصابة بالكزاز", +common_name: "جرح معرض للإصابة بالكزاز", +}, +{ +id: "s_2904", +type: "symptom", +name: "محاولة انتحار نشطة حالياً", +common_name: "محاولة انتحار نشطة حالياً", +}, +{ +id: "s_2905", +type: "symptom", +name: "تمزق السلى، قبل الأسبوع 22 الحملي", +common_name: "نزول ماء الجنين قبل الأسبوع 22 من الحمل", +}, +{ +id: "s_2906", +type: "symptom", +name: "تمزق السلى، بعد الأسبوع 37 الحملي", +common_name: "نزول ماء الجنين بعد الأسبوع 37 من الحمل", +}, +{ +id: "s_2907", +type: "symptom", +name: "حمى، شافية حالياً ولكنها كانت موجودة خلال الساعات الـ72 الماضية", +common_name: "ارتفاع في درجة حرارة الجسم كان موجوداً خلال الساعات الـ72 الماضية ولكنه زال حالياً", +}, +{ +id: "s_2908", +type: "symptom", +name: "نزيف رحمي غير طبيعي، غير طمثي", +common_name: "نزف من المهبل يختلف عن الدورة الشهرية", +}, +{ +id: "s_2909", +type: "symptom", +name: "تمشيح رحمي غير طبيعي، غير طمثي", +common_name: "تمشيح من المهبل يختلف عن الدورة الشهرية", +}, +{ +id: "s_2913", +type: "symptom", +name: "لا نزيف أو تمشيح تناسلي غير طبيعي، غير طمثي", +common_name: "لا نزيف أو تمشيح تناسلي غير طبيعي، غير طمثي", +}, +{ +id: "s_2914", +type: "symptom", +name: "أذية جسدية، على الرأس", +common_name: "إصابة في الرأس", +}, +{ +id: "s_2915", +type: "symptom", +name: "أذية جسدية، على الجذع", +common_name: "إصابة في الجذع", +}, +{ +id: "s_2916", +type: "symptom", +name: "أذية جسدية، على الطرف العلوي", +common_name: "إصابة في الطرف العلوي", +}, +{ +id: "s_2917", +type: "symptom", +name: "أذية جسدية، على الطرف السفلي", +common_name: "إصابة في الطرف السفلي", +}, +{ +id: "s_2918", +type: "symptom", +name: "ألم جذري", +common_name: "ألم في الظهر منتشر", +}, +{ +id: "s_2919", +type: "symptom", +name: "موضع الرض", +common_name: "موضع الرض", +}, +{ +id: "s_2920", +type: "symptom", +name: "الأعراض ناتجة عن التعرض لرض حديث", +common_name: "الأعراض ناتجة عن التعرض لإصابة مؤخراً", +}, +{ +id: "s_2924", +type: "symptom", +name: "عَرَج", +common_name: "عرج", +}, +{ +id: "s_2927", +type: "symptom", +name: "آفات فموية، في الجزء الأمامي منه", +common_name: "آفات تتوضع في الجزء الأمامي من الفم", +}, +{ +id: "s_2928", +type: "symptom", +name: "سقوط من شاهق", +common_name: "سقوط من مكان مرتفع", +}, +{ +id: "s_2929", +type: "symptom", +name: "رض ناتج عن حادث بدراجة نارية", +common_name: "إصابة ناتجة عن حادث بدراجة نارية", +}, +{ +id: "s_2930", +type: "symptom", +name: "اصطدام أحد المشاة أو راكب على الدراجة الهوائية بسيارة", +common_name: "اصطدام أحد المشاة أو راكب على الدراجة الهوائية بسيارة", +}, +{ +id: "s_2931", +type: "symptom", +name: "رض ناتج عن حادث سيارة خطير", +common_name: "إصابة ناتجة عن حادث سيارة خطير", +}, +{ +id: "s_2932", +type: "symptom", +name: "لا قصة سابقة للتعرُّض لرض ذي قوة كبيرة", +common_name: "لا قصة سابقة للتعرُّض لرض ذي قوة كبيرة", +}, +{ +id: "s_2935", +type: "symptom", +name: "اضطرابات في الرؤية، بعد التعرض لرض", +common_name: "مشاكل في الرؤية بعد التعرض لإصابة ما", +}, +{ +id: "s_2936", +type: "symptom", +name: "عجز عصبي حديث، بعد رض", +common_name: "تغيرات عصبية حديثة ظهرت بعد التعرض لإصابة ما", +}, +{ +id: "s_2937", +type: "symptom", +name: "انخفاض مفاجئ في ضغط الدم", +common_name: "انخفاض مفاجئ في ضغط الدم", +}, +{ +id: "s_2938", +type: "symptom", +name: "تغيرات جلدية، حول الشرج", +common_name: "تغيرات في الجلد حول الشرج", +}, +{ +id: "s_2939", +type: "symptom", +name: "ألم في العنق، حاد", +common_name: "ألم حاد في الرقبة", +}, +{ +id: "s_2940", +type: "symptom", +name: "ألم في العنق، تحت حاد", +common_name: "ألم تحت حاد في الرقبة", +}, +{ +id: "s_2941", +type: "symptom", +name: "ألم في العنق، مزمن", +common_name: "ألم مزمن في الرقبة", +}, +{ +id: "s_2942", +type: "symptom", +name: "اختناق شافٍ", +common_name: "زوال الاختناق", +}, +{ +id: "s_2945", +type: "symptom", +name: "قصة سابقة للتعرُّض للدغة حشرة القراد، خلال الأسابيع الثلاثة الماضية، في أوروبا", +common_name: "التعرُّض خلال الأسابيع الثلاثة الماضية للدغة حشرة القراد في أوروبا", +}, +{ +id: "s_2946", +type: "symptom", +name: "لا قصة سابقة للتعرُّض للدغة القراد", +common_name: "عدم التعرض في الماضي للدغة بحشرة القراد", +}, +{ +id: "s_2947", +type: "symptom", +name: "قصة سابقة للتعرُّض للدغة حشرة القراد، خلال الأسابيع الثلاثة الماضية، في أمريكا الشمالية", +common_name: "التعرُّض خلال الأسابيع الثلاثة الماضية للدغة حشرة القراد في أمريكا الشمالية", +}, +{ +id: "s_2948", +type: "symptom", +name: "قصة سابقة للتعرُّض للدغة حشرة القراد، خلال الأسابيع الثلاثة الماضية، في شمال آسيا", +common_name: "التعرُّض خلال الأسابيع الثلاثة الماضية للدغة حشرة القراد في شمال آسيا", +}, +{ +id: "s_2949", +type: "symptom", +name: "قصة سابقة للتعرُّض للدغة حشرة القراد، خلال الأسابيع الثلاثة الماضية، في جنوب شرق آسيا", +common_name: "التعرُّض خلال الأسابيع الثلاثة الماضية للدغة حشرة القراد في جنوب شرق آسيا", +}, +{ +id: "s_2950", +type: "symptom", +name: "لا نزيف أو تمشيح تناسلي غير طبيعي، أثناء الحمل", +common_name: "لا نزيف أو تمشيح تناسلي غير طبيعي، أثناء الحمل", +}, +{ +id: "s_2953", +type: "symptom", +name: "ألم في العنق، ذو بدء مفاجئ", +common_name: "ألم في الرقبة ظهر فجأةً", +}, +{ +id: "s_2954", +type: "symptom", +name: "تحدد حركة العنق", +common_name: "تحدد حركة الرقبة", +}, +{ +id: "s_2955", +type: "symptom", +name: "حرق في الجلد", +common_name: "حرق", +}, +{ +id: "s_2956", +type: "symptom", +name: "حرق في الجلد، ناتج عن الحرارة العالية", +common_name: "حرق ناتج عن الحرارة العالية", +}, +{ +id: "s_2957", +type: "symptom", +name: "حرق في الجلد، بمادة كيميائية", +common_name: "حرق بمادة كيميائية", +}, +{ +id: "s_2958", +type: "symptom", +name: "حرق في الجلد، بالتيار الكهربائي", +common_name: "حرق بالتيار الكهربائي", +}, +{ +id: "s_2959", +type: "symptom", +name: "حرق في الجلد، بشيء آخر", +common_name: "سبب آخر للحرق", +}, +{ +id: "s_2960", +type: "symptom", +name: "ألم شديد عند تحريك طرف، بعد رض", +common_name: "عدم القدرة على تحريك طرف ما بسبب ألمٍ شديد فيه ظهر بعد التعرض لإصابة", +}, +{ +id: "s_2961", +type: "symptom", +name: "قصة سابقة لسقوط متكرر من نفس ارتفاع الجسم", +common_name: "سقوط عفوي مفاجئ", +}, +{ +id: "s_2962", +type: "symptom", +name: "حرق في الجلد، سطحي", +common_name: "حرق سطحي في الجلد", +}, +{ +id: "s_2963", +type: "symptom", +name: "حرق في الجلد، جزئي السماكة", +common_name: "حرق جزئي السماكة في الجلد", +}, +{ +id: "s_2964", +type: "symptom", +name: "حرق في الجلد، كامل السماكة", +common_name: "حرق شامل لكامل سماكة الجلد", +}, +{ +id: "s_2965", +type: "symptom", +name: "حرق في الجلد، يشمل النسج العميقة", +common_name: "حرق يشمل الطبقات العميقة", +}, +{ +id: "s_2966", +type: "symptom", +name: "حرق في الجلد، يشمل 1-10% من مساحة سطح الجسم", +common_name: "حرق يشمل 1-10% من مساحة سطح الجسم", +}, +{ +id: "s_2967", +type: "symptom", +name: "خزل في طرف، بعد رض", +common_name: "ضعف في عضلات طرف بعد التعرض لإصابة", +}, +{ +id: "s_2968", +type: "symptom", +name: "تحدد مجال حركة مفصل، بعد رض", +common_name: "تحدد مجال حركة مفصل، بعد رض", +}, +{ +id: "s_2969", +type: "symptom", +name: "ألم يمكن تحمله عند تحريك طرف، بعد رض", +common_name: "ألم يمكن تحمله عند تحريك طرف من الأطراف ظهر بعد التعرض لإصابة ما", +}, +{ +id: "s_2970", +type: "symptom", +name: "لا ألم أو تحدد في الحركة عند تحريك طرف، بعد رض", +common_name: "لا ألم أو تحدد في الحركة عند تحريك طرف، بعد رض", +}, +{ +id: "s_2971", +type: "symptom", +name: "حرق في الجلد، في الرأس أو العنق وما حوله", +common_name: "حرق في الرأس أو الرقبة أو ما حولها", +}, +{ +id: "s_2972", +type: "symptom", +name: "حرق في الجلد، في اليد", +common_name: "حرق في اليد", +}, +{ +id: "s_2973", +type: "symptom", +name: "حرق في الجلد، في القدم", +common_name: "حرق في القدم", +}, +{ +id: "s_2974", +type: "symptom", +name: "حرق في الجلد، في الأعضاء التناسلية أو العجان", +common_name: "حرق في المنطقة التناسلية", +}, +{ +id: "s_2975", +type: "symptom", +name: "حرق في الجلد، في المفاصل الكبيرة", +common_name: "حرق، في الجلد المغطي للمفاصل الكبيرة", +}, +{ +id: "s_2976", +type: "symptom", +name: "حرق في الجلد، في مكان آخر", +common_name: "حرق في مكان آخر", +}, +{ +id: "s_2977", +type: "symptom", +name: "صعوبة في التبول، بعد رض", +common_name: "صعوبة في التبول بعد التعرض لإصابة", +}, +{ +id: "s_2980", +type: "symptom", +name: "حرق في الجلد، يشمل 10-20% من مساحة سطح الجسم", +common_name: "حرق يشمل 10-20% من مساحة سطح الجسم", +}, +{ +id: "s_2981", +type: "symptom", +name: "حرق في الجلد، يشمل أكثر من 20% من مساحة سطح الجسم", +common_name: "حرق يشمل أكثر من 20% من مساحة سطح الجسم", +}, +{ +id: "s_2982", +type: "symptom", +name: "صعوبة في التغوط، بعد رض", +common_name: "صعوبة في التغوط بعد التعرض لإصابة", +}, +{ +id: "s_2984", +type: "symptom", +name: "عدم القدرة على حمل ثقل الجسم", +common_name: "عدم القدرة على الوقوف على أي من القدمين", +}, +{ +id: "s_2985", +type: "symptom", +name: "لا توجد مشاكل في المشي", +common_name: "مشي طبيعي", +}, +{ +id: "s_2986", +type: "symptom", +name: "إجهاض حديث", +common_name: "إجهاض حديث", +}, +{ +id: "s_2987", +type: "symptom", +name: "ألم عيني، أحادي الجانب", +common_name: "ألم في عين واحدة", +}, +{ +id: "s_2988", +type: "symptom", +name: "ألم عيني، ثنائي الجانب", +common_name: "ألم في كلتا العينين", +}, +{ +id: "s_2991", +type: "symptom", +name: "مضض في النواتئ الشوكية", +common_name: "ألم عند الضغط على النواتئ الشوكية", +}, +{ +id: "s_2992", +type: "symptom", +name: "عدم القدرة على حمل ثقل الجسم، غير رضي المنشأ", +common_name: "عدم القدرة على الوقوف على أي من القدمين دون التعرض لأي إصابة", +}, +{ +id: "s_2999", +type: "symptom", +name: "كتلة جلدية، في المنطقة الإربية", +common_name: "بروز تحت الجلد في المنطقة أعلى الفخذ", +}, +{ +id: "s_3000", +type: "symptom", +name: "كتلة جلدية، ردودة", +common_name: "كتلة ردودة في الجلد", +}, +{ +id: "s_3001", +type: "symptom", +name: "كتلة جلدية، غير ردودة", +common_name: "كتلة غير ردودة في الجلد", +}, +{ +id: "s_3002", +type: "symptom", +name: "كتلة جلدية، في منطقة السرة", +common_name: "كتلة في الجلد في المنطقة المحيطة بالسرة", +}, +{ +id: "s_3003", +type: "symptom", +name: "كتلة جلدية، طرية", +common_name: "كتلة أو نتوء طري في الجلد", +}, +{ +id: "s_3004", +type: "symptom", +name: "حرق في العين", +common_name: "حرق في العين", +}, +{ +id: "s_3005", +type: "symptom", +name: "كتلة جلدية، داكنة أو زرقاء اللون", +common_name: "كتلة أو نتوء في الجلد ذات لون داكن أو أزرق", +}, +{ +id: "s_3006", +type: "symptom", +name: "كتلة جلدية، مسررة", +common_name: "نتوءات في الجلد في مركزها انخفاض صغير", +}, +{ +id: "s_3007", +type: "symptom", +name: "كتلة جلدية، قاسية", +common_name: "كتلة قاسية في الجلد", +}, +{ +id: "s_3008", +type: "symptom", +name: "كتلة جلدية، ذات قوام غير معروف", +common_name: "كتلة في الجلد مجهولة القوام", +}, +{ +id: "s_3009", +type: "symptom", +name: "كتلة جلدية، مؤلمة", +common_name: "كتلة أو نتوء مؤلم في الجلد", +}, +{ +id: "s_3012", +type: "symptom", +name: "حرق في الجلد، يشمل أقل من 1% من مساحة سطح الجسم", +common_name: "حرق يشمل أقل من 1% من مساحة سطح الجسم", +}, +{ +id: "s_3013", +type: "symptom", +name: "جرح، نظيف", +common_name: "جرح نظيف", +}, +{ +id: "s_3014", +type: "symptom", +name: "جرح، ملوث", +common_name: "جرح ملوث", +}, +{ +id: "s_3015", +type: "symptom", +name: "جرح، حاد", +common_name: "جرح حاد", +}, +{ +id: "s_3016", +type: "symptom", +name: "جرح، مزمن", +common_name: "جرح مزمن", +}, +{ +id: "s_3017", +type: "symptom", +name: "جرح، ممزق", +common_name: "تمزق في الجلد", +}, +{ +id: "s_3018", +type: "symptom", +name: "جرح، ثاقب", +common_name: "جرح ثاقب", +}, +{ +id: "s_3019", +type: "symptom", +name: "جرح، قاطع", +common_name: "جرح قاطع", +}, +{ +id: "s_3020", +type: "symptom", +name: "سحجة", +common_name: "سحجة", +}, +{ +id: "s_3021", +type: "symptom", +name: "جرح، هرسي", +common_name: "جرح هرسي", +}, +{ +id: "s_3022", +type: "symptom", +name: "جرح، ناتج عن طلق ناري", +common_name: "جرح بطلق ناري", +}, +{ +id: "s_3025", +type: "symptom", +name: "جرح، سطحي", +common_name: "جرح سطحي في الجلد", +}, +{ +id: "s_3026", +type: "symptom", +name: "جرح، جزئي السماكة", +common_name: "جرح جزئي السماكة في الجلد", +}, +{ +id: "s_3027", +type: "symptom", +name: "جرح، كامل السماكة", +common_name: "جرح كامل السماكة في الجلد", +}, +{ +id: "s_3028", +type: "symptom", +name: "جرح، يشمل النسج العميقة", +common_name: "جرح يصل للأنسجة العميقة", +}, +{ +id: "s_3030", +type: "symptom", +name: "تغير جلدي وحيد", +common_name: "تغير واحد في الجلد", +}, +{ +id: "s_3031", +type: "symptom", +name: "تغيرات جلدية، متعددة", +common_name: "تغيرات متعددة في الجلد", +}, +{ +id: "s_3034", +type: "symptom", +name: "صداع، اشتد فجأة", +common_name: "ألم في الرأس ازدادت شدته فجأة", +}, +{ +id: "s_3037", +type: "symptom", +name: "التفكير الوهمي", +common_name: "الاعتقاد الجازم بشيء غير صحيح", +}, +{ +id: "s_3038", +type: "symptom", +name: "هلوسات سابقة", +common_name: "إدراك أحاسيس أو أشياء غير موجودة حقيقة", +}, +{ +id: "s_3039", +type: "symptom", +name: "حالة التلقيح ضد الكزاز غير معروفة", +common_name: "حالة التطعيم ضد الكزاز غير معروفة", +}, +{ +id: "s_3042", +type: "symptom", +name: "شرب الكحول", +common_name: "شرب الكحول", +}, +{ +id: "s_3045", +type: "symptom", +name: "إصابة استنشاقية", +common_name: "حرق في الطريق الهوائي", +}, +{ +id: "s_3046", +type: "symptom", +name: "أذية في الركبة، التواء", +common_name: "التواء في الركبة", +}, +{ +id: "s_3047", +type: "symptom", +name: "سيلان من الحلمة، مفرزات دموية", +common_name: "خروج مفرزات دموية من الحلمة", +}, +{ +id: "s_3048", +type: "symptom", +name: "تشقق الحلمة", +common_name: "تشققات الحلمة", +}, +{ +id: "s_3049", +type: "symptom", +name: "سيلان من الحلمة، قيح", +common_name: "خروج قيح من الحلمة", +}, +{ +id: "s_3051", +type: "symptom", +name: "سيلان من الحلمة، مفرزات مائية أو مصلية", +common_name: "خروج مفرزات مائية أو مصلية من الحلمة", +}, +{ +id: "s_3052", +type: "symptom", +name: "مستوى جلوكوز الدم بين 71 و180 ملغ/دل أو بين 4 و9.9 ممول/ل", +common_name: "مستوى السكر في الدم بين 71 و180 ملغ/دل", +}, +{ +id: "s_3053", +type: "symptom", +name: "مستوى جلوكوز الدم بين 181 و250 ملغ/دل أو بين 10 و13.9 ممول/ل", +common_name: "مستوى السكر في الدم بين 181 و250 ملغ/دل", +}, +{ +id: "s_3054", +type: "symptom", +name: "مستوى جلوكوز الدم بين 251 و 350 ملغ/دل أو بين 14 و19.4 ممول/ل", +common_name: "مستوى السكر في الدم بين 251 و 350 ملغ/دل", +}, +{ +id: "s_3055", +type: "symptom", +name: "مستوى جلوكوز الدم أعلى من 350 ملغ/دل أو 19.4 ممول/ل", +common_name: "مستوى السكر في الدم أعلى من 350 ملغ/دل", +}, +{ +id: "s_3056", +type: "symptom", +name: "مستوى جلوكوز الدم خلال الساعات الستة الماضية، أعلى من 250 ملغ/دل أو 13.9 ممول/ل", +common_name: "مستوى السكر في الدم بقي أعلى من 250 ملغ/دل خلال الساعات الستة الماضية", +}, +{ +id: "s_3057", +type: "symptom", +name: "إدخال جسم أجنبي، في الشرج", +common_name: "إدخال جسم غريب في الشرج", +}, +{ +id: "s_3058", +type: "symptom", +name: "إدخال جسم أجنبي، في المهبل", +common_name: "إدخال جسم غريب في المهبل", +}, +{ +id: "s_3059", +type: "symptom", +name: "رض مباشر على الوجه الأمامي من الركبة", +common_name: "التعرض لضربة مباشرة على الركبة من الأمام", +}, +{ +id: "s_3062", +type: "symptom", +name: "اضطراب في الدورة الشهرية، عدم انتظام", +common_name: "عدم انتظام الدورة الشهرية", +}, +{ +id: "s_3063", +type: "symptom", +name: "اضطراب في الدورة الشهرية، طول في الدورة", +common_name: "طول في الدورة الشهرية أكثر من 8 أيام", +}, +{ +id: "s_3064", +type: "symptom", +name: "اضطراب في الدورة الشهرية، غزارة", +common_name: "غزارة الدورة الشهرية", +}, +{ +id: "s_3065", +type: "symptom", +name: "اضطراب في الدورة الشهرية، قلة الطمث", +common_name: "قلة دم الدورة الشهرية", +}, +{ +id: "s_3066", +type: "symptom", +name: "اضطراب في الدورة الشهرية، عسر الطمث", +common_name: "ألم الدورة الشهرية", +}, +{ +id: "s_3067", +type: "symptom", +name: "اضطراب في الدورة الشهرية، تعدد الطموث", +common_name: "كثرة عدد الدورات الشهرية", +}, +{ +id: "s_3068", +type: "symptom", +name: "اضطراب في الدورة الشهرية، ندرة الطمث", +common_name: "قلة عدد الدورات الشهرية", +}, +{ +id: "s_3069", +type: "symptom", +name: "اضطراب في الدورة الشهرية", +common_name: "مشاكل في الدورة الشهرية", +}, +{ +id: "s_3070", +type: "symptom", +name: "تغيرات جلدية، أحادية الجانب", +common_name: "تغيرات في الجلد تتوضع على جانب واحد فقط من الجسم", +}, +{ +id: "s_3071", +type: "symptom", +name: "بكاء لا يتوقف", +common_name: "بكاء لا يمكن إيقافه", +}, +{ +id: "s_3072", +type: "symptom", +name: "نوب متكررة من البكاء الشديد الذي لا يمكن إيقافه ولا سبب واضح له", +common_name: "نوب متكررة من البكاء الشديد الذي لا يمكن إيقافه ولا سبب واضح له", +}, +{ +id: "s_3078", +type: "symptom", +name: "ضعف عضلي، دون شلل", +common_name: "ضعف في العضلات مع بقاء القدرة على تحريكها", +}, +{ +id: "s_3079", +type: "symptom", +name: "ضعف عضلي، خزل", +common_name: "ضعف في العضلات مع تراجع القدرة على الحركة", +}, +{ +id: "s_3080", +type: "symptom", +name: "ضعف عضلي، شلل", +common_name: "ضعف في العضلات مع عدم القدرة على الحركة", +}, +{ +id: "s_3083", +type: "symptom", +name: "ألم في الخاصرة، في البطن", +common_name: "ألم في جانب البطن", +}, +{ +id: "s_3084", +type: "symptom", +name: "ألم في الخاصرة، في الظهر", +common_name: "ألم في جانب الظهر", +}, +{ +id: "s_3085", +type: "symptom", +name: "ألم في الخاصرة، في الجانب", +common_name: "ألم في الخاصرة، في الجانب", +}, +{ +id: "s_3087", +type: "symptom", +name: "تبارز في الصيوان", +common_name: "بروز في الأذن", +}, +{ +id: "s_3089", +type: "symptom", +name: "زلة تنفسية، شديدة أثناء الراحة", +common_name: "ضيق شديد في التنفس يحدث حتى عند الراحة", +}, +{ +id: "s_3090", +type: "symptom", +name: "زلة تنفسية، شديدة", +common_name: "ضيق شديد في التنفس", +}, +{ +id: "s_3091", +type: "symptom", +name: "الأذية الحالية", +common_name: "الإصابة الحالية", +}, +{ +id: "s_3092", +type: "symptom", +name: "أذية إضافية", +common_name: "إصابة أخرى", +}, +{ +id: "s_3093", +type: "symptom", +name: "لا أذية إضافية", +common_name: "لا إصابة أخرى", +}, +{ +id: "s_3094", +type: "symptom", +name: "التعرض لأحادي أكسيد الكربون في حالة حرق", +common_name: "التعرض لأحادي أكسيد الكربون في حالة حرق", +}, +{ +id: "s_3096", +type: "symptom", +name: "ضعف عضلي، موضع", +common_name: "ضعف في العضلات في جزء محدد من الجسم", +}, +{ +id: "s_3097", +type: "symptom", +name: "ضعف عضلي، في الأطراف", +common_name: "ضعف في الأطراف", +}, +{ +id: "s_3098", +type: "symptom", +name: "ضعف عضلي، وجهي", +common_name: "ضعف في عضلات الوجه", +}, +{ +id: "s_3099", +type: "symptom", +name: "صعوبة إغلاق العين، في عينٍ واحدة", +common_name: "صعوبة في إغلاق إحدى العينين بشكل كامل", +}, +{ +id: "s_3100", +type: "symptom", +name: "ضعف عضلي، هبوط زاوية الفم في جهة واحدة", +common_name: "هبوط في أحد جانبي الفم", +}, +{ +id: "s_3101", +type: "symptom", +name: "ضعف عضلي، في جانب واحد من الوجه", +common_name: "ضعف في العضلات في جانبٍ واحد من الوجه", +}, +{ +id: "s_3104", +type: "symptom", +name: "ضعف عضلي، في كلا الطرفين العلويين", +common_name: "ضعف في العضلات في كلا الطرفين العلويين", +}, +{ +id: "s_3105", +type: "symptom", +name: "ضعف عضلي، في طرف علوي واحد", +common_name: "ضعف في العضلات في طرف علوي واحد", +}, +{ +id: "s_3106", +type: "symptom", +name: "ضعف عضلي، يستمر أقل من 24 ساعة", +common_name: "ضعف في العضلات يستمر أقل من 24 ساعة", +}, +{ +id: "s_3107", +type: "symptom", +name: "ضعف عضلي، في طرف سفلي واحد", +common_name: "ضعف في العضلات في طرف سفلي واحد", +}, +{ +id: "s_3108", +type: "symptom", +name: "ضعف عضلي، في كلا الطرفين السفليين", +common_name: "ضعف في العضلات في كلا الطرفين السفليين", +}, +{ +id: "s_3109", +type: "symptom", +name: "ضعف عضلي، خزل رباعي", +common_name: "ضعف في كل الأطراف الأربعة", +}, +{ +id: "s_3110", +type: "symptom", +name: "ضعف عضلي، خزل شقي", +common_name: "ضعف في العضلات في جانب واحد من الجسم", +}, +{ +id: "s_3111", +type: "symptom", +name: "ضعف عضلي، في الأطراف، من نمط آخر", +common_name: "ضعف عضلي، في الأطراف، من نمط آخر", +}, +{ +id: "s_3112", +type: "symptom", +name: "ضعف عضلي صاعد", +common_name: "ضعف في العضلات ينتشر من الأسفل للأعلى", +}, +{ +id: "s_3113", +type: "symptom", +name: "ضعف عضلي، يستمر بين 24 ساعة وأسبوع واحد", +common_name: "ضعف في العضلات يستمر بين 24 ساعة وأسبوع واحد", +}, +{ +id: "s_3115", +type: "symptom", +name: "حمى، استجابة غير معروفة لخافضات الحرارة", +common_name: "استجابة غير معروفة للحمى على الأدوية الخافضة للحرارة", +}, +{ +id: "s_3116", +type: "symptom", +name: "أذية، لا معلومات", +common_name: "إصابة دون معلومات تفصيلية", +}, +{ +id: "s_3117", +type: "symptom", +name: "ضعف عضلي، يستمر بين أسبوع واحد و4 أسابيع", +common_name: "ضعف في العضلات يستمر بين أسبوع واحد و4 اسابيع", +}, +{ +id: "s_3118", +type: "symptom", +name: "ضعف عضلي، يستمر أكثر من 4 أسابيع", +common_name: "ضعف في العضلات يستمر أكثر من 4 أسابيع", +}, +{ +id: "s_3120", +type: "symptom", +name: "ألم أو مضض في الحلمة", +common_name: "ألم أو مضض في الحلمة", +}, +{ +id: "s_3121", +type: "symptom", +name: "محاولة انتحار في الماضي", +common_name: "محاولة انتحار في الماضي", +}, +{ +id: "s_3122", +type: "symptom", +name: "صعوبة إغلاق العين، في كلا العينين", +common_name: "صعوبة في إغلاق كلا العينين بشكل كامل", +}, +{ +id: "s_3123", +type: "symptom", +name: "ضعف عضلي، هبوط زاوية الفم في الجهتين", +common_name: "هبوط في جانبي الفم", +}, +{ +id: "s_3124", +type: "symptom", +name: "ضعف عضلي، وجهي، من نمط آخر", +common_name: "ضعف عضلي، وجهي، من نمط آخر", +}, +{ +id: "s_3125", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة", +}, +{ +id: "s_3126", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة", +}, +{ +id: "s_3127", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية غير معروفة", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية غير معروفة", +}, +{ +id: "s_3128", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة عند رجل", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة عند رجل", +}, +{ +id: "s_3129", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة عند امرأة", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية كبيرة عند امرأة", +}, +{ +id: "s_3130", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة عند رجل", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة عند رجل", +}, +{ +id: "s_3131", +type: "symptom", +name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة عند امرأة", +common_name: "شرب الكحول، منذ أقل من 24 ساعة، كمية قليلة عند امرأة", +}, +{ +id: "s_3133", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر، عند رجل", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر، عند رجل", +}, +{ +id: "s_3134", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر، عند امرأة", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر، عند امرأة", +}, +{ +id: "s_3135", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، محفوف بالمخاطر", +}, +{ +id: "s_3136", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط", +}, +{ +id: "s_3137", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط، عند رجل", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط، عند رجل", +}, +{ +id: "s_3138", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط، عند امرأة", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بإفراط، عند امرأة", +}, +{ +id: "s_3139", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة", +}, +{ +id: "s_3140", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة، عند رجل", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة، عند رجل", +}, +{ +id: "s_3141", +type: "symptom", +name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة، عند امرأة", +common_name: "شرب الكحول، منذ أكثر من 24 ساعة، بشراهة، عند امرأة", +}, +{ +id: "s_3144", +type: "symptom", +name: "مضض بالثدي، في أحد أو كلا الثديين", +common_name: "ألم في أحد أو كلا الثديين عند الضغط عليهما", +}, +{ +id: "s_3145", +type: "symptom", +name: "لا إصابة عينية", +common_name: "لا توجد إصابة في العين", +}, +{ +id: "s_3146", +type: "symptom", +name: "يرقان، منذ أقل من 72 ساعة", +common_name: "اصفرار في الجلد منذ أقل من 3 أيام", +}, +{ +id: "s_3147", +type: "symptom", +name: "يرقان، يستمر بين 3 أيام و3 أسابيع", +common_name: "اصفرار في الجلد يستمر فترة بين 3 أيام و3 أسابيع", +}, +{ +id: "s_3148", +type: "symptom", +name: "يرقان، يستمر بين 3 أسابيع و3 أشهر", +common_name: "اصفرار في الجلد يستمر فترة بين 3 أسابيع و3 أشهر", +}, +{ +id: "s_3149", +type: "symptom", +name: "يرقان، منذ أكثر من 3 أشهر", +common_name: "اصفرار في الجلد منذ أكثر من 3 أشهر", +}, +{ +id: "s_3150", +type: "symptom", +name: "يرقان، ظهر خلال الساعات الـ24 الأولى التالية للولادة", +common_name: "اصفرار في الجلد ظهر خلال أول 24 ساعة من الولادة", +}, +{ +id: "s_3151", +type: "symptom", +name: "حمامى، ذات حدود واضحة", +common_name: "احمرار في الجلد حوافه واضحة ومحددة", +}, +{ +id: "s_3154", +type: "symptom", +name: "تنخر في الجلد", +common_name: "تنخر في الجلد", +}, +{ +id: "s_3156", +type: "symptom", +name: "ابتلاع جسم أجنبي، بطارية", +common_name: "ابتلاع بطارية", +}, +{ +id: "s_3157", +type: "symptom", +name: "ابتلاع جسم أجنبي، مادة كيميائية", +common_name: "ابتلاع مادة كيميائية", +}, +{ +id: "s_3158", +type: "symptom", +name: "ابتلاع جسم أجنبي، شيء خطير", +common_name: "ابتلاع شيء خطير", +}, +{ +id: "s_3159", +type: "symptom", +name: "ابتلاع جسم أجنبي، صغير وكليل", +common_name: "ابتلاع شيء صغير وغير حاد", +}, +{ +id: "s_3162", +type: "symptom", +name: "جرح، ناتج عن حرق", +common_name: "جرح ناتج عن حرق", +}, +{ +id: "s_3166", +type: "symptom", +name: "شرب الكحول، متلازمة السحب حالياً", +common_name: "أعراض الانسحاب الكحولي حالياً", +}, +{ +id: "s_3167", +type: "symptom", +name: "جرح، ملتهب", +common_name: "التهاب في الجرح", +}, +{ +id: "s_3168", +type: "symptom", +name: "جرح، غير ملتهب", +common_name: "جرح، غير ملتهب", +}, +{ +id: "s_3171", +type: "symptom", +name: "نقص التروية في طرف، بعد التعرض لرض", +common_name: "ضعف الجريان الدموي إلى الطرف المصاب", +}, +{ +id: "s_3173", +type: "symptom", +name: "جرح، خدش ناجم عن التعرض لحيوان", +common_name: "خدش ناجم عن التعامل مع حيوان", +}, +{ +id: "s_3174", +type: "symptom", +name: "ضغط الدم، مرتفع عند طفل", +common_name: "ارتفاع ضغط الدم عند طفل", +}, +{ +id: "s_3176", +type: "symptom", +name: "انخفاض التوتر الشرياني عند طفل", +common_name: "انخفاض ضغط الدم عند طفل", +}, +{ +id: "s_3178", +type: "symptom", +name: "إدمان الكحول", +common_name: "إدمان الكحول", +}, +{ +id: "s_3179", +type: "symptom", +name: "ابتلاع جسم أجنبي، غير معروف", +common_name: "ابتلاع شيء غير معروف", +}, +{ +id: "s_3188", +type: "symptom", +name: "دوخة، مفاجئة وشديدة", +common_name: "دوخة مفاجئة وشديدة", +}, +{ +id: "s_3189", +type: "symptom", +name: "ضعف الرؤية، فقدان الرؤية في جزء من الساحة البصرية", +common_name: "فقدان الرؤية في جزء من الساحة البصرية", +}, +{ +id: "s_3190", +type: "symptom", +name: "ضعف الرؤية، بدء مفاجئ", +common_name: "ضعف مفاجئ في الرؤية", +}, +{ +id: "s_3193", +type: "symptom", +name: "حدقتان غير متناظرتان، منذ أقل من 3 أيام", +common_name: "حدقتان غير متماثلتان ببدء مفاجئ", +}, +{ +id: "s_3194", +type: "symptom", +name: "حدقتان غير متناظرتان، منذ 3 أيام أو أكثر", +common_name: "حدقتان غير متماثلتان منذ أكثر من 3 أيام", +}, +{ +id: "s_3195", +type: "symptom", +name: "ظاهرة غروب الشمس", +common_name: "ظاهرة غروب الشمس", +}, +{ +id: "s_3197", +type: "symptom", +name: "غياب الوعي، بعد التعرض لرض", +common_name: "فقدان الوعي بعد التعرض لإصابة", +}, +{ +id: "s_3199", +type: "symptom", +name: "ضعف الرؤية، تدريجي", +common_name: "ضعف تدريجي في الرؤية", +}, +{ +id: "s_3200", +type: "symptom", +name: "ضعف الرؤية، اضطرابات بصرية شخصية", +common_name: "مشاكل في الرؤية ناتجة عن حوادث غير طبيعية فيها", +}, +{ +id: "s_3201", +type: "symptom", +name: "ضعف الرؤية، عمى تام", +common_name: "عمى تام", +}, +{ +id: "s_3205", +type: "symptom", +name: "رُعاف، لا يمكن إيقافه", +common_name: "نزف لا يمكن إيقافه من الأنف", +}, +{ +id: "s_3206", +type: "symptom", +name: "صعوبة إغلاق العين", +common_name: "صعوبة في إغلاق العين", +}, +{ +id: "s_3208", +type: "symptom", +name: "ضعف القدرة على تحريك بعض أجزاء الجسم", +common_name: "صعوبة تحريك أحد أجزاء الجسم", +}, +{ +id: "s_3209", +type: "symptom", +name: "صعق بالتيار الكهربائي أدى لمضاعفات قلبية أو رئوية", +common_name: "مشاكل في القلب أو الرئتين بعد الإصابة بصعق كهربائي", +}, +{ +id: "s_3210", +type: "symptom", +name: "ألم في طرف", +common_name: "ألم طرف", +}, +{ +id: "s_3212", +type: "symptom", +name: "عدم استخدام أي موانع حمل هرمونية أو معالجة هرمونية معيضة أو لولب رحمي", +common_name: "عدم استخدام أي موانع حمل هرمونية أو معالجة هرمونية معيضة أو لولب رحمي", +}, +]; \ No newline at end of file diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 787a718..b8fc7eb 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -876,5 +876,6 @@ "endDate": "تاريخ الانتهاء", "walkin": "زيارة بدون موعد", "laserClinic": "عيادة الليزر", - "continueString": "يكمل" + "continueString": "يكمل", + "covid_info": "تجري مستشفيات د. سليمان الحبيب فحص فيروس كورونا المستجد وتصدر شهادات السفر على مدار الساعة، طوال أيام الأسبوع، وبسرعة ودقة عالية. يمكن للراغبين في الاستفادة من هذه الخدمة زيارة أحد فروع مستشفيات د. سليمان الحبيب وإجراء فحص كورونا خلال بضع دقائق والحصول على النتائج خلال عدة ساعات خدمة فحص فيروس كورونا Covid 19 بتقنية PCR للكشف عن الفيروس وفقاً لأعلى المعايير العالمية وبأحدث أجهزة RT-PCR عالية الدقة (GeneXpert الأمريكي وغيره)، وهي طرق معتمدة من قبل هيئة الغذاء والدواء وكذلك من قبل المركز السعودي للوقاية من الأمراض المُعدية" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 7b8c4b8..7839083 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -872,6 +872,6 @@ "searchClinic": "Search Clinic", "walkin": "Walk In", "continueString": "Continue", - "laserClinic": "Laser Clinic" - + "laserClinic": "Laser Clinic", + "covid_info" :"Dr. Sulaiman Al Habib hospitals are conducting a test for the emerging corona virus and issuing travel certificates 24/7 in a short time and with high accuracy. Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches to conduct a corona test within few minutes, and obtain the result within several hours. Corona Virus Covid 19 testing service with PCR technology to detect the virus according to the highest international standards and with the latest high-precision RT-PCR devices (American GeneXpert and others), That is approved by the Food and Drug Authority as well as by the Saudi Center for Infectious Diseases Prevention." } \ No newline at end of file diff --git a/convert_json.dart b/convert_json.dart new file mode 100644 index 0000000..08f344d --- /dev/null +++ b/convert_json.dart @@ -0,0 +1,73 @@ +import 'dart:convert'; +import 'dart:io'; + +void main() async { + final file = File('assets/json/body_symptoms_data.json'); + final content = await file.readAsString(); + + print('File size: ${content.length} characters'); + + // Split into two parts + final parts = content.split('export const SymptomsData = ['); + if (parts.length != 2) { + print('ERROR: Could not split file properly'); + exit(1); + } + + print('Split into ${parts.length} parts'); + + // Process BodySymptomsData + var bodyPart = parts[0] + .replaceAll('export const BodySymptomsData = ', '') + .trim() + .replaceAll(RegExp(r';$'), ''); + + print('Parsing body symptoms...'); + Map bodySymptomsData; + try { + bodySymptomsData = json.decode(bodyPart); + print('✅ Body symptoms parsed: ${bodySymptomsData.length} body parts'); + } catch (e) { + print('❌ Error parsing body symptoms: $e'); + exit(1); + } + + // Process SymptomsData + print('Processing symptoms data...'); + var symptomsPart = parts[1] + .trim() + .replaceAll(RegExp(r'\];$'), '') + .replaceAllMapped(RegExp(r'\n(\s*)id:'), (m) => '\n${m.group(1)}"id":') + .replaceAllMapped(RegExp(r'\n(\s*)type:'), (m) => '\n${m.group(1)}"type":') + .replaceAllMapped(RegExp(r'\n(\s*)name:'), (m) => '\n${m.group(1)}"name":') + .replaceAllMapped(RegExp(r'\n(\s*)common_name:'), (m) => '\n${m.group(1)}"common_name":'); + + print('Parsing symptoms...'); + List symptomsData; + try { + symptomsData = json.decode('[$symptomsPart]'); + print('✅ Symptoms parsed: ${symptomsData.length} symptoms'); + } catch (e) { + print('❌ Error parsing symptoms: $e'); + print('First 1000 chars:'); + print('[$symptomsPart]'.substring(0, 1000)); + exit(1); + } + + // Create final JSON + print('Creating final JSON structure...'); + final jsonStructure = { + 'bodySymptoms': bodySymptomsData, + 'symptoms': symptomsData, + }; + + // Write to file + print('Writing to file...'); + final encoder = JsonEncoder.withIndent(' '); + await file.writeAsString(encoder.convert(jsonStructure)); + + print('\n✅ SUCCESS! File converted to proper JSON'); + print('✅ Body parts: ${bodySymptomsData.length}'); + print('✅ Symptoms: ${symptomsData.length}'); +} + 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/api_client.dart b/lib/core/api/api_client.dart index 888f704..f366329 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -19,7 +19,7 @@ abstract class ApiClient { Future post( String endPoint, { - required Map body, + required dynamic body, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, bool isAllowAny, @@ -27,6 +27,8 @@ abstract class ApiClient { bool isRCService, bool isPaymentServices, bool bypassConnectionCheck, + Map apiHeaders, + bool isBodyPlainText, }); Future get( @@ -89,7 +91,7 @@ class ApiClientImp implements ApiClient { @override post( String endPoint, { - required Map body, + required dynamic body, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, bool isAllowAny = false, @@ -97,6 +99,8 @@ class ApiClientImp implements ApiClient { bool isRCService = false, bool isPaymentServices = false, bool bypassConnectionCheck = true, + Map? apiHeaders, + bool isBodyPlainText = false, }) async { String url; if (isExternal) { @@ -110,80 +114,84 @@ class ApiClientImp implements ApiClient { } // try { var user = _appState.getAuthenticatedUser(); - Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; - if (!isExternal) { - String? token = _appState.appAuthToken; + Map headers = apiHeaders ?? {'Content-Type': 'application/json', 'Accept': 'application/json'}; - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] ?? body[''] : SETUP_ID; - } else {} + // When isBodyPlainText is true, skip all body manipulation and use body as-is + if (!isBodyPlainText) { + if (!isExternal) { + String? token = _appState.appAuthToken; - if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND; - } + if (body.containsKey('SetupID')) { + body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] ?? body[''] : SETUP_ID; + } else {} - if (!body.containsKey('IsPublicRequest')) { - // if (!body.containsKey('PatientType')) { - if (user != null && user.patientType != null) { - body['PatientType'] = user.patientType; - } else { - body['PatientType'] = PATIENT_TYPE.toString(); + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = + body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND; } - if (user != null && user.patientType != null) { - body['PatientTypeID'] = user.patientType; - } else { - body['PatientType'] = PATIENT_TYPE_ID.toString(); - } + if (!body.containsKey('IsPublicRequest')) { + // if (!body.containsKey('PatientType')) { + if (user != null && user.patientType != null) { + body['PatientType'] = user.patientType; + } else { + body['PatientType'] = PATIENT_TYPE.toString(); + } + + if (user != null && user.patientType != null) { + body['PatientTypeID'] = user.patientType; + } else { + body['PatientType'] = PATIENT_TYPE_ID.toString(); + } - if (user != null) { - body['TokenID'] = body['TokenID'] ?? token; + if (user != null) { + body['TokenID'] = body['TokenID'] ?? token; - body['PatientID'] = body['PatientID'] ?? user.patientId; + body['PatientID'] = body['PatientID'] ?? user.patientId; - body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSa : user.outSa; - body['SessionID'] = body['TokenID'] == null ? ApiConsts.sessionID : getSessionId(body['TokenID'] ?? ""); //getSe + body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSa : user.outSa; + body['SessionID'] = body['TokenID'] == null ? ApiConsts.sessionID : getSessionId(body['TokenID'] ?? ""); //getSe + } + // else { + // body['SessionID'] = body['TokenID'] == null ? ApiConsts.sessionID : getSessionId(body['TokenID'] ?? ""); //getSe + // + // } } - // else { - // body['SessionID'] = body['TokenID'] == null ? ApiConsts.sessionID : getSessionId(body['TokenID'] ?? ""); //getSe - // - // } } - } - // request.versionID = VERSION_ID; - // request.channel = CHANNEL; - // request.iPAdress = IP_ADDRESS; - // request.generalid = GENERAL_ID; - // request.languageID = (languageID == 'ar' ? 1 : 2); - // request.patientOutSA = (request.zipCode == '966' || request.zipCode == '+966') ? 0 : 1; - - // body['VersionID'] = ApiConsts.appVersionID.toString(); - if (!isExternal) { - body['VersionID'] = ApiConsts.appVersionID.toString(); - body['Channel'] = ApiConsts.appChannelId.toString(); - body['IPAdress'] = ApiConsts.appIpAddress; - body['generalid'] = ApiConsts.appGeneralId; - - body['LanguageID'] = _appState.getLanguageID().toString(); - body['Latitude'] = _appState.userLat.toString(); - body['Longitude'] = _appState.userLong.toString(); - body['DeviceTypeID'] = _appState.deviceTypeID; - if (_appState.appAuthToken.isNotEmpty) { - body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; + // request.versionID = VERSION_ID; + // request.channel = CHANNEL; + // request.iPAdress = IP_ADDRESS; + // request.generalid = GENERAL_ID; + // request.languageID = (languageID == 'ar' ? 1 : 2); + // request.patientOutSA = (request.zipCode == '966' || request.zipCode == '+966') ? 0 : 1; + + // body['VersionID'] = ApiConsts.appVersionID.toString(); + if (!isExternal) { + body['VersionID'] = ApiConsts.appVersionID.toString(); + body['Channel'] = ApiConsts.appChannelId.toString(); + body['IPAdress'] = ApiConsts.appIpAddress; + body['generalid'] = ApiConsts.appGeneralId; + + body['LanguageID'] = _appState.getLanguageID().toString(); + body['Latitude'] = _appState.userLat.toString(); + body['Longitude'] = _appState.userLong.toString(); + body['DeviceTypeID'] = _appState.deviceTypeID; + if (_appState.appAuthToken.isNotEmpty) { + body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; + } + + // body['TokenID'] = "@dm!n"; + // body['PatientID'] = 1018977; + // body['PatientTypeID'] = 1; + // + // body['PatientOutSA'] = 0; + // body['SessionID'] = "45786230487560q"; } - // body['TokenID'] = "@dm!n"; - // body['PatientID'] = 1018977; - // body['PatientTypeID'] = 1; - // - // body['PatientOutSA'] = 0; - // body['SessionID'] = "45786230487560q"; + body.removeWhere((key, value) => value == null); } - body.removeWhere((key, value) => value == null); - final bool networkStatus = await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck); if (!networkStatus) { @@ -196,12 +204,13 @@ class ApiClientImp implements ApiClient { return; } - final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); + // Handle body encoding based on isBodyPlainText flag + final dynamic requestBody = isBodyPlainText ? body : json.encode(body); + final response = await http.post(Uri.parse(url.trim()), body: requestBody, headers: headers); 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 b92461e..0febdbe 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -14,8 +14,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -181,6 +181,7 @@ var GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; /// /// use get all cities from the e-referral, already calling this api there don't use multiple same api calls var GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities'; + /// /// /// @@ -333,6 +334,8 @@ var GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/GetChe var CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/CanPayForWalkinAppointment'; +var GET_APPOINTMENT_NEAREST_GATE = 'Services/OUTPs.svc/REST/getGateByProjectIDandClinicID'; + //URL to get medicine and pharmacies list var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; @@ -436,16 +439,6 @@ var RATE_DOCTOR_RESPONSE = 'Services/OUTPs.svc/REST/insertAppointmentQuestionRat var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; -// H2O -var H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; -var H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; -var H2O_GET_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New"; -var H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New"; -var H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity"; -//E_Referral Services - - - // Encillary Orders var GET_ANCILLARY_ORDERS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList'; @@ -455,8 +448,6 @@ var GET_ANCILLARY_ORDERS_DETAILS = 'Services/Doctors.svc/REST/GetOnlineAncillary //Pharmacy wishlist // var GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; -var GET_DOCTOR_LIST_BY_TIME = "Services/Doctors.svc/REST/SearchDoctorsByTime"; - // pharmacy var PHARMACY_AUTORZIE_CUSTOMER = "AutorizeCustomer"; var PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer"; @@ -512,12 +503,6 @@ var PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertP var BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; var ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; -// HHC RC SERVICES -var HHC_GET_ALL_SERVICES_RC = "api/HHC/getallhhc"; -var ADD_HHC_ORDER_RC = "api/HHC/add"; -var GET_ALL_HHC_ORDERS_RC = 'api/hhc/list'; -var UPDATE_HHC_ORDER_RC = 'api/hhc/update'; - // RRT RC SERVICES var ADD_RRT_ORDER_RC = "api/rrt/add"; var GET_ALL_RRT_ORDERS_RC = "api/rrt/list"; @@ -560,7 +545,6 @@ var GET_FINAL_PRODUCTS = 'products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId='; var GET_CLINIC_CATEGORY = 'Services/Doctors.svc/REST/DP_GetClinicCategory'; var GET_DISEASE_BY_CLINIC_ID = 'Services/Doctors.svc/REST/DP_GetDiseasesByClinicID'; -var SEARCH_DOCTOR_BY_TIME = 'Services/Doctors.svc/REST/SearchDoctorsByTime'; var TIMER_MIN = 10; @@ -680,25 +664,6 @@ var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; // Auth Provider Consts -const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI'; -const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI'; -const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication'; -const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo'; - -const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; -const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration"; - -const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo"; -const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration'; -const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; - -const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber'; -const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; -const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate'; -const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo'; - -const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate'; - var ER_CREATE_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic"; //family Files @@ -710,13 +675,15 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD - static String rcBaseUrl = 'https://rc.hmg.com/'; // RC API URL PROD + static String rcBaseUrl = 'https://rc.hmg.com/'; // dRC API URL PROD + static String hmgPharmacyApiBaseUrl = 'https://hmgpharmacyapi.hmg.com/'; // dRC API URL PROD + static String symptomsCheckerApi = '${hmgPharmacyApiBaseUrl}symptomsapi/api/SymptomChecker'; // dRC API URL PROD static var payFortEnvironment = FortEnvironment.production; static var applePayMerchantId = "merchant.com.hmgwebservices"; @@ -728,6 +695,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; @@ -744,6 +713,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/"; @@ -754,6 +724,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/"; @@ -764,6 +735,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/"; @@ -774,6 +746,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/"; @@ -784,6 +757,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/"; @@ -794,6 +768,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; } } @@ -850,9 +825,14 @@ class ApiConsts { static final String updateHHCOrder = 'api/hhc/update'; static final String addHHCOrder = 'api/HHC/add'; + // SYMPTOMS CHECKER + 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 explain = '$symptomsCheckerApi/explain'; //E-REFERRAL SERVICES - static final getAllRelationshipTypes = "Services/Patients.svc/REST/GetAllRelationshipTypes"; static final sendActivationCodeForEReferral = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; static final checkActivationCodeForEReferral = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; @@ -860,6 +840,13 @@ class ApiConsts { static final createEReferral = "Services/Patients.svc/REST/CreateEReferral"; static final getEReferrals = "Services/Patients.svc/REST/GetEReferrals"; + //WATER CONSUMPTION + static String h2oGetUserProgress = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; + static String h2oInsertUserActivity = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; + static String h2oInsertUserDetailsNew = "Services/H2ORemainder.svc/REST/H2O_InsertUserDetails_New"; + static String h2oGetUserDetail = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New"; + static String h2oUpdateUserDetail = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New"; + static String h2oUndoUserActivity = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity"; // ************ static values for Api **************** static final double appVersionID = 50.3; @@ -868,3 +855,38 @@ class ApiConsts { static final String appGeneralId = "Cs2020@2016\$2958"; static final String sessionID = 'TMRhVmkGhOsvamErw'; } + +class ApiKeyConstants { + static final String googleMapsApiKey = 'AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng'; +} + +//flutter: URL : https://hmgwebservices.com/Services/H2ORemainder.svc/REST/H2O_InsertUserActivity +// flutter: {"IdentificationNo":"2530976584","MobileNumber":"504278212","QuantityIntake":200,"VersionID":20.0,"Channel":3,"LanguageID":2,"IPAdress":"10.20.10.20","generalid":"Cs2020@2016$2958","PatientOutSA":0,"SessionID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","isDentalAllowedBackend":false,"DeviceTypeID":1,"PatientID":4515697,"TokenID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","PatientTypeID":1,"PatientType":1,"Latitude":37.785834,"Longitude":-122.406417} +// flutter: response.body: +// flutter: {"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":true,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"IsHMGPatient":false,"LogInTokenID":null,"PhysicalActivityData":null,"RowExists":0,"UserDetailData":null,"UserDetailData_New":null,"UserProgressForMonthData":null,"UserProgressForTodayData":[{"QuantityConsumed":200.00,"PercentageConsumed":9.41,"PercentageLeft":90.59,"QuantityLimit":2125.00}],"UserProgressForWeekData":null,"UserProgressHistoryData":[{"Quantity":200.000,"CreatedDate":"\/Date(1766911222217+0300)\/"}],"VerificationCode":null,"isSMSSent":false} + +// URL : https://hmgwebservices.com/Services/H2ORemainder.svc/REST/H2o_UndoUserActivity +// flutter: {"Progress":1,"MobileNumber":"504278212","IdentificationNo":"2530976584","VersionID":20.0,"Channel":3,"LanguageID":2,"IPAdress":"10.20.10.20","generalid":"Cs2020@2016$2958","PatientOutSA":0,"SessionID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","isDentalAllowedBackend":false,"DeviceTypeID":1,"PatientID":4515697,"TokenID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","PatientTypeID":1,"PatientType":1,"Latitude":37.785834,"Longitude":-122.406417} +// flutter: response.body: +// flutter: {"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":false,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"IsHMGPatient":false,"LogInTokenID":null,"PhysicalActivityData":null,"RowExists":0,"UserDetailData":null,"UserDetailData_New":null,"UserProgressForMonthData":null,"UserProgressForTodayData":[{"QuantityConsumed":0.00,"PercentageConsumed":0.00,"PercentageLeft":100.00,"QuantityLimit":2125.00}],"UserProgressForWeekData":null,"UserProgressHistoryData":[],"VerificationCode":null,"isSMSSent":false} + +// Progress":2 means weekly data + +// flutter: URL : https://hmgwebservices.com/Services/H2ORemainder.svc/REST/H2O_GetUserProgress +// flutter: {"Progress":2,"MobileNumber":"504278212","IdentificationNo":"2530976584","VersionID":20.0,"Channel":3,"LanguageID":2,"IPAdress":"10.20.10.20","generalid":"Cs2020@2016$2958","PatientOutSA":0,"SessionID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","isDentalAllowedBackend":false,"DeviceTypeID":1,"PatientID":4515697,"TokenID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","PatientTypeID":1,"PatientType":1,"Latitude":37.785834,"Longitude":-122.406417} +// flutter: response.body: +// [log] {"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":false,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"IsHMGPatient":false,"LogInTokenID":null,"PhysicalActivityData":null,"RowExists":0,"UserDetailData":null,"UserDetailData_New":null,"UserProgressForMonthData":null,"UserProgressForTodayData":null,"UserProgressForWeekData":[{"DayNumber":1,"DayDate":null,"DayName":"Sunday","PercentageConsumed":0},{"DayNumber":7,"DayDate":null,"DayName":"Saturday","PercentageConsumed":0},{"DayNumber":6,"DayDate":null,"DayName":"Friday","PercentageConsumed":0},{"DayNumber":5,"DayDate":null,"DayName":"Thursday","PercentageConsumed":0},{"DayNumber":4,"DayDate":null,"DayName":"Wednesday","PercentageConsumed":0},{"DayNumber":3,"DayDate":null,"DayName":"Tuesday","PercentageConsumed":0},{"DayNumber":2,"DayDate":null,"DayName":"Monday","PercentageConsumed":0}],"UserProgressHistoryData":[],"VerificationCode":null,"isSMSSent":false} + +// Progress":1 means daily data + +//URL : https://hmgwebservices.com/Services/H2ORemainder.svc/REST/H2O_GetUserProgress +// flutter: {"Progress":1,"MobileNumber":"504278212","IdentificationNo":"2530976584","VersionID":20.0,"Channel":3,"LanguageID":2,"IPAdress":"10.20.10.20","generalid":"Cs2020@2016$2958","PatientOutSA":0,"SessionID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","isDentalAllowedBackend":false,"DeviceTypeID":1,"PatientID":4515697,"TokenID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","PatientTypeID":1,"PatientType":1,"Latitude":37.785834,"Longitude":-122.406417} +// flutter: response.body: +// flutter: {"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":false,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"IsHMGPatient":false,"LogInTokenID":null,"PhysicalActivityData":null,"RowExists":0,"UserDetailData":null,"UserDetailData_New":null,"UserProgressForMonthData":null,"UserProgressForTodayData":[{"QuantityConsumed":0.00,"PercentageConsumed":0.00,"PercentageLeft":100.00,"QuantityLimit":2125.00}],"UserProgressForWeekData":null,"UserProgressHistoryData":[],"VerificationCode":null,"isSMSSent":false} + +// Progress":1 means monthly data + +// flutter: URL : https://hmgwebservices.com/Services/H2ORemainder.svc/REST/H2O_GetUserProgress +// flutter: {"Progress":3,"MobileNumber":"504278212","IdentificationNo":"2530976584","VersionID":20.0,"Channel":3,"LanguageID":2,"IPAdress":"10.20.10.20","generalid":"Cs2020@2016$2958","PatientOutSA":0,"SessionID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","isDentalAllowedBackend":false,"DeviceTypeID":1,"PatientID":4515697,"TokenID":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlblR5cGUiOjIsIm9iaiI6eyJUaW1lIjoiMjAyNS0xMi0yOFQwODozNjo0My45MTY0MzRaIiwiUGF0aWVudElEIjoiNDUxNTY5NyIsIlBhdGllbnRNZXJnZWRJRHMiOiI0NTE1Njk3IiwiUGF0aWVudE91dFNBIjpmYWxzZX0sImV4cCI6MTc2Njk2NjQwMH0.l1rCcs2OAU5u2J-iZMiO7NX6shGzLJV0hlYtVh2JeqY","PatientTypeID":1,"PatientType":1,"Latitude":37.785834,"Longitude":-122.406417} +// flutter: response.body: +// [log] {"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":false,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"IsHMGPatient":false,"LogInTokenID":null,"PhysicalActivityData":null,"RowExists":0,"UserDetailData":null,"UserDetailData_New":null,"UserProgressForMonthData":[{"MonthNumber":1,"MonthName":"January","PercentageConsumed":0},{"MonthNumber":2,"MonthName":"February","PercentageConsumed":0},{"MonthNumber":3,"MonthName":"March","PercentageConsumed":0},{"MonthNumber":4,"MonthName":"April","PercentageConsumed":0},{"MonthNumber":5,"MonthName":"May","PercentageConsumed":0},{"MonthNumber":6,"MonthName":"June","PercentageConsumed":0},{"MonthNumber":7,"MonthName":"July","PercentageConsumed":0},{"MonthNumber":8,"MonthName":"August","PercentageConsumed":0},{"MonthNumber":9,"MonthName":"September","PercentageConsumed":0},{"MonthNumber":10,"MonthName":"October","PercentageConsumed":0},{"MonthNumber":11,"MonthName":"November","PercentageConsumed":0},{"MonthNumber":12,"MonthName":"December","PercentageConsumed":0}],"UserProgressForTodayData":null,"UserProgressForWeekData":null,"UserProgressHistoryData":[],"VerificationCode":null,"isSMSSent":false} diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index 1c17024..4d5535f 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -188,7 +188,40 @@ 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'; + static const String bmi = '$svgBasePath/bmi.svg'; + static const String bmr = '$svgBasePath/bmr.svg'; + static const String calories = '$svgBasePath/calories.svg'; + static const String ibw = '$svgBasePath/ibw.svg'; + static const String general_health = '$svgBasePath/general_health.svg'; + static const String women_health = '$svgBasePath/women_health.svg'; + static const String height = '$svgBasePath/height.svg'; + static const String weight = '$svgBasePath/weight.svg'; + static const String activity = '$svgBasePath/activity.svg'; + static const String age = '$svgBasePath/age_icon.svg'; + static const String gender = '$svgBasePath/gender_icon.svg'; + + static const String trade_down_yellow = '$svgBasePath/trade_down_yellow.svg'; + static const String trade_down_red = '$svgBasePath/trade_down_red.svg'; + static const String pharmacy_icon = '$svgBasePath/phramacy_icon.svg'; //bottom navigation// static const String homeBottom = '$svgBasePath/home_bottom.svg'; @@ -202,23 +235,83 @@ class AppAssets { static const String heart = '$svgBasePath/heart.svg'; static const String alertSquare = '$svgBasePath/alert-square.svg'; static const String arrowRight = '$svgBasePath/arrow-right.svg'; + static const String tickIcon = '$svgBasePath/tick.svg'; + + // Symptoms Checker + static const String calendarGrey = '$svgBasePath/calendar-grey.svg'; + static const String weightScale = '$svgBasePath/weight-scale.svg'; + static const String rulerIcon = '$svgBasePath/ruler.svg'; + static const String genderIcon = '$svgBasePath/gender.svg'; + static const String bodyIcon = '$svgBasePath/body_icon.svg'; + static const String rotateIcon = '$svgBasePath/rotate_icon.svg'; + static const String refreshIcon = '$svgBasePath/refresh.svg'; + static const String homeBorderedIcon = '$svgBasePath/home_bordered.svg'; + + // Water Monitor + static const String waterBottle = '$svgBasePath/water_bottle.svg'; + static const String cupAdd = '$svgBasePath/cup_add.svg'; + static const String cupFilled = '$svgBasePath/cup_filled.svg'; + static const String waterBottleOuterBubbles = '$svgBasePath/outer_bubbles.svg'; + static const String cupEmpty = '$svgBasePath/cup_empty.svg'; + static const String dumbellIcon = '$svgBasePath/dumbell_icon.svg'; + static const String weightScaleIcon = '$svgBasePath/weight_scale_icon.svg'; + static const String heightIcon = '$svgBasePath/height_icon.svg'; + static const String profileIcon = '$svgBasePath/profile_icon.svg'; + static const String notificationIconGrey = '$svgBasePath/notification_icon_grey.svg'; + static const String minimizeIcon = '$svgBasePath/minimize_icon.svg'; + static const String addIconDark = '$svgBasePath/add_icon_dark.svg'; + static const String glassIcon = '$svgBasePath/glass_icon.svg'; + static const String graphIcon = '$svgBasePath/graph_icon.svg'; + static const String listIcon = '$svgBasePath/list_icon.svg'; + 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'; + + + 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'; + static const String pregnancyDayAccordion = '$svgBasePath/pregnancy_test_day_accordion.svg'; + static const String pregnancyDueDateAccordion = '$svgBasePath/due_date_accordion.svg'; + + static const String covid19icon = '$svgBasePath/covid_19.svg'; // PNGS // - static const String hmg_logo = '$pngBasePath/hmg_logo.png'; - static const String livecare_service = '$pngBasePath/livecare_service.png'; - static const String male_img = '$pngBasePath/male_img.png'; + static const String hmgLogo = '$pngBasePath/hmg_logo.png'; + static const String liveCareService = '$pngBasePath/livecare_service.png'; + + static const String homeHealthCareService = '$pngBasePath/home_health_care.png'; + static const String pharmacyService = '$pngBasePath/pharmacy_service.png'; + + static const String maleImg = '$pngBasePath/male_img.png'; static const String femaleImg = '$pngBasePath/female_img.png'; static const String babyGirlImg = '$pngBasePath/baby_girl_img.png'; static const String babyBoyImg = '$pngBasePath/baby_img.png'; - static const String apple_pay = '$pngBasePath/Apple_Pay.png'; + static const String applePay = '$pngBasePath/Apple_Pay.png'; static const String mada = '$pngBasePath/Mada.png'; - static const String Mastercard = '$pngBasePath/Mastercard.png'; - static const String tamara_en = '$pngBasePath/tamara_en.png'; + static const String mastercard = '$pngBasePath/Mastercard.png'; + static const String tamaraEng = '$pngBasePath/tamara_en.png'; static const String visa = '$pngBasePath/visa.png'; static const String lockIcon = '$pngBasePath/lock-icon.png'; - static const String dummy_user = '$pngBasePath/dummy_user.png'; + static const String dummyUser = '$pngBasePath/dummy_user.png'; static const String comprehensiveCheckupEn = '$pngBasePath/cc_en.png'; static const String comprehensiveCheckupAr = '$pngBasePath/cc_er.png'; + static const String maleIcon = '$pngBasePath/male_icon.png'; + static const String femaleIcon = '$pngBasePath/female_icon.png'; + + static const String fullBodyFront = '$pngBasePath/full_body_front.png'; + static const String fullBodyBack = '$pngBasePath/full_body_back.png'; + + + } class AppAnimations { @@ -234,9 +327,11 @@ class AppAnimations { static const String splashLaunching = '$lottieBasePath/splash_launching.json'; static const String noData = '$lottieBasePath/Nodata.json'; static const String ripple = '$lottieBasePath/Ripple.json'; - static const String pending_loading_animation = '$lottieBasePath/pending_loading_animation.json'; + static const String pendingLoadingAnimation = '$lottieBasePath/pending_loading_animation.json'; static const String ambulance = '$lottieBasePath/ambulance.json'; - static const String ambulance_alert = '$lottieBasePath/ambulance_alert.json'; - static const String rrt_ambulance = '$lottieBasePath/rrt_ambulance.json'; + static const String ambulanceAlert = '$lottieBasePath/ambulance_alert.json'; + static const String rrtAmbulance = '$lottieBasePath/rrt_ambulance.json'; + + } diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index c8659a7..e1d6e05 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -4,10 +4,8 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:gms_check/gms_check.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/HMCProjectListModel.dart'; -import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/ProjectDetailListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/VidaPlusProjectListModel.dart'; -import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; @@ -45,7 +43,7 @@ class AppState { bool isChildLoggedIn = false; bool isGMSAvailable = true; bool isAndroid = true; - + bool isRatedVisible =false; void setAuthenticatedUser(AuthenticatedUser? authenticatedUser, {bool isFamily = false}) { if (isFamily) { _authenticatedChildUser = authenticatedUser; @@ -172,4 +170,8 @@ class AppState { userLong = 0.0; userLong = 0.0; } + + setRatedVisible(bool value) { + isRatedVisible = value; + } } diff --git a/lib/core/cache_consts.dart b/lib/core/cache_consts.dart index bcbb185..8deb8bd 100644 --- a/lib/core/cache_consts.dart +++ b/lib/core/cache_consts.dart @@ -63,6 +63,7 @@ class CacheConst { static const String pharmacyAutorzieToken = 'PHARMACY_AUTORZIE_TOKEN'; static const String h2oUnit = 'H2O_UNIT'; static const String h2oReminder = 'H2O_REMINDER'; + static const String waterReminderEnabled = 'WATER_REMINDER_ENABLED'; static const String livecareClinicData = 'LIVECARE_CLINIC_DATA'; static const String doctorScheduleDateSel = 'DOCTOR_SCHEDULE_DATE_SEL'; static const String appointmentHistoryMedical = 'APPOINTMENT_HISTORY_MEDICAL'; diff --git a/lib/core/common_models/data_points.dart b/lib/core/common_models/data_points.dart index 3f5065c..f156ecb 100644 --- a/lib/core/common_models/data_points.dart +++ b/lib/core/common_models/data_points.dart @@ -1,26 +1,26 @@ - - ///class used to provide value for the [DynamicResultChart] to plot the values class DataPoint { ///values that is displayed on the graph and dot is plotted on this final double value; + ///label shown on the bottom of the graph String label; String referenceValue; String actualValue; - String? unitOfMeasurement ; + String? unitOfMeasurement; + DateTime time; String displayTime; - DataPoint( - {required this.value, - required this.label, - required this.referenceValue, - required this.actualValue, - required this.time, - required this.displayTime, - this.unitOfMeasurement - }); + DataPoint({ + required this.value, + required this.label, + required this.actualValue, + required this.time, + required this.displayTime, + this.unitOfMeasurement, + this.referenceValue = '', + }); @override String toString() { diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index c7037e5..489af59 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -1,4 +1,5 @@ import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/api/api_client.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; @@ -29,6 +30,7 @@ import 'package:hmg_patient_app_new/features/location/location_repo.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; @@ -39,8 +41,13 @@ 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'; 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/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'; @@ -49,11 +56,14 @@ import 'package:hmg_patient_app_new/services/firebase_service.dart'; import 'package:hmg_patient_app_new/services/localauth_service.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/services/notification_service.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:local_auth/local_auth.dart'; import 'package:logger/web.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + GetIt getIt = GetIt.instance; class AppDependencies { @@ -95,7 +105,17 @@ class AppDependencies { final sharedPreferences = await SharedPreferences.getInstance(); getIt.registerLazySingleton(() => CacheServiceImp(sharedPreferences: sharedPreferences, loggerService: getIt())); + + final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + getIt.registerLazySingleton(() => NotificationServiceImp( + flutterLocalNotificationsPlugin: flutterLocalNotificationsPlugin, + loggerService: getIt(), + )); + getIt.registerLazySingleton(() => ApiClientImp(appState: getIt())); + getIt.registerLazySingleton( + () => LocalAuthService(loggerService: getIt(), localAuth: getIt()), + ); // Repositories getIt.registerLazySingleton(() => CommonRepoImp(loggerService: getIt())); @@ -107,9 +127,6 @@ class AppDependencies { getIt.registerLazySingleton(() => PrescriptionsRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => InsuranceRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => PayfortRepoImp(loggerService: getIt(), apiClient: getIt())); - getIt.registerLazySingleton( - () => LocalAuthService(loggerService: getIt(), localAuth: getIt()), - ); getIt.registerLazySingleton(() => HabibWalletRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => MedicalFileRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => ImmediateLiveCareRepoImp(loggerService: getIt(), apiClient: getIt())); @@ -118,7 +135,9 @@ class AppDependencies { getIt.registerLazySingleton(() => LocationRepoImpl(apiClient: getIt())); getIt.registerLazySingleton(() => ContactUsRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => HmgServicesRepoImp(loggerService: getIt(), apiClient: getIt())); + getIt.registerLazySingleton(() => SymptomsCheckerRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => BloodDonationRepoImp(loggerService: getIt(), apiClient: getIt())); + getIt.registerLazySingleton(() => WaterMonitorRepoImp(loggerService: getIt(), apiClient: getIt())); // ViewModels // Global/shared VMs → LazySingleton @@ -126,31 +145,28 @@ class AppDependencies { getIt.registerLazySingleton(() => LabViewModel(labRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt())); getIt.registerLazySingleton( - () => RadiologyViewModel( - radiologyRepo: getIt(), - errorHandlerService: getIt(), - navigationService: getIt() - ), + () => RadiologyViewModel(radiologyRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt()), ); - getIt.registerLazySingleton(() => PrescriptionsViewModel(prescriptionsRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); + getIt.registerLazySingleton( + () => PrescriptionsViewModel(prescriptionsRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); getIt.registerLazySingleton(() => InsuranceViewModel(insuranceRepo: getIt(), errorHandlerService: getIt())); getIt.registerLazySingleton( () => MyAppointmentsViewModel(myAppointmentsRepo: getIt(), errorHandlerService: getIt(), appState: getIt())); + getIt.registerLazySingleton( + () => AppointmentRatingViewModel(myAppointmentsRepo: getIt(), errorHandlerService: getIt(), appState: getIt())); + getIt.registerLazySingleton( - () => PayfortViewModel( - payfortRepo: getIt(), - errorHandlerService: getIt(), - ), + () => PayfortViewModel(payfortRepo: getIt(), errorHandlerService: getIt()), ); getIt.registerLazySingleton( () => HabibWalletViewModel( habibWalletRepo: getIt(), - errorHandlerService: getIt(), + errorHandlerService: getIt() ), ); @@ -190,6 +206,7 @@ class AppDependencies { errorHandlerService: getIt(), localAuthService: getIt()), ); + getIt.registerLazySingleton(() => ProfileSettingsViewModel()); getIt.registerLazySingleton(() => DateRangeSelectorRangeViewModel()); @@ -202,13 +219,14 @@ class AppDependencies { getIt.registerLazySingleton( () => EmergencyServicesViewModel( - locationUtils: getIt(), - navServices: getIt(), - emergencyServicesRepo: getIt(), - appState: getIt(), - errorHandlerService: getIt(), - appointmentRepo: getIt(), - dialogService: getIt()), + locationUtils: getIt(), + navServices: getIt(), + emergencyServicesRepo: getIt(), + appState: getIt(), + errorHandlerService: getIt(), + appointmentRepo: getIt(), + dialogService: getIt(), + ), ); getIt.registerLazySingleton( @@ -219,25 +237,39 @@ class AppDependencies { () => ContactUsViewModel(contactUsRepo: getIt(), appState: getIt(), errorHandlerService: getIt()), ); - getIt.registerLazySingleton( - () => TodoSectionViewModel(todoSectionRepo: getIt(), errorHandlerService: getIt()), + getIt.registerLazySingleton(() => HealthCalcualtorViewModel()); + + getIt.registerLazySingleton(() => TodoSectionViewModel(todoSectionRepo: getIt(), errorHandlerService: getIt())); + + getIt.registerLazySingleton( + () => SymptomsCheckerViewModel( + errorHandlerService: getIt(), + symptomsCheckerRepo: getIt(), + appState: getIt(), + ), ); getIt.registerLazySingleton( - () => HmgServicesViewModel(bookAppointmentsRepo: getIt(), hmgServicesRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt()), + () => HmgServicesViewModel( + bookAppointmentsRepo: getIt(), + hmgServicesRepo: getIt(), + errorHandlerService: getIt(), + navigationService: getIt(), + ), ); getIt.registerLazySingleton( - () => BloodDonationViewModel(bloodDonationRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt()), + () => BloodDonationViewModel( + bloodDonationRepo: getIt(), + errorHandlerService: getIt(), + navigationService: getIt(), + dialogService: getIt(), + appState: getIt(), + ), ); - // Screen-specific VMs → Factory - // getIt.registerFactory( - // () => BookAppointmentsViewModel( - // bookAppointmentsRepo: getIt(), - // dialogService: getIt(), - // errorHandlerService: getIt(), - // ), - // ); + getIt.registerLazySingleton(() => HealthProvider()); + + getIt.registerLazySingleton(() => WaterMonitorViewModel(waterMonitorRepo: getIt())); } } diff --git a/lib/core/enums.dart b/lib/core/enums.dart index 4151bed..8fd4818 100644 --- a/lib/core/enums.dart +++ b/lib/core/enums.dart @@ -32,6 +32,60 @@ enum AppEnvironmentTypeEnum { dev, uat, preProd, qa, staging, prod } enum FamilyFileEnum { active, inactive, blocked, deleted, pending, rejected } +enum BodyView { front, back } + +enum HealthCalConEnum { calculator, converter } + +enum HealthCalculatorEnum { general, women } + +enum HealthCalculatorsTypeEnum { bmi, calories, bmr, idealBodyWeight, bodyFat, crabsProteinFat, ovulation, deliveryDueDate, bloodSugar, bloodCholesterol, triglycerides } + +extension HealthCalculatorExtenshion on HealthCalculatorsTypeEnum { + String get displayName { + AppState appState = getIt.get(); + bool isArabic = appState.getLanguageID() == 1 ? true : false; + switch (this) { + case HealthCalculatorsTypeEnum.bmi: + return isArabic ? "حاسبة مؤشر كتلة الجسم" : "BMI Calculator"; + case HealthCalculatorsTypeEnum.calories: + return isArabic ? "حاسبة السعرات الحرارية" : "Calories Calculator"; + case HealthCalculatorsTypeEnum.bmr: + return isArabic ? "حاسبة معدل الأيض الأساسي" : "BMR Calculator"; + case HealthCalculatorsTypeEnum.idealBodyWeight: + return isArabic ? "الوزن المثالي للجسم" : "Ideal Body Weight Calculator"; + case HealthCalculatorsTypeEnum.bodyFat: + return isArabic ? "حاسبة الدهون في الجسم" : "Body Fat Calculator"; + case HealthCalculatorsTypeEnum.crabsProteinFat: + return isArabic ? "حاسبة البروتين والدهون في سرطان البحر" : "Crabs Protein & Fat Calculator"; + case HealthCalculatorsTypeEnum.ovulation: + return isArabic ? "فترة الإباضة" : "Ovulation Period"; + case HealthCalculatorsTypeEnum.deliveryDueDate: + return isArabic ? "تاريخ استحقاق التسليم" : "Delivery Due Date"; + case HealthCalculatorsTypeEnum.bloodSugar: + return isArabic ? "سكر الدم" : "Blood Sugar"; + case HealthCalculatorsTypeEnum.bloodCholesterol: + return isArabic ? "كوليسترول الدم" : "Blood Cholesterol"; + case HealthCalculatorsTypeEnum.triglycerides: + return isArabic ? "الدهون الثلاثية في الدم" : "Triglycerides Fat Blood"; + } + } + + static LoginTypeEnum? fromValue(int value) { + switch (value) { + case 1: + return LoginTypeEnum.sms; + case 2: + return LoginTypeEnum.fingerprint; + case 3: + return LoginTypeEnum.face; + case 4: + return LoginTypeEnum.whatsapp; + default: + return null; + } + } +} + extension CalenderExtension on CalenderEnum { int get toInt { switch (this) { @@ -172,7 +226,7 @@ extension FamilyFileEnumExtenshion on FamilyFileEnum { return isArabic ? 'محذوف' : 'Deleted'; case FamilyFileEnum.pending: return isArabic ? 'قيد الانتظار' : 'Pending'; - case FamilyFileEnum.rejected: + case FamilyFileEnum.rejected: return isArabic ? 'مرفوض' : 'Rejected'; } } @@ -239,3 +293,7 @@ extension ServiceTypeEnumExt on ServiceTypeEnum { } } } + +// SymptomsChecker + +enum PossibleConditionsSeverityEnum { seekMedicalAdvice, monitorOnly, emergency } diff --git a/lib/core/exceptions/api_exception.dart b/lib/core/exceptions/api_exception.dart index eb11b71..eb0258f 100644 --- a/lib/core/exceptions/api_exception.dart +++ b/lib/core/exceptions/api_exception.dart @@ -1,7 +1,5 @@ import 'dart:convert'; -import 'package:equatable/equatable.dart'; -import 'package:hmg_patient_app_new/core/api/api_client.dart'; class APIException implements Exception { static const String BAD_REQUEST = 'api_common_bad_request'; diff --git a/lib/core/location_util.dart b/lib/core/location_util.dart index 487b228..9dcdbb5 100644 --- a/lib/core/location_util.dart +++ b/lib/core/location_util.dart @@ -12,8 +12,9 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; -import 'package:huawei_location/huawei_location.dart' as HmsLocation show FusedLocationProviderClient, Location, LocationSettingsRequest, LocationRequest; -import 'package:location/location.dart' show Location, PermissionStatus, LocationData; +import 'package:huawei_location/huawei_location.dart' as HmsLocation + show FusedLocationProviderClient, Location, LocationSettingsRequest, LocationRequest; +import 'package:location/location.dart' show Location; import 'package:permission_handler/permission_handler.dart' show Permission, PermissionListActions, PermissionStatusGetters, openAppSettings; class LocationUtils { @@ -59,37 +60,22 @@ class LocationUtils { // } void getLocation( - {Function(LatLng)? onSuccess, - VoidCallback? onFailure, - bool isShowConfirmDialog = false, - VoidCallback? onLocationDeniedForever}) async { + {Function(LatLng)? onSuccess, VoidCallback? onFailure, bool isShowConfirmDialog = false, VoidCallback? onLocationDeniedForever}) async { this.isShowConfirmDialog = isShowConfirmDialog; if (Platform.isIOS) { - getCurrentLocation( - onFailure: onFailure, - onSuccess: onSuccess, - onLocationDeniedForever: onLocationDeniedForever); + getCurrentLocation(onFailure: onFailure, onSuccess: onSuccess, onLocationDeniedForever: onLocationDeniedForever); return; } if (await isGMSDevice ?? true) { - getCurrentLocation( - onFailure: onFailure, - onSuccess: onSuccess, - onLocationDeniedForever: onLocationDeniedForever); + getCurrentLocation(onFailure: onFailure, onSuccess: onSuccess, onLocationDeniedForever: onLocationDeniedForever); return; } - getHMSLocation( - onFailure: onFailure, - onSuccess: onSuccess, - onLocationDeniedForever: onLocationDeniedForever); + getHMSLocation(onFailure: onFailure, onSuccess: onSuccess, onLocationDeniedForever: onLocationDeniedForever); } - void getCurrentLocation( - {Function(LatLng)? onSuccess, - VoidCallback? onFailure, - VoidCallback? onLocationDeniedForever}) async { + void getCurrentLocation({Function(LatLng)? onSuccess, VoidCallback? onFailure, VoidCallback? onLocationDeniedForever}) async { var location = Location(); bool isLocationEnabled = await location.serviceEnabled(); @@ -113,14 +99,12 @@ class LocationUtils { } } else if (permissionGranted == LocationPermission.deniedForever) { appState.resetLocation(); - if(onLocationDeniedForever == null && isShowConfirmDialog){ + if (onLocationDeniedForever == null && isShowConfirmDialog) { showCommonBottomSheetWithoutHeight( title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), navigationService.navigatorKey.currentContext!, child: Utils.getWarningWidget( - loadingText: - "Please grant location permission from app settings to see better results" - .needTranslation, + loadingText: "Please grant location permission from app settings to see better results".needTranslation, isShowActionButtons: true, onCancelTap: () { navigationService.pop(); @@ -253,10 +237,7 @@ class LocationUtils { appState.userLong = locationData.longitude; } - void getHMSLocation( - {VoidCallback? onFailure, - Function(LatLng p1)? onSuccess, - VoidCallback? onLocationDeniedForever}) async { + void getHMSLocation({VoidCallback? onFailure, Function(LatLng p1)? onSuccess, VoidCallback? onLocationDeniedForever}) async { try { var location = Location(); HmsLocation.FusedLocationProviderClient locationService = HmsLocation.FusedLocationProviderClient()..initFusedLocationService(); @@ -279,14 +260,12 @@ class LocationUtils { permissionGranted = await Geolocator.requestPermission(); if (permissionGranted == LocationPermission.deniedForever) { appState.resetLocation(); - if(onLocationDeniedForever == null && isShowConfirmDialog){ + if (onLocationDeniedForever == null && isShowConfirmDialog) { showCommonBottomSheetWithoutHeight( title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), navigationService.navigatorKey.currentContext!, child: Utils.getWarningWidget( - loadingText: - "Please grant location permission from app settings to see better results" - .needTranslation, + loadingText: "Please grant location permission from app settings to see better results".needTranslation, isShowActionButtons: true, onCancelTap: () { navigationService.pop(); @@ -311,7 +290,7 @@ class LocationUtils { HmsLocation.Location data = await locationService.getLastLocation(); if (data.latitude == null || data.longitude == null) { - appState.resetLocation(); + appState.resetLocation(); HmsLocation.LocationRequest request = HmsLocation.LocationRequest() ..priority = HmsLocation.LocationRequest.PRIORITY_HIGH_ACCURACY ..interval = 1000 // 1 second diff --git a/lib/core/post_params_model.dart b/lib/core/post_params_model.dart index cf52306..e13eb5c 100644 --- a/lib/core/post_params_model.dart +++ b/lib/core/post_params_model.dart @@ -14,19 +14,20 @@ class PostParamsModel { String? sessionID; String? setupID; - PostParamsModel( - {this.versionID, - this.channel, - this.languageID, - this.logInTokenID, - this.tokenID, - this.language, - this.ipAddress, - this.generalId, - this.latitude, - this.longitude, - this.deviceTypeID, - this.sessionID}); + PostParamsModel({ + this.versionID, + this.channel, + this.languageID, + this.logInTokenID, + this.tokenID, + this.language, + this.ipAddress, + this.generalId, + this.latitude, + this.longitude, + this.deviceTypeID, + this.sessionID, + }); PostParamsModel.fromJson(Map json) { versionID = json['VersionID']; diff --git a/lib/core/utils/calender_utils_new.dart b/lib/core/utils/calender_utils_new.dart index 05448b1..5a43d78 100644 --- a/lib/core/utils/calender_utils_new.dart +++ b/lib/core/utils/calender_utils_new.dart @@ -25,7 +25,13 @@ class CalenderUtilsNew { }); } - FutureOr createOrUpdateEvent({required String title, required String description, required String location, DateTime? scheduleDateTime, String? eventId, int? reminderMinutes}) async { + FutureOr createOrUpdateEvent( + {required String title, + required String description, + required String location, + DateTime? scheduleDateTime, + String? eventId, + int? reminderMinutes}) async { if (writableCalender.isEmpty) { await getCalenders(); } @@ -38,12 +44,14 @@ class CalenderUtilsNew { // String eventId = await getEventIdIfEventExist(title!.split("#").last); // if (eventId.isEmpty) { eventResult = await DeviceCalendar.instance.createEvent( - calendarId: writableCalendars!.id, - title: title, - description: description, - startDate: scheduleDateTime!, - endDate: scheduleDateTime!.add(Duration(minutes: 30)), - reminderMinutes: reminderMinutes); + calendarId: writableCalendars!.id, + title: title, + description: description, + startDate: scheduleDateTime!, + endDate: scheduleDateTime!.add(Duration(minutes: 30)), + + // reminderMinutes: reminderMinutes, // TODO : NEED TO CONFIRM THIS FROM TAHA + ); return eventResult.isNotEmpty; // } diff --git a/lib/core/utils/date_util.dart b/lib/core/utils/date_util.dart index a42a44d..746d2a7 100644 --- a/lib/core/utils/date_util.dart +++ b/lib/core/utils/date_util.dart @@ -6,8 +6,6 @@ class DateUtil { /// convert String To Date function /// [date] String we want to convert static DateTime convertStringToDate(String? date) { - - if (date == null) return DateTime.now(); if (date.isEmpty) return DateTime.now(); @@ -522,6 +520,64 @@ class DateUtil { } return ""; } + + /// Get short month name from full month name + /// [monthName] Full month name like "January" + /// Returns short form like "Jan" + static String getShortMonthName(String monthName) { + switch (monthName.toLowerCase()) { + case 'january': + return 'Jan'; + case 'february': + return 'Feb'; + case 'march': + return 'Mar'; + case 'april': + return 'Apr'; + case 'may': + return 'May'; + case 'june': + return 'Jun'; + case 'july': + return 'Jul'; + case 'august': + return 'Aug'; + case 'september': + return 'Sep'; + case 'october': + return 'Oct'; + case 'november': + return 'Nov'; + case 'december': + return 'Dec'; + default: + return monthName; // Return as-is if not recognized + } + } + + /// Get short weekday name from full weekday name + /// [weekDayName] Full weekday name like "Monday" + /// Returns short form like "Mon" + static String getShortWeekDayName(String weekDayName) { + switch (weekDayName.toLowerCase().trim()) { + case 'monday': + return 'Mon'; + case 'tuesday': + return 'Tue'; + case 'wednesday': + return 'Wed'; + case 'thursday': + return 'Thu'; + case 'friday': + return 'Fri'; + case 'saturday': + return 'Sat'; + case 'sunday': + return 'Sun'; + default: + return weekDayName; // Return as-is if not recognized + } + } } extension OnlyDate on DateTime { diff --git a/lib/core/utils/doctor_response_mapper.dart b/lib/core/utils/doctor_response_mapper.dart index 994e9a1..05ed2fd 100644 --- a/lib/core/utils/doctor_response_mapper.dart +++ b/lib/core/utils/doctor_response_mapper.dart @@ -1,7 +1,5 @@ import 'dart:math'; -import 'package:hmg_patient_app_new/core/cache_consts.dart' show CacheConst; -import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart' show RegionList, PatientDoctorAppointmentList, DoctorList, PatientDoctorAppointmentListByRegion; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel; diff --git a/lib/core/utils/local_notifications.dart b/lib/core/utils/local_notifications.dart deleted file mode 100644 index aba01f8..0000000 --- a/lib/core/utils/local_notifications.dart +++ /dev/null @@ -1,191 +0,0 @@ -import 'dart:math'; -import 'dart:typed_data'; - -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; - -final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - -class LocalNotification { - Function(String payload)? _onNotificationClick; - static LocalNotification? _instance; - - static LocalNotification? getInstance() { - return _instance; - } - - static init({required Function(String payload) onNotificationClick}) { - if (_instance == null) { - _instance = LocalNotification(); - _instance?._onNotificationClick = onNotificationClick; - _instance?._initialize(); - } else { - // assert(false,(){ - // //TODO fix it - // "LocalNotification Already Initialized"; - // }); - } - } - - _initialize() async { - try { - var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - var initializationSettingsIOS = DarwinInitializationSettings(); - var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); - await flutterLocalNotificationsPlugin.initialize( - initializationSettings, - onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { - switch (notificationResponse.notificationResponseType) { - case NotificationResponseType.selectedNotification: - // selectNotificationStream.add(notificationResponse.payload); - break; - case NotificationResponseType.selectedNotificationAction: - // if (notificationResponse.actionId == navigationActionId) { - // selectNotificationStream.add(notificationResponse.payload); - // } - break; - } - }, - // onDidReceiveBackgroundNotificationResponse: notificationTapBackground, - ); - } catch (ex) { - print(ex.toString()); - } - // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) - // { - // switch (notificationResponse.notificationResponseType) { - // case NotificationResponseType.selectedNotification: - // // selectNotificationStream.add(notificationResponse.payload); - // break; - // case NotificationResponseType.selectedNotificationAction: - // // if (notificationResponse.actionId == navigationActionId) { - // // selectNotificationStream.add(notificationResponse.payload); - // } - // // break; - // },} - // - // , - // - // ); - } - - // void notificationTapBackground(NotificationResponse notificationResponse) { - // // ignore: avoid_print - // print('notification(${notificationResponse.id}) action tapped: ' - // '${notificationResponse.actionId} with' - // ' payload: ${notificationResponse.payload}'); - // if (notificationResponse.input?.isNotEmpty ?? false) { - // // ignore: avoid_print - // print('notification action tapped with input: ${notificationResponse.input}'); - // } - // } - - var _random = new Random(); - - _randomNumber({int from = 100000}) { - return _random.nextInt(from); - } - - _vibrationPattern() { - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - return vibrationPattern; - } - - Future? showNow({required String title, required String subtitle, required String payload}) { - Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'com.hmg.local_notification', - 'HMG', - channelDescription: 'HMG', - importance: Importance.max, - priority: Priority.high, - ticker: 'ticker', - vibrationPattern: _vibrationPattern(), - ongoing: true, - autoCancel: false, - usesChronometer: true, - when: DateTime.now().millisecondsSinceEpoch - 120 * 1000, - ); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(25613, title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - print(err); - }); - }); - } - - Future scheduleNotification({required DateTime scheduledNotificationDateTime, required String title, required String description}) async { - ///vibrationPattern - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - // var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', - // channelDescription: 'ActivePrescriptionsDescription', - // // icon: 'secondary_icon', - // sound: RawResourceAndroidNotificationSound('slow_spring_board'), - // - // ///change it to be as ionic - // // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic - // vibrationPattern: vibrationPattern, - // enableLights: true, - // color: const Color.fromARGB(255, 255, 0, 0), - // ledColor: const Color.fromARGB(255, 255, 0, 0), - // ledOnMs: 1000, - // ledOffMs: 500); - // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); - - // /change it to be as ionic - // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); - } - - ///Repeat notification every day at approximately 10:00:00 am - Future showDailyAtTime() async { - // var time = Time(10, 0, 0); - // var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); - // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showDailyAtTime( - // 0, - // 'show daily title', - // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // time, - // platformChannelSpecifics); - } - - ///Repeat notification weekly on Monday at approximately 10:00:00 am - Future showWeeklyAtDayAndTime() async { - // var time = Time(10, 0, 0); - // var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); - // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - // 0, - // 'show weekly title', - // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // Day.Monday, - // time, - // platformChannelSpecifics); - } - - String _toTwoDigitString(int value) { - return value.toString().padLeft(2, '0'); - } - - Future cancelNotification() async { - await flutterLocalNotificationsPlugin.cancel(0); - } - - Future cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); - } -} diff --git a/lib/core/utils/push_notification_handler.dart b/lib/core/utils/push_notification_handler.dart index ee05335..88e8cc8 100644 --- a/lib/core/utils/push_notification_handler.dart +++ b/lib/core/utils/push_notification_handler.dart @@ -15,18 +15,11 @@ import 'package:flutter_callkit_incoming/entities/notification_params.dart'; import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; import 'package:flutter_ios_voip_kit_karmm/call_state_type.dart'; import 'package:flutter_ios_voip_kit_karmm/flutter_ios_voip_kit.dart'; -// import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; - -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:get_it/get_it.dart'; -import 'package:hmg_patient_app_new/core/utils/local_notifications.dart'; +import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; -import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:uuid/uuid.dart'; -import '../cache_consts.dart'; - // |--> Push Notification Background @pragma('vm:entry-point') Future backgroundMessageHandler(dynamic message) async { @@ -38,7 +31,7 @@ Future backgroundMessageHandler(dynamic message) async { // showCallkitIncoming(message); _incomingCall(message.data); return; - } else {} + } } callPage(String sessionID, String token) async {} @@ -325,7 +318,7 @@ class PushNotificationHandler { if (fcmToken != null) onToken(fcmToken); // } } catch (ex) { - print("Notification Exception: " + ex.toString()); + print("Notification Exception: $ex"); } FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); } @@ -333,7 +326,7 @@ class PushNotificationHandler { if (Platform.isIOS) { final permission = await FirebaseMessaging.instance.requestPermission(); await FirebaseMessaging.instance.getAPNSToken().then((value) async { - log("APNS token: " + value.toString()); + log("APNS token: $value"); await Utils.saveStringFromPrefs(CacheConst.apnsToken, value.toString()); }); await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( @@ -380,14 +373,14 @@ class PushNotificationHandler { }); FirebaseMessaging.instance.getToken().then((String? token) { - print("Push Notification getToken: " + token!); + print("Push Notification getToken: ${token!}"); onToken(token!); }).catchError((err) { print(err); }); FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { - print("Push Notification onTokenRefresh: " + fcm_token); + print("Push Notification onTokenRefresh: $fcm_token"); onToken(fcm_token); }); @@ -403,7 +396,7 @@ class PushNotificationHandler { } newMessage(RemoteMessage remoteMessage) async { - print("Remote Message: " + remoteMessage.data.toString()); + print("Remote Message: ${remoteMessage.data}"); if (remoteMessage.data.isEmpty) { return; } @@ -429,7 +422,7 @@ class PushNotificationHandler { } onToken(String token) async { - print("Push Notification Token: " + token); + print("Push Notification Token: $token"); await Utils.saveStringFromPrefs(CacheConst.pushToken, token); } @@ -443,9 +436,7 @@ class PushNotificationHandler { Future requestPermissions() async { try { if (Platform.isIOS) { - await flutterLocalNotificationsPlugin - .resolvePlatformSpecificImplementation() - ?.requestPermissions(alert: true, badge: true, sound: true); + await FirebaseMessaging.instance.requestPermission(alert: true, badge: true, sound: true); } else if (Platform.isAndroid) { Map statuses = await [ Permission.notification, diff --git a/lib/core/utils/size_config.dart b/lib/core/utils/size_config.dart index 9f9d835..0f8766a 100644 --- a/lib/core/utils/size_config.dart +++ b/lib/core/utils/size_config.dart @@ -1,6 +1,5 @@ import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; -import 'package:hmg_patient_app_new/core/cache_consts.dart'; class SizeConfig { static double _blockWidth = 0; diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart index fdd0d30..4fdc09c 100644 --- a/lib/core/utils/size_utils.dart +++ b/lib/core/utils/size_utils.dart @@ -1,4 +1,5 @@ import 'dart:developer'; +import 'dart:math' as math; import 'package:flutter/material.dart'; // These are the Viewport values of your Figma Design. @@ -6,6 +7,16 @@ 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; + + /// 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; @@ -27,7 +38,7 @@ extension ResponsiveExtension on num { double clamp; if (SizeUtils.deviceType == DeviceType.tablet || _isFoldable) { // More conservative scaling for tablets and foldables - clamp = (aspectRatio > 1.5 || aspectRatio < 0.67) ? 1.4 : 1.1; + clamp = (aspectRatio > 1.5 || aspectRatio < 0.67) ? 1.6 : 1.4; } else { // Original logic for phones clamp = (aspectRatio > 1.3 || aspectRatio < 0.77) ? 1.6 : 1.2; @@ -68,7 +79,7 @@ extension ResponsiveExtension on num { double get r { double baseScale = (this * _screenWidth) / figmaDesignWidth; - if (_isFoldable) { + if (_isFoldable || isTablet) { // Use the same logic as enhanced width for foldables double scale = _screenWidth / figmaDesignWidth; scale = scale.clamp(0.8, 1.4); diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index df8cdcb..0302818 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -8,7 +8,6 @@ import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:crypto/crypto.dart' as crypto; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:google_api_availability/google_api_availability.dart'; @@ -352,10 +351,10 @@ class Utils { ).center; } - static Widget getSuccessWidget({String? loadingText}) { + static Widget getSuccessWidget({String? loadingText, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center}) { return Column( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: crossAxisAlignment, children: [ Lottie.asset(AppAnimations.checkmark, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill), SizedBox(height: 8.h), @@ -723,10 +722,19 @@ class Utils { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Image.asset(AppAssets.mada, width: 25.h, height: 25.h), - Image.asset(AppAssets.tamara_en, width: 25.h, height: 25.h), + Image.asset( + AppAssets.tamaraEng, + width: 25.h, + height: 25.h, + fit: BoxFit.contain, + errorBuilder: (context, error, stackTrace) { + debugPrint('Failed to load Tamara PNG in payment methods: $error'); + return Utils.buildSvgWithAssets(icon: AppAssets.tamara, width: 25.h, height: 25.h, fit: BoxFit.contain); + }, + ), Image.asset(AppAssets.visa, width: 25.h, height: 25.h), - Image.asset(AppAssets.Mastercard, width: 25.h, height: 25.h), - Image.asset(AppAssets.apple_pay, width: 25.h, height: 25.h), + Image.asset(AppAssets.mastercard, width: 25.h, height: 25.h), + Image.asset(AppAssets.applePay, width: 25.h, height: 25.h), ], ); } @@ -871,12 +879,12 @@ class Utils { } return isHavePrivilege; } - static void openWebView({ required String url}) { + + static void openWebView({required String url}) { Uri uri = Uri.parse(url); launchUrl(uri, mode: LaunchMode.inAppBrowserView); } - static Color getCardBorderColor(int currentQueueStatus) { switch (currentQueueStatus) { case 0: @@ -913,16 +921,23 @@ 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 ""; } + static bool isDateToday(DateTime dateToCheck) { + final DateTime now = DateTime.now(); + final DateTime today = DateTime(now.year, now.month, now.day); + final DateTime checkDate = DateTime(dateToCheck.year, dateToCheck.month, dateToCheck.day); + + return checkDate == today; + } } diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart index 80b3171..75460c5 100644 --- a/lib/extensions/int_extensions.dart +++ b/lib/extensions/int_extensions.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/theme/colors.dart'; extension IntExtensions on int { Widget get height => SizedBox(height: toDouble()); diff --git a/lib/extensions/route_extensions.dart b/lib/extensions/route_extensions.dart index 0dcc54b..b76acfa 100644 --- a/lib/extensions/route_extensions.dart +++ b/lib/extensions/route_extensions.dart @@ -17,7 +17,7 @@ extension NavigationExtensions on BuildContext { Navigator.of(this).pop(); } - void navigateTo(Widget page) { + void pushNavigateTo(Widget page) { Navigator.push(this, MaterialPageRoute(builder: (context) => page)); } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 2039fb8..75c57a7 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -23,14 +23,15 @@ extension CapExtension on String { extension EmailValidator on String { Widget get toWidget => Text(this); - Widget toText8({Color? color, bool isBold = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow}) => Text( + Widget toText8({Color? color, FontWeight? fontWeight, bool isBold = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow}) => + Text( this, maxLines: maxlines, overflow: textOverflow, style: TextStyle( fontSize: 8.f, fontStyle: fontStyle ?? FontStyle.normal, - fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + fontWeight: fontWeight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: 0, ), @@ -41,7 +42,7 @@ extension EmailValidator on String { FontWeight? weight, bool isBold = false, bool isUnderLine = false, - bool isCenter = false, + bool isCenter = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow, @@ -214,39 +215,38 @@ extension EmailValidator on String { decoration: isUnderLine ? TextDecoration.underline : null), ); - Widget toText16({ - Color? color, - bool isUnderLine = false, - bool isBold = false, - bool isCenter = false, - int? maxlines, - double? height, - TextAlign? textAlign, - FontWeight? weight, - TextOverflow? textOverflow, - double? letterSpacing = -0.4, - Color decorationColor =AppColors.errorColor - }) => + Widget toText16( + {Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int? maxlines, + double? height, + TextAlign? textAlign, + FontWeight? weight, + TextOverflow? textOverflow, + double? letterSpacing = -0.4, + Color decorationColor = AppColors.errorColor}) => Text( this, maxLines: maxlines, textAlign: isCenter ? TextAlign.center : null, style: TextStyle( - color: color ?? AppColors.blackColor, - fontSize: 16.f, - letterSpacing: letterSpacing, - height: height, - overflow: textOverflow, - fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), - decoration: isUnderLine ? TextDecoration.underline : null, - decorationColor: decorationColor - ), + color: color ?? AppColors.blackColor, + fontSize: 16.f, + letterSpacing: letterSpacing, + height: height, + overflow: textOverflow, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + decoration: isUnderLine ? TextDecoration.underline : null, + decorationColor: decorationColor), ); Widget toText17({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 17.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle( + color: color ?? AppColors.blackColor, fontSize: 17.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); Widget toText18({Color? color, FontWeight? weight, bool isBold = false, bool isCenter = false, int? maxlines, TextOverflow? textOverflow}) => Text( @@ -255,39 +255,62 @@ extension EmailValidator on String { this, overflow: textOverflow, style: TextStyle( - fontSize: 18.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), + fontSize: 18.f, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + color: color ?? AppColors.blackColor, + letterSpacing: -0.4), ); Widget toText19({Color? color, bool isBold = false}) => Text( this, - style: TextStyle(fontSize: 19.f, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4), + style: TextStyle( + fontSize: 19.f, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4), ); - Widget toText20({Color? color, FontWeight? weight, bool isBold = false, }) => Text( + Widget toText20({ + Color? color, + FontWeight? weight, + bool isBold = false, + }) => + Text( this, style: TextStyle( - fontSize: 20.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), + fontSize: 20.f, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + color: color ?? AppColors.blackColor, + letterSpacing: -0.4), ); Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( this, maxLines: maxlines, style: TextStyle( - color: color ?? AppColors.blackColor, fontSize: 21.f, letterSpacing: -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)), + color: color ?? AppColors.blackColor, + fontSize: 21.f, + letterSpacing: -1, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)), ); Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, style: TextStyle( - height: 1, color: color ?? AppColors.blackColor, fontSize: 22.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + height: 1, + color: color ?? AppColors.blackColor, + fontSize: 22.f, + letterSpacing: -1, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); Widget toText24({Color? color, bool isBold = false, bool isCenter = false, FontWeight? fontWeight, double? letterSpacing}) => Text( this, textAlign: isCenter ? TextAlign.center : null, style: TextStyle( - height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.f, letterSpacing: letterSpacing??-1, fontWeight: isBold ? FontWeight.bold : fontWeight??FontWeight.normal), + height: 23 / 24, + color: color ?? AppColors.blackColor, + fontSize: 24.f, + letterSpacing: letterSpacing ?? -1, + fontWeight: isBold ? FontWeight.bold : fontWeight ?? FontWeight.normal), ); Widget toText26({Color? color, bool isBold = false, double? height, bool isCenter = false, FontWeight? weight, double? letterSpacing}) => Text( @@ -312,17 +335,25 @@ extension EmailValidator on String { fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); - Widget toText32({Color? color, bool isBold = false, bool isCenter = false}) => Text( + Widget toText32({FontWeight? weight, Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, style: TextStyle( - height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 32.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + height: 32 / 32, + color: color ?? AppColors.blackColor, + fontSize: 32.f, + letterSpacing: -1, + fontWeight: isBold ? FontWeight.bold : weight ?? FontWeight.normal), ); Widget toText44({Color? color, bool isBold = false}) => Text( this, style: TextStyle( - height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + height: 32 / 32, + color: color ?? AppColors.blackColor, + fontSize: 44.f, + letterSpacing: -1, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index c9796e8..9b09c43 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -5,10 +5,8 @@ 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/app_state.dart'; import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; -import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; -import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; @@ -262,10 +260,10 @@ class AuthenticationRepoImp implements AuthenticationRepo { newRequest.forRegisteration = newRequest.isRegister ?? false; newRequest.isRegister = false; //silent login case removed token and login token - // if(newRequest.logInTokenID.isEmpty && newRequest.isSilentLogin == true) { - // newRequest.logInTokenID = null; - // newRequest.deviceToken = null; - // } + if(newRequest.logInTokenID.isEmpty && newRequest.isSilentLogin == true && (newRequest.loginType==1 || newRequest.loginType==4)) { + newRequest.logInTokenID = null; + newRequest.deviceToken = null; + } } diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index fa16423..46649fb 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -27,7 +27,6 @@ import 'package:hmg_patient_app_new/features/authentication/models/resp_models/a import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; -import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; @@ -586,6 +585,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/blood_donation/blood_donation_repo.dart b/lib/features/blood_donation/blood_donation_repo.dart index 84997b2..dce0975 100644 --- a/lib/features/blood_donation/blood_donation_repo.dart +++ b/lib/features/blood_donation/blood_donation_repo.dart @@ -66,6 +66,7 @@ class BloodDonationRepoImp implements BloodDonationRepo { await apiClient.post( GET_BLOOD_REQUEST, body: mapDevice, + isAllowAny: true, onFailure: (error, statusCode, {messageStatus, failureType}) { failure = failureType; }, diff --git a/lib/features/blood_donation/blood_donation_view_model.dart b/lib/features/blood_donation/blood_donation_view_model.dart index f345359..b8f0e9c 100644 --- a/lib/features/blood_donation/blood_donation_view_model.dart +++ b/lib/features/blood_donation/blood_donation_view_model.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_repo.dart'; import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_list_model.dart'; import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_response_model.dart'; @@ -31,7 +32,7 @@ class BloodDonationViewModel extends ChangeNotifier { List genderList = [ BloodGroupListModel(LocaleKeys.malE.tr(), 1), - BloodGroupListModel(LocaleKeys.female.tr(), 2), + BloodGroupListModel("Female".needTranslation.tr(), 2), ]; late CitiesModel selectedCity; diff --git a/lib/features/book_appointments/book_appointments_repo.dart b/lib/features/book_appointments/book_appointments_repo.dart index 3683d57..cfd473e 100644 --- a/lib/features/book_appointments/book_appointments_repo.dart +++ b/lib/features/book_appointments/book_appointments_repo.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'package:dartz/dartz.dart'; import 'package:hmg_patient_app_new/core/api/api_client.dart'; @@ -6,6 +5,7 @@ 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/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/dental_chief_complaints_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctor_profile_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; @@ -26,9 +26,12 @@ abstract class BookAppointmentsRepo { Future>>> getDoctorsList(int clinicID, int projectID, bool isNearest, int doctorId, String doctorName, {isContinueDentalPlan = false}); + Future>>> getDoctorsListByHealthCal(int calculationID); + Future>> getDoctorProfile(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}); - Future>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, bool isBookingForLiveCare, {bool continueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}); + Future>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, bool isBookingForLiveCare, + {bool continueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}); Future>> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}); @@ -83,8 +86,7 @@ abstract class BookAppointmentsRepo { Future>>> getDentalChiefComplaintDoctorsList(int projectID, int chiefComplaintID, {Function(dynamic)? onSuccess, Function(String)? onError}); - Future>>> getLaserClinics(int laserCategoryID, int projectID, int languageID, - {Function(dynamic)? onSuccess, Function(String)? onError}); + Future>>> getLaserClinics(int laserCategoryID, int projectID, int languageID, {Function(dynamic)? onSuccess, Function(String)? onError}); Future>> checkScannedNFCAndQRCode(String nfcCode, int projectId, {Function(dynamic)? onSuccess, Function(String)? onError}); @@ -101,6 +103,8 @@ abstract class BookAppointmentsRepo { required int userAge, Function(dynamic)? onSuccess, Function(String)? onError}); + + Future>> getAppointmentNearestGate({required int projectID, required int clinicID}); } class BookAppointmentsRepoImp implements BookAppointmentsRepo { @@ -206,6 +210,45 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { } } + @override + Future>>> getDoctorsListByHealthCal(int calculationID, {Function(dynamic)? onSuccess, Function(String)? onError}) async { + Map mapDevice = {"CalculationID": calculationID}; + + try { + GenericApiModel>? apiResponse; + Failure? failure; + await apiClient.post( + GET_DOCTOR_LIST_CALCULATION, + body: mapDevice, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + onError!(error); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['List_CalculationTable']; + + final doctorsList = list.map((item) => DoctorsListResponseModel.fromJson(item as Map)).toList().cast(); + + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: doctorsList, + ); + } 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>> getDoctorProfile(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}) async { Map mapDevice = { @@ -824,7 +867,8 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { } @override - Future>>> getLaserClinics(int laserCategoryID, int projectID, int languageID, {Function(dynamic p1)? onSuccess, Function(String p1)? onError}) async { + Future>>> getLaserClinics(int laserCategoryID, int projectID, int languageID, + {Function(dynamic p1)? onSuccess, Function(String p1)? onError}) async { Map mapDevice = { "LaserCategoryID": laserCategoryID, "ProjectID": projectID, @@ -1005,4 +1049,40 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { return Left(UnknownFailure(e.toString())); } } + + @override + Future>> getAppointmentNearestGate({required int projectID, required int clinicID}) async { + Map mapRequest = {"ProjectID": projectID, "ClinicID": clinicID}; + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post( + GET_APPOINTMENT_NEAREST_GATE, + body: mapRequest, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final nearestGateResponse = AppointmentNearestGateResponseModel.fromJson(response['getGateByProjectIDandClinicIDList'][0]); + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: nearestGateResponse, + ); + } 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())); + } + } } diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index d96cb4f..cbed940 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/LaserCategoryType.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/free_slot.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/dental_chief_complaints_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctor_profile_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; @@ -44,11 +45,17 @@ class BookAppointmentsViewModel extends ChangeNotifier { bool isDoctorsListLoading = false; bool isDoctorProfileLoading = false; bool isDoctorSearchByNameStarted = false; + bool isAppointmentNearestGateLoading = false; bool isLiveCareSchedule = false; + bool isGetDocForHealthCal = false; + int? calculationID = 0; + bool isSortByClinic = true; int initialSlotDuration = 0; + bool isNearestAppointmentSelected = false; + LocationUtils locationUtils; List clinicsList = []; @@ -61,6 +68,11 @@ class BookAppointmentsViewModel extends ChangeNotifier { List doctorsList = []; List filteredDoctorList = []; + // Grouped doctors lists + List> doctorsListByClinic = []; + List> doctorsListByHospital = []; + List> doctorsListGrouped = []; + List liveCareDoctorsList = []; List patientDentalPlanEstimationList = []; @@ -122,6 +134,8 @@ class BookAppointmentsViewModel extends ChangeNotifier { PatientAppointmentShareResponseModel? patientWalkInAppointmentShareResponseModel; + AppointmentNearestGateResponseModel? appointmentNearestGateResponseModel; + ///variables for laser clinic List femaleLaserCategory = [ LaserCategoryType(1, 'bodyString'), @@ -143,6 +157,31 @@ class BookAppointmentsViewModel extends ChangeNotifier { bool isBodyPartsLoading = false; int duration = 0; + + setIsSortByClinic(bool value) { + isSortByClinic = value; + doctorsListGrouped = isSortByClinic ? doctorsListByClinic : doctorsListByHospital; + notifyListeners(); + } + + // Group doctors by clinic and hospital + void _groupDoctorsList() { + final clinicMap = >{}; + final hospitalMap = >{}; + + for (var doctor in doctorsList) { + final clinicKey = (doctor.clinicName ?? 'Unknown').trim(); + clinicMap.putIfAbsent(clinicKey, () => []).add(doctor); + + final hospitalKey = (doctor.projectName ?? 'Unknown').trim(); + hospitalMap.putIfAbsent(hospitalKey, () => []).add(doctor); + } + + doctorsListByClinic = clinicMap.values.toList(); + doctorsListByHospital = hospitalMap.values.toList(); + doctorsListGrouped = isSortByClinic ? doctorsListByClinic : doctorsListByHospital; + } + BookAppointmentsViewModel( {required this.bookAppointmentsRepo, required this.errorHandlerService, @@ -187,6 +226,18 @@ class BookAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } + setIsNearestAppointmentSelected(bool isNearestAppointmentSelected) { + this.isNearestAppointmentSelected = isNearestAppointmentSelected; + + if (isNearestAppointmentSelected) { + doctorsList.sort((a, b) => DateUtil.convertStringToDate(a.nearestFreeSlot!).compareTo(DateUtil.convertStringToDate(b.nearestFreeSlot!))); + } else { + doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!)); + } + + notifyListeners(); + } + setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) { this.isWaitingAppointmentSelected = isWaitingAppointmentSelected; notifyListeners(); @@ -280,6 +331,8 @@ class BookAppointmentsViewModel extends ChangeNotifier { } void onTabChanged(int index) { + calculationID = null; + isGetDocForHealthCal = false; selectedTabIndex = index; notifyListeners(); } @@ -319,8 +372,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { Future getLiveCareScheduleClinics({Function(dynamic)? onSuccess, Function(String)? onError}) async { liveCareClinicsList.clear(); - final result = - await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!); + final result = await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!); result.fold( (failure) async => await errorHandlerService.handleError(failure: failure), @@ -342,9 +394,8 @@ class BookAppointmentsViewModel extends ChangeNotifier { Future getLiveCareDoctorsList({Function(dynamic)? onSuccess, Function(String)? onError}) async { doctorsList.clear(); - final result = await bookAppointmentsRepo.getLiveCareDoctorsList( - selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!, - onError: onError); + final result = + await bookAppointmentsRepo.getLiveCareDoctorsList(selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!, onError: onError); result.fold( (failure) async { @@ -367,11 +418,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } //TODO: Make the API dynamic with parameters for ProjectID, isNearest, languageID, doctorId, doctorName - Future getDoctorsList( - {int projectID = 0, bool isNearest = true, int doctorId = 0, - String doctorName = "", - Function(dynamic)? onSuccess, - Function(String)? onError}) async { + Future getDoctorsList({int projectID = 0, bool isNearest = true, int doctorId = 0, String doctorName = "", Function(dynamic)? onSuccess, Function(String)? onError}) async { doctorsList.clear(); projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : projectID; final result = @@ -391,9 +438,43 @@ class BookAppointmentsViewModel extends ChangeNotifier { doctorsList = apiResponse.data!; filteredDoctorList = doctorsList; isDoctorsListLoading = false; + doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!)); initializeFilteredList(); clearSearchFilters(); getFiltersFromDoctorList(); + _groupDoctorsList(); + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } + }, + ); + } + + //TODO: GetDockets & Calculations For Health Calculator + Future getDoctorsListByHealthCal({Function(dynamic)? onSuccess, Function(String)? onError}) async { + doctorsList.clear(); + final result = await bookAppointmentsRepo.getDoctorsListByHealthCal(calculationID!); + result.fold( + (failure) async { + isDoctorsListLoading = false; + if (onError != null) onError("No doctors found for the search criteria".needTranslation); + + notifyListeners(); + }, + (apiResponse) { + if (apiResponse.messageStatus == 2) { + // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); + } else if (apiResponse.messageStatus == 1) { + doctorsList = apiResponse.data!; + setIsSortByClinic(true); + filteredDoctorList = doctorsList; + isDoctorsListLoading = false; + initializeFilteredList(); + clearSearchFilters(); + getFiltersFromDoctorList(); + _groupDoctorsList(); notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -404,13 +485,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } Future getMappedDoctors( - {int projectID = 0, - bool isNearest = false, - int doctorId = 0, - String doctorName = "", - isContinueDentalPlan = false, - Function(dynamic)? onSuccess, - Function(String)? onError}) async { + {int projectID = 0, bool isNearest = false, int doctorId = 0, String doctorName = "", isContinueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}) async { filteredHospitalList = null; hospitalList = null; isRegionListLoading = true; @@ -446,8 +521,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } Future getDoctorProfile({Function(dynamic)? onSuccess, Function(String)? onError}) async { - final result = await bookAppointmentsRepo - .getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError); + final result = await bookAppointmentsRepo.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError); result.fold( (failure) async {}, @@ -506,8 +580,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { // : date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString())); slotsList.add(FreeSlot(date, ['slot'])); - docFreeSlots.add(TimeSlot( - isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element)); + docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element)); }); notifyListeners(); @@ -526,8 +599,8 @@ class BookAppointmentsViewModel extends ChangeNotifier { final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); Map _eventsParsed; - final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, - selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare, + final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots( + selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare, onError: onError); result.fold( @@ -551,8 +624,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { // : date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString())); slotsList.add(FreeSlot(date, ['slot'])); - docFreeSlots.add(TimeSlot( - isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element)); + docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element)); }); notifyListeners(); @@ -564,10 +636,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { ); } - Future cancelAppointment( - {required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, - Function(dynamic)? onSuccess, - Function(String)? onError}) async { + Future cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async { final result = await bookAppointmentsRepo.cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel); result.fold( @@ -651,15 +720,13 @@ class BookAppointmentsViewModel extends ChangeNotifier { await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { navigationService.pop(); Future.delayed(Duration(milliseconds: 50)).then((value) async {}); - LoadingUtils.showFullScreenLoader( - barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); await insertSpecificAppointment( onError: (err) {}, onSuccess: (apiResp) async { LoadingUtils.hideFullScreenLoader(); await Future.delayed(Duration(milliseconds: 50)).then((value) async { - LoadingUtils.showFullScreenLoader( - barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); await Future.delayed(Duration(milliseconds: 4000)).then((value) { LoadingUtils.hideFullScreenLoader(); Navigator.pushAndRemoveUntil( @@ -749,15 +816,13 @@ class BookAppointmentsViewModel extends ChangeNotifier { await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { navigationService.pop(); Future.delayed(Duration(milliseconds: 50)).then((value) async {}); - LoadingUtils.showFullScreenLoader( - barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); await insertSpecificAppointment( onError: (err) {}, onSuccess: (apiResp) async { LoadingUtils.hideFullScreenLoader(); await Future.delayed(Duration(milliseconds: 50)).then((value) async { - LoadingUtils.showFullScreenLoader( - barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); await Future.delayed(Duration(milliseconds: 4000)).then((value) { LoadingUtils.hideFullScreenLoader(); Navigator.pushAndRemoveUntil( @@ -831,9 +896,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } else { filteredHospitalList = RegionList(); - var list = isHMG - ? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList - : hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList; + var list = isHMG ? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList : hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList; if (list != null && list.isEmpty) { notifyListeners(); @@ -916,8 +979,8 @@ class BookAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } - void setSelections(List? selectedFacilityForFilters, List? selectedRegionForFilters, String? selectedClinicForFilters, - PatientDoctorAppointmentList? selectedHospitalForFilters, bool applyFilters) { + void setSelections( + List? selectedFacilityForFilters, List? selectedRegionForFilters, String? selectedClinicForFilters, PatientDoctorAppointmentList? selectedHospitalForFilters, bool applyFilters) { this.selectedFacilityForFilters = selectedFacilityForFilters; this.selectedClinicForFilters = selectedClinicForFilters; this.selectedHospitalForFilters = selectedHospitalForFilters; @@ -985,15 +1048,11 @@ class BookAppointmentsViewModel extends ChangeNotifier { List getDoctorListAsPerSelection() { if (!applyFilters) return doctorsList; - if ((selectedRegionForFilters?.isEmpty == true) && - (selectedFacilityForFilters?.isEmpty == true) && - selectedClinicForFilters == null && - selectedHospitalForFilters == null) { + if ((selectedRegionForFilters?.isEmpty == true) && (selectedFacilityForFilters?.isEmpty == true) && selectedClinicForFilters == null && selectedHospitalForFilters == null) { return doctorsList; } var list = doctorsList.where((element) { - var isInSelectedRegion = - (selectedRegionForFilters?.isEmpty == true) ? true : selectedRegionForFilters?.any((region) => region == element.getRegionName(isArabic())); + var isInSelectedRegion = (selectedRegionForFilters?.isEmpty == true) ? true : selectedRegionForFilters?.any((region) => region == element.getRegionName(isArabic())); var shouldApplyFacilityFilter = (selectedFacilityForFilters?.isEmpty == true) ? false : true; var isHMC = (selectedFacilityForFilters?.isEmpty == true) ? true : selectedFacilityForFilters?.any((item) => item.contains("hmc")); var isInSelectedClinic = (selectedClinicForFilters == null) ? true : selectedClinicForFilters == element.clinicName; @@ -1044,8 +1103,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { dentalChiefComplaintsList.clear(); notifyListeners(); int patientID = _appState.isAuthenticated ? _appState.getAuthenticatedUser()!.patientId ?? -1 : -1; - final result = await bookAppointmentsRepo.getDentalChiefComplaintsList( - patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17); + final result = await bookAppointmentsRepo.getDentalChiefComplaintsList(patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17); result.fold( (failure) async => await errorHandlerService.handleError(failure: failure), @@ -1084,6 +1142,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { // initializeFilteredList(); // clearSearchFilters(); // getFiltersFromDoctorList(); + _groupDoctorsList(); notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -1288,4 +1347,32 @@ class BookAppointmentsViewModel extends ChangeNotifier { }, ); } + + Future getAppointmentNearestGate({required int projectID, required int clinicID, Function(dynamic)? onSuccess, Function(String)? onError}) async { + isAppointmentNearestGateLoading = true; + notifyListeners(); + + final result = await bookAppointmentsRepo.getAppointmentNearestGate(projectID: projectID, clinicID: clinicID); + + result.fold( + (failure) async { + if (onError != null) { + onError(failure.message); + } + }, + (apiResponse) { + if (apiResponse.messageStatus == 2) { + onError!(apiResponse.errorMessage!); + // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); + } else if (apiResponse.messageStatus == 1) { + appointmentNearestGateResponseModel = apiResponse.data!; + isAppointmentNearestGateLoading = false; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } + }, + ); + } } diff --git a/lib/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart b/lib/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart new file mode 100644 index 0000000..bdaa4e2 --- /dev/null +++ b/lib/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart @@ -0,0 +1,64 @@ +class AppointmentNearestGateResponseModel { + String? clinicDescription; + String? clinicDescriptionN; + int? clinicID; + String? clinicLocation; + String? clinicLocationN; + int? gender; + int? iD; + String? nearestGateNumber; + String? nearestGateNumberN; + int? projectID; + String? projectName; + String? projectNameN; + int? rowID; + + AppointmentNearestGateResponseModel( + {this.clinicDescription, + this.clinicDescriptionN, + this.clinicID, + this.clinicLocation, + this.clinicLocationN, + this.gender, + this.iD, + this.nearestGateNumber, + this.nearestGateNumberN, + this.projectID, + this.projectName, + this.projectNameN, + this.rowID}); + + AppointmentNearestGateResponseModel.fromJson(Map json) { + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + clinicID = json['ClinicID']; + clinicLocation = json['ClinicLocation']; + clinicLocationN = json['ClinicLocationN']; + gender = json['Gender']; + iD = json['ID']; + nearestGateNumber = json['NearestGateNumber']; + nearestGateNumberN = json['NearestGateNumberN']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + rowID = json['RowID']; + } + + Map toJson() { + final Map data = Map(); + data['ClinicDescription'] = clinicDescription; + data['ClinicDescriptionN'] = clinicDescriptionN; + data['ClinicID'] = clinicID; + data['ClinicLocation'] = clinicLocation; + data['ClinicLocationN'] = clinicLocationN; + data['Gender'] = gender; + data['ID'] = iD; + data['NearestGateNumber'] = nearestGateNumber; + data['NearestGateNumberN'] = nearestGateNumberN; + data['ProjectID'] = projectID; + data['ProjectName'] = projectName; + data['ProjectNameN'] = projectNameN; + data['RowID'] = rowID; + return data; + } +} diff --git a/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart b/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart index 5df6ed8..75ed122 100644 --- a/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart +++ b/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart @@ -65,75 +65,77 @@ class DoctorsListResponseModel { String? regionID; String? projectBottomName; String? projectTopName; + int? calcID; - - DoctorsListResponseModel( - {this.clinicID, - this.clinicName, - this.clinicNameN, - this.doctorTitle, - this.iD, - this.name, - this.projectID, - this.projectName, - this.actualDoctorRate, - this.clinicRoomNo, - this.date, - this.dayName, - this.decimalDoctorRate, - this.doctorAvailability, - this.doctorID, - this.doctorImageURL, - this.doctorMobileNumber, - this.doctorProfile, - this.doctorProfileInfo, - this.doctorRate, - this.doctorStarsRate, - this.employmentType, - this.gender, - this.genderDescription, - this.hISRegionId, - this.isActive, - this.isAllowWaitList, - this.isAppointmentAllowed, - this.isDoctorAllowVedioCall, - this.isDoctorDummy, - this.isDoctorHasPrePostImages, - this.isHMC, - this.isHmg, - this.isLiveCare, - this.latitude, - this.longitude, - this.nationalityFlagURL, - this.nationalityID, - this.nationalityName, - this.nearestFreeSlot, - this.noOfFreeSlotsAvailable, - this.noOfPatientsRate, - this.originalClinicID, - this.personRate, - this.projectDistanceInKiloMeters, - this.projectNameBottom, - this.projectNameTop, - this.qR, - this.qRString, - this.rateNumber, - this.regionName, - this.regionNameN, - this.serviceID, - this.setupID, - this.speciality, - this.specialityN, - this.transactionType, - this.virtualEmploymentType, - this.workingHours, - this.vida3Id, - this.region, - this.regionArabic, - this.regionEnglish, - this.regionID, - this.projectBottomName, - this.projectTopName,}); + DoctorsListResponseModel({ + this.clinicID, + this.clinicName, + this.clinicNameN, + this.doctorTitle, + this.iD, + this.name, + this.projectID, + this.projectName, + this.actualDoctorRate, + this.clinicRoomNo, + this.date, + this.dayName, + this.decimalDoctorRate, + this.doctorAvailability, + this.doctorID, + this.doctorImageURL, + this.doctorMobileNumber, + this.doctorProfile, + this.doctorProfileInfo, + this.doctorRate, + this.doctorStarsRate, + this.employmentType, + this.gender, + this.genderDescription, + this.hISRegionId, + this.isActive, + this.isAllowWaitList, + this.isAppointmentAllowed, + this.isDoctorAllowVedioCall, + this.isDoctorDummy, + this.isDoctorHasPrePostImages, + this.isHMC, + this.isHmg, + this.isLiveCare, + this.latitude, + this.longitude, + this.nationalityFlagURL, + this.nationalityID, + this.nationalityName, + this.nearestFreeSlot, + this.noOfFreeSlotsAvailable, + this.noOfPatientsRate, + this.originalClinicID, + this.personRate, + this.projectDistanceInKiloMeters, + this.projectNameBottom, + this.projectNameTop, + this.qR, + this.qRString, + this.rateNumber, + this.regionName, + this.regionNameN, + this.serviceID, + this.setupID, + this.speciality, + this.specialityN, + this.transactionType, + this.virtualEmploymentType, + this.workingHours, + this.vida3Id, + this.region, + this.regionArabic, + this.regionEnglish, + this.regionID, + this.projectBottomName, + this.projectTopName, + this.calcID, + }); DoctorsListResponseModel.fromJson(Map json) { clinicID = json['ClinicID']; @@ -141,7 +143,7 @@ class DoctorsListResponseModel { clinicNameN = json['ClinicNameN']; doctorTitle = json['DoctorTitle']; iD = json['ID']; - name = json['Name']; + name = json['Name'] ?? json["DoctorName"]; projectID = json['ProjectID']; projectName = json['ProjectName']; actualDoctorRate = json['ActualDoctorRate']; @@ -174,7 +176,7 @@ class DoctorsListResponseModel { longitude = json['Longitude']; nationalityFlagURL = json['NationalityFlagURL']; nationalityID = json['NationalityID']; - nationalityName = json['NationalityName']; + nationalityName = json['NationalityName'] ?? json["Nationality"]; nearestFreeSlot = json['NearestFreeSlot']; noOfFreeSlotsAvailable = json['NoOfFreeSlotsAvailable']; noOfPatientsRate = json['NoOfPatientsRate']; @@ -200,6 +202,7 @@ class DoctorsListResponseModel { regionEnglish = json['RegionName']; projectBottomName = json['ProjectNameBottom']; projectTopName = json['ProjectNameTop']; + calcID = json["CalcID"]; } Map toJson() { @@ -264,6 +267,7 @@ class DoctorsListResponseModel { data['VirtualEmploymentType'] = this.virtualEmploymentType; data['WorkingHours'] = this.workingHours; data['vida3Id'] = this.vida3Id; + data['CalcID'] = this.calcID; return data; } @@ -273,7 +277,8 @@ class DoctorsListResponseModel { } return regionEnglish; } - String getProjectCompleteName(){ + + String getProjectCompleteName() { return "${this.projectTopName} ${this.projectBottomName}"; } diff --git a/lib/features/emergency_services/emergency_services_view_model.dart b/lib/features/emergency_services/emergency_services_view_model.dart index a713003..400eb04 100644 --- a/lib/features/emergency_services/emergency_services_view_model.dart +++ b/lib/features/emergency_services/emergency_services_view_model.dart @@ -3,12 +3,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices; import 'package:hmg_patient_app_new/core/app_assets.dart'; - import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; -import 'package:hmg_patient_app_new/core/utils/doctor_response_mapper.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -16,29 +14,24 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_repo.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/OrderDisplay.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/RRTRequestModel.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/EROnlineCheckInPaymentDetailsResponse.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; -import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/models/OrderDisplay.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/PatientER_RC.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/RRTRequestModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/EROnlineCheckInPaymentDetailsResponse.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/PatientERTransportationMethod.dart' show PatientERTransportationMethod; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/ProjectAvgERWaitingTime.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/rrt_procedures_response_model.dart'; import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart' show PlaceDetails; import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart'; +import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_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/my_appointments_repo.dart'; -import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_map_screen.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_request_type_select.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/terms_and_condition.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.dart'; @@ -85,7 +78,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { List nearestERList = []; List nearestERFilteredList = []; - List? hospitalList; List? hmgHospitalList; List? hmcHospitalList; @@ -104,7 +96,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { AmbulanceCallingPlace callingPlace = AmbulanceCallingPlace.FROM_HOSPITAL; AmbulanceDirection ambulanceDirection = AmbulanceDirection.ONE_WAY; - bool patientHasAdvanceERBalance = false; bool isERBookAppointment = false; late EROnlineCheckInPaymentDetailsResponse erOnlineCheckInPaymentDetailsResponse; @@ -118,14 +109,11 @@ class EmergencyServicesViewModel extends ChangeNotifier { RRTServiceData? ordersRRT; TextEditingController rrtNotes = TextEditingController(); - List allOrders = []; List orderDisplayList = []; - bool historyLoading= false; + bool historyLoading = false; OrderDislpay currentlyDisplayedOrder = OrderDislpay.ALL; - - setSelectedRRTProcedure(RRTProceduresResponseModel procedure) { selectedRRTProcedure = procedure; notifyListeners(); @@ -161,7 +149,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { String? termsAndConditions; Future getRRTProcedures({Function(dynamic)? onSuccess, Function(String)? onError}) async { - print("the app state is ${appState.isAuthenticated}"); if (!appState.isAuthenticated) { dialogService.showErrorBottomSheet( @@ -797,8 +784,8 @@ class EmergencyServicesViewModel extends ChangeNotifier { historyLoading = false; ambulanceOrders = apiResponse.data; allOrders.clear(); - allOrders.addAll(ambulanceOrders??[]); - allOrders.addAll(ordersRRT?.completedOrders??[]); + allOrders.addAll(ambulanceOrders ?? []); + allOrders.addAll(ordersRRT?.completedOrders ?? []); changeOrderDisplayItems(OrderDislpay.ALL); notifyListeners(); }, @@ -889,8 +876,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } - - RRTRequestModel createRRTRequest(GeocodeResult? result, PlaceDetails? place, PlacePrediction? placePrediction){ + RRTRequestModel createRRTRequest(GeocodeResult? result, PlaceDetails? place, PlacePrediction? placePrediction) { AuthenticatedUser? user = appState.getAuthenticatedUser(); if (user == null) throw Exception("Authentication Required to Continue"); @@ -898,7 +884,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { Procedures procedures = new Procedures(); rrtRequestModel.procedures = []; - procedures.serviceID = selectedRRTProcedure?.procedureID; rrtRequestModel.latitude = ((result?.geometry.location.lat) ?? place?.lat); @@ -920,7 +905,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { notifyListeners(); } - FutureOr submitRRTRequest(GeocodeResult? result, PlaceDetails? place, PlacePrediction? placePrediction) async { + FutureOr submitRRTRequest(GeocodeResult? result, PlaceDetails? place, PlacePrediction? placePrediction) async { RRTRequestModel request = createRRTRequest(result, place, placePrediction); navServices.push(CustomPageRoute(page: RequestingServicesPage())); @@ -929,9 +914,9 @@ class EmergencyServicesViewModel extends ChangeNotifier { navServices.pushAndRemoveUntil( CustomPageRoute( page: TrackingScreen( - isRRTOrder: true, - state: OrderTrackingState.failed, - )), + isRRTOrder: true, + state: OrderTrackingState.failed, + )), ModalRoute.withName("/EmergencyServicesPage")); }, (success) { getRRTOrders(shouldNavigateToTrackingScreen: true); @@ -939,7 +924,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { } Future getRRTOrders({bool shouldNavigateToTrackingScreen = false, bool showLoader = false}) async { - if(shouldNavigateToTrackingScreen == false && showLoader ) { + if (shouldNavigateToTrackingScreen == false && showLoader) { LoaderBottomSheet.showLoader(loadingText: "Fetching Orders"); } historyLoading = true; @@ -947,39 +932,40 @@ class EmergencyServicesViewModel extends ChangeNotifier { int? id = appState.getAuthenticatedUser()?.patientId; var response = await emergencyServicesRepo.getRRTOrders(id: id); - if(shouldNavigateToTrackingScreen == false && showLoader ) { - LoaderBottomSheet.hideLoader();} + if (shouldNavigateToTrackingScreen == false && showLoader) { + LoaderBottomSheet.hideLoader(); + } response.fold( - (failure) async { - historyLoading = false; - notifyListeners(); + (failure) async { + historyLoading = false; + notifyListeners(); if (shouldNavigateToTrackingScreen) { - navServices.pushAndRemoveUntil(CustomPageRoute(page: TrackingScreen(isRRTOrder: true,state: OrderTrackingState.waitingForCall)), ModalRoute.withName("/EmergencyServicesPage")); + navServices.pushAndRemoveUntil(CustomPageRoute(page: TrackingScreen(isRRTOrder: true, state: OrderTrackingState.waitingForCall)), + ModalRoute.withName("/EmergencyServicesPage")); } }, - (apiResponse) { + (apiResponse) { if (shouldNavigateToTrackingScreen) { navServices.pushAndRemoveUntil( CustomPageRoute( page: TrackingScreen( - state: OrderTrackingState.waitingForCall, - isRRTOrder: true, - rrtOrder: apiResponse.data?.pendingOrders.first, - )), + state: OrderTrackingState.waitingForCall, + isRRTOrder: true, + rrtOrder: apiResponse.data?.pendingOrders.first, + )), ModalRoute.withName("/EmergencyServicesPage")); } historyLoading = false; ordersRRT = apiResponse.data; allOrders.clear(); - allOrders.addAll(ambulanceOrders??[]); - allOrders.addAll(ordersRRT?.completedOrders??[]); + allOrders.addAll(ambulanceOrders ?? []); + allOrders.addAll(ordersRRT?.completedOrders ?? []); changeOrderDisplayItems(OrderDislpay.ALL); notifyListeners(); }, ); } - FutureOr cancelRRTOrder(int? orderID, {bool shouldPop = false}) async { dialogService.showCommonBottomSheetWithoutH( message: "Do you want to cancel the request".needTranslation, @@ -998,52 +984,54 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } - void changeOrderDisplayItems(OrderDislpay currentlyDisplayedOrder){ + void changeOrderDisplayItems(OrderDislpay currentlyDisplayedOrder) { this.currentlyDisplayedOrder = currentlyDisplayedOrder; - switch(currentlyDisplayedOrder){ + switch (currentlyDisplayedOrder) { case OrderDislpay.ALL: - orderDisplayList = allOrders; - break; + orderDisplayList = allOrders; + break; case OrderDislpay.RRT: orderDisplayList = ordersRRT?.completedOrders ?? []; break; case OrderDislpay.AMBULANCE: - orderDisplayList = ambulanceOrders??[]; + orderDisplayList = ambulanceOrders ?? []; break; } notifyListeners(); } - void openRRT(){ + void openRRT() { print("the app state is ${appState.isAuthenticated}"); if (appState.isAuthenticated) { - if(agreedToTermsAndCondition == false){ - dialogService.showErrorBottomSheet(message: "You Need To Agree To Terms And Conditions".needTranslation, onOkPressed: (){ - if(navServices.context == null ) return; - showCommonBottomSheetWithoutHeight( - navServices.context!, - padding: EdgeInsets.only(top: 24.h), - titleWidget: Transform.flip( - flipX: isArabic, - child: Utils.buildSvgWithAssets( - icon: AppAssets.arrow_back, - iconColor: Color(0xff2B353E), - fit: BoxFit.contain, - ), - ).onPress(() { - navServices.pop(); - }), - // title: "Rapid Response Team (RRT)".needTranslation, - child: RrtRequestTypeSelect(), - isFullScreen: false, - isCloseButtonVisible: true, - hasBottomPadding: false, - backgroundColor: AppColors.bottomSheetBgColor, - callBackFunc: () { - navServices.pop(); - }, - ); - }); + if (agreedToTermsAndCondition == false) { + dialogService.showErrorBottomSheet( + message: "You Need To Agree To Terms And Conditions".needTranslation, + onOkPressed: () { + if (navServices.context == null) return; + showCommonBottomSheetWithoutHeight( + navServices.context!, + padding: EdgeInsets.only(top: 24.h), + titleWidget: Transform.flip( + flipX: isArabic, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + fit: BoxFit.contain, + ), + ).onPress(() { + navServices.pop(); + }), + // title: "Rapid Response Team (RRT)".needTranslation, + child: RrtRequestTypeSelect(), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + navServices.pop(); + }, + ); + }); return; } placeValueInController(); @@ -1051,7 +1039,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { isShowConfirmDialog: true, onSuccess: (position) async { updateBottomSheetState(BottomSheetType.FIXED); - bool result = await navServices.push( + bool result = await navServices.push( CustomPageRoute( page: MapUtilityScreen( confirmButtonString: "Submit Request".needTranslation, @@ -1061,16 +1049,15 @@ class EmergencyServicesViewModel extends ChangeNotifier { ), direction: AxisDirection.down), ); - if(result){ - LocationViewModel locationViewModel = getIt.get(); - GeocodeResponse? response = locationViewModel.geocodeResponse; - PlaceDetails? placeDetails = locationViewModel.placeDetails; - PlacePrediction? placePrediction = locationViewModel.selectedPrediction; - submitRRTRequest(response?.results.first, placeDetails, placePrediction); - } - + if (result) { + LocationViewModel locationViewModel = getIt.get(); + GeocodeResponse? response = locationViewModel.geocodeResponse; + PlaceDetails? placeDetails = locationViewModel.placeDetails; + PlacePrediction? placePrediction = locationViewModel.selectedPrediction; + submitRRTRequest(response?.results.first, placeDetails, placePrediction); + } }); - } else{ + } else { dialogService.showErrorBottomSheet( message: "You Need To Login First To Continue".needTranslation, onOkPressed: () { @@ -1079,24 +1066,22 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } } - clearRRTData(){ + + clearRRTData() { selectedRRTProcedure = null; } - FutureOr getTermsAndConditions() async { LoaderBottomSheet.showLoader(loadingText: "Fetching Terms And Conditions".needTranslation); var response = await emergencyServicesRepo.getTermsAndCondition(); LoaderBottomSheet.hideLoader(); - response.fold((failure)=>errorHandlerService.handleError(failure: failure),(success){ + response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { termsAndConditions = success.data; print("the response terms are $termsAndConditions"); notifyListeners(); navServices.push( - CustomPageRoute( - page: TermsAndCondition(termsAndCondition:success.data??""), direction: AxisDirection.down), + CustomPageRoute(page: TermsAndCondition(termsAndCondition: success.data ?? ""), direction: AxisDirection.down), ); }); } - } diff --git a/lib/features/hmg_services/hmg_services_repo.dart b/lib/features/hmg_services/hmg_services_repo.dart index 4103569..37a813d 100644 --- a/lib/features/hmg_services/hmg_services_repo.dart +++ b/lib/features/hmg_services/hmg_services_repo.dart @@ -14,12 +14,14 @@ import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; -import 'package:provider/provider.dart'; import 'models/req_models/create_e_referral_model.dart'; import 'models/req_models/send_activation_code_ereferral_req_model.dart'; +import 'models/resq_models/covid_get_test_proceedure_resp.dart'; +import 'models/resq_models/get_covid_payment_info_resp.dart'; import 'models/resq_models/relationship_type_resp_mode.dart'; import 'models/resq_models/search_e_referral_resp_model.dart'; +import 'models/resq_models/vital_sign_respo_model.dart'; abstract class HmgServicesRepo { Future>>> getAllComprehensiveCheckupOrders(); @@ -61,7 +63,11 @@ abstract class HmgServicesRepo { Future>>> searchEReferral(SearchEReferralRequestModel requestModel); + Future>>> getCovidTestProcedures(); + Future>> getCovidPaymentInfo(String procedureID, int projectID); + + Future>>> getPatientVitalSign(); } class HmgServicesRepoImp implements HmgServicesRepo { @@ -817,4 +823,149 @@ class HmgServicesRepoImp implements HmgServicesRepo { } } + + @override + Future>>> getCovidTestProcedures() async { + + try { + GenericApiModel>? apiResponse; + Failure? failure; + + await apiClient.post( + GET_COVID_DRIVETHRU_PROCEDURES_LIST, + body: {"TestTypeEnum":2,"TestProcedureEnum":3,}, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + loggerService.logError("Covid Test Procedure : $error, Status: $statusCode"); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + List covidTestProcedure = []; + + if (response['COVID19_TestProceduresList'] != null && response['COVID19_TestProceduresList'] is List) { + final servicesList = response['COVID19_TestProceduresList'] as List; + + for (var serviceJson in servicesList) { + if (serviceJson is Map) { + covidTestProcedure.add(Covid19GetTestProceduresResp.fromJson(serviceJson)); + } + } + } + + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: covidTestProcedure, + ); + } catch (e) { + loggerService.logError("Error parsing E-Referral services: ${e.toString()}"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + log("Unknown error in Search Referral: ${e.toString()}"); + return Left(UnknownFailure(e.toString())); + } + } + + @override + Future>> getCovidPaymentInfo(String procedureID, int projectID) async { + + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + GET_COVID_DRIVETHRU_PAYMENT_INFO, + body: {"TestTypeEnum":2,"TestProcedureEnum":3, "ProcedureId":procedureID, "ProjectID":projectID,}, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + loggerService.logError("Covid Test Procedure : $error, Status: $statusCode"); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + + Covid19GetPaymentInfo covidPaymentInfo = Covid19GetPaymentInfo.fromJson(response["COVID19_PatientShare"]); + + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: covidPaymentInfo, + ); + } catch (e) { + loggerService.logError("Error parsing E-Referral services: ${e.toString()}"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + log("Unknown error in Search Referral: ${e.toString()}"); + return Left(UnknownFailure(e.toString())); + } + } + + @override + Future>>> getPatientVitalSign() async { + Map requestBody = {}; + + try { + GenericApiModel>? apiResponse; + Failure? failure; + + await apiClient.post( + GET_PATIENT_VITAL_SIGN, + body: requestBody, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + loggerService.logError("Patient Vital Sign API Failed: $error, Status: $statusCode"); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + List vitalSignList = []; + + if (response['PatientVitalSignList'] != null && response['PatientVitalSignList'] is List) { + final vitalSignsList = response['PatientVitalSignList'] as List; + + for (var vitalSignJson in vitalSignsList) { + if (vitalSignJson is Map) { + vitalSignList.add(VitalSignResModel.fromJson(vitalSignJson)); + } + } + } + + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: vitalSignList, + ); + } catch (e) { + loggerService.logError("Error parsing Patient Vital Sign: ${e.toString()}"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + log("Unknown error in getPatientVitalSign: ${e.toString()}"); + return Left(UnknownFailure(e.toString())); + } + } + + } diff --git a/lib/features/hmg_services/hmg_services_view_model.dart b/lib/features/hmg_services/hmg_services_view_model.dart index 81cd060..b620c6d 100644 --- a/lib/features/hmg_services/hmg_services_view_model.dart +++ b/lib/features/hmg_services/hmg_services_view_model.dart @@ -1,36 +1,44 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart'; -import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/order_update_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/search_e_referral_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/send_activation_code_ereferral_req_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/covid_get_test_proceedure_resp.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_all_cities_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/search_e_referral_resp_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'models/req_models/check_activation_e_referral_req_model.dart'; +import 'models/resq_models/get_covid_payment_info_resp.dart'; import 'models/resq_models/relationship_type_resp_mode.dart'; +import 'models/ui_models/covid_questionnare_model.dart'; class HmgServicesViewModel extends ChangeNotifier { final HmgServicesRepo hmgServicesRepo; final BookAppointmentsRepo bookAppointmentsRepo; final ErrorHandlerService errorHandlerService; final NavigationService navigationService; - HmgServicesViewModel({required this.bookAppointmentsRepo, required this.hmgServicesRepo, required this.errorHandlerService, required this.navigationService}); + HmgServicesViewModel( + {required this.bookAppointmentsRepo, required this.hmgServicesRepo, required this.errorHandlerService, required this.navigationService}); bool isCmcOrdersLoading = false; bool isCmcServicesLoading = false; bool isUpdatingOrder = false; bool isHospitalListLoading = false; + bool isVitalSignLoading = false; // HHC specific loading states bool isHhcOrdersLoading = false; @@ -41,6 +49,7 @@ class HmgServicesViewModel extends ChangeNotifier { List hospitalsList = []; List filteredHospitalsList = []; HospitalsModel? selectedHospital; + List vitalSignList = []; // HHC specific lists List hhcOrdersList = []; @@ -53,12 +62,15 @@ class HmgServicesViewModel extends ChangeNotifier { // HHC order creation state (no hospital selection needed for home healthcare) GetCMCServicesResponseModel? selectedServiceForHhcOrder; + List relationTypes = []; + List getAllCitiesList = []; + List searchReferralList = []; + List covidTestProcedureList = []; + Covid19GetPaymentInfo? covidPaymentInfo; + Future getOrdersList() async {} + - List relationTypes =[]; - List getAllCitiesList =[]; - List searchReferralList =[]; - Future getOrdersList() async {} // HHC multiple services selection List selectedHhcServices = []; @@ -332,10 +344,7 @@ class HmgServicesViewModel extends ChangeNotifier { await getAllHhcOrders(); } - Future getAllHhcOrders({ - Function(dynamic)? onSuccess, - Function(String)? onError, - }) async { + Future getAllHhcOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async { isHhcOrdersLoading = true; notifyListeners(); @@ -541,16 +550,14 @@ class HmgServicesViewModel extends ChangeNotifier { final result = await hmgServicesRepo.getRelationshipTypes(); result.fold( - (failure) async { - + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { - + (apiResponse) { if (apiResponse.messageStatus == 1) { relationTypes = apiResponse.data ?? []; notifyListeners(); @@ -567,7 +574,6 @@ class HmgServicesViewModel extends ChangeNotifier { ); } - Future getAllCities({ Function(dynamic)? onSuccess, Function(String)? onError, @@ -576,16 +582,14 @@ class HmgServicesViewModel extends ChangeNotifier { final result = await hmgServicesRepo.getAllCities(); result.fold( - (failure) async { - + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { - + (apiResponse) { if (apiResponse.messageStatus == 1) { getAllCitiesList = apiResponse.data ?? []; notifyListeners(); @@ -607,22 +611,20 @@ class HmgServicesViewModel extends ChangeNotifier { Function(GenericApiModel)? onSuccess, Function(String)? onError, }) async { - notifyListeners(); final result = await hmgServicesRepo.sendEReferralActivationCode(requestModel); result.fold( - (failure) async { + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { + (apiResponse) { if (apiResponse.messageStatus == 1) { - notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -642,22 +644,20 @@ class HmgServicesViewModel extends ChangeNotifier { Function(GenericApiModel)? onSuccess, Function(String)? onError, }) async { - notifyListeners(); final result = await hmgServicesRepo.checkEReferralActivationCode(requestModel); result.fold( - (failure) async { + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { + (apiResponse) { if (apiResponse.messageStatus == 1) { - notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -672,28 +672,25 @@ class HmgServicesViewModel extends ChangeNotifier { ); } - Future createEReferral({ required CreateEReferralRequestModel requestModel, Function(GenericApiModel)? onSuccess, Function(String)? onError, }) async { - notifyListeners(); final result = await hmgServicesRepo.createEReferral(requestModel); result.fold( - (failure) async { + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { + (apiResponse) { if (apiResponse.messageStatus == 1) { - notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -708,29 +705,24 @@ class HmgServicesViewModel extends ChangeNotifier { ); } - - Future searchEReferral({ required SearchEReferralRequestModel requestModel, Function(dynamic)? onSuccess, Function(String)? onError, }) async { - notifyListeners(); final result = await hmgServicesRepo.searchEReferral(requestModel); result.fold( - (failure) async { - + (failure) async { notifyListeners(); await errorHandlerService.handleError(failure: failure); if (onError != null) { onError(failure.toString()); } }, - (apiResponse) { - + (apiResponse) { if (apiResponse.messageStatus == 1) { searchReferralList = apiResponse.data ?? []; notifyListeners(); @@ -747,28 +739,26 @@ class HmgServicesViewModel extends ChangeNotifier { ); } - Future navigateToOTPScreen( - {required OTPTypeEnum otpTypeEnum, - required String phoneNumber, - required String loginToken, - required Function onSuccess, - }) async { - + Future navigateToOTPScreen({ + required OTPTypeEnum otpTypeEnum, + required String phoneNumber, + required String loginToken, + required Function onSuccess, + }) async { navigationService.pushToOtpScreen( phoneNumber: phoneNumber, isFormFamilyFile: false, checkActivationCode: (int activationCode) async { - checkEReferralActivationCode( requestModel: CheckActivationCodeForEReferralRequestModel( logInTokenID: loginToken, activationCode: activationCode.toString(), ), onSuccess: (GenericApiModel response) { - onSuccess(); + onSuccess(); }, onError: (String errorMessage) { - print(errorMessage); + print(errorMessage); }, ); }, @@ -787,5 +777,123 @@ class HmgServicesViewModel extends ChangeNotifier { }, ); } + List getQuestionsFromJson() { + final String questionsJson = '''[ { "id": 1, "questionEN": "Is the test intended for travel?", "questionAR": "هل تجري التحليل بغرض السفر؟", "ans": 2 }, { "id": 2, "questionEN": "Coming from outside KSA within last 2 weeks?", "questionAR": "هل قدمت من خارج المملكة خلال الأسبوعين الماضيين؟", "ans": 2 }, { "id": 3, "questionEN": "Do you currently have fever?", "questionAR": "هل تعاني حاليا من حرارة؟", "ans": 2 }, { "id": 4, "questionEN": "Did you have fever in last 2 weeks?", "questionAR": "هل عانيت من حرارة في الأسبوعين الماضيين؟", "ans": 2 }, { "id": 5, "questionEN": "Do you have a sore throat?", "questionAR": "هل لديك التهاب في الحلق؟", "ans": 2 }, { "id": 6, "questionEN": "Do you have a runny nose?", "questionAR": "هل لديك سيلان بالأنف؟" }, { "id": 7, "questionEN": "Do you have a cough?", "questionAR": "هل لديك سعال؟", "ans": 2 }, { "id": 8, "questionEN": "Do you have shortness of breath?", "questionAR": "هل تعاني من ضيق في التنفس؟", "ans": 2 }, { "id": 9, "questionEN": "Do you have nausea?", "questionAR": "هل تعاني من غثيان؟", "ans": 2 }, { "id": 10, "questionEN": "Do you have vomiting?", "questionAR": "هل تعاني من القيء؟", "ans": 2 }, { "id": 11, "questionEN": "Do you have a headache?", "questionAR": "هل تعاني من صداع في الرأس؟", "ans": 2 }, { "id": 12, "questionEN": "Do you have muscle pain?", "questionAR": "هل تعانين من آلام عضلية؟", "ans": 2 }, { "id": 13, "questionEN": "Do you have joint pain?", "questionAR": "هل تعاني من آلام المفاصل؟", "ans": 2 }, { "id": 14, "questionEN": "Do you have diarrhea?", "questionAR": "هل لديك اسهال؟", "ans": 2 } ]'''; + + try { + final parsed = json.decode(questionsJson) as List; + return parsed + .map((e) => CovidQuestionnaireModel.fromJson(Map.from(e))) + .toList(); + } catch (_) { + return []; + } + } + + Future getCovidProcedureList({ + + Function(dynamic)? onSuccess, + Function(String)? onError, + }) async { + notifyListeners(); + + final result = await hmgServicesRepo.getCovidTestProcedures(); + + result.fold( + (failure) async { + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + if (apiResponse.messageStatus == 1) { + covidTestProcedureList = apiResponse.data ?? []; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Unknown error'); + } + } + }, + ); + } + + + Future getPaymentInfo({ + String? procedureID, + int? projectID, + Function(dynamic)? onSuccess, + Function(String)? onError, + }) async { + notifyListeners(); + + final result = await hmgServicesRepo.getCovidPaymentInfo(procedureID!, projectID!); + + result.fold( + (failure) async { + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + if (apiResponse.messageStatus == 1) { + covidPaymentInfo = apiResponse.data; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Unknown error'); + } + } + }, + ); + } + + Future getPatientVitalSign({ + Function(dynamic)? onSuccess, + Function(String)? onError, + }) async { + isVitalSignLoading = true; + notifyListeners(); + + final result = await hmgServicesRepo.getPatientVitalSign(); + + result.fold( + (failure) async { + isVitalSignLoading = false; + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + isVitalSignLoading = false; + if (apiResponse.messageStatus == 1) { + vitalSignList = apiResponse.data ?? []; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Unknown error'); + } + } + }, + ); + } } diff --git a/lib/features/hmg_services/models/resq_models/covid_get_test_proceedure_resp.dart b/lib/features/hmg_services/models/resq_models/covid_get_test_proceedure_resp.dart new file mode 100644 index 0000000..c27f1e7 --- /dev/null +++ b/lib/features/hmg_services/models/resq_models/covid_get_test_proceedure_resp.dart @@ -0,0 +1,33 @@ +import 'dart:convert'; + +class Covid19GetTestProceduresResp { + String? procedureId; + String? procedureName; + String? procedureNameN; + String? setupId; + + Covid19GetTestProceduresResp({ + this.procedureId, + this.procedureName, + this.procedureNameN, + this.setupId, + }); + + factory Covid19GetTestProceduresResp.fromRawJson(String str) => Covid19GetTestProceduresResp.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory Covid19GetTestProceduresResp.fromJson(Map json) => Covid19GetTestProceduresResp( + procedureId: json["ProcedureID"], + procedureName: json["ProcedureName"], + procedureNameN: json["ProcedureNameN"], + setupId: json["SetupID"], + ); + + Map toJson() => { + "ProcedureID": procedureId, + "ProcedureName": procedureName, + "ProcedureNameN": procedureNameN, + "SetupID": setupId, + }; +} diff --git a/lib/features/hmg_services/models/resq_models/get_covid_payment_info_resp.dart b/lib/features/hmg_services/models/resq_models/get_covid_payment_info_resp.dart new file mode 100644 index 0000000..5f95263 --- /dev/null +++ b/lib/features/hmg_services/models/resq_models/get_covid_payment_info_resp.dart @@ -0,0 +1,105 @@ +import 'dart:convert'; + +class Covid19GetPaymentInfo { + dynamic propertyChanged; + int? cashPriceField; + int? cashPriceTaxField; + int? cashPriceWithTaxField; + int? companyIdField; + String? companyNameField; + int? companyShareWithTaxField; + dynamic errCodeField; + int? groupIdField; + dynamic insurancePolicyNoField; + String? messageField; + dynamic patientCardIdField; + int? patientShareField; + double? patientShareWithTaxField; + double? patientTaxAmountField; + int? policyIdField; + dynamic policyNameField; + dynamic procedureIdField; + String? procedureNameField; + dynamic setupIdField; + int? statusCodeField; + dynamic subPolicyNoField; + + Covid19GetPaymentInfo({ + this.propertyChanged, + this.cashPriceField, + this.cashPriceTaxField, + this.cashPriceWithTaxField, + this.companyIdField, + this.companyNameField, + this.companyShareWithTaxField, + this.errCodeField, + this.groupIdField, + this.insurancePolicyNoField, + this.messageField, + this.patientCardIdField, + this.patientShareField, + this.patientShareWithTaxField, + this.patientTaxAmountField, + this.policyIdField, + this.policyNameField, + this.procedureIdField, + this.procedureNameField, + this.setupIdField, + this.statusCodeField, + this.subPolicyNoField, + }); + + factory Covid19GetPaymentInfo.fromRawJson(String str) => Covid19GetPaymentInfo.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory Covid19GetPaymentInfo.fromJson(Map json) => Covid19GetPaymentInfo( + propertyChanged: json["PropertyChanged"], + cashPriceField: json["cashPriceField"], + cashPriceTaxField: json["cashPriceTaxField"], + cashPriceWithTaxField: json["cashPriceWithTaxField"], + companyIdField: json["companyIdField"], + companyNameField: json["companyNameField"], + companyShareWithTaxField: json["companyShareWithTaxField"], + errCodeField: json["errCodeField"], + groupIdField: json["groupIDField"], + insurancePolicyNoField: json["insurancePolicyNoField"], + messageField: json["messageField"], + patientCardIdField: json["patientCardIDField"], + patientShareField: json["patientShareField"], + patientShareWithTaxField: json["patientShareWithTaxField"]?.toDouble(), + patientTaxAmountField: json["patientTaxAmountField"]?.toDouble(), + policyIdField: json["policyIdField"], + policyNameField: json["policyNameField"], + procedureIdField: json["procedureIdField"], + procedureNameField: json["procedureNameField"], + setupIdField: json["setupIDField"], + statusCodeField: json["statusCodeField"], + subPolicyNoField: json["subPolicyNoField"], + ); + + Map toJson() => { + "PropertyChanged": propertyChanged, + "cashPriceField": cashPriceField, + "cashPriceTaxField": cashPriceTaxField, + "cashPriceWithTaxField": cashPriceWithTaxField, + "companyIdField": companyIdField, + "companyNameField": companyNameField, + "companyShareWithTaxField": companyShareWithTaxField, + "errCodeField": errCodeField, + "groupIDField": groupIdField, + "insurancePolicyNoField": insurancePolicyNoField, + "messageField": messageField, + "patientCardIDField": patientCardIdField, + "patientShareField": patientShareField, + "patientShareWithTaxField": patientShareWithTaxField, + "patientTaxAmountField": patientTaxAmountField, + "policyIdField": policyIdField, + "policyNameField": policyNameField, + "procedureIdField": procedureIdField, + "procedureNameField": procedureNameField, + "setupIDField": setupIdField, + "statusCodeField": statusCodeField, + "subPolicyNoField": subPolicyNoField, + }; +} diff --git a/lib/features/hmg_services/models/resq_models/vital_sign_respo_model.dart b/lib/features/hmg_services/models/resq_models/vital_sign_respo_model.dart new file mode 100644 index 0000000..bc93f59 --- /dev/null +++ b/lib/features/hmg_services/models/resq_models/vital_sign_respo_model.dart @@ -0,0 +1,259 @@ +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; + +class VitalSignResModel { + var transNo; + var projectID; + var weightKg; + var heightCm; + var temperatureCelcius; + var pulseBeatPerMinute; + var respirationBeatPerMinute; + var bloodPressureLower; + var bloodPressureHigher; + var sAO2; + var fIO2; + var painScore; + var bodyMassIndex; + var headCircumCm; + var leanBodyWeightLbs; + var idealBodyWeightLbs; + var temperatureCelciusMethod; + var pulseRhythm; + var respirationPattern; + var bloodPressureCuffLocation; + var bloodPressureCuffSize; + var bloodPressurePatientPosition; + var painLocation; + var painDuration; + var painCharacter; + var painFrequency; + bool? isPainManagementDone; + var status; + bool? isVitalsRequired; + var patientID; + var createdOn; + var doctorID; + var clinicID; + var triageCategory; + var gCScore; + var lineItemNo; + DateTime? vitalSignDate; + var actualTimeTaken; + var sugarLevel; + var fBS; + var rBS; + var observationType; + var heartRate; + var muscleTone; + var reflexIrritability; + var bodyColor; + var isFirstAssessment; + var dateofBirth; + var timeOfBirth; + var bloodPressure; + var bloodPressureCuffLocationDesc; + var bloodPressureCuffSizeDesc; + var bloodPressurePatientPositionDesc; + var clinicName; + var doctorImageURL; + var doctorName; + var painScoreDesc; + var pulseRhythmDesc; + var respirationPatternDesc; + var temperatureCelciusMethodDesc; + var time; + + VitalSignResModel( + {this.transNo, + this.projectID, + this.weightKg, + this.heightCm, + this.temperatureCelcius, + this.pulseBeatPerMinute, + this.respirationBeatPerMinute, + this.bloodPressureLower, + this.bloodPressureHigher, + this.sAO2, + this.fIO2, + this.painScore, + this.bodyMassIndex, + this.headCircumCm, + this.leanBodyWeightLbs, + this.idealBodyWeightLbs, + this.temperatureCelciusMethod, + this.pulseRhythm, + this.respirationPattern, + this.bloodPressureCuffLocation, + this.bloodPressureCuffSize, + this.bloodPressurePatientPosition, + this.painLocation, + this.painDuration, + this.painCharacter, + this.painFrequency, + this.isPainManagementDone, + this.status, + this.isVitalsRequired, + this.patientID, + this.createdOn, + this.doctorID, + this.clinicID, + this.triageCategory, + this.gCScore, + this.lineItemNo, + this.vitalSignDate, + this.actualTimeTaken, + this.sugarLevel, + this.fBS, + this.rBS, + this.observationType, + this.heartRate, + this.muscleTone, + this.reflexIrritability, + this.bodyColor, + this.isFirstAssessment, + this.dateofBirth, + this.timeOfBirth, + this.bloodPressure, + this.bloodPressureCuffLocationDesc, + this.bloodPressureCuffSizeDesc, + this.bloodPressurePatientPositionDesc, + this.clinicName, + this.doctorImageURL, + this.doctorName, + this.painScoreDesc, + this.pulseRhythmDesc, + this.respirationPatternDesc, + this.temperatureCelciusMethodDesc, + this.time}); + + VitalSignResModel.fromJson(Map json) { + transNo = json['TransNo']; + projectID = json['ProjectID']; + weightKg = json['WeightKg']; + heightCm = json['HeightCm']; + temperatureCelcius = json['TemperatureCelcius']; + pulseBeatPerMinute = json['PulseBeatPerMinute']; + respirationBeatPerMinute = json['RespirationBeatPerMinute']; + bloodPressureLower = json['BloodPressureLower']; + bloodPressureHigher = json['BloodPressureHigher']; + sAO2 = json['SAO2']; + fIO2 = json['FIO2']; + painScore = json['PainScore']; + bodyMassIndex = json['BodyMassIndex']; + headCircumCm = json['HeadCircumCm']; + leanBodyWeightLbs = json['LeanBodyWeightLbs']; + idealBodyWeightLbs = json['IdealBodyWeightLbs']; + temperatureCelciusMethod = json['TemperatureCelciusMethod']; + pulseRhythm = json['PulseRhythm']; + respirationPattern = json['RespirationPattern']; + bloodPressureCuffLocation = json['BloodPressureCuffLocation']; + bloodPressureCuffSize = json['BloodPressureCuffSize']; + bloodPressurePatientPosition = json['BloodPressurePatientPosition']; + painLocation = json['PainLocation']; + painDuration = json['PainDuration']; + painCharacter = json['PainCharacter']; + painFrequency = json['PainFrequency']; + isPainManagementDone = json['IsPainManagementDone']; + status = json['Status']; + isVitalsRequired = json['IsVitalsRequired']; + patientID = json['PatientID']; + createdOn = json['CreatedOn']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + triageCategory = json['TriageCategory']; + gCScore = json['GCScore']; + lineItemNo = json['LineItemNo']; + vitalSignDate = DateUtil.convertStringToDate(json['CreatedOn']); + actualTimeTaken = json['ActualTimeTaken']; + sugarLevel = json['SugarLevel']; + fBS = json['FBS']; + rBS = json['RBS']; + observationType = json['ObservationType']; + heartRate = json['HeartRate']; + muscleTone = json['MuscleTone']; + reflexIrritability = json['ReflexIrritability']; + bodyColor = json['BodyColor']; + isFirstAssessment = json['IsFirstAssessment']; + dateofBirth = json['DateofBirth']; + timeOfBirth = json['TimeOfBirth']; + bloodPressure = json['BloodPressure']; + bloodPressureCuffLocationDesc = json['BloodPressureCuffLocationDesc']; + bloodPressureCuffSizeDesc = json['BloodPressureCuffSizeDesc']; + bloodPressurePatientPositionDesc = json['BloodPressurePatientPositionDesc']; + clinicName = json['ClinicName']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + painScoreDesc = json['PainScoreDesc']; + pulseRhythmDesc = json['PulseRhythmDesc']; + respirationPatternDesc = json['RespirationPatternDesc']; + temperatureCelciusMethodDesc = json['TemperatureCelciusMethodDesc']; + time = json['Time']; + } + + Map toJson() { + final Map data = new Map(); + data['TransNo'] = this.transNo; + data['ProjectID'] = this.projectID; + data['WeightKg'] = this.weightKg; + data['HeightCm'] = this.heightCm; + data['TemperatureCelcius'] = this.temperatureCelcius; + data['PulseBeatPerMinute'] = this.pulseBeatPerMinute; + data['RespirationBeatPerMinute'] = this.respirationBeatPerMinute; + data['BloodPressureLower'] = this.bloodPressureLower; + data['BloodPressureHigher'] = this.bloodPressureHigher; + data['SAO2'] = this.sAO2; + data['FIO2'] = this.fIO2; + data['PainScore'] = this.painScore; + data['BodyMassIndex'] = this.bodyMassIndex; + data['HeadCircumCm'] = this.headCircumCm; + data['LeanBodyWeightLbs'] = this.leanBodyWeightLbs; + data['IdealBodyWeightLbs'] = this.idealBodyWeightLbs; + data['TemperatureCelciusMethod'] = this.temperatureCelciusMethod; + data['PulseRhythm'] = this.pulseRhythm; + data['RespirationPattern'] = this.respirationPattern; + data['BloodPressureCuffLocation'] = this.bloodPressureCuffLocation; + data['BloodPressureCuffSize'] = this.bloodPressureCuffSize; + data['BloodPressurePatientPosition'] = this.bloodPressurePatientPosition; + data['PainLocation'] = this.painLocation; + data['PainDuration'] = this.painDuration; + data['PainCharacter'] = this.painCharacter; + data['PainFrequency'] = this.painFrequency; + data['IsPainManagementDone'] = this.isPainManagementDone; + data['Status'] = this.status; + data['IsVitalsRequired'] = this.isVitalsRequired; + data['PatientID'] = this.patientID; + data['CreatedOn'] = this.createdOn; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['TriageCategory'] = this.triageCategory; + data['GCScore'] = this.gCScore; + data['LineItemNo'] = this.lineItemNo; + data['VitalSignDate'] = this.vitalSignDate; + data['ActualTimeTaken'] = this.actualTimeTaken; + data['SugarLevel'] = this.sugarLevel; + data['FBS'] = this.fBS; + data['RBS'] = this.rBS; + data['ObservationType'] = this.observationType; + data['HeartRate'] = this.heartRate; + data['MuscleTone'] = this.muscleTone; + data['ReflexIrritability'] = this.reflexIrritability; + data['BodyColor'] = this.bodyColor; + data['IsFirstAssessment'] = this.isFirstAssessment; + data['DateofBirth'] = this.dateofBirth; + data['TimeOfBirth'] = this.timeOfBirth; + data['BloodPressure'] = this.bloodPressure; + data['BloodPressureCuffLocationDesc'] = this.bloodPressureCuffLocationDesc; + data['BloodPressureCuffSizeDesc'] = this.bloodPressureCuffSizeDesc; + data['BloodPressurePatientPositionDesc'] = + this.bloodPressurePatientPositionDesc; + data['ClinicName'] = this.clinicName; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['PainScoreDesc'] = this.painScoreDesc; + data['PulseRhythmDesc'] = this.pulseRhythmDesc; + data['RespirationPatternDesc'] = this.respirationPatternDesc; + data['TemperatureCelciusMethodDesc'] = this.temperatureCelciusMethodDesc; + data['Time'] = this.time; + return data; + } +} diff --git a/lib/features/hmg_services/models/ui_models/covid_questionnare_model.dart b/lib/features/hmg_services/models/ui_models/covid_questionnare_model.dart new file mode 100644 index 0000000..35b0efe --- /dev/null +++ b/lib/features/hmg_services/models/ui_models/covid_questionnare_model.dart @@ -0,0 +1,33 @@ +import 'dart:convert'; + +class CovidQuestionnaireModel { + int? id; + String? questionEn; + String? questionAr; + int? ans; + + CovidQuestionnaireModel({ + this.id, + this.questionEn, + this.questionAr, + this.ans, + }); + + factory CovidQuestionnaireModel.fromRawJson(String str) => CovidQuestionnaireModel.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory CovidQuestionnaireModel.fromJson(Map json) => CovidQuestionnaireModel( + id: json["id"], + questionEn: json["questionEN"], + questionAr: json["questionAR"], + ans: json["ans"], + ); + + Map toJson() => { + "id": id, + "questionEN": questionEn, + "questionAR": questionAr, + "ans": ans, + }; +} diff --git a/lib/features/hmg_services/models/ui_models/e_referral_form_model.dart b/lib/features/hmg_services/models/ui_models/e_referral_form_model.dart index 32964b1..8be00d6 100644 --- a/lib/features/hmg_services/models/ui_models/e_referral_form_model.dart +++ b/lib/features/hmg_services/models/ui_models/e_referral_form_model.dart @@ -1,5 +1,4 @@ // models/referral_models.dart -import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_all_cities_resp_model.dart'; diff --git a/lib/features/insurance/insurance_view_model.dart b/lib/features/insurance/insurance_view_model.dart index 30f4c26..0bbdda2 100644 --- a/lib/features/insurance/insurance_view_model.dart +++ b/lib/features/insurance/insurance_view_model.dart @@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patien import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_card_history.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_details_response_model.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_update_response_model.dart'; -import 'package:hmg_patient_app_new/features/lab/lab_repo.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; class InsuranceViewModel extends ChangeNotifier { diff --git a/lib/features/lab/lab_view_model.dart b/lib/features/lab/lab_view_model.dart index cd4065e..118c54a0 100644 --- a/lib/features/lab/lab_view_model.dart +++ b/lib/features/lab/lab_view_model.dart @@ -1,6 +1,5 @@ import 'dart:collection'; import 'dart:core'; -import 'dart:math'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -18,7 +17,6 @@ import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:intl/intl.dart' show DateFormat; -import 'package:logger/logger.dart'; class LabViewModel extends ChangeNotifier { bool isLabOrdersLoading = false; @@ -82,6 +80,12 @@ class LabViewModel extends ChangeNotifier { double minY = double.infinity; double maxX = double.infinity; + // --- New grouping fields --- + bool isSortByClinic = true; + List> patientLabOrdersByClinic = []; + List> patientLabOrdersByHospital = []; + List> patientLabOrdersViewList = []; + LabViewModel( {required this.labRepo, required this.errorHandlerService, @@ -94,6 +98,9 @@ class LabViewModel extends ChangeNotifier { labOrderTests.clear(); isLabOrdersLoading = true; isLabResultsLoading = true; + patientLabOrdersByClinic.clear(); + patientLabOrdersByHospital.clear(); + patientLabOrdersViewList.clear(); getPatientLabOrders(); // } notifyListeners(); @@ -104,6 +111,12 @@ class LabViewModel extends ChangeNotifier { notifyListeners(); } + void setIsSortByClinic(bool value) { + isSortByClinic = value; + patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; + notifyListeners(); + } + Future getPatientLabOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async { // if (!isLabNeedToLoad) return; @@ -112,6 +125,9 @@ class LabViewModel extends ChangeNotifier { uniqueTests.clear(); labOrderTests.clear(); uniqueTests = {}; + patientLabOrdersByClinic.clear(); + patientLabOrdersByHospital.clear(); + patientLabOrdersViewList.clear(); notifyListeners(); final result = await labRepo.getPatientLabOrders(); @@ -122,7 +138,7 @@ class LabViewModel extends ChangeNotifier { isLabResultsLoading = false; notifyListeners(); }, - // => await errorHandlerService.handleError(failure: failure), + // => await errorHandler_service.handleError(failure: failure), (apiResponse) { if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); @@ -132,6 +148,23 @@ class LabViewModel extends ChangeNotifier { tempLabOrdersList = apiResponse.data!; isLabOrdersLoading = false; isLabResultsLoading = false; + + // --- Build groups by clinic and by hospital (projectName) --- + final clinicMap = >{}; + final hospitalMap = >{}; + + for (var order in patientLabOrders) { + final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); + clinicMap.putIfAbsent(clinicKey, () => []).add(order); + + final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); + hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); + } + + patientLabOrdersByClinic = clinicMap.values.toList(); + patientLabOrdersByHospital = hospitalMap.values.toList(); + patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; + filterSuggestions(); getUniqueTestDescription(); isLabNeedToLoad = false; @@ -206,7 +239,6 @@ class LabViewModel extends ChangeNotifier { createdOn: item.createdOn, model: item)) }; - var sortedResult = SplayTreeSet.from(uniqueTests, (a, b) => a.description?[0].toUpperCase().compareTo(b.description?[0] ?? "") ?? -1); uniqueTestsList = uniqueTests.toList(); uniqueTestsList.sort((a, b) { return a.description!.toLowerCase().compareTo(b.description!.toLowerCase()); @@ -291,7 +323,7 @@ class LabViewModel extends ChangeNotifier { PatientLabOrdersResponseModel laborder) async { isLabResultByHospitalLoading = true; notifyListeners(); - mainLabResultsByHospitals.clear; + mainLabResultsByHospitals.clear(); final result = await labRepo.getPatientLabResultsByHospitals(laborder, Utils.isVidaPlusProject(int.parse(laborder.projectID ?? "0"))); @@ -334,8 +366,7 @@ class LabViewModel extends ChangeNotifier { LoaderBottomSheet.hideLoader(); if (apiResponse.messageStatus == 2) { } else if (apiResponse.messageStatus == 1) { - var sortedResponse = sortByFlagAndValue(apiResponse.data!); - var recentThree = sort(sortedResponse); + var recentThree = sort(apiResponse.data!); mainLabResults = recentThree; @@ -617,19 +648,6 @@ class LabViewModel extends ChangeNotifier { } List sort(List original) { - DateTime? parseVerifiedDate(String? raw) { - if (raw == null) return null; - final regex = RegExp(r'\/Date\((\d+)\)\/'); - final match = regex.firstMatch(raw); - if (match != null) { - final millis = int.tryParse(match.group(1)!); - if (millis != null) { - - return DateTime.fromMillisecondsSinceEpoch(millis); - } - } - return null; - } final copy = List.from(original); copy.sort((a, b) { @@ -649,8 +667,8 @@ class LabViewModel extends ChangeNotifier { final copy = List.from(original); copy.sort((a, b) { - final aDate =a.time; - final bDate = a.time; + final aDate = a.time; + final bDate = b.time; final now = DateTime.now(); if (aDate == now && bDate == now) return 0; if (aDate == now) return 1; diff --git a/lib/features/location/location_view_model.dart b/lib/features/location/location_view_model.dart index c6ea34e..5b0eef6 100644 --- a/lib/features/location/location_view_model.dart +++ b/lib/features/location/location_view_model.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart' show ChangeNotifier; import 'package:flutter/material.dart'; -import 'package:google_maps_flutter_platform_interface/src/types/camera.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; @@ -10,9 +10,6 @@ import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart'; import 'package:hmg_patient_app_new/features/location/location_repo.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:huawei_map/huawei_map.dart' as HMSCameraServices; -import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices; - - import 'PlacePrediction.dart'; @@ -20,12 +17,12 @@ class LocationViewModel extends ChangeNotifier { final LocationRepo locationRepo; final ErrorHandlerService errorHandlerService; - LocationViewModel({required this.locationRepo, required this.errorHandlerService}){ + LocationViewModel({required this.locationRepo, required this.errorHandlerService}) { placeValueInController(); } - List predictions = []; - PlacePrediction? selectedPrediction; + List predictions = []; + PlacePrediction? selectedPrediction; bool isPredictionLoading = false; GeocodeResponse? geocodeResponse; PlaceDetails? placeDetails; @@ -39,12 +36,13 @@ class LocationViewModel extends ChangeNotifier { return HMSCameraServices.CameraPosition(target: HMSCameraServices.LatLng(getIt().userLat, getIt().userLong), zoom: 18); } - GMSMapServices.CameraPosition getGMSLocation() { - return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt().userLat, getIt().userLong), zoom: 18); + return GMSMapServices.CameraPosition( + target: GMSMapServices.LatLng(getIt().userLat != 0.0 ? getIt().userLat : 24.7248316, getIt().userLong != 0.0 ? getIt().userLong : 46.4928828), + zoom: 18); } - void placeValueInController() async{ + void placeValueInController() async { if (await getIt().isGMSAvailable) { gmsController = Completer(); } else { @@ -54,14 +52,14 @@ class LocationViewModel extends ChangeNotifier { FutureOr getPlacesPrediction(String input) async { predictions = []; - isPredictionLoading= true; + isPredictionLoading = true; final result = await locationRepo.getPlacePredictionsAsInput(input); result.fold( (failure) { errorHandlerService.handleError(failure: failure); }, (apiModel) { - predictions = apiModel.data??[]; + predictions = apiModel.data ?? []; }, ); isPredictionLoading = false; @@ -99,21 +97,20 @@ class LocationViewModel extends ChangeNotifier { handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) { mapCapturedLocation = Location(lat: value.target.latitude, lng: value.target.longitude); - } handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) { mapCapturedLocation = Location(lat: value.target.lat, lng: value.target.lng); } - handleOnCameraIdle(){ - if(mapCapturedLocation != null) { + handleOnCameraIdle() { + if (mapCapturedLocation != null) { getPlaceEncodedData(mapCapturedLocation!.lat, mapCapturedLocation!.lng); } } void updateSearchQuery(String? value) { - if(value == null || value.isEmpty){ + if (value == null || value.isEmpty) { predictions = []; return; } @@ -123,16 +120,16 @@ class LocationViewModel extends ChangeNotifier { void flushSearchPredictions() { predictions = []; - mapCapturedLocation= null; - placeDetails= null; - geocodeResponse= null; - selectedPrediction= null; + mapCapturedLocation = null; + placeDetails = null; + geocodeResponse = null; + selectedPrediction = null; notifyListeners(); } - FutureOr selectPlacePrediction(PlacePrediction placePrediction) async{ - selectedPrediction= placePrediction; + FutureOr selectPlacePrediction(PlacePrediction placePrediction) async { + selectedPrediction = placePrediction; await getPlaceDetails(placePrediction.placeID); } @@ -141,8 +138,6 @@ class LocationViewModel extends ChangeNotifier { } void moveController(Location location) { - print("moving to location"); - print("gmsController is null or not $gmsController"); if (getIt().isGMSAvailable) { gmsController?.future.then((controller) { controller.animateCamera( @@ -169,4 +164,4 @@ class LocationViewModel extends ChangeNotifier { }); } } -} \ No newline at end of file +} diff --git a/lib/features/medical_file/medical_file_repo.dart b/lib/features/medical_file/medical_file_repo.dart index bf10e9e..2f5cae6 100644 --- a/lib/features/medical_file/medical_file_repo.dart +++ b/lib/features/medical_file/medical_file_repo.dart @@ -3,7 +3,6 @@ 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/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_allergies_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart'; diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart index de7f067..d67e5de 100644 --- a/lib/features/medical_file/medical_file_view_model.dart +++ b/lib/features/medical_file/medical_file_view_model.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:developer'; import 'package:flutter/material.dart'; @@ -36,6 +35,12 @@ class MedicalFileViewModel extends ChangeNotifier { List patientVaccineList = []; List patientSickLeaveList = []; + List patientSickLeavesByClinic = []; + List patientSickLeavesByHospital = []; + List patientSickLeavesViewList = []; + + bool isSickLeavesSortByClinic = true; + List patientAllergiesList = []; List patientMedicalReportList = []; @@ -44,6 +49,12 @@ class MedicalFileViewModel extends ChangeNotifier { List patientMedicalReportReadyList = []; List patientMedicalReportCancelledList = []; + List patientMedicalReportsByClinic = []; + List patientMedicalReportsByHospital = []; + List patientMedicalReportsViewList = []; + + bool isMedicalReportsSortByClinic = true; + List patientMedicalReportAppointmentHistoryList = []; PatientAppointmentHistoryResponseModel? patientMedicalReportSelectedAppointment; @@ -90,6 +101,49 @@ class MedicalFileViewModel extends ChangeNotifier { } else if (index == 2) { patientMedicalReportList = patientMedicalReportCancelledList; } + // Re-group by clinic/hospital for the selected tab + _groupMedicalReportsByClinicAndHospital(); + notifyListeners(); + } + + void _groupMedicalReportsByClinicAndHospital() { + patientMedicalReportsByClinic.clear(); + patientMedicalReportsByHospital.clear(); + + for (var element in patientMedicalReportList) { + // Group by clinic + List reportsByClinic = patientMedicalReportsByClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList(); + + if (reportsByClinic.isNotEmpty) { + patientMedicalReportsByClinic[patientMedicalReportsByClinic.indexOf(reportsByClinic[0])].medicalReportsList!.add(element); + } else { + patientMedicalReportsByClinic.add(MedicalReportList(filterName: element.clinicDescription, medicalReport: element)); + } + + // Group by hospital + List reportsByHospital = patientMedicalReportsByHospital.where((elementHospital) => elementHospital.filterName == element.projectName).toList(); + + if (reportsByHospital.isNotEmpty) { + patientMedicalReportsByHospital[patientMedicalReportsByHospital.indexOf(reportsByHospital[0])].medicalReportsList!.add(element); + } else { + patientMedicalReportsByHospital.add(MedicalReportList(filterName: element.projectName, medicalReport: element)); + } + } + + if (isMedicalReportsSortByClinic) { + patientMedicalReportsViewList = patientMedicalReportsByClinic; + } else { + patientMedicalReportsViewList = patientMedicalReportsByHospital; + } + } + + setIsMedicalReportsSortByClinic(bool value) { + isMedicalReportsSortByClinic = value; + if (isMedicalReportsSortByClinic) { + patientMedicalReportsViewList = patientMedicalReportsByClinic; + } else { + patientMedicalReportsViewList = patientMedicalReportsByHospital; + } notifyListeners(); } @@ -110,17 +164,35 @@ class MedicalFileViewModel extends ChangeNotifier { setIsPatientSickLeaveListLoading(bool val) { if (val) { patientSickLeaveList.clear(); + patientSickLeavesByClinic.clear(); + patientSickLeavesByHospital.clear(); + patientSickLeavesViewList.clear(); patientSickLeavePDFBase64 = ""; + isSickLeavesSortByClinic = true; } isPatientSickLeaveListLoading = val; notifyListeners(); } + setIsSickLeavesSortByClinic(bool value) { + isSickLeavesSortByClinic = value; + if (isSickLeavesSortByClinic) { + patientSickLeavesViewList = patientSickLeavesByClinic; + } else { + patientSickLeavesViewList = patientSickLeavesByHospital; + } + notifyListeners(); + } + setIsPatientMedicalReportsLoading(bool val) { if (val) { onMedicalReportTabChange(0); patientMedicalReportList.clear(); + patientMedicalReportsByClinic.clear(); + patientMedicalReportsByHospital.clear(); + patientMedicalReportsViewList.clear(); patientMedicalReportPDFBase64 = ""; + isMedicalReportsSortByClinic = true; } isPatientMedicalReportsListLoading = val; notifyListeners(); @@ -214,6 +286,29 @@ class MedicalFileViewModel extends ChangeNotifier { } else if (apiResponse.messageStatus == 1) { patientSickLeaveList = apiResponse.data!; isPatientSickLeaveListLoading = false; + + // Group by clinic and hospital + for (var element in patientSickLeaveList) { + // Group by clinic + List sickLeavesByClinic = patientSickLeavesByClinic.where((elementClinic) => elementClinic.filterName == element.clinicName).toList(); + + if (sickLeavesByClinic.isNotEmpty) { + patientSickLeavesByClinic[patientSickLeavesByClinic.indexOf(sickLeavesByClinic[0])].sickLeavesList!.add(element); + } else { + patientSickLeavesByClinic.add(SickLeaveList(filterName: element.clinicName, sickLeaves: element)); + } + + // Group by hospital + List sickLeavesByHospital = patientSickLeavesByHospital.where((elementHospital) => elementHospital.filterName == element.projectName).toList(); + + if (sickLeavesByHospital.isNotEmpty) { + patientSickLeavesByHospital[patientSickLeavesByHospital.indexOf(sickLeavesByHospital[0])].sickLeavesList!.add(element); + } else { + patientSickLeavesByHospital.add(SickLeaveList(filterName: element.projectName, sickLeaves: element)); + } + } + patientSickLeavesViewList = patientSickLeavesByClinic; + notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); diff --git a/lib/features/medical_file/models/patient_medical_response_model.dart b/lib/features/medical_file/models/patient_medical_response_model.dart index 52785af..3bcf5cd 100644 --- a/lib/features/medical_file/models/patient_medical_response_model.dart +++ b/lib/features/medical_file/models/patient_medical_response_model.dart @@ -190,3 +190,16 @@ class PatientMedicalReportResponseModel { return data; } } + +class MedicalReportList { + String? filterName; + List? medicalReportsList; + + MedicalReportList({this.filterName, PatientMedicalReportResponseModel? medicalReport}) { + medicalReportsList = []; + if (medicalReport != null) { + medicalReportsList!.add(medicalReport); + } + } +} + diff --git a/lib/features/medical_file/models/patient_sickleave_response_model.dart b/lib/features/medical_file/models/patient_sickleave_response_model.dart index 3bf732c..53c886f 100644 --- a/lib/features/medical_file/models/patient_sickleave_response_model.dart +++ b/lib/features/medical_file/models/patient_sickleave_response_model.dart @@ -174,3 +174,16 @@ class PatientSickLeavesResponseModel { return data; } } + +class SickLeaveList { + String? filterName; + List? sickLeavesList; + + SickLeaveList({this.filterName, PatientSickLeavesResponseModel? sickLeaves}) { + sickLeavesList = []; + if (sickLeaves != null) { + sickLeavesList!.add(sickLeaves); + } + } +} + diff --git a/lib/features/my_appointments/appointment_rating_view_model.dart b/lib/features/my_appointments/appointment_rating_view_model.dart new file mode 100644 index 0000000..6dd41ff --- /dev/null +++ b/lib/features/my_appointments/appointment_rating_view_model.dart @@ -0,0 +1,133 @@ +// dart +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/appointment_details_resp_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; +import 'package:hmg_patient_app_new/services/error_handler_service.dart'; + +import 'models/resp_models/rate_appointment_resp_model.dart'; + +class AppointmentRatingViewModel extends ChangeNotifier { + final MyAppointmentsRepo myAppointmentsRepo; + final ErrorHandlerService errorHandlerService; + final AppState appState; + List appointmentRatedList = []; + AppointmentDetails? appointmentDetails; + AppointmentRatingViewModel({ + required this.myAppointmentsRepo, + required this.errorHandlerService, + required this.appState, + }); + + + String title = ""; + String subTitle = ""; + bool isRateClinic = false; + + Future getLastRatingAppointment({Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await myAppointmentsRepo.getLastRatingAppointment(); + + result.fold( + (failure) async => await errorHandlerService.handleError(failure: failure), + (apiResponse) { + if (apiResponse.messageStatus == 2) { + onError?.call(apiResponse.errorMessage ?? 'Unknown error'); + } else if (apiResponse.messageStatus == 1) { + appointmentRatedList = apiResponse.data ?? []; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data); + } + } + }, + ); + } + + Future getAppointmentDetails(int appointmentID, int projectID, {Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await myAppointmentsRepo.getAppointmentDetails(appointmentID, projectID); + + result.fold( + (failure) async => await errorHandlerService.handleError(failure: failure), + (apiResponse) { + if (apiResponse.messageStatus == 2) { + onError?.call(apiResponse.errorMessage ?? 'Unknown error'); + } else if (apiResponse.messageStatus == 1) { + appointmentDetails = apiResponse.data ?? AppointmentDetails(); + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data); + } + } + }, + ); + } + Future submitDoctorRating( {required int docRate, required String docNote,Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await myAppointmentsRepo.sendDoctorRate( + docRate, + appointmentDetails!.appointmentNo!, + appointmentDetails!.projectID!, + appointmentDetails!.doctorID!, + appointmentDetails!.clinicID!, + docNote, + appointmentDetails!.appointmentDate!, + appointmentDetails!.doctorName, + appointmentDetails!.projectName, + appointmentDetails!.clinicName + ); + + result.fold( + (failure) async => await errorHandlerService.handleError(failure: failure), + (apiResponse) { + if (apiResponse.messageStatus == 2) { + onError?.call(apiResponse.errorMessage ?? 'Unknown error'); + } else if (apiResponse.messageStatus == 1) { + + notifyListeners(); + if (onSuccess != null) { + // onSuccess(apiResponse.data); + } + } + }, + ); + } + + Future submitClinicRating( { required int clinicRate, required String clinicNote, Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await myAppointmentsRepo.sendAppointmentRate( + clinicRate, + appointmentDetails!.appointmentNo!, + appointmentDetails!.projectID!, + appointmentDetails!.doctorID!, + appointmentDetails!.clinicID!, + clinicNote + ); + + result.fold( + (failure) async => await errorHandlerService.handleError(failure: failure), + (apiResponse) { + if (apiResponse.messageStatus == 2) { + onError?.call(apiResponse.errorMessage ?? 'Unknown error'); + } else if (apiResponse.messageStatus == 1) { + + notifyListeners(); + if (onSuccess != null) { + // onSuccess(apiResponse.data); + } + } + }, + ); + } + + void setSubTitle(String value) { + this.subTitle = value; + notifyListeners(); + } + + void setTitle(String value) { + this.title = value; + notifyListeners(); + } + void setClinicOrDoctor(bool value){ + this.isRateClinic = value; + notifyListeners(); + } +} diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart index 4a0ffab..f51f701 100644 --- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart +++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart @@ -7,7 +7,6 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_ import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; enum AppointmentViaRegionState { REGION_SELECTION, diff --git a/lib/features/my_appointments/models/req_model/appointment_rate_req_model.dart b/lib/features/my_appointments/models/req_model/appointment_rate_req_model.dart new file mode 100644 index 0000000..91070f2 --- /dev/null +++ b/lib/features/my_appointments/models/req_model/appointment_rate_req_model.dart @@ -0,0 +1,100 @@ +class AppointmentRate { + int? rate; + int? appointmentNo; + int? projectID; + int? doctorID; + int? clinicID; + String? note; + String? mobileNumber; + int? createdBy; + int? editedBy; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + + AppointmentRate( + {this.rate, + this.appointmentNo, + this.projectID, + this.doctorID, + this.clinicID, + this.note, + this.mobileNumber, + this.createdBy, + this.editedBy, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + AppointmentRate.fromJson(Map json) { + rate = json['Rate']; + appointmentNo = json['AppointmentNo']; + projectID = json['ProjectID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + note = json['Note']; + mobileNumber = json['MobileNumber']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['Rate'] = this.rate; + data['AppointmentNo'] = this.appointmentNo; + data['ProjectID'] = this.projectID; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['Note'] = this.note; + data['MobileNumber'] = this.mobileNumber; + data['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} diff --git a/lib/features/my_appointments/models/resp_models/appointment_details_resp_model.dart b/lib/features/my_appointments/models/resp_models/appointment_details_resp_model.dart new file mode 100644 index 0000000..2900bce --- /dev/null +++ b/lib/features/my_appointments/models/resp_models/appointment_details_resp_model.dart @@ -0,0 +1,64 @@ +class AppointmentDetails { + String? setupID; + int? projectID; + int? patientID; + int? appointmentNo; + int? clinicID; + int? doctorID; + dynamic startTime; + dynamic endTime; + dynamic appointmentDate; + dynamic clinicName; + dynamic doctorImageURL; + dynamic doctorName; + dynamic projectName; + + AppointmentDetails( + {this.setupID, + this.projectID, + this.patientID, + this.appointmentNo, + this.clinicID, + this.doctorID, + this.startTime, + this.endTime, + this.appointmentDate, + this.clinicName, + this.doctorImageURL, + this.doctorName, + this.projectName}); + + AppointmentDetails.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + appointmentNo = json['AppointmentNo']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + startTime = json['StartTime']; + endTime = json['EndTime']; + appointmentDate = json['AppointmentDate']; + clinicName = json['ClinicName']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + projectName = json['ProjectName']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['AppointmentNo'] = this.appointmentNo; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['StartTime'] = this.startTime; + data['EndTime'] = this.endTime; + data['AppointmentDate'] = this.appointmentDate; + data['ClinicName'] = this.clinicName; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['ProjectName'] = this.projectName; + return data; + } +} 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/models/resp_models/rate_appointment_resp_model.dart b/lib/features/my_appointments/models/resp_models/rate_appointment_resp_model.dart new file mode 100644 index 0000000..877b7bc --- /dev/null +++ b/lib/features/my_appointments/models/resp_models/rate_appointment_resp_model.dart @@ -0,0 +1,160 @@ +class RateAppointmentRespModel { + String? setupID; + int? projectID; + int? appointmentNo; + String? appointmentDate; + String? appointmentDateN; + int? appointmentType; + String? bookDate; + int? patientType; + int? patientID; + int? clinicID; + int? doctorID; + String? endDate; + String? startTime; + String? endTime; + int? status; + int? visitType; + int? visitFor; + int? patientStatusType; + int? companyID; + int? bookedBy; + String? bookedOn; + int? confirmedBy; + String? confirmedOn; + int? arrivalChangedBy; + String? arrivedOn; + int? editedBy; + String? editedOn; + dynamic doctorName; + String? doctorNameN; + String? statusDesc; + String? statusDescN; + bool? vitalStatus; + dynamic vitalSignAppointmentNo; + int? episodeID; + String? doctorTitle; + bool? isAppoitmentLiveCare; + + RateAppointmentRespModel( + {this.setupID, + this.projectID, + this.appointmentNo, + this.appointmentDate, + this.appointmentDateN, + this.appointmentType, + this.bookDate, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.endDate, + this.startTime, + this.endTime, + this.status, + this.visitType, + this.visitFor, + this.patientStatusType, + this.companyID, + this.bookedBy, + this.bookedOn, + this.confirmedBy, + this.confirmedOn, + this.arrivalChangedBy, + this.arrivedOn, + this.editedBy, + this.editedOn, + this.doctorName, + this.doctorNameN, + this.statusDesc, + this.statusDescN, + this.vitalStatus, + this.vitalSignAppointmentNo, + this.episodeID, + this.doctorTitle, + this.isAppoitmentLiveCare}); + + RateAppointmentRespModel.fromJson(Map json) { + try { + setupID = json['SetupID']; + projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = json['AppointmentDate']; + appointmentDateN = json['AppointmentDateN']; + appointmentType = json['AppointmentType']; + bookDate = json['BookDate']; + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + endDate = json['EndDate']; + startTime = json['StartTime']; + endTime = json['EndTime']; + status = json['Status']; + visitType = json['VisitType']; + visitFor = json['VisitFor']; + patientStatusType = json['PatientStatusType']; + companyID = json['CompanyID']; + bookedBy = json['BookedBy']; + bookedOn = json['BookedOn']; + confirmedBy = json['ConfirmedBy']; + confirmedOn = json['ConfirmedOn']; + arrivalChangedBy = json['ArrivalChangedBy']; + arrivedOn = json['ArrivedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + statusDesc = json['StatusDesc']; + statusDescN = json['StatusDescN']; + vitalStatus = json['VitalStatus']; + vitalSignAppointmentNo = json['VitalSignAppointmentNo']; + episodeID = json['EpisodeID']; + doctorTitle = json['DoctorTitle']; + isAppoitmentLiveCare = json['IsAppoitmentLiveCare']; + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentDateN'] = this.appointmentDateN; + data['AppointmentType'] = this.appointmentType; + data['BookDate'] = this.bookDate; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EndDate'] = this.endDate; + data['StartTime'] = this.startTime; + data['EndTime'] = this.endTime; + data['Status'] = this.status; + data['VisitType'] = this.visitType; + data['VisitFor'] = this.visitFor; + data['PatientStatusType'] = this.patientStatusType; + data['CompanyID'] = this.companyID; + data['BookedBy'] = this.bookedBy; + data['BookedOn'] = this.bookedOn; + data['ConfirmedBy'] = this.confirmedBy; + data['ConfirmedOn'] = this.confirmedOn; + data['ArrivalChangedBy'] = this.arrivalChangedBy; + data['ArrivedOn'] = this.arrivedOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['StatusDesc'] = this.statusDesc; + data['StatusDescN'] = this.statusDescN; + data['VitalStatus'] = this.vitalStatus; + data['VitalSignAppointmentNo'] = this.vitalSignAppointmentNo; + data['EpisodeID'] = this.episodeID; + data['DoctorTitle'] = this.doctorTitle; + data['IsAppoitmentLiveCare'] = this.isAppoitmentLiveCare; + return data; + } +} diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart index 87ec10d..ce9e877 100644 --- a/lib/features/my_appointments/my_appointments_repo.dart +++ b/lib/features/my_appointments/my_appointments_repo.dart @@ -8,13 +8,17 @@ 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/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/rate_appointment_resp_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart'; 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/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'; +import 'models/req_model/appointment_rate_req_model.dart'; +import 'models/resp_models/appointment_details_resp_model.dart'; + abstract class MyAppointmentsRepo { Future>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false}); @@ -58,6 +62,17 @@ abstract class MyAppointmentsRepo { Future>> sendAskDocCallRequest( {required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, required String requestType, required String remarks, required String userMobileNumber}); + + Future>>> getLastRatingAppointment(); + + Future>> getAppointmentDetails(int appointmentID, int projectID); + + + Future>> sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note); + + Future>> sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName); + + Future>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID}); } class MyAppointmentsRepoImp implements MyAppointmentsRepo { @@ -67,7 +82,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { MyAppointmentsRepoImp({required this.loggerService, required this.apiClient}); @override - Future>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false}) async { + Future>>> getPatientAppointments( + {required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false}) async { Map mapDevice = { "IsActiveAppointment": isActiveAppointment, "IsComingFromCOC": false, @@ -176,7 +192,9 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { "AppointmentNo": appointmentNo, "PaymentMethodName": paymentMethodName, "PaymentAmount": payedAmount == 0 ? "0" : payedAmount.toString(), - "PaymentDate": payedAmount == 0 ? "" : "/Date(${DateTime.now().millisecondsSinceEpoch})/", + "PaymentDate": payedAmount == 0 ? "" : "/Date(${DateTime + .now() + .millisecondsSinceEpoch})/", "PaymentReferenceNumber": payedAmount == 0 ? "" : paymentReference, "ProjectID": projectID, "PatientID": patientID, @@ -746,4 +764,197 @@ 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())); + } + } + + @override + Future>>> getLastRatingAppointment() async { + Map mapDevice = {}; + try { + GenericApiModel>? apiResponse; + Failure? failure; + await apiClient.post(IS_LAST_APPOITMENT_RATED, onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['IsLastAppoitmentRatedList']; + + final lstRatingAppointmentList = list.map((item) => RateAppointmentRespModel.fromJson(item as Map)).toList().cast(); + + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: lstRatingAppointmentList, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, body: mapDevice); + 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>> getAppointmentDetails(int appointmentID, int projectID) async { + Map mapDevice = { + "AppointmentNumber": appointmentID, + "ProjectID": projectID, + }; + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post(GET_APPOINTMENT_DETAILS_BY_NO, onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['AppointmentDetails']; + + final appointmentDetails = AppointmentDetails.fromJson(list); + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: appointmentDetails, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, body: mapDevice); + 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>> sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { + + AppointmentRate appointmentRate = AppointmentRate(); + appointmentRate.rate = rate; + appointmentRate.appointmentNo = appointmentNo; + appointmentRate.projectID = projectID; + appointmentRate.doctorID = doctorID; + appointmentRate.clinicID = clinicID; + appointmentRate.note = note; + appointmentRate.createdBy = 2; + appointmentRate.editedBy = 2; + + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post(NEW_RATE_APPOINTMENT_URL, onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['AppointmentRated']; + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: list, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, body: appointmentRate.toJson()); + 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>> sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName) async { + Map request; + + request = { + "DoctorID": doctorID, + "Rate": rate, + "ClinicID": clinicID, + "ProjectID": projectID, + "AppointmentNo": appointmentNo, + "Note": note, + // "MobileNumber": authenticatedUserObject.user!.mobileNumber, + "AppointmentDate": appoDate, + "DoctorName": docName, + "ProjectName": projectName, + "COCTypeName": 1, + // "PatientName": authenticatedUserObject.user!.firstName! + " " + authenticatedUserObject.user!.lastName!, + // "PatientOutSA": authenticatedUserObject.user!.outSA, + // "PatientTypeID": authenticatedUserObject.user!.patientType, + "ClinicName": clinicName, + // "PatientIdentificationID": authenticatedUserObject.user!.patientIdentificationNo + }; + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post(NEW_RATE_DOCTOR_URL, onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['AppointmentRated']; + + // final appointmentDetails = AppointmentDetails.fromJson(list); + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: list, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, body: request); + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + return Left(UnknownFailure(e.toString())); + } + } + +} \ No newline at end of file diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index 71e0312..b4a25ee 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart'; 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 +39,14 @@ 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 = []; @@ -52,6 +60,12 @@ class MyAppointmentsViewModel extends ChangeNotifier { List patientEyeMeasurementsAppointmentsHistoryList = []; + // Grouping by Clinic and Hospital + List patientAppointmentsByClinic = []; + List patientAppointmentsByHospital = []; + List patientAppointmentsViewList = []; + bool isAppointmentsSortByClinic = true; + List askDoctorRequestTypeList = []; PatientAppointmentShareResponseModel? patientAppointmentShareResponseModel; @@ -74,6 +88,43 @@ class MyAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } + setIsAppointmentsSortByClinic(bool value) { + isAppointmentsSortByClinic = value; + _groupAppointmentsByClinicAndHospital(); + notifyListeners(); + } + + void _groupAppointmentsByClinicAndHospital() { + patientAppointmentsByClinic.clear(); + patientAppointmentsByHospital.clear(); + + for (var element in filteredAppointmentList) { + // Group by clinic + List appointmentsByClinic = patientAppointmentsByClinic.where((elementClinic) => elementClinic.filterName == element.clinicName).toList(); + + if (appointmentsByClinic.isNotEmpty) { + patientAppointmentsByClinic[patientAppointmentsByClinic.indexOf(appointmentsByClinic[0])].patientDoctorAppointmentList!.add(element); + } else { + patientAppointmentsByClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + } + + // Group by hospital + List appointmentsByHospital = patientAppointmentsByHospital.where((elementHospital) => elementHospital.filterName == element.projectName).toList(); + + if (appointmentsByHospital.isNotEmpty) { + patientAppointmentsByHospital[patientAppointmentsByHospital.indexOf(appointmentsByHospital[0])].patientDoctorAppointmentList!.add(element); + } else { + patientAppointmentsByHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + } + } + + if (isAppointmentsSortByClinic) { + patientAppointmentsViewList = patientAppointmentsByClinic; + } else { + patientAppointmentsViewList = patientAppointmentsByHospital; + } + } + initAppointmentsViewModel() { if (isAppointmentDataToBeLoaded) { patientAppointmentsHistoryList.clear(); @@ -88,7 +139,7 @@ class MyAppointmentsViewModel extends ChangeNotifier { isTamaraDetailsLoading = true; isAppointmentPatientShareLoading = true; isEyeMeasurementsAppointmentsLoading = true; - isPatientHasQueueAppointment = false; + notifyListeners(); } @@ -218,6 +269,13 @@ class MyAppointmentsViewModel extends ChangeNotifier { patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList); filteredAppointmentList.addAll(patientAppointmentsHistoryList); + if (patientArrivedAppointmentsHistoryList.isNotEmpty) { + if (Utils.isDateToday(DateUtil.convertStringToDate(patientArrivedAppointmentsHistoryList.first.appointmentDate))) { + // getPatientAppointmentQueueDetails(appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID); + getPatientAppointmentQueueDetails(); + } + } + print('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}'); print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}'); print('All Appointments: ${patientAppointmentsHistoryList.length}'); @@ -498,6 +556,7 @@ class MyAppointmentsViewModel extends ChangeNotifier { break; } getFiltersForSelectedAppointmentList(filteredAppointmentList); + _groupAppointmentsByClinicAndHospital(); notifyListeners(); } @@ -555,6 +614,7 @@ class MyAppointmentsViewModel extends ChangeNotifier { } catch (e) {} } } + _groupAppointmentsByClinicAndHospital(); notifyListeners(); } @@ -659,6 +719,51 @@ class MyAppointmentsViewModel extends ChangeNotifier { ); } + Future getPatientAppointmentQueueDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async { + isAppointmentQueueDetailsLoading = true; + notifyListeners(); + final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails( + appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.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 == patientArrivedAppointmentsHistoryList.first.patientID) { + currentPatientQueueDetails = element; + currentQueueStatus = element.callType!; + // currentQueueStatus = 2; + break; + } + } + // patientQueueDetailsList.first.callType = 1; + + patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID); + } else { + isPatientHasQueueAppointment = false; + } + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data); + } + } + }, + ); + } + Future sendAskDocCallRequest({ required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, required String requestType, @@ -688,4 +793,5 @@ class MyAppointmentsViewModel extends ChangeNotifier { }, ); } + } diff --git a/lib/features/payfort/payfort_view_model.dart b/lib/features/payfort/payfort_view_model.dart index db8209a..dda8f51 100644 --- a/lib/features/payfort/payfort_view_model.dart +++ b/lib/features/payfort/payfort_view_model.dart @@ -110,7 +110,7 @@ class PayfortViewModel extends ChangeNotifier { onError!(failure.message); }, (apiResponse) { - log(apiResponse.data); + log(apiResponse.data.toString()); if (onSuccess != null) { onSuccess(apiResponse); } @@ -134,7 +134,7 @@ class PayfortViewModel extends ChangeNotifier { onError!(failure.message); }, (apiResponse) { - log(apiResponse.data); + log(apiResponse.data.toString()); if (onSuccess != null) { onSuccess(apiResponse); } diff --git a/lib/features/prescriptions/prescriptions_repo.dart b/lib/features/prescriptions/prescriptions_repo.dart index e7a4f07..c6e7150 100644 --- a/lib/features/prescriptions/prescriptions_repo.dart +++ b/lib/features/prescriptions/prescriptions_repo.dart @@ -182,6 +182,7 @@ class PrescriptionsRepoImp implements PrescriptionsRepo { "To": Utils.appState.getAuthenticatedUser()!.emailAddress, "SetupID": prescriptionsResponseModel.setupID, "IsDownload": true, + "isDentalAllowedBackend": false, }; try { diff --git a/lib/features/prescriptions/prescriptions_view_model.dart b/lib/features/prescriptions/prescriptions_view_model.dart index 7517134..ff86406 100644 --- a/lib/features/prescriptions/prescriptions_view_model.dart +++ b/lib/features/prescriptions/prescriptions_view_model.dart @@ -5,8 +5,6 @@ import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; -import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart'; -import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; diff --git a/lib/features/radiology/radiology_view_model.dart b/lib/features/radiology/radiology_view_model.dart index 4a87906..986945e 100644 --- a/lib/features/radiology/radiology_view_model.dart +++ b/lib/features/radiology/radiology_view_model.dart @@ -29,6 +29,18 @@ class RadiologyViewModel extends ChangeNotifier { late PatientRadiologyResponseModel patientRadiologyOrderByAppointment; + // --- Grouping fields: By Clinic / By Hospital --- + bool isSortByClinic = true; + List> patientRadiologyOrdersByClinic = []; + List> patientRadiologyOrdersByHospital = []; + List> patientRadiologyOrdersViewList = []; + + void setIsSortByClinic(bool value) { + isSortByClinic = value; + patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital; + notifyListeners(); + } + RadiologyViewModel({required this.radiologyRepo, required this.errorHandlerService, required this.navigationService}); initRadiologyViewModel() { 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..d3815b3 --- /dev/null +++ b/lib/features/smartwatch_health_data/health_service.dart @@ -0,0 +1,164 @@ +import 'dart:io'; + +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>> getAllHealthData( + DateTime startTime, + DateTime endTime, + ) async { + final Map> allData = {}; + + try { + for (var type in _healthMetricsCumulative) { + try { + final data = await health.getHealthIntervalDataFromTypes( + startDate: startTime, + endDate: endTime, + types: [type], + interval: 86400, + ); + + if (type == HealthDataType.BLOOD_OXYGEN) { + for (var point in data) { + if (point.value is NumericHealthValue) { + final numericValue = (point.value as NumericHealthValue).numericValue; + point.value = NumericHealthValue( + numericValue: numericValue * 100, + ); + } + } + } + + if (type == HealthDataType.DISTANCE_WALKING_RUNNING) { + for (var point in data) { + if (point.value is NumericHealthValue) { + final numericValue = (point.value as NumericHealthValue).numericValue; + point.value = NumericHealthValue( + numericValue: numericValue / 1000, + ); + } + } + } + + allData[type] = data; + } catch (e) { + print('Error fetching $type: $e'); + allData[type] = []; + } + } + + for (var type in Platform.isIOS ? _healthMetrics : _healthMetricsAndroid) { + try { + final data = await health.getHealthDataFromTypes( + startTime: startTime, + endTime: endTime, + types: [type], + // includeManualEntry: false + // interval: 86400, + ); + + allData[type] = data; + } catch (e) { + print('Error fetching $type: $e'); + allData[type] = []; + } + } + } catch (e) { + print('Error fetching health data: $e'); + } + + return allData; + } + + Future> getSpecificHealthData( + HealthDataType type, + DateTime startTime, + DateTime endTime, + ) async { + try { + final data = await health.getHealthDataFromTypes( + startTime: startTime, + endTime: endTime, + types: [type], + ); + return data; + } catch (e) { + print('Error fetching $type: $e'); + return []; + } + } +} diff --git a/lib/features/smartwatch_health_data/health_utils.dart b/lib/features/smartwatch_health_data/health_utils.dart new file mode 100644 index 0000000..3d3588e --- /dev/null +++ b/lib/features/smartwatch_health_data/health_utils.dart @@ -0,0 +1,109 @@ +import 'package:health/health.dart'; + +/// Data types available on iOS via Apple Health. +const List dataTypesIOS = [ + HealthDataType.ACTIVE_ENERGY_BURNED, + HealthDataType.APPLE_STAND_TIME, + HealthDataType.APPLE_STAND_HOUR, + HealthDataType.APPLE_MOVE_TIME, + HealthDataType.AUDIOGRAM, + HealthDataType.BASAL_ENERGY_BURNED, + HealthDataType.BLOOD_GLUCOSE, + HealthDataType.BLOOD_OXYGEN, + HealthDataType.BLOOD_PRESSURE_DIASTOLIC, + HealthDataType.BLOOD_PRESSURE_SYSTOLIC, + HealthDataType.BODY_FAT_PERCENTAGE, + HealthDataType.BODY_MASS_INDEX, + HealthDataType.BODY_TEMPERATURE, + HealthDataType.DIETARY_CARBS_CONSUMED, + HealthDataType.DIETARY_CAFFEINE, + HealthDataType.DIETARY_ENERGY_CONSUMED, + HealthDataType.DIETARY_FATS_CONSUMED, + HealthDataType.DIETARY_PROTEIN_CONSUMED, + HealthDataType.ELECTRODERMAL_ACTIVITY, + HealthDataType.FORCED_EXPIRATORY_VOLUME, + HealthDataType.HEART_RATE, + HealthDataType.HEART_RATE_VARIABILITY_SDNN, + HealthDataType.HEIGHT, + HealthDataType.INSULIN_DELIVERY, + HealthDataType.RESPIRATORY_RATE, + HealthDataType.PERIPHERAL_PERFUSION_INDEX, + HealthDataType.STEPS, + HealthDataType.WAIST_CIRCUMFERENCE, + HealthDataType.WEIGHT, + HealthDataType.FLIGHTS_CLIMBED, + HealthDataType.DISTANCE_WALKING_RUNNING, + HealthDataType.WALKING_SPEED, + HealthDataType.MINDFULNESS, + HealthDataType.SLEEP_AWAKE, + HealthDataType.SLEEP_ASLEEP, + HealthDataType.SLEEP_IN_BED, + HealthDataType.SLEEP_LIGHT, + HealthDataType.SLEEP_DEEP, + HealthDataType.SLEEP_REM, + HealthDataType.WATER, + HealthDataType.EXERCISE_TIME, + HealthDataType.WORKOUT, + HealthDataType.HEADACHE_NOT_PRESENT, + HealthDataType.HEADACHE_MILD, + HealthDataType.HEADACHE_MODERATE, + HealthDataType.HEADACHE_SEVERE, + HealthDataType.HEADACHE_UNSPECIFIED, + HealthDataType.LEAN_BODY_MASS, + + // note that a phone cannot write these ECG-based types - only read them + // HealthDataType.ELECTROCARDIOGRAM, + // HealthDataType.HIGH_HEART_RATE_EVENT, + // HealthDataType.IRREGULAR_HEART_RATE_EVENT, + // HealthDataType.LOW_HEART_RATE_EVENT, + // HealthDataType.RESTING_HEART_RATE, + // HealthDataType.WALKING_HEART_RATE, + // HealthDataType.ATRIAL_FIBRILLATION_BURDEN, + + HealthDataType.NUTRITION, + HealthDataType.GENDER, + HealthDataType.BLOOD_TYPE, + HealthDataType.BIRTH_DATE, + HealthDataType.MENSTRUATION_FLOW, + HealthDataType.WATER_TEMPERATURE, + HealthDataType.UNDERWATER_DEPTH, + HealthDataType.UV_INDEX, +]; + +/// Data types available on Android via the Google Health Connect API. +const List dataTypesAndroid = [ + HealthDataType.ACTIVE_ENERGY_BURNED, + // HealthDataType.BASAL_ENERGY_BURNED, + // HealthDataType.BLOOD_GLUCOSE, + HealthDataType.BLOOD_OXYGEN, + // HealthDataType.BLOOD_PRESSURE_DIASTOLIC, + // HealthDataType.BLOOD_PRESSURE_SYSTOLIC, + // HealthDataType.BODY_FAT_PERCENTAGE, + // HealthDataType.HEIGHT, + // HealthDataType.WEIGHT, + // HealthDataType.LEAN_BODY_MASS, + // HealthDataType.BODY_MASS_INDEX, + // HealthDataType.BODY_TEMPERATURE, + HealthDataType.HEART_RATE, + // HealthDataType.HEART_RATE_VARIABILITY_RMSSD, + HealthDataType.STEPS, + HealthDataType.DISTANCE_DELTA, + // HealthDataType.SPEED, + HealthDataType.RESPIRATORY_RATE, + // HealthDataType.SLEEP_ASLEEP, + // HealthDataType.SLEEP_AWAKE_IN_BED, + // HealthDataType.SLEEP_AWAKE, + // HealthDataType.SLEEP_DEEP, + // HealthDataType.SLEEP_LIGHT, + // HealthDataType.SLEEP_OUT_OF_BED, + // HealthDataType.SLEEP_REM, + // HealthDataType.SLEEP_UNKNOWN, + // HealthDataType.SLEEP_SESSION, + // HealthDataType.WATER, + // HealthDataType.WORKOUT, + HealthDataType.RESTING_HEART_RATE, + // HealthDataType.FLIGHTS_CLIMBED, + // HealthDataType.NUTRITION, + HealthDataType.TOTAL_CALORIES_BURNED, + // HealthDataType.MENSTRUATION_FLOW, +]; \ No newline at end of file diff --git a/lib/features/symptoms_checker/data/organ_mapping_data.dart b/lib/features/symptoms_checker/data/organ_mapping_data.dart new file mode 100644 index 0000000..6b50b25 --- /dev/null +++ b/lib/features/symptoms_checker/data/organ_mapping_data.dart @@ -0,0 +1,422 @@ +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/organ_model.dart'; + +class OrganData { + // ==================== FRONT VIEW ==================== + static const List frontViewOrgans = [ + // ========== HEAD & FACE ========== + OrganModel( + id: 'head', + name: 'whole_head', + description: 'Head', + bodyView: BodyView.front, + position: OrganPosition(x: 0.50, y: 0.03), + ), + OrganModel( + id: 'left_eye', + name: 'eyes', + description: 'Left Eye', + bodyView: BodyView.front, + position: OrganPosition(x: 0.43, y: 0.07), + ), + OrganModel( + id: 'right_eye', + name: 'eyes', + description: 'Right Eye', + bodyView: BodyView.front, + position: OrganPosition(x: 0.57, y: 0.07), + ), + OrganModel( + id: 'nose_mouth', + name: 'oral_cavity', + description: 'Nose/Mouth', + bodyView: BodyView.front, + position: OrganPosition(x: 0.50, y: 0.09), + ), + + // ========== NECK ========== + OrganModel( + id: 'throat', + name: 'neck_or_throat', + description: 'Throat', + bodyView: BodyView.front, + position: OrganPosition(x: 0.50, y: 0.15), + ), + + // ========== SHOULDERS ========== + OrganModel( + id: 'left_shoulder', + name: 'upper_arm', + description: 'Left Shoulder', + bodyView: BodyView.front, + position: OrganPosition(x: 0.22, y: 0.22), + ), + OrganModel( + id: 'right_shoulder', + name: 'upper_arm', + description: 'Right Shoulder', + bodyView: BodyView.front, + position: OrganPosition(x: 0.8, y: 0.22), + ), + + // ========== CHEST ========== + OrganModel( + id: 'left_chest', + name: 'chest', + description: 'Left Chest', + bodyView: BodyView.front, + position: OrganPosition(x: 0.38, y: 0.22), + ), + OrganModel( + id: 'center_chest', + name: 'chest', + description: 'Center Chest', + bodyView: BodyView.front, + position: OrganPosition(x: 0.52, y: 0.25), + ), + OrganModel( + id: 'right_chest', + name: 'chest', + description: 'Right Chest', + bodyView: BodyView.front, + position: OrganPosition(x: 0.65, y: 0.22), + ), + + // ========== RIBS ========== + OrganModel( + id: 'left_ribs', + name: 'chest', + description: 'Left Ribs', + bodyView: BodyView.front, + position: OrganPosition(x: 0.38, y: 0.35), + ), + OrganModel( + id: 'right_ribs', + name: 'chest', + description: 'Right Ribs', + bodyView: BodyView.front, + position: OrganPosition(x: 0.64, y: 0.35), + ), + + // ========== ABDOMEN ========== + OrganModel( + id: 'upper_abdomen', + name: 'upper_abdomen', + description: 'Upper Abdomen', + bodyView: BodyView.front, + position: OrganPosition(x: 0.51, y: 0.31), + ), + OrganModel( + id: 'navel', + name: 'mid_abdomen', + description: 'Navel', + bodyView: BodyView.front, + position: OrganPosition(x: 0.51, y: 0.38), + ), + OrganModel( + id: 'lower_abdomen', + name: 'lower_abdomen', + description: 'Lower Abdomen', + bodyView: BodyView.front, + position: OrganPosition(x: 0.51, y: 0.44), + ), + + // ========== PELVIS ========== + OrganModel( + id: 'left_groin', + name: 'sexual_organs', + description: 'Left Groin', + bodyView: BodyView.front, + position: OrganPosition(x: 0.42, y: 0.49), + ), + OrganModel( + id: 'right_groin', + name: 'sexual_organs', + description: 'Right Groin', + bodyView: BodyView.front, + position: OrganPosition(x: 0.59, y: 0.49), + ), + + // ========== LEFT ARM ========== + + OrganModel( + id: 'left_elbow', + name: 'elbow', + description: 'Left Elbow', + bodyView: BodyView.front, + position: OrganPosition(x: 0.21, y: 0.35), + ), + OrganModel( + id: 'left_forearm', + name: 'forearm', + description: 'Left Forearm', + bodyView: BodyView.front, + position: OrganPosition(x: 0.19, y: 0.43), + ), + OrganModel( + id: 'left_wrist', + name: 'hand', + description: 'Left Wrist', + bodyView: BodyView.front, + position: OrganPosition(x: 0.14, y: 0.5), + ), + + // ========== RIGHT ARM ========== + + OrganModel( + id: 'right_elbow', + name: 'elbow', + description: 'Right Elbow', + bodyView: BodyView.front, + position: OrganPosition(x: 0.79, y: 0.35), + ), + OrganModel( + id: 'right_forearm', + name: 'forearm', + description: 'Right Forearm', + bodyView: BodyView.front, + position: OrganPosition(x: 0.81, y: 0.43), + ), + OrganModel( + id: 'right_wrist', + name: 'hand', + description: 'Right Wrist', + bodyView: BodyView.front, + position: OrganPosition(x: 0.85, y: 0.5), + ), + + // ========== LEFT LEG ========== + OrganModel( + id: 'left_thigh', + name: 'thigh', + description: 'Left Thigh', + bodyView: BodyView.front, + position: OrganPosition(x: 0.4, y: 0.60), + ), + OrganModel( + id: 'left_knee', + name: 'knee', + description: 'Left Knee', + bodyView: BodyView.front, + position: OrganPosition(x: 0.4, y: 0.72), + ), + OrganModel( + id: 'left_shin', + name: 'lower_leg', + description: 'Left Shin', + bodyView: BodyView.front, + position: OrganPosition(x: 0.41, y: 0.82), + ), + OrganModel( + id: 'left_ankle', + name: 'foot', + description: 'Left Ankle', + bodyView: BodyView.front, + position: OrganPosition(x: 0.43, y: 0.91), + ), + + // ========== RIGHT LEG ========== + OrganModel( + id: 'right_thigh', + name: 'thigh', + description: 'Right Thigh', + bodyView: BodyView.front, + position: OrganPosition(x: 0.65, y: 0.60), + ), + OrganModel( + id: 'right_knee', + name: 'knee', + description: 'Right Knee', + bodyView: BodyView.front, + position: OrganPosition(x: 0.6, y: 0.72), + ), + OrganModel( + id: 'right_shin', + name: 'lower_leg', + description: 'Right Shin', + bodyView: BodyView.front, + position: OrganPosition(x: 0.57, y: 0.82), + ), + OrganModel( + id: 'right_ankle', + name: 'foot', + description: 'Right Ankle', + bodyView: BodyView.front, + position: OrganPosition(x: 0.57, y: 0.91), + ), + ]; + + // ==================== BACK VIEW ==================== + static const List backViewOrgans = [ + // ========== HEAD & NECK ========== + OrganModel( + id: 'back_of_head', + name: 'whole_head', + description: 'Back of Head', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.04), + ), + OrganModel( + id: 'neck_back', + name: 'nape_of_neck', + description: 'Neck', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.14), + ), + + // ========== SHOULDERS ========== + OrganModel( + id: 'left_shoulder_back', + name: 'upper_arm', + description: 'Left Shoulder', + bodyView: BodyView.back, + position: OrganPosition(x: 0.33, y: 0.19), + ), + OrganModel( + id: 'right_shoulder_back', + name: 'upper_arm', + description: 'Right Shoulder', + bodyView: BodyView.back, + position: OrganPosition(x: 0.67, y: 0.19), + ), + + // ========== UPPER BACK ========== + OrganModel( + id: 'upper_spine', + name: 'back', + description: 'Upper Spine', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.23), + ), + OrganModel( + id: 'left_upper_back', + name: 'back', + description: 'Left Upper Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.38, y: 0.28), + ), + OrganModel( + id: 'right_upper_back', + name: 'back', + description: 'Right Upper Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.62, y: 0.28), + ), + + // ========== MID BACK ========== + OrganModel( + id: 'mid_spine', + name: 'back', + description: 'Mid Spine', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.35), + ), + OrganModel( + id: 'left_mid_back', + name: 'back', + description: 'Left Mid Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.38, y: 0.35), + ), + OrganModel( + id: 'right_mid_back', + name: 'back', + description: 'Right Mid Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.62, y: 0.35), + ), + + // ========== LOWER BACK ========== + OrganModel( + id: 'lower_spine', + name: 'lower_back', + description: 'Lower Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.43), + ), + OrganModel( + id: 'left_lower_back', + name: 'lower_back', + description: 'Left Lower Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.40, y: 0.43), + ), + OrganModel( + id: 'right_lower_back', + name: 'lower_back', + description: 'Right Lower Back', + bodyView: BodyView.back, + position: OrganPosition(x: 0.60, y: 0.43), + ), + + // ========== GLUTES ========== + OrganModel( + id: 'sacrum', + name: 'lower_back', + description: 'Sacrum', + bodyView: BodyView.back, + position: OrganPosition(x: 0.50, y: 0.52), + ), + OrganModel( + id: 'left_glute', + name: 'buttocks', + description: 'Left Glute', + bodyView: BodyView.back, + position: OrganPosition(x: 0.45, y: 0.56), + ), + OrganModel( + id: 'right_glute', + name: 'buttocks', + description: 'Right Glute', + bodyView: BodyView.back, + position: OrganPosition(x: 0.55, y: 0.56), + ), + + // ========== LEGS ========== + OrganModel( + id: 'left_hamstring', + name: 'thigh', + description: 'Left Hamstring', + bodyView: BodyView.back, + position: OrganPosition(x: 0.43, y: 0.65), + ), + OrganModel( + id: 'right_hamstring', + name: 'thigh', + description: 'Right Hamstring', + bodyView: BodyView.back, + position: OrganPosition(x: 0.57, y: 0.65), + ), + OrganModel( + id: 'left_calf', + name: 'lower_leg', + description: 'Left Calf', + bodyView: BodyView.back, + position: OrganPosition(x: 0.43, y: 0.79), + ), + OrganModel( + id: 'right_calf', + name: 'lower_leg', + description: 'Right Calf', + bodyView: BodyView.back, + position: OrganPosition(x: 0.57, y: 0.79), + ), + ]; + + // Helper methods + static List getOrgansForView(BodyView view) { + return view == BodyView.front ? frontViewOrgans : backViewOrgans; + } + + static List getAllOrgans() { + return [...frontViewOrgans, ...backViewOrgans]; + } + + static OrganModel? getOrganById(String id) { + try { + return getAllOrgans().firstWhere((organ) => organ.id == id); + } catch (e) { + return null; + } + } +} diff --git a/lib/features/symptoms_checker/data/symptoms_mapping_data.dart b/lib/features/symptoms_checker/data/symptoms_mapping_data.dart new file mode 100644 index 0000000..65aa152 --- /dev/null +++ b/lib/features/symptoms_checker/data/symptoms_mapping_data.dart @@ -0,0 +1,323 @@ +import 'package:hmg_patient_app_new/features/symptoms_checker/models/symptom_model.dart'; + +class SymptomsMappingData { + // Map of organ IDs to their possible symptoms + static final Map> organSymptomsMap = { + // HEAD & FACE + 'head': [ + SymptomModel(id: 'head_s1', name: 'Headache', organId: 'head'), + SymptomModel(id: 'head_s2', name: 'Dizziness', organId: 'head'), + SymptomModel(id: 'head_s3', name: 'Migraine', organId: 'head'), + SymptomModel(id: 'head_s4', name: 'Head pressure', organId: 'head'), + SymptomModel(id: 'head_s5', name: 'Vertigo', organId: 'head'), + SymptomModel(id: 'head_s6', name: 'Confusion', organId: 'head'), + SymptomModel(id: 'head_s7', name: 'Memory problems', organId: 'head'), + ], + 'left_eye': [ + SymptomModel(id: 'left_eye_s1', name: 'Blurred vision', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s2', name: 'Eye pain', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s3', name: 'Redness', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s4', name: 'Itching', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s5', name: 'Watering', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s6', name: 'Sensitivity to light', organId: 'left_eye'), + SymptomModel(id: 'left_eye_s7', name: 'Double vision', organId: 'left_eye'), + ], + 'right_eye': [ + SymptomModel(id: 'right_eye_s1', name: 'Blurred vision', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s2', name: 'Eye pain', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s3', name: 'Redness', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s4', name: 'Itching', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s5', name: 'Watering', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s6', name: 'Sensitivity to light', organId: 'right_eye'), + SymptomModel(id: 'right_eye_s7', name: 'Double vision', organId: 'right_eye'), + ], + 'nose_mouth': [ + SymptomModel(id: 'nose_mouth_s1', name: 'Nasal congestion', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s2', name: 'Runny nose', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s3', name: 'Nosebleed', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s4', name: 'Loss of smell', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s5', name: 'Mouth pain', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s6', name: 'Dry mouth', organId: 'nose_mouth'), + SymptomModel(id: 'nose_mouth_s7', name: 'Difficulty swallowing', organId: 'nose_mouth'), + ], + + // NECK & THROAT + 'throat': [ + SymptomModel(id: 'throat_s1', name: 'Sore throat', organId: 'throat'), + SymptomModel(id: 'throat_s2', name: 'Difficulty swallowing', organId: 'throat'), + SymptomModel(id: 'throat_s3', name: 'Hoarseness', organId: 'throat'), + SymptomModel(id: 'throat_s4', name: 'Throat pain', organId: 'throat'), + SymptomModel(id: 'throat_s5', name: 'Swollen glands', organId: 'throat'), + SymptomModel(id: 'throat_s6', name: 'Cough', organId: 'throat'), + SymptomModel(id: 'throat_s7', name: 'Difficulty breathing', organId: 'throat'), + ], + + // SHOULDERS + 'left_shoulder': [ + SymptomModel(id: 'left_shoulder_s1', name: 'Shoulder pain', organId: 'left_shoulder'), + SymptomModel(id: 'left_shoulder_s2', name: 'Stiffness', organId: 'left_shoulder'), + SymptomModel(id: 'left_shoulder_s3', name: 'Limited mobility', organId: 'left_shoulder'), + SymptomModel(id: 'left_shoulder_s4', name: 'Swelling', organId: 'left_shoulder'), + SymptomModel(id: 'left_shoulder_s5', name: 'Weakness', organId: 'left_shoulder'), + SymptomModel(id: 'left_shoulder_s6', name: 'Clicking sound', organId: 'left_shoulder'), + ], + 'right_shoulder': [ + SymptomModel(id: 'right_shoulder_s1', name: 'Shoulder pain', organId: 'right_shoulder'), + SymptomModel(id: 'right_shoulder_s2', name: 'Stiffness', organId: 'right_shoulder'), + SymptomModel(id: 'right_shoulder_s3', name: 'Limited mobility', organId: 'right_shoulder'), + SymptomModel(id: 'right_shoulder_s4', name: 'Swelling', organId: 'right_shoulder'), + SymptomModel(id: 'right_shoulder_s5', name: 'Weakness', organId: 'right_shoulder'), + SymptomModel(id: 'right_shoulder_s6', name: 'Clicking sound', organId: 'right_shoulder'), + ], + + // CHEST + 'left_chest': [ + SymptomModel(id: 'left_chest_s1', name: 'Chest pain', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s2', name: 'Tightness', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s3', name: 'Pressure', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s4', name: 'Sharp pain', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s5', name: 'Burning sensation', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s6', name: 'Palpitations', organId: 'left_chest'), + SymptomModel(id: 'left_chest_s7', name: 'Shortness of breath', organId: 'left_chest'), + ], + 'center_chest': [ + SymptomModel(id: 'center_chest_s1', name: 'Chest pain', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s2', name: 'Tightness', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s3', name: 'Pressure', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s4', name: 'Sharp pain', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s5', name: 'Burning sensation', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s6', name: 'Heartburn', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s7', name: 'Difficulty breathing', organId: 'center_chest'), + SymptomModel(id: 'center_chest_s8', name: 'Palpitations', organId: 'center_chest'), + ], + 'right_chest': [ + SymptomModel(id: 'right_chest_s1', name: 'Chest pain', organId: 'right_chest'), + SymptomModel(id: 'right_chest_s2', name: 'Tightness', organId: 'right_chest'), + SymptomModel(id: 'right_chest_s3', name: 'Pressure', organId: 'right_chest'), + SymptomModel(id: 'right_chest_s4', name: 'Sharp pain', organId: 'right_chest'), + SymptomModel(id: 'right_chest_s5', name: 'Burning sensation', organId: 'right_chest'), + SymptomModel(id: 'right_chest_s6', name: 'Shortness of breath', organId: 'right_chest'), + ], + + // RIBS + 'left_ribs': [ + SymptomModel(id: 'left_ribs_s1', name: 'Rib pain', organId: 'left_ribs'), + SymptomModel(id: 'left_ribs_s2', name: 'Pain when breathing', organId: 'left_ribs'), + SymptomModel(id: 'left_ribs_s3', name: 'Tenderness', organId: 'left_ribs'), + SymptomModel(id: 'left_ribs_s4', name: 'Bruising', organId: 'left_ribs'), + SymptomModel(id: 'left_ribs_s5', name: 'Difficulty moving', organId: 'left_ribs'), + ], + 'right_ribs': [ + SymptomModel(id: 'right_ribs_s1', name: 'Rib pain', organId: 'right_ribs'), + SymptomModel(id: 'right_ribs_s2', name: 'Pain when breathing', organId: 'right_ribs'), + SymptomModel(id: 'right_ribs_s3', name: 'Tenderness', organId: 'right_ribs'), + SymptomModel(id: 'right_ribs_s4', name: 'Bruising', organId: 'right_ribs'), + SymptomModel(id: 'right_ribs_s5', name: 'Difficulty moving', organId: 'right_ribs'), + ], + + // ABDOMEN + 'upper_abdomen': [ + SymptomModel(id: 'upper_abdomen_s1', name: 'Abdominal pain', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s2', name: 'Bloating', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s3', name: 'Nausea', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s4', name: 'Vomiting', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s5', name: 'Heartburn', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s6', name: 'Loss of appetite', organId: 'upper_abdomen'), + SymptomModel(id: 'upper_abdomen_s7', name: 'Indigestion', organId: 'upper_abdomen'), + ], + 'navel': [ + SymptomModel(id: 'navel_s1', name: 'Abdominal pain', organId: 'navel'), + SymptomModel(id: 'navel_s2', name: 'Cramping', organId: 'navel'), + SymptomModel(id: 'navel_s3', name: 'Bloating', organId: 'navel'), + SymptomModel(id: 'navel_s4', name: 'Gas', organId: 'navel'), + SymptomModel(id: 'navel_s5', name: 'Tenderness', organId: 'navel'), + ], + 'lower_abdomen': [ + SymptomModel(id: 'lower_abdomen_s1', name: 'Lower abdominal pain', organId: 'lower_abdomen'), + SymptomModel(id: 'lower_abdomen_s2', name: 'Cramping', organId: 'lower_abdomen'), + SymptomModel(id: 'lower_abdomen_s3', name: 'Bloating', organId: 'lower_abdomen'), + SymptomModel(id: 'lower_abdomen_s4', name: 'Constipation', organId: 'lower_abdomen'), + SymptomModel(id: 'lower_abdomen_s5', name: 'Diarrhea', organId: 'lower_abdomen'), + SymptomModel(id: 'lower_abdomen_s6', name: 'Urinary discomfort', organId: 'lower_abdomen'), + ], + + // PELVIS & GROIN + 'left_groin': [ + SymptomModel(id: 'left_groin_s1', name: 'Groin pain', organId: 'left_groin'), + SymptomModel(id: 'left_groin_s2', name: 'Swelling', organId: 'left_groin'), + SymptomModel(id: 'left_groin_s3', name: 'Tenderness', organId: 'left_groin'), + SymptomModel(id: 'left_groin_s4', name: 'Limited mobility', organId: 'left_groin'), + ], + 'right_groin': [ + SymptomModel(id: 'right_groin_s1', name: 'Groin pain', organId: 'right_groin'), + SymptomModel(id: 'right_groin_s2', name: 'Swelling', organId: 'right_groin'), + SymptomModel(id: 'right_groin_s3', name: 'Tenderness', organId: 'right_groin'), + SymptomModel(id: 'right_groin_s4', name: 'Limited mobility', organId: 'right_groin'), + ], + + // ARMS - LEFT + 'left_elbow': [ + SymptomModel(id: 'left_elbow_s1', name: 'Elbow pain', organId: 'left_elbow'), + SymptomModel(id: 'left_elbow_s2', name: 'Stiffness', organId: 'left_elbow'), + SymptomModel(id: 'left_elbow_s3', name: 'Swelling', organId: 'left_elbow'), + SymptomModel(id: 'left_elbow_s4', name: 'Limited mobility', organId: 'left_elbow'), + SymptomModel(id: 'left_elbow_s5', name: 'Tingling', organId: 'left_elbow'), + ], + 'left_forearm': [ + SymptomModel(id: 'left_forearm_s1', name: 'Forearm pain', organId: 'left_forearm'), + SymptomModel(id: 'left_forearm_s2', name: 'Weakness', organId: 'left_forearm'), + SymptomModel(id: 'left_forearm_s3', name: 'Numbness', organId: 'left_forearm'), + SymptomModel(id: 'left_forearm_s4', name: 'Tingling', organId: 'left_forearm'), + SymptomModel(id: 'left_forearm_s5', name: 'Swelling', organId: 'left_forearm'), + ], + 'left_wrist': [ + SymptomModel(id: 'left_wrist_s1', name: 'Wrist pain', organId: 'left_wrist'), + SymptomModel(id: 'left_wrist_s2', name: 'Stiffness', organId: 'left_wrist'), + SymptomModel(id: 'left_wrist_s3', name: 'Swelling', organId: 'left_wrist'), + SymptomModel(id: 'left_wrist_s4', name: 'Limited mobility', organId: 'left_wrist'), + SymptomModel(id: 'left_wrist_s5', name: 'Tingling', organId: 'left_wrist'), + SymptomModel(id: 'left_wrist_s6', name: 'Numbness', organId: 'left_wrist'), + ], + + // ARMS - RIGHT + 'right_elbow': [ + SymptomModel(id: 'right_elbow_s1', name: 'Elbow pain', organId: 'right_elbow'), + SymptomModel(id: 'right_elbow_s2', name: 'Stiffness', organId: 'right_elbow'), + SymptomModel(id: 'right_elbow_s3', name: 'Swelling', organId: 'right_elbow'), + SymptomModel(id: 'right_elbow_s4', name: 'Limited mobility', organId: 'right_elbow'), + SymptomModel(id: 'right_elbow_s5', name: 'Tingling', organId: 'right_elbow'), + ], + 'right_forearm': [ + SymptomModel(id: 'right_forearm_s1', name: 'Forearm pain', organId: 'right_forearm'), + SymptomModel(id: 'right_forearm_s2', name: 'Weakness', organId: 'right_forearm'), + SymptomModel(id: 'right_forearm_s3', name: 'Numbness', organId: 'right_forearm'), + SymptomModel(id: 'right_forearm_s4', name: 'Tingling', organId: 'right_forearm'), + SymptomModel(id: 'right_forearm_s5', name: 'Swelling', organId: 'right_forearm'), + ], + 'right_wrist': [ + SymptomModel(id: 'right_wrist_s1', name: 'Wrist pain', organId: 'right_wrist'), + SymptomModel(id: 'right_wrist_s2', name: 'Stiffness', organId: 'right_wrist'), + SymptomModel(id: 'right_wrist_s3', name: 'Swelling', organId: 'right_wrist'), + SymptomModel(id: 'right_wrist_s4', name: 'Limited mobility', organId: 'right_wrist'), + SymptomModel(id: 'right_wrist_s5', name: 'Tingling', organId: 'right_wrist'), + SymptomModel(id: 'right_wrist_s6', name: 'Numbness', organId: 'right_wrist'), + ], + + // LEGS - LEFT + 'left_thigh': [ + SymptomModel(id: 'left_thigh_s1', name: 'Thigh pain', organId: 'left_thigh'), + SymptomModel(id: 'left_thigh_s2', name: 'Muscle cramps', organId: 'left_thigh'), + SymptomModel(id: 'left_thigh_s3', name: 'Weakness', organId: 'left_thigh'), + SymptomModel(id: 'left_thigh_s4', name: 'Numbness', organId: 'left_thigh'), + SymptomModel(id: 'left_thigh_s5', name: 'Swelling', organId: 'left_thigh'), + ], + 'left_knee': [ + SymptomModel(id: 'left_knee_s1', name: 'Knee pain', organId: 'left_knee'), + SymptomModel(id: 'left_knee_s2', name: 'Stiffness', organId: 'left_knee'), + SymptomModel(id: 'left_knee_s3', name: 'Swelling', organId: 'left_knee'), + SymptomModel(id: 'left_knee_s4', name: 'Limited mobility', organId: 'left_knee'), + SymptomModel(id: 'left_knee_s5', name: 'Clicking sound', organId: 'left_knee'), + SymptomModel(id: 'left_knee_s6', name: 'Instability', organId: 'left_knee'), + ], + 'left_shin': [ + SymptomModel(id: 'left_shin_s1', name: 'Shin pain', organId: 'left_shin'), + SymptomModel(id: 'left_shin_s2', name: 'Tenderness', organId: 'left_shin'), + SymptomModel(id: 'left_shin_s3', name: 'Swelling', organId: 'left_shin'), + SymptomModel(id: 'left_shin_s4', name: 'Numbness', organId: 'left_shin'), + ], + 'left_ankle': [ + SymptomModel(id: 'left_ankle_s1', name: 'Ankle pain', organId: 'left_ankle'), + SymptomModel(id: 'left_ankle_s2', name: 'Stiffness', organId: 'left_ankle'), + SymptomModel(id: 'left_ankle_s3', name: 'Swelling', organId: 'left_ankle'), + SymptomModel(id: 'left_ankle_s4', name: 'Limited mobility', organId: 'left_ankle'), + SymptomModel(id: 'left_ankle_s5', name: 'Instability', organId: 'left_ankle'), + ], + + // LEGS - RIGHT + 'right_thigh': [ + SymptomModel(id: 'right_thigh_s1', name: 'Thigh pain', organId: 'right_thigh'), + SymptomModel(id: 'right_thigh_s2', name: 'Muscle cramps', organId: 'right_thigh'), + SymptomModel(id: 'right_thigh_s3', name: 'Weakness', organId: 'right_thigh'), + SymptomModel(id: 'right_thigh_s4', name: 'Numbness', organId: 'right_thigh'), + SymptomModel(id: 'right_thigh_s5', name: 'Swelling', organId: 'right_thigh'), + ], + 'right_knee': [ + SymptomModel(id: 'right_knee_s1', name: 'Knee pain', organId: 'right_knee'), + SymptomModel(id: 'right_knee_s2', name: 'Stiffness', organId: 'right_knee'), + SymptomModel(id: 'right_knee_s3', name: 'Swelling', organId: 'right_knee'), + SymptomModel(id: 'right_knee_s4', name: 'Limited mobility', organId: 'right_knee'), + SymptomModel(id: 'right_knee_s5', name: 'Clicking sound', organId: 'right_knee'), + SymptomModel(id: 'right_knee_s6', name: 'Instability', organId: 'right_knee'), + ], + 'right_shin': [ + SymptomModel(id: 'right_shin_s1', name: 'Shin pain', organId: 'right_shin'), + SymptomModel(id: 'right_shin_s2', name: 'Tenderness', organId: 'right_shin'), + SymptomModel(id: 'right_shin_s3', name: 'Swelling', organId: 'right_shin'), + SymptomModel(id: 'right_shin_s4', name: 'Numbness', organId: 'right_shin'), + ], + 'right_ankle': [ + SymptomModel(id: 'right_ankle_s1', name: 'Ankle pain', organId: 'right_ankle'), + SymptomModel(id: 'right_ankle_s2', name: 'Stiffness', organId: 'right_ankle'), + SymptomModel(id: 'right_ankle_s3', name: 'Swelling', organId: 'right_ankle'), + SymptomModel(id: 'right_ankle_s4', name: 'Limited mobility', organId: 'right_ankle'), + SymptomModel(id: 'right_ankle_s5', name: 'Instability', organId: 'right_ankle'), + ], + + // BACK VIEW ORGANS + 'back_head': [ + SymptomModel(id: 'back_head_s1', name: 'Back of head pain', organId: 'back_head'), + SymptomModel(id: 'back_head_s2', name: 'Neck stiffness', organId: 'back_head'), + SymptomModel(id: 'back_head_s3', name: 'Tension headache', organId: 'back_head'), + ], + 'neck': [ + SymptomModel(id: 'neck_s1', name: 'Neck pain', organId: 'neck'), + SymptomModel(id: 'neck_s2', name: 'Stiffness', organId: 'neck'), + SymptomModel(id: 'neck_s3', name: 'Limited mobility', organId: 'neck'), + SymptomModel(id: 'neck_s4', name: 'Muscle spasm', organId: 'neck'), + SymptomModel(id: 'neck_s5', name: 'Tingling', organId: 'neck'), + ], + 'upper_back': [ + SymptomModel(id: 'upper_back_s1', name: 'Upper back pain', organId: 'upper_back'), + SymptomModel(id: 'upper_back_s2', name: 'Stiffness', organId: 'upper_back'), + SymptomModel(id: 'upper_back_s3', name: 'Muscle tension', organId: 'upper_back'), + SymptomModel(id: 'upper_back_s4', name: 'Sharp pain', organId: 'upper_back'), + SymptomModel(id: 'upper_back_s5', name: 'Difficulty breathing', organId: 'upper_back'), + ], + 'mid_back': [ + SymptomModel(id: 'mid_back_s1', name: 'Mid back pain', organId: 'mid_back'), + SymptomModel(id: 'mid_back_s2', name: 'Stiffness', organId: 'mid_back'), + SymptomModel(id: 'mid_back_s3', name: 'Muscle spasm', organId: 'mid_back'), + SymptomModel(id: 'mid_back_s4', name: 'Tenderness', organId: 'mid_back'), + ], + 'lower_back': [ + SymptomModel(id: 'lower_back_s1', name: 'Lower back pain', organId: 'lower_back'), + SymptomModel(id: 'lower_back_s2', name: 'Stiffness', organId: 'lower_back'), + SymptomModel(id: 'lower_back_s3', name: 'Sharp pain', organId: 'lower_back'), + SymptomModel(id: 'lower_back_s4', name: 'Sciatica', organId: 'lower_back'), + SymptomModel(id: 'lower_back_s5', name: 'Limited mobility', organId: 'lower_back'), + SymptomModel(id: 'lower_back_s6', name: 'Muscle spasm', organId: 'lower_back'), + ], + }; + + /// Get symptoms for a specific organ ID + static List getSymptomsForOrgan(String organId) { + return organSymptomsMap[organId] ?? []; + } + + /// Get symptoms for multiple organ IDs + static Map> getSymptomsForOrgans(List organIds) { + Map> result = {}; + for (String organId in organIds) { + List symptoms = getSymptomsForOrgan(organId); + if (symptoms.isNotEmpty) { + result[organId] = symptoms; + } + } + return result; + } + + /// Check if an organ has symptoms mapped + static bool hasSymptoms(String organId) { + return organSymptomsMap.containsKey(organId) && organSymptomsMap[organId]!.isNotEmpty; + } +} diff --git a/lib/features/symptoms_checker/data/triage_questions_data.dart b/lib/features/symptoms_checker/data/triage_questions_data.dart new file mode 100644 index 0000000..ffaef92 --- /dev/null +++ b/lib/features/symptoms_checker/data/triage_questions_data.dart @@ -0,0 +1,209 @@ +import 'package:hmg_patient_app_new/features/symptoms_checker/models/triage_question_model.dart'; + +class TriageQuestionsData { + static List getSampleTriageQuestions() { + return [ + // Question 1: Pain Location + TriageQuestionModel( + id: 'q1', + question: 'Where do you feel the chest pain, and where does the pain spread or move to?', + options: [ + TriageOptionModel( + id: 'q1_opt1', + text: 'It is all over', + severityScore: 3, + ), + TriageOptionModel( + id: 'q1_opt2', + text: 'It is behind the breast bone', + severityScore: 5, + ), + TriageOptionModel( + id: 'q1_opt3', + text: 'Moves or spread to the upper limb; for example the shoulder, arm, or fingers', + severityScore: 7, + ), + TriageOptionModel( + id: 'q1_opt4', + text: 'Moves or spread to the upper back; between the shoulder blades', + severityScore: 6, + ), + TriageOptionModel( + id: 'q1_opt5', + text: 'Moves or spread to the neck or jaw', + severityScore: 8, + ), + ], + ), + + // Question 2: Pain Intensity + TriageQuestionModel( + id: 'q2', + question: 'How would you describe the intensity of your chest pain?', + options: [ + TriageOptionModel( + id: 'q2_opt1', + text: 'Mild - Barely noticeable, does not interfere with daily activities', + severityScore: 2, + ), + TriageOptionModel( + id: 'q2_opt2', + text: 'Moderate - Noticeable but manageable, some interference with activities', + severityScore: 4, + ), + TriageOptionModel( + id: 'q2_opt3', + text: 'Severe - Significantly interferes with activities, difficult to ignore', + severityScore: 7, + ), + TriageOptionModel( + id: 'q2_opt4', + text: 'Very severe - Unbearable, cannot perform any activities', + severityScore: 9, + ), + ], + ), + + // Question 3: Pain Duration + TriageQuestionModel( + id: 'q3', + question: 'How long have you been experiencing this chest pain?', + options: [ + TriageOptionModel( + id: 'q3_opt1', + text: 'Less than 5 minutes', + severityScore: 3, + ), + TriageOptionModel( + id: 'q3_opt2', + text: 'Between 5 to 15 minutes', + severityScore: 5, + ), + TriageOptionModel( + id: 'q3_opt3', + text: 'Between 15 to 30 minutes', + severityScore: 7, + ), + TriageOptionModel( + id: 'q3_opt4', + text: 'More than 30 minutes', + severityScore: 8, + ), + TriageOptionModel( + id: 'q3_opt5', + text: 'Comes and goes (intermittent)', + severityScore: 4, + ), + ], + ), + + // Question 4: Associated Symptoms + TriageQuestionModel( + id: 'q4', + question: 'Are you experiencing any of these symptoms along with chest pain?', + options: [ + TriageOptionModel( + id: 'q4_opt1', + text: 'Shortness of breath or difficulty breathing', + severityScore: 8, + ), + TriageOptionModel( + id: 'q4_opt2', + text: 'Sweating, nausea, or vomiting', + severityScore: 7, + ), + TriageOptionModel( + id: 'q4_opt3', + text: 'Dizziness or lightheadedness', + severityScore: 7, + ), + TriageOptionModel( + id: 'q4_opt4', + text: 'Rapid or irregular heartbeat', + severityScore: 6, + ), + TriageOptionModel( + id: 'q4_opt5', + text: 'None of the above', + severityScore: 2, + ), + ], + ), + + // Question 5: Triggering Factors + TriageQuestionModel( + id: 'q5', + question: 'What triggers or worsens your chest pain?', + options: [ + TriageOptionModel( + id: 'q5_opt1', + text: 'Physical activity or exertion', + severityScore: 6, + ), + TriageOptionModel( + id: 'q5_opt2', + text: 'Emotional stress or anxiety', + severityScore: 4, + ), + TriageOptionModel( + id: 'q5_opt3', + text: 'Deep breathing or coughing', + severityScore: 3, + ), + TriageOptionModel( + id: 'q5_opt4', + text: 'Eating or lying down', + severityScore: 3, + ), + TriageOptionModel( + id: 'q5_opt5', + text: 'Nothing specific, pain is constant', + severityScore: 7, + ), + ], + ), + ]; + } + + /// Calculate total severity score from answered questions + static int calculateTotalScore(List questions) { + int totalScore = 0; + int answeredCount = 0; + + for (var question in questions) { + if (question.isConfirmed && question.confirmedOption != null) { + totalScore += question.confirmedOption!.severityScore ?? 0; + answeredCount++; + } + } + + // Return average score or 0 if no questions answered + return answeredCount > 0 ? (totalScore / answeredCount * 10).round() : 0; + } + + /// Get risk level based on score + static String getRiskLevel(int score) { + if (score >= 70) { + return 'High Risk - Seek immediate medical attention'; + } else if (score >= 50) { + return 'Moderate Risk - Consult a doctor soon'; + } else if (score >= 30) { + return 'Low to Moderate Risk - Monitor symptoms'; + } else { + return 'Low Risk - Self-care may be sufficient'; + } + } + + /// Get suggested condition based on score + static String getSuggestedCondition(int score) { + if (score >= 70) { + return 'Acute Coronary Syndrome'; + } else if (score >= 50) { + return 'Angina or Cardiac concern'; + } else if (score >= 30) { + return 'Non-cardiac chest pain'; + } else { + return 'Musculoskeletal chest pain'; + } + } +} diff --git a/lib/features/symptoms_checker/models/conditions_model.dart b/lib/features/symptoms_checker/models/conditions_model.dart new file mode 100644 index 0000000..774d8c3 --- /dev/null +++ b/lib/features/symptoms_checker/models/conditions_model.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; + +class ConditionsModel { + final IconData icon; + final String title; + final int percentage; + final String tagText; + final String clinic; + final List symptoms; + final String description; + final String? monitorNote; + final String? appointmentLabel; + final PossibleConditionsSeverityEnum possibleConditionsSeverityEnum; + + ConditionsModel({ + required this.icon, + required this.title, + required this.percentage, + required this.tagText, + required this.clinic, + required this.symptoms, + required this.description, + required this.possibleConditionsSeverityEnum, + this.monitorNote, + this.appointmentLabel, + }); +} + +List dummyConditions = [ + ConditionsModel( + icon: Icons.psychology_alt, + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.seekMedicalAdvice, + title: "Migraine", + percentage: 87, + tagText: "Seek Medical Advice", + clinic: "Internal Medicine Clinic", + symptoms: ["Headache", "Nausea", "Sensitivity to light"], + description: "A migraine is a type of headache that can cause severe throbbing pain, usually on one side of the head.", + appointmentLabel: "Book Appointment", + ), + ConditionsModel( + icon: Icons.deblur, + title: "Tension Headache", + percentage: 37, + tagText: "Monitor", + monitorNote: "No need to visit doctor", + clinic: "GP Clinic", + symptoms: ["Mild head pressure", "Scalp tenderness"], + description: "A tension-type headache is generally a mild to moderate pain that feels like a tight band around your head.", + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.monitorOnly, + ), + ConditionsModel( + icon: Icons.medication_liquid, + title: "Meningitis", + percentage: 28, + tagText: "Emergency", + clinic: "Neurology Clinic", + symptoms: ["Mild head pressure", "Scalp tenderness"], + description: "A tension-type headache is generally a mild to moderate pain that feels like a tight band around your head.", + appointmentLabel: "Book Appointment", + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.emergency, + ), + ConditionsModel( + icon: Icons.psychology_alt, + title: "Migraine", + percentage: 87, + tagText: "Seek Medical Advice", + clinic: "Internal Medicine Clinic", + symptoms: ["Headache", "Nausea", "Sensitivity to light"], + description: "A migraine is a type of headache that can cause severe throbbing pain, usually on one side of the head.", + appointmentLabel: "Book Appointment", + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.seekMedicalAdvice, + ), + ConditionsModel( + icon: Icons.deblur, + title: "Tension Headache", + percentage: 37, + tagText: "Monitor", + monitorNote: "No need to visit doctor", + clinic: "GP Clinic", + symptoms: ["Mild head pressure", "Scalp tenderness"], + description: "A tension-type headache is generally a mild to moderate pain that feels like a tight band around your head.", + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.monitorOnly, + ), + ConditionsModel( + icon: Icons.medication_liquid, + title: "Meningitis", + percentage: 28, + tagText: "Emergency", + clinic: "Neurology Clinic", + symptoms: ["Mild head pressure", "Scalp tenderness"], + description: "A tension-type headache is generally a mild to moderate pain that feels like a tight band around your head.", + appointmentLabel: "Book Appointment", + possibleConditionsSeverityEnum: PossibleConditionsSeverityEnum.emergency, + ), +]; diff --git a/lib/features/symptoms_checker/models/organ_model.dart b/lib/features/symptoms_checker/models/organ_model.dart new file mode 100644 index 0000000..fab7dff --- /dev/null +++ b/lib/features/symptoms_checker/models/organ_model.dart @@ -0,0 +1,43 @@ +import 'package:hmg_patient_app_new/core/enums.dart'; + +class OrganModel { + final String id; + final String name; + final String description; + final BodyView bodyView; + final OrganPosition position; + + const OrganModel({ + required this.id, + required this.name, + required this.description, + required this.bodyView, + required this.position, + }); + + OrganModel copyWith({ + String? id, + String? name, + String? description, + BodyView? bodyView, + OrganPosition? position, + }) { + return OrganModel( + id: id ?? this.id, + name: name ?? this.name, + description: description ?? this.description, + bodyView: bodyView ?? this.bodyView, + position: position ?? this.position, + ); + } +} + +class OrganPosition { + final double x; // Percentage from left (0.0 to 1.0) + final double y; // Percentage from top (0.0 to 1.0) + + const OrganPosition({ + required this.x, + required this.y, + }); +} diff --git a/lib/features/symptoms_checker/models/resp_models/body_symptom_response_model.dart b/lib/features/symptoms_checker/models/resp_models/body_symptom_response_model.dart new file mode 100644 index 0000000..7c8f915 --- /dev/null +++ b/lib/features/symptoms_checker/models/resp_models/body_symptom_response_model.dart @@ -0,0 +1,151 @@ +class BodySymptomResponseModel { + final DataDetails? dataDetails; + + BodySymptomResponseModel({ + this.dataDetails, + }); + + factory BodySymptomResponseModel.fromJson(Map json) { + return BodySymptomResponseModel( + dataDetails: json['dataDetails'] != null ? DataDetails.fromJson(json['dataDetails']) : null, + ); + } + + Map toJson() { + return { + 'dataDetails': dataDetails?.toJson(), + }; + } +} + +class DataDetails { + final List? result; + final int? id; + final dynamic exception; + final int? status; + final bool? isCanceled; + final bool? isCompleted; + final bool? isCompletedSuccessfully; + final int? creationOptions; + final dynamic asyncState; + final bool? isFaulted; + + DataDetails({ + this.result, + this.id, + this.exception, + this.status, + this.isCanceled, + this.isCompleted, + this.isCompletedSuccessfully, + this.creationOptions, + this.asyncState, + this.isFaulted, + }); + + factory DataDetails.fromJson(Map json) { + return DataDetails( + result: json['Result'] != null ? (json['Result'] as List).map((item) => OrganSymptomResult.fromJson(item)).toList() : null, + id: json['Id'], + exception: json['Exception'], + status: json['Status'], + isCanceled: json['IsCanceled'], + isCompleted: json['IsCompleted'], + isCompletedSuccessfully: json['IsCompletedSuccessfully'], + creationOptions: json['CreationOptions'], + asyncState: json['AsyncState'], + isFaulted: json['IsFaulted'], + ); + } + + Map toJson() { + return { + 'Result': result?.map((item) => item.toJson()).toList(), + 'Id': id, + 'Exception': exception, + 'Status': status, + 'IsCanceled': isCanceled, + 'IsCompleted': isCompleted, + 'IsCompletedSuccessfully': isCompletedSuccessfully, + 'CreationOptions': creationOptions, + 'AsyncState': asyncState, + 'IsFaulted': isFaulted, + }; + } +} + +class OrganSymptomResult { + final String? name; + final List? bodySymptoms; + + OrganSymptomResult({ + this.name, + this.bodySymptoms, + }); + + factory OrganSymptomResult.fromJson(Map json) { + return OrganSymptomResult( + name: json['name'], + bodySymptoms: json['bodySymptoms'] != null ? (json['bodySymptoms'] as List).map((item) => BodySymptom.fromJson(item)).toList() : null, + ); + } + + Map toJson() { + return { + 'name': name, + 'bodySymptoms': bodySymptoms?.map((item) => item.toJson()).toList(), + }; + } +} + +class BodySymptom { + final String? id; + final String? type; + final String? symptomsName; + final String? name; + final String? commonName; + final String? nameAr; + final String? commonNameAr; + + BodySymptom({ + this.id, + this.type, + this.symptomsName, + this.name, + this.commonName, + this.nameAr, + this.commonNameAr, + }); + + factory BodySymptom.fromJson(Map json) { + return BodySymptom( + id: json['Id'], + type: json['type'], + symptomsName: json['symptoms_name'], + name: json['name'], + commonName: json['common_name'], + nameAr: json['nameAr'], + commonNameAr: json['common_nameAr'], + ); + } + + Map toJson() { + return { + 'Id': id, + 'type': type, + 'symptoms_name': symptomsName, + 'name': name, + 'common_name': commonName, + 'nameAr': nameAr, + 'common_nameAr': commonNameAr, + }; + } + + // Helper method to get display name based on locale + String getDisplayName(bool isArabic) { + if (isArabic) { + return commonNameAr ?? nameAr ?? commonName ?? name ?? ''; + } + return commonName ?? name ?? ''; + } +} diff --git a/lib/features/symptoms_checker/models/resp_models/risk_and_suggestions_response_model.dart b/lib/features/symptoms_checker/models/resp_models/risk_and_suggestions_response_model.dart new file mode 100644 index 0000000..b2be4a2 --- /dev/null +++ b/lib/features/symptoms_checker/models/resp_models/risk_and_suggestions_response_model.dart @@ -0,0 +1,59 @@ +class RiskAndSuggestionsResponseModel { + final List? dataDetails; + + RiskAndSuggestionsResponseModel({this.dataDetails}); + + factory RiskAndSuggestionsResponseModel.fromJson(Map json) { + return RiskAndSuggestionsResponseModel( + dataDetails: + json['dataDetails'] != null ? (json['dataDetails'] as List).map((item) => RiskAndSuggestionsItemModel.fromJson(item)).toList() : null, + ); + } + + Map toJson() { + return { + 'dataDetails': dataDetails?.map((item) => item.toJson()).toList(), + }; + } +} + +class RiskAndSuggestionsItemModel { + final String? id; + final String? type; + final String? name; + final String? commonName; + final String? language; + + RiskAndSuggestionsItemModel({ + this.id, + this.type, + this.name, + this.commonName, + this.language, + }); + + factory RiskAndSuggestionsItemModel.fromJson(Map json) { + return RiskAndSuggestionsItemModel( + id: json['id'], + type: json['type'], + name: json['name'], + commonName: json['common_name'], + language: json['language'], + ); + } + + Map toJson() { + return { + 'id': id, + 'type': type, + 'name': name, + 'common_name': commonName, + 'language': language, + }; + } + + // Helper method to get display name + String getDisplayName() { + return commonName ?? name ?? ''; + } +} diff --git a/lib/features/symptoms_checker/models/symptom_model.dart b/lib/features/symptoms_checker/models/symptom_model.dart new file mode 100644 index 0000000..19d8be4 --- /dev/null +++ b/lib/features/symptoms_checker/models/symptom_model.dart @@ -0,0 +1,105 @@ +class SymptomModel { + final String id; + final String name; + final String nameAr; + final String? organId; + + const SymptomModel({ + required this.id, + required this.name, + this.nameAr = '', + this.organId, + }); + + SymptomModel copyWith({ + String? id, + String? name, + String? nameAr, + String? organId, + }) { + return SymptomModel( + id: id ?? this.id, + name: name ?? this.name, + nameAr: nameAr ?? this.nameAr, + organId: organId ?? this.organId, + ); + } + + Map toJson() { + return { + 'id': id, + 'name': name, + 'nameAr': nameAr, + 'organId': organId, + }; + } + + factory SymptomModel.fromJson(Map json) { + return SymptomModel( + id: json['id'] ?? '', + name: json['name'] ?? '', + nameAr: json['nameAr'] ?? '', + organId: json['organId'], + ); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + return other is SymptomModel && other.id == id; + } + + @override + int get hashCode => id.hashCode; + + @override + String toString() { + return 'SymptomModel(id: $id, name: $name, nameAr: $nameAr, organId: $organId)'; + } +} + +/// Class to group symptoms by organ +class OrganSymptomsGroup { + final String organId; + final String organName; + final List symptoms; + final Set selectedSymptomIds; + + OrganSymptomsGroup({ + required this.organId, + required this.organName, + required this.symptoms, + Set? selectedSymptomIds, + }) : selectedSymptomIds = selectedSymptomIds ?? {}; + + /// Get count of selected symptoms + int get selectedCount => selectedSymptomIds.length; + + /// Check if any symptoms are selected + bool get hasSelectedSymptoms => selectedSymptomIds.isNotEmpty; + + /// Get list of selected symptoms + List get selectedSymptoms { + return symptoms.where((symptom) => selectedSymptomIds.contains(symptom.id)).toList(); + } + + OrganSymptomsGroup copyWith({ + String? organId, + String? organName, + List? symptoms, + Set? selectedSymptomIds, + }) { + return OrganSymptomsGroup( + organId: organId ?? this.organId, + organName: organName ?? this.organName, + symptoms: symptoms ?? this.symptoms, + selectedSymptomIds: selectedSymptomIds ?? this.selectedSymptomIds, + ); + } + + @override + String toString() { + return 'OrganSymptomsGroup(organId: $organId, organName: $organName, symptomsCount: ${symptoms.length}, selectedCount: $selectedCount)'; + } +} + diff --git a/lib/features/symptoms_checker/models/triage_question_model.dart b/lib/features/symptoms_checker/models/triage_question_model.dart new file mode 100644 index 0000000..fb8ab20 --- /dev/null +++ b/lib/features/symptoms_checker/models/triage_question_model.dart @@ -0,0 +1,85 @@ +class TriageQuestionModel { + final String id; + final String question; + final List options; + int? selectedOptionIndex; + int? confirmedOptionIndex; // Confirmed answer when user presses Next + + TriageQuestionModel({ + required this.id, + required this.question, + required this.options, + this.selectedOptionIndex, + this.confirmedOptionIndex, + }); + + bool get isAnswered => selectedOptionIndex != null; + + bool get isConfirmed => confirmedOptionIndex != null; + + void selectOption(int index) { + selectedOptionIndex = index; + } + + void confirmSelection() { + confirmedOptionIndex = selectedOptionIndex; + } + + void clearSelection() { + selectedOptionIndex = null; + } + + TriageOptionModel? get selectedOption { + if (selectedOptionIndex != null && selectedOptionIndex! < options.length) { + return options[selectedOptionIndex!]; + } + return null; + } + + TriageOptionModel? get confirmedOption { + if (confirmedOptionIndex != null && confirmedOptionIndex! < options.length) { + return options[confirmedOptionIndex!]; + } + return null; + } + + TriageQuestionModel copyWith({ + String? id, + String? question, + List? options, + int? selectedOptionIndex, + int? confirmedOptionIndex, + }) { + return TriageQuestionModel( + id: id ?? this.id, + question: question ?? this.question, + options: options ?? this.options, + selectedOptionIndex: selectedOptionIndex ?? this.selectedOptionIndex, + confirmedOptionIndex: confirmedOptionIndex ?? this.confirmedOptionIndex, + ); + } +} + +class TriageOptionModel { + final String id; + final String text; + final int? severityScore; // Optional: for calculating risk scores + + TriageOptionModel({ + required this.id, + required this.text, + this.severityScore, + }); + + TriageOptionModel copyWith({ + String? id, + String? text, + int? severityScore, + }) { + return TriageOptionModel( + id: id ?? this.id, + text: text ?? this.text, + severityScore: severityScore ?? this.severityScore, + ); + } +} diff --git a/lib/features/symptoms_checker/symptoms_checker_repo.dart b/lib/features/symptoms_checker/symptoms_checker_repo.dart new file mode 100644 index 0000000..954d414 --- /dev/null +++ b/lib/features/symptoms_checker/symptoms_checker_repo.dart @@ -0,0 +1,223 @@ +import 'dart:convert'; +import 'dart:developer'; + +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/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/services/logger_service.dart'; + +abstract class SymptomsCheckerRepo { + Future>> getBodySymptomsByName({ + required List organNames, + }); + + Future>> getRiskFactors({ + required int age, + required String sex, + required List evidenceIds, + required String language, + }); + + Future>> getSuggestions({ + required int age, + required String sex, + required List evidenceIds, + required String language, + }); +} + +class SymptomsCheckerRepoImp implements SymptomsCheckerRepo { + final ApiClient apiClient; + final LoggerService loggerService; + + SymptomsCheckerRepoImp({required this.apiClient, required this.loggerService}); + + @override + Future>> getBodySymptomsByName({required List organNames}) async { + log("GetBodySymptomsByName Request URL: ${ApiConsts.getBodySymptomsByName}"); + log("GetBodySymptomsByName Request Body: ${jsonEncode(organNames)}"); + + Map headers = {'Content-Type': 'application/json', 'Accept': 'text/plain'}; + + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + ApiConsts.getBodySymptomsByName, + apiHeaders: headers, + body: jsonEncode(organNames), + isExternal: true, + isAllowAny: true, + isBodyPlainText: true, + onFailure: (error, statusCode, {messageStatus, failureType}) { + loggerService.logError("GetBodySymptomsByName API Failed: $error"); + log("GetBodySymptomsByName Failed: $error, Status: $statusCode"); + failure = failureType ?? ServerFailure(error); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + log("GetBodySymptomsByName Response Status: $statusCode"); + loggerService.logInfo("GetBodySymptomsByName API Success: $response"); + log("GetBodySymptomsByName Response: $response"); + + BodySymptomResponseModel bodySymptomResponse = BodySymptomResponseModel.fromJson(response); + + apiResponse = GenericApiModel( + messageStatus: messageStatus ?? 1, + statusCode: statusCode, + errorMessage: errorMessage, + data: bodySymptomResponse, + ); + } catch (e, stackTrace) { + loggerService.logError("Error parsing GetBodySymptomsByName response: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Parse Error: $e"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e, stackTrace) { + loggerService.logError("Exception in getBodySymptomsByName: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Exception: $e"); + return Left(UnknownFailure(e.toString())); + } + } + + @override + Future>> getRiskFactors({ + required int age, + required String sex, + required List evidenceIds, + required String language, + }) async { + final Map body = { + "age": { + "value": age, + }, + "sex": sex, + "evidence": evidenceIds.map((id) => {"id": id}).toList(), + "language": language, + }; + + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + ApiConsts.getRiskFactors, + body: body, + isExternal: true, + isAllowAny: true, + onFailure: (error, statusCode, {messageStatus, failureType}) { + log("GetRiskFactors Failed: $error, Status: $statusCode"); + failure = failureType ?? ServerFailure(error); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + log("GetRiskFactors Response: $response"); + + // Parse response if it's a string + final Map responseData = response is String ? jsonDecode(response) : response; + + RiskAndSuggestionsResponseModel riskFactorsResponse = RiskAndSuggestionsResponseModel.fromJson(responseData); + + apiResponse = GenericApiModel( + messageStatus: messageStatus ?? 1, + statusCode: statusCode, + errorMessage: errorMessage, + data: riskFactorsResponse, + ); + } catch (e, stackTrace) { + loggerService.logError("Error parsing GetRiskFactors response: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Parse Error: $e"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e, stackTrace) { + loggerService.logError("Exception in getRiskFactors: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Exception: $e"); + return Left(UnknownFailure(e.toString())); + } + } + + @override + Future>> getSuggestions({ + required int age, + required String sex, + required List evidenceIds, + required String language, + }) async { + final Map body = { + "age": { + "value": age, + }, + "sex": sex, + "evidence": evidenceIds.map((id) => {"id": id}).toList(), + "language": language, + }; + + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + ApiConsts.getSuggestions, + body: body, + isExternal: true, + isAllowAny: true, + onFailure: (error, statusCode, {messageStatus, failureType}) { + log("getSuggestions Failed: $error, Status: $statusCode"); + failure = failureType ?? ServerFailure(error); + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + log("getSuggestions Response: $response"); + + // Parse response if it's a string + final Map responseData = response is String ? jsonDecode(response) : response; + + RiskAndSuggestionsResponseModel riskFactorsResponse = RiskAndSuggestionsResponseModel.fromJson(responseData); + + apiResponse = GenericApiModel( + messageStatus: messageStatus ?? 1, + statusCode: statusCode, + errorMessage: errorMessage, + data: riskFactorsResponse, + ); + } catch (e, stackTrace) { + loggerService.logError("Error parsing getSuggestions response: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Parse Error: $e"); + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e, stackTrace) { + loggerService.logError("Exception in getSuggestions: $e"); + loggerService.logError("StackTrace: $stackTrace"); + log("Exception: $e"); + return Left(UnknownFailure(e.toString())); + } + } +} diff --git a/lib/features/symptoms_checker/symptoms_checker_view_model.dart b/lib/features/symptoms_checker/symptoms_checker_view_model.dart new file mode 100644 index 0000000..da439c6 --- /dev/null +++ b/lib/features/symptoms_checker/symptoms_checker_view_model.dart @@ -0,0 +1,772 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/data/organ_mapping_data.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/organ_model.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/symptoms_checker_repo.dart'; +import 'package:hmg_patient_app_new/services/error_handler_service.dart'; + +class SymptomsCheckerViewModel extends ChangeNotifier { + final SymptomsCheckerRepo symptomsCheckerRepo; + final ErrorHandlerService errorHandlerService; + final AppState appState; + + SymptomsCheckerViewModel({ + required this.symptomsCheckerRepo, + required this.errorHandlerService, + required this.appState, + }); + + // State variables + bool isBodyHidden = false; + BodyView _currentView = BodyView.front; + final Set _selectedOrganIds = {}; + bool _isBottomSheetExpanded = false; + + // Tooltip state + String? _tooltipOrganId; + Timer? _tooltipTimer; + + // API loading states + bool isBodySymptomsLoading = false; + bool isRiskFactorsLoading = false; + bool isSuggestionsLoading = false; + + // API data storage - using API models directly + BodySymptomResponseModel? bodySymptomResponse; + RiskAndSuggestionsResponseModel? riskFactorsResponse; + RiskAndSuggestionsResponseModel? suggestionsResponse; + + // Selected risk factors tracking + final Set _selectedRiskFactorIds = {}; + + // Selected Suggestions tracking + final Set _selectedSuggestionsIds = {}; + + // Selected symptoms tracking (organId -> Set of symptom IDs) + final Map> _selectedSymptomsByOrgan = {}; + + // User Info Flow State + int _userInfoCurrentPage = 0; + bool _isSinglePageEditMode = false; // Track if editing single page or full flow + String? _selectedGender; + DateTime? _dateOfBirth; + int? _selectedAge; + double _selectedHeight = 170; + bool _isHeightCm = true; + double _selectedWeight = 60; + bool _isWeightKg = true; + + // Getters + + bool isPossibleConditionsLoading = false; + + // User Info Getters + int get userInfoCurrentPage => _userInfoCurrentPage; + + bool get isSinglePageEditMode => _isSinglePageEditMode; + + String? get selectedGender => _selectedGender; + + DateTime? get dateOfBirth => _dateOfBirth; + + int? get selectedAge => _selectedAge; + + double? get selectedHeight => _selectedHeight; + + bool get isHeightCm => _isHeightCm; + + double? get selectedWeight => _selectedWeight; + + bool get isWeightKg => _isWeightKg; + + BodyView get currentView => _currentView; + + Set get selectedOrganIds => _selectedOrganIds; + + bool get isBottomSheetExpanded => _isBottomSheetExpanded; + + String? get tooltipOrganId => _tooltipOrganId; + + /// Get organs for current view + List get currentOrgans => OrganData.getOrgansForView(_currentView); + + /// Get all selected organs from both views + List get selectedOrgans { + final allOrgans = [ + ...OrganData.frontViewOrgans, + ...OrganData.backViewOrgans, + ]; + return allOrgans.where((organ) => _selectedOrganIds.contains(organ.id)).toList(); + } + + /// Check if any organs are selected + bool get hasSelectedOrgans => _selectedOrganIds.isNotEmpty; + + /// Get count of selected organs + int get selectedOrgansCount => _selectedOrganIds.length; + + List get organSymptomsResults { + if (bodySymptomResponse?.dataDetails?.result == null) { + return []; + } + return bodySymptomResponse!.dataDetails!.result ?? []; + } + + int get totalSelectedSymptomsCount { + return _selectedSymptomsByOrgan.values.fold(0, (sum, symptomIds) => sum + symptomIds.length); + } + + bool get hasSelectedSymptoms { + return _selectedSymptomsByOrgan.values.any((symptomIds) => symptomIds.isNotEmpty); + } + + /// Get risk factors list + List get riskFactorsList { + return riskFactorsResponse?.dataDetails ?? []; + } + + /// Check if any risk factors are selected + bool get hasSelectedRiskFactors => _selectedRiskFactorIds.isNotEmpty; + + /// Get selected risk factors count + int get selectedRiskFactorsCount => _selectedRiskFactorIds.length; + + /// Check if any risk factors are selected + bool get hasSelectedSuggestions => _selectedSuggestionsIds.isNotEmpty; + + /// Get selected risk factors count + int get selectedSuggestionsCount => _selectedSuggestionsIds.length; + + /// Get risk factors list + List get suggestionsList { + return suggestionsResponse?.dataDetails ?? []; + } + + void toggleView() { + _currentView = _currentView == BodyView.front ? BodyView.back : BodyView.front; + notifyListeners(); + } + + toggleIsBodyHidden() { + isBodyHidden = !isBodyHidden; + notifyListeners(); + } + + void toggleOrganSelection(String organId) { + if (selectedOrganIds.isEmpty && _isBottomSheetExpanded == false) { + toggleBottomSheet(); + } + + if (_selectedOrganIds.contains(organId)) { + _selectedOrganIds.remove(organId); + } else { + _selectedOrganIds.add(organId); + } + + // Show tooltip + _showTooltip(organId); + + if (_selectedOrganIds.isEmpty) { + _isBottomSheetExpanded = false; + notifyListeners(); + } + + notifyListeners(); + } + + void _showTooltip(String organId) { + _tooltipTimer?.cancel(); + + _tooltipOrganId = organId; + notifyListeners(); + + // Hide tooltip after 2 seconds + _tooltipTimer = Timer(const Duration(seconds: 1), () { + _tooltipOrganId = null; + notifyListeners(); + }); + } + + /// Hide tooltip immediately + void hideTooltip() { + _tooltipTimer?.cancel(); + _tooltipOrganId = null; + notifyListeners(); + } + + void removeOrgan(String organId) { + _selectedOrganIds.remove(organId); + notifyListeners(); + if (_selectedOrganIds.isEmpty) { + _isBottomSheetExpanded = false; + notifyListeners(); + } + } + + void clearAllSelections() { + _selectedOrganIds.clear(); + notifyListeners(); + } + + void toggleBottomSheet({bool? value}) { + if (value != null) { + _isBottomSheetExpanded = value; + notifyListeners(); + return; + } + _isBottomSheetExpanded = !_isBottomSheetExpanded; + notifyListeners(); + } + + void setBottomSheetExpanded(bool isExpanded) { + _isBottomSheetExpanded = isExpanded; + notifyListeners(); + } + + bool validateSelection() { + return _selectedOrganIds.isNotEmpty; + } + + List getSelectedOrganIds() { + return _selectedOrganIds.toList(); + } + + List getSelectedOrganNames() { + return selectedOrgans.map((organ) => organ.description).toList(); + } + + Future initializeSymptomGroups({ + Function()? onSuccess, + Function(String)? onError, + }) async { + if (_selectedOrganIds.isEmpty) { + if (onError != null) { + onError('No organs selected'); + } + return; + } + + List organNames = selectedOrgans.map((organ) => organ.name).toList(); + + await getBodySymptomsByName( + organNames: organNames, + onSuccess: (response) { + if (onSuccess != null) { + onSuccess(); + } + }, + onError: (error) { + if (onError != null) { + onError(error); + } + }, + ); + } + + void toggleSymptomSelection(String organId, String symptomId) { + if (!_selectedSymptomsByOrgan.containsKey(organId)) { + _selectedSymptomsByOrgan[organId] = {}; + } + + if (_selectedSymptomsByOrgan[organId]!.contains(symptomId)) { + _selectedSymptomsByOrgan[organId]!.remove(symptomId); + } else { + _selectedSymptomsByOrgan[organId]!.add(symptomId); + } + notifyListeners(); + } + + bool isSymptomSelected(String organId, String symptomId) { + return _selectedSymptomsByOrgan[organId]?.contains(symptomId) ?? false; + } + + List getAllSelectedSymptoms() { + List allSymptoms = []; + + if (bodySymptomResponse?.dataDetails?.result == null) { + return allSymptoms; + } + + for (var organResult in bodySymptomResponse!.dataDetails!.result!) { + String? matchingOrganId; + for (var organ in selectedOrgans) { + if (organ.name == organResult.name) { + matchingOrganId = organ.id; + break; + } + } + + if (matchingOrganId != null && _selectedSymptomsByOrgan.containsKey(matchingOrganId)) { + final selectedIds = _selectedSymptomsByOrgan[matchingOrganId]!; + + if (organResult.bodySymptoms != null) { + for (var symptom in organResult.bodySymptoms!) { + if (symptom.id != null && selectedIds.contains(symptom.id)) { + allSymptoms.add(symptom); + } + } + } + } + } + + return allSymptoms; + } + + void clearAllSymptomSelections() { + _selectedSymptomsByOrgan.clear(); + notifyListeners(); + } + + // Risk Factors Methods + + /// Toggle risk factor selection + void toggleRiskFactorSelection(String riskFactorId) { + if (riskFactorId == "not_applicable") { + // "Not applicable" is mutually exclusive: if selected, clear all others + if (_selectedRiskFactorIds.contains(riskFactorId)) { + _selectedRiskFactorIds.remove(riskFactorId); + } else { + _selectedRiskFactorIds + ..clear() + ..add(riskFactorId); + } + } else { + _selectedRiskFactorIds.remove("not_applicable"); + if (!_selectedRiskFactorIds.add(riskFactorId)) { + _selectedRiskFactorIds.remove(riskFactorId); + } + } + + notifyListeners(); + } + + /// Check if risk factor is selected + bool isRiskFactorSelected(String riskFactorId) { + return _selectedRiskFactorIds.contains(riskFactorId); + } + + /// Get all selected risk factors + List getAllSelectedRiskFactors() { + return riskFactorsList.where((factor) => factor.id != null && _selectedRiskFactorIds.contains(factor.id)).toList(); + } + + /// Clear all risk factor selections + void clearAllRiskFactorSelections() { + _selectedRiskFactorIds.clear(); + notifyListeners(); + } + + /// Fetch risk factors based on selected symptoms + Future fetchRiskFactors({ + Function()? onSuccess, + Function(String)? onError, + }) async { + // Get all selected symptoms + final selectedSymptoms = getAllSelectedSymptoms(); + + if (selectedSymptoms.isEmpty) { + if (onError != null) { + onError('No symptoms selected'); + } + return; + } + + // Validate user info + if (_selectedAge == null || _selectedGender == null) { + if (onError != null) { + onError('User information is incomplete'); + } + return; + } + + // Extract symptom IDs + List evidenceIds = selectedSymptoms.where((s) => s.id != null).map((s) => s.id!).toList(); + + await getRiskFactors( + age: _selectedAge!, + sex: _selectedGender!.toLowerCase(), + evidenceIds: evidenceIds, + language: appState.isArabic() ? 'ar' : 'en', + onSuccess: (response) { + if (onSuccess != null) { + onSuccess(); + } + }, + onError: (error) { + if (onError != null) { + onError(error); + } + }, + ); + } + + /// Call Risk Factors API + Future getRiskFactors({ + required int age, + required String sex, + required List evidenceIds, + required String language, + Function(RiskAndSuggestionsResponseModel)? onSuccess, + Function(String)? onError, + }) async { + isRiskFactorsLoading = true; + notifyListeners(); + + final result = await symptomsCheckerRepo.getRiskFactors( + age: age, + sex: sex, + evidenceIds: evidenceIds, + language: language, + ); + + result.fold( + (failure) async { + isRiskFactorsLoading = false; + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + isRiskFactorsLoading = false; + if (apiResponse.messageStatus == 1 && apiResponse.data != null) { + riskFactorsResponse = apiResponse.data; + + if (riskFactorsResponse != null && riskFactorsResponse!.dataDetails != null) { + RiskAndSuggestionsItemModel riskFactorItem = RiskAndSuggestionsItemModel( + id: "not_applicable", + commonName: "Not Applicable", + name: "Not Applicable", + language: appState.isArabic() ? 'ar' : 'en', + type: null, + ); + riskFactorsResponse!.dataDetails!.add(riskFactorItem); + } + + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data!); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Failed to fetch risk factors'); + } + } + }, + ); + } + + // Suggestions Methods + + /// Toggle suggestions selection + void toggleSuggestionsSelection(String suggestionsId) { + if (suggestionsId == "not_applicable") { + // "Not applicable" is mutually exclusive: if selected, clear all others + if (_selectedSuggestionsIds.contains(suggestionsId)) { + _selectedSuggestionsIds.remove(suggestionsId); + } else { + _selectedSuggestionsIds + ..clear() + ..add(suggestionsId); + } + } else { + _selectedSuggestionsIds.remove("not_applicable"); + if (!_selectedSuggestionsIds.add(suggestionsId)) { + _selectedSuggestionsIds.remove(suggestionsId); + } + } + + notifyListeners(); + } + + /// Check if risk factor is selected + bool isSuggestionsSelected(String riskFactorId) { + return _selectedSuggestionsIds.contains(riskFactorId); + } + + /// Get all selected risk factors + List getAllSelectedSuggestions() { + return suggestionsList.where((factor) => factor.id != null && _selectedSuggestionsIds.contains(factor.id)).toList(); + } + + /// Clear all risk factor selections + void clearAllSuggestionsSelections() { + _selectedSuggestionsIds.clear(); + notifyListeners(); + } + + /// Fetch risk factors based on selected symptoms + Future fetchSuggestions({ + Function()? onSuccess, + Function(String)? onError, + }) async { + // Get all selected symptoms + final selectedSymptoms = getAllSelectedSymptoms(); + + if (selectedSymptoms.isEmpty) { + if (onError != null) { + onError('No symptoms selected'); + } + return; + } + + // Validate user info + if (_selectedAge == null || _selectedGender == null) { + if (onError != null) { + onError('User information is incomplete'); + } + return; + } + + // Extract symptom IDs + List evidenceIds = selectedSymptoms.where((s) => s.id != null).map((s) => s.id!).toList(); + + // Get all selected symptoms + final selectedRisks = getAllSelectedRiskFactors(); + + if (selectedRisks.isNotEmpty) { + List evidenceRisksIds = selectedRisks.where((s) => s.id != null && s.id != "not_applicable").map((s) => s.id!).toList(); + evidenceIds.addAll(evidenceRisksIds); + } + + await getSuggestions( + age: _selectedAge!, + sex: _selectedGender!.toLowerCase(), + evidenceIds: evidenceIds, + language: appState.isArabic() ? 'ar' : 'en', + onSuccess: (response) { + if (onSuccess != null) { + onSuccess(); + } + }, + onError: (error) { + if (onError != null) { + onError(error); + } + }, + ); + } + + /// Call Suggestions API + Future getSuggestions({ + required int age, + required String sex, + required List evidenceIds, + required String language, + Function(RiskAndSuggestionsResponseModel)? onSuccess, + Function(String)? onError, + }) async { + isSuggestionsLoading = true; + notifyListeners(); + + final result = await symptomsCheckerRepo.getSuggestions( + age: age, + sex: sex, + evidenceIds: evidenceIds, + language: language, + ); + + result.fold( + (failure) async { + isSuggestionsLoading = false; + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + isSuggestionsLoading = false; + if (apiResponse.messageStatus == 1 && apiResponse.data != null) { + suggestionsResponse = apiResponse.data; + + if (suggestionsResponse != null && suggestionsResponse!.dataDetails != null) { + RiskAndSuggestionsItemModel riskFactorItem = RiskAndSuggestionsItemModel( + id: "not_applicable", + commonName: "Not Applicable", + name: "Not Applicable", + language: appState.isArabic() ? 'ar' : 'en', + type: null, + ); + suggestionsResponse!.dataDetails!.add(riskFactorItem); + } + + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data!); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Failed to fetch risk factors'); + } + } + }, + ); + } + + void reset() { + _currentView = BodyView.front; + _selectedOrganIds.clear(); + _selectedSymptomsByOrgan.clear(); + _selectedRiskFactorIds.clear(); + _selectedSuggestionsIds.clear(); + bodySymptomResponse = null; + riskFactorsResponse = null; + suggestionsResponse = null; + _isBottomSheetExpanded = false; + _tooltipTimer?.cancel(); + _tooltipOrganId = null; + // Reset user info flow + _userInfoCurrentPage = 0; + _isSinglePageEditMode = false; + _selectedGender = null; + _dateOfBirth = null; + _selectedAge = null; + _selectedHeight = 170; + _isHeightCm = true; + _selectedWeight = 60; + _isWeightKg = true; + notifyListeners(); + } + + // User Info Flow Methods + + /// Set current page in user info flow + void setUserInfoPage(int page, {bool isSinglePageEdit = false}) { + _userInfoCurrentPage = page; + _isSinglePageEditMode = isSinglePageEdit; + notifyListeners(); + } + + /// Set single page edit mode + void setSinglePageEditMode(bool isSingleEdit) { + _isSinglePageEditMode = isSingleEdit; + notifyListeners(); + } + + /// Navigate to next page in user info flow + void nextUserInfoPage() { + if (_userInfoCurrentPage < 3) { + _userInfoCurrentPage++; + notifyListeners(); + } + } + + /// Navigate to previous page in user info flow + void previousUserInfoPage() { + if (_userInfoCurrentPage > 0) { + _userInfoCurrentPage--; + notifyListeners(); + } + } + + /// Set selected gender + void setGender(String gender) { + _selectedGender = gender; + notifyListeners(); + } + + /// Set selected age + void setAge(int age) { + _selectedAge = age; + notifyListeners(); + } + + /// Set date of birth + void setDateOfBirth(DateTime dateOfBirth) { + _dateOfBirth = dateOfBirth; + // Calculate age from date of birth + final now = DateTime.now(); + int age = now.year - dateOfBirth.year; + if (now.month < dateOfBirth.month || (now.month == dateOfBirth.month && now.day < dateOfBirth.day)) { + age--; + } + _selectedAge = age; + notifyListeners(); + } + + /// Set selected height + void setHeight(double height, bool isCm) { + _selectedHeight = height; + _isHeightCm = isCm; + notifyListeners(); + } + + /// Set selected weight + void setWeight(double weight, bool isKg) { + _selectedWeight = weight; + _isWeightKg = isKg; + notifyListeners(); + } + + /// Check if user info page is last + bool get isUserInfoLastPage => _userInfoCurrentPage == 3; + + bool get isUserInfoFirstPage => _userInfoCurrentPage == 0; + + /// Validate and submit user info + Map getUserInfoData() { + return { + 'gender': _selectedGender, + 'dateOfBirth': _dateOfBirth?.toIso8601String(), + 'age': _selectedAge, + 'height': _selectedHeight, + 'heightUnit': _isHeightCm ? 'cm' : 'ft', + 'weight': _selectedWeight, + 'weightUnit': _isWeightKg ? 'kg' : 'lbs', + }; + } + + Future getBodySymptomsByName({ + required List organNames, + Function(BodySymptomResponseModel)? onSuccess, + Function(String)? onError, + }) async { + isBodySymptomsLoading = true; + notifyListeners(); + + final result = await symptomsCheckerRepo.getBodySymptomsByName( + organNames: organNames, + ); + + result.fold( + (failure) async { + isBodySymptomsLoading = false; + notifyListeners(); + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + isBodySymptomsLoading = false; + if (apiResponse.messageStatus == 1 && apiResponse.data != null) { + bodySymptomResponse = apiResponse.data; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse.data!); + } + } else { + notifyListeners(); + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Failed to fetch symptoms'); + } + } + }, + ); + } + + @override + void dispose() { + _tooltipTimer?.cancel(); + super.dispose(); + } +} diff --git a/lib/features/water_monitor/models/insert_user_activity_request_model.dart b/lib/features/water_monitor/models/insert_user_activity_request_model.dart new file mode 100644 index 0000000..a0af649 --- /dev/null +++ b/lib/features/water_monitor/models/insert_user_activity_request_model.dart @@ -0,0 +1,26 @@ +class InsertUserActivityRequestModel { + String? identificationNo; + String? mobileNumber; + num? quantityIntake; + + InsertUserActivityRequestModel({ + this.identificationNo, + this.mobileNumber, + this.quantityIntake, + }); + + Map toJson() { + final map = {}; + if (identificationNo != null) map['IdentificationNo'] = identificationNo; + if (mobileNumber != null) map['MobileNumber'] = mobileNumber; + if (quantityIntake != null) map['QuantityIntake'] = quantityIntake; + return map; + } + + factory InsertUserActivityRequestModel.fromJson(Map json) => InsertUserActivityRequestModel( + identificationNo: json['IdentificationNo']?.toString(), + mobileNumber: json['MobileNumber']?.toString(), + quantityIntake: json['QuantityIntake'], + ); +} + diff --git a/lib/features/water_monitor/models/undo_user_activity_request_model.dart b/lib/features/water_monitor/models/undo_user_activity_request_model.dart new file mode 100644 index 0000000..01dbd92 --- /dev/null +++ b/lib/features/water_monitor/models/undo_user_activity_request_model.dart @@ -0,0 +1,26 @@ +class UndoUserActivityRequestModel { + num? progress; + String? mobileNumber; + String? identificationNo; + + UndoUserActivityRequestModel({ + this.progress, + this.mobileNumber, + this.identificationNo, + }); + + Map toJson() { + final map = {}; + if (progress != null) map['Progress'] = progress; + if (mobileNumber != null) map['MobileNumber'] = mobileNumber; + if (identificationNo != null) map['IdentificationNo'] = identificationNo; + return map; + } + + factory UndoUserActivityRequestModel.fromJson(Map json) => UndoUserActivityRequestModel( + progress: json['Progress'], + mobileNumber: json['MobileNumber']?.toString(), + identificationNo: json['IdentificationNo']?.toString(), + ); +} + diff --git a/lib/features/water_monitor/models/update_user_detail_request_model.dart b/lib/features/water_monitor/models/update_user_detail_request_model.dart new file mode 100644 index 0000000..33dbbb2 --- /dev/null +++ b/lib/features/water_monitor/models/update_user_detail_request_model.dart @@ -0,0 +1,88 @@ +class UpdateUserDetailRequestModel { + // User detail fields + String? activityID; + String? dOB; + String? email; + String? firstName; + String? lastName; + String? firstNameN; + String? middleName; + String? middleNameN; + String? lastNameN; + String? gender; + num? height; + bool? isHeightInCM; + bool? isWeightInKG; + String? zipCode; + num? weight; + bool? isNotificationOn; + String? mobileNumber; + String? identificationNo; + + UpdateUserDetailRequestModel({ + this.activityID, + this.dOB, + this.email, + this.firstName, + this.lastName, + this.firstNameN, + this.middleName, + this.middleNameN, + this.lastNameN, + this.gender, + this.height, + this.isHeightInCM, + this.isWeightInKG, + this.zipCode, + this.weight, + this.isNotificationOn, + this.mobileNumber, + this.identificationNo, + }); + + Map toJson() { + final map = {}; + + // User detail fields + if (activityID != null) map['ActivityID'] = activityID; + if (dOB != null) map['DOB'] = dOB; + if (email != null) map['Email'] = email; + if (firstName != null) map['FirstName'] = firstName; + if (lastName != null) map['LastName'] = lastName; + if (firstNameN != null) map['FirstNameN'] = firstNameN; + if (middleName != null) map['MiddleName'] = middleName; + if (middleNameN != null) map['MiddleNameN'] = middleNameN; + if (lastNameN != null) map['LastNameN'] = lastNameN; + if (gender != null) map['Gender'] = gender; + if (height != null) map['Height'] = height; + if (isHeightInCM != null) map['IsHeightInCM'] = isHeightInCM; + if (isWeightInKG != null) map['IsWeightInKG'] = isWeightInKG; + if (zipCode != null) map['ZipCode'] = zipCode; + if (weight != null) map['Weight'] = weight; + if (isNotificationOn != null) map['IsNotificationOn'] = isNotificationOn; + if (mobileNumber != null) map['MobileNumber'] = mobileNumber; + if (identificationNo != null) map['IdentificationNo'] = identificationNo; + return map; + } + + factory UpdateUserDetailRequestModel.fromJson(Map json) => UpdateUserDetailRequestModel( + activityID: json['ActivityID']?.toString(), + dOB: json['DOB']?.toString(), + email: json['Email']?.toString(), + firstName: json['FirstName']?.toString(), + lastName: json['LastName']?.toString(), + firstNameN: json['FirstNameN']?.toString(), + middleName: json['MiddleName']?.toString(), + middleNameN: json['MiddleNameN']?.toString(), + lastNameN: json['LastNameN']?.toString(), + gender: json['Gender']?.toString(), + height: json['Height'], + isHeightInCM: json['IsHeightInCM'] as bool?, + isWeightInKG: json['IsWeightInKG'] as bool?, + zipCode: json['ZipCode']?.toString(), + weight: json['Weight'], + isNotificationOn: json['IsNotificationOn'] as bool?, + mobileNumber: json['MobileNumber']?.toString(), + identificationNo: json['IdentificationNo']?.toString(), + ); +} diff --git a/lib/features/water_monitor/models/user_progress_models.dart b/lib/features/water_monitor/models/user_progress_models.dart new file mode 100644 index 0000000..667653e --- /dev/null +++ b/lib/features/water_monitor/models/user_progress_models.dart @@ -0,0 +1,111 @@ +/// Model for today's water progress data +class UserProgressForTodayModel { + num? quantityConsumed; + num? percentageConsumed; + num? percentageLeft; + num? quantityLimit; + + UserProgressForTodayModel({ + this.quantityConsumed, + this.percentageConsumed, + this.percentageLeft, + this.quantityLimit, + }); + + factory UserProgressForTodayModel.fromJson(Map json) => UserProgressForTodayModel( + quantityConsumed: json['QuantityConsumed'], + percentageConsumed: json['PercentageConsumed'], + percentageLeft: json['PercentageLeft'], + quantityLimit: json['QuantityLimit'], + ); + + Map toJson() { + return { + 'QuantityConsumed': quantityConsumed, + 'PercentageConsumed': percentageConsumed, + 'PercentageLeft': percentageLeft, + 'QuantityLimit': quantityLimit, + }; + } +} + +/// Model for weekly water progress data +class UserProgressForWeekModel { + int? dayNumber; + String? dayDate; + String? dayName; + num? percentageConsumed; + + UserProgressForWeekModel({ + this.dayNumber, + this.dayDate, + this.dayName, + this.percentageConsumed, + }); + + factory UserProgressForWeekModel.fromJson(Map json) => UserProgressForWeekModel( + dayNumber: json['DayNumber'] as int?, + dayDate: json['DayDate']?.toString(), + dayName: json['DayName']?.toString(), + percentageConsumed: json['PercentageConsumed'], + ); + + Map toJson() { + return { + 'DayNumber': dayNumber, + 'DayDate': dayDate, + 'DayName': dayName, + 'PercentageConsumed': percentageConsumed, + }; + } +} + +/// Model for monthly water progress data +class UserProgressForMonthModel { + int? monthNumber; + String? monthName; + num? percentageConsumed; + + UserProgressForMonthModel({ + this.monthNumber, + this.monthName, + this.percentageConsumed, + }); + + factory UserProgressForMonthModel.fromJson(Map json) => UserProgressForMonthModel( + monthNumber: json['MonthNumber'] as int?, + monthName: json['MonthName']?.toString(), + percentageConsumed: json['PercentageConsumed'], + ); + + Map toJson() { + return { + 'MonthNumber': monthNumber, + 'MonthName': monthName, + 'PercentageConsumed': percentageConsumed, + }; + } +} + +/// Model for user progress history data +class UserProgressHistoryModel { + num? quantity; + String? createdDate; + + UserProgressHistoryModel({ + this.quantity, + this.createdDate, + }); + + factory UserProgressHistoryModel.fromJson(Map json) => UserProgressHistoryModel( + quantity: json['Quantity'], + createdDate: json['CreatedDate']?.toString(), + ); + + Map toJson() { + return { + 'Quantity': quantity, + 'CreatedDate': createdDate, + }; + } +} diff --git a/lib/features/water_monitor/models/water_cup_model.dart b/lib/features/water_monitor/models/water_cup_model.dart new file mode 100644 index 0000000..b86fae4 --- /dev/null +++ b/lib/features/water_monitor/models/water_cup_model.dart @@ -0,0 +1,47 @@ +class WaterCupModel { + final String id; + final String name; + final int capacityMl; + final String iconPath; // or use IconData if you prefer + final bool isDefault; + + WaterCupModel({ + required this.id, + required this.name, + required this.capacityMl, + required this.iconPath, + this.isDefault = false, + }); + + WaterCupModel copyWith({ + String? id, + String? name, + int? capacityMl, + String? iconPath, + bool? isDefault, + }) { + return WaterCupModel( + id: id ?? this.id, + name: name ?? this.name, + capacityMl: capacityMl ?? this.capacityMl, + iconPath: iconPath ?? this.iconPath, + isDefault: isDefault ?? this.isDefault, + ); + } + + Map toJson() => { + 'id': id, + 'name': name, + 'capacityMl': capacityMl, + 'iconPath': iconPath, + 'isDefault': isDefault, + }; + + factory WaterCupModel.fromJson(Map json) => WaterCupModel( + id: json['id'], + name: json['name'], + capacityMl: json['capacityMl'], + iconPath: json['iconPath'], + isDefault: json['isDefault'] ?? false, + ); +} diff --git a/lib/features/water_monitor/water_monitor_repo.dart b/lib/features/water_monitor/water_monitor_repo.dart new file mode 100644 index 0000000..14a74a7 --- /dev/null +++ b/lib/features/water_monitor/water_monitor_repo.dart @@ -0,0 +1,333 @@ +import 'dart:developer'; + +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/features/water_monitor/models/insert_user_activity_request_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/undo_user_activity_request_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/update_user_detail_request_model.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 WaterMonitorRepo { + /// Fetch user details for water monitoring. + /// The request will include the standard payload injected by ApiClient and + /// additionally these three parameters: Progress, MobileNumber, IdentificationNo. + Future>> getUserDetailsForWaterMonitoring({ + required num progress, + required String mobileNumber, + required String identificationNo, + }); + + /// Fetch user progress for water monitoring (H2O_GetUserProgress). + Future>> getUserProgressForWaterMonitoring({ + required ProgressType progressType, + required String mobileNumber, + required String identificationNo, + }); + + /// Update user details for water monitoring. + Future>> updateOrInsertUserDetailForWaterMonitoring( + {required UpdateUserDetailRequestModel requestModel, bool isUpdate = false}); + + /// Insert user activity (water intake). + Future>> insertUserActivity({ + required InsertUserActivityRequestModel requestModel, + }); + + /// Undo last user activity. + Future>> undoUserActivity({ + required UndoUserActivityRequestModel requestModel, + }); +} + +class WaterMonitorRepoImp implements WaterMonitorRepo { + final ApiClient apiClient; + final LoggerService loggerService; + + WaterMonitorRepoImp({required this.loggerService, required this.apiClient}); + + @override + Future>> getUserDetailsForWaterMonitoring({ + required num progress, + required String mobileNumber, + required String identificationNo, + }) async { + Map request = { + "Progress": progress, + "MobileNumber": mobileNumber, + "IdentificationNo": identificationNo, + }; + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post( + ApiConsts.h2oGetUserDetail, + body: request, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + // Extract only the specific key from the API response as requested + dynamic extracted; + if (response is Map && response.containsKey('UserDetailData_New')) { + extracted = response['UserDetailData_New']; + } else { + extracted = null; + } + + 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>> getUserProgressForWaterMonitoring({ + required ProgressType progressType, + required String mobileNumber, + required String identificationNo, + }) async { + final progressValue = progressType == ProgressType.today ? 1 : (progressType == ProgressType.week ? 2 : 3); + + Map request = { + "Progress": progressValue, + "MobileNumber": mobileNumber, + "IdentificationNo": identificationNo, + }; + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post( + ApiConsts.h2oGetUserProgress, + body: request, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + // Extract progress data and history data + dynamic extracted; + dynamic historyData; + + if (response is Map) { + // Extract history data (available for all progress types) + if (response.containsKey('UserProgressHistoryData')) { + historyData = response['UserProgressHistoryData']; + } + + // Extract progress data based on type + switch (progressType) { + case ProgressType.today: + if (response.containsKey('UserProgressForTodayData')) { + extracted = response['UserProgressForTodayData']; + } + break; + case ProgressType.week: + if (response.containsKey('UserProgressForWeekData')) { + extracted = response['UserProgressForWeekData']; + } + break; + case ProgressType.month: + if (response.containsKey('UserProgressForMonthData')) { + extracted = response['UserProgressForMonthData']; + } + break; + } + + // fallbacks + if (extracted == null) { + if (response.containsKey('UserProgress')) { + extracted = response['UserProgress']; + } else if (response.containsKey('UserProgressData_New')) { + extracted = response['UserProgressData_New']; + } else { + extracted = response; + } + } + } else { + extracted = response; + } + + // Package both progress data and history data + final combinedData = { + 'progressData': extracted, + 'historyData': historyData, + }; + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: combinedData, + ); + } 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>> updateOrInsertUserDetailForWaterMonitoring({ + required UpdateUserDetailRequestModel requestModel, + bool isUpdate = false, + }) async { + try { + GenericApiModel? apiResponse; + Failure? failure; + + // Use different endpoint based on isUpdate flag + final endpoint = isUpdate ? ApiConsts.h2oUpdateUserDetail : ApiConsts.h2oInsertUserDetailsNew; + await apiClient.post( + endpoint, + body: requestModel.toJson(), + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + dynamic extracted; + if (response is Map && response.containsKey('UserDetailData_New')) { + extracted = response['UserDetailData_New']; + } else { + extracted = null; + } + + 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>> insertUserActivity({ + required InsertUserActivityRequestModel requestModel, + }) async { + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + ApiConsts.h2oInsertUserActivity, + body: requestModel.toJson(), + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + // Extract UserProgressForTodayData from the response + dynamic extracted; + if (response is Map && response.containsKey('UserProgressForTodayData')) { + extracted = response['UserProgressForTodayData']; + } 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>> undoUserActivity({ + required UndoUserActivityRequestModel requestModel, + }) async { + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + ApiConsts.h2oUndoUserActivity, + body: requestModel.toJson(), + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + log("response h2oUndoUserActivity: ${response.toString()}"); + // Extract UserProgressForTodayData from the response + dynamic extracted; + if (response is Map && response.containsKey('UserProgressForTodayData')) { + extracted = response['UserProgressForTodayData']; + } 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())); + } + } +} diff --git a/lib/features/water_monitor/water_monitor_view_model.dart b/lib/features/water_monitor/water_monitor_view_model.dart new file mode 100644 index 0000000..01167fe --- /dev/null +++ b/lib/features/water_monitor/water_monitor_view_model.dart @@ -0,0 +1,1340 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/cache_consts.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/insert_user_activity_request_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/undo_user_activity_request_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/update_user_detail_request_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/user_progress_models.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/water_cup_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_repo.dart'; +import 'package:hmg_patient_app_new/routes/app_routes.dart'; +import 'package:hmg_patient_app_new/services/cache_service.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/services/notification_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class WaterMonitorViewModel extends ChangeNotifier { + WaterMonitorRepo waterMonitorRepo; + + WaterMonitorViewModel({required this.waterMonitorRepo}); + + // Controllers + final TextEditingController nameController = TextEditingController(); + final TextEditingController heightController = TextEditingController(); + final TextEditingController weightController = TextEditingController(); + final TextEditingController ageController = TextEditingController(); + + // Units + final List heightUnits = ['cm', 'm', 'ft', 'in']; + final List weightUnits = ['kg', 'lb']; + + // Selected values + String _selectedHeightUnit = 'cm'; + String _selectedWeightUnit = 'kg'; + String _selectedActivityLevel = 'Lightly active'; + String _selectedNumberOfReminders = '3 Time'; + String _selectedGender = "Male"; + + // ConsumptionScreen + + String _selectedDuration = "Daily"; + bool _isGraphView = true; + + // Validation error message + String? _validationError; + + // Getters + String? get validationError => _validationError; + + String get selectedHeightUnit => _selectedHeightUnit; + + String get selectedWeightUnit => _selectedWeightUnit; + + String get selectedActivityLevel => _selectedActivityLevel; + + String get selectedNumberOfReminders => _selectedNumberOfReminders; + + String get selectedGender => _selectedGender; + + String get selectedDurationFilter => _selectedDuration; + + bool get isGraphView => _isGraphView; + + // Activity level options + List get activityLevels => + ["Almost Inactive (no exercise)", "Lightly active", "Lightly active (1-3) days per week", "Super active (very hard exercise)"]; + + // Reminder options + List get reminderOptions => ["1 Time", "2 Time", "3 Time", "4 Time", "5 Time", "6 Time"]; + + // Gender options + List get genderOptions => ["Male", "Female"]; + +//Duration Options + List get durationFilters => ["Daily", "Weekly", "Monthly"]; + + // Network/data + final AppState _appState = GetIt.instance(); + final NavigationService _navigationService = GetIt.instance(); + final CacheService _cacheService = GetIt.instance(); + + bool _isLoading = false; + dynamic _userDetailData; + bool _isWaterReminderEnabled = false; + + // Progress data lists + List _todayProgressList = []; + List _weekProgressList = []; + List _monthProgressList = []; + List _historyList = []; + + bool get isLoading => _isLoading; + + dynamic get userDetailData => _userDetailData; + + bool get isWaterReminderEnabled => _isWaterReminderEnabled; + + // Getters for progress data + List get todayProgressList => _todayProgressList; + + List get weekProgressList => _weekProgressList; + + List get monthProgressList => _monthProgressList; + + List get historyList => _historyList; + + // Get current progress list based on selected duration + dynamic get currentProgressData { + switch (_selectedDuration) { + case 'Daily': + return _todayProgressList; + case 'Weekly': + return _weekProgressList; + case 'Monthly': + return _monthProgressList; + default: + return _todayProgressList; + } + } + + // Initialize method to be called when needed + Future initialize() async { + _initializeDefaultCups(); + _loadReminderEnabledState(); + await fetchUserDetailsForMonitoring(); + // Fetch daily progress to get consumed amount and daily goal + await fetchUserProgressForMonitoring(); + } + + /// Load reminder enabled state from cache + void _loadReminderEnabledState() { + _isWaterReminderEnabled = _cacheService.getBool(key: CacheConst.waterReminderEnabled) ?? false; + log('Water reminder enabled state loaded: $_isWaterReminderEnabled'); + } + + /// Map selected duration to ProgressType enum + ProgressType _getProgressTypeFromDuration() { + switch (_selectedDuration) { + case 'Daily': + return ProgressType.today; + case 'Weekly': + return ProgressType.week; + case 'Monthly': + return ProgressType.month; + default: + return ProgressType.today; + } + } + + /// Map selected duration to ProgressType enum + int _getProgressIdFromDuration() { + switch (_selectedDuration) { + case 'Daily': + return 1; + case 'Weekly': + return 2; + case 'Monthly': + return 3; + default: + return 1; + } + } + + /// Fetch user progress data based on selected duration + Future fetchUserProgressForMonitoring() async { + try { + _isLoading = true; + notifyListeners(); + + final authenticated = _appState.getAuthenticatedUser(); + if (authenticated == null) { + _isLoading = false; + notifyListeners(); + return; + } + + final mobile = (authenticated.mobileNumber ?? '').replaceAll('+', '').replaceFirst(RegExp(r'^0'), ''); + final identification = authenticated.patientIdentificationNo ?? ''; + final progressType = _getProgressTypeFromDuration(); + + final result = await waterMonitorRepo.getUserProgressForWaterMonitoring( + progressType: progressType, + mobileNumber: mobile, + identificationNo: identification, + ); + + result.fold((failure) { + log('Error fetching user progress: ${failure.message}'); + }, (apiModel) { + log("User Progress Data ($_selectedDuration): ${apiModel.data.toString()}"); + + // Parse the response based on progress type + try { + // Extract progressData and historyData from combined response + dynamic progressData; + dynamic historyData; + + if (apiModel.data is Map && apiModel.data.containsKey('progressData')) { + progressData = apiModel.data['progressData']; + historyData = apiModel.data['historyData']; + } else { + // Fallback to old structure + progressData = apiModel.data; + } + + // Parse history data (available for all progress types, especially for daily) + if (historyData != null && historyData is List) { + _historyList.clear(); + for (var item in historyData) { + if (item is Map) { + _historyList.add(UserProgressHistoryModel.fromJson(item as Map)); + } + } + log('History data parsed: ${_historyList.length} items'); + } + + if (progressData != null && progressData is List) { + switch (progressType) { + case ProgressType.today: + _todayProgressList.clear(); + for (var item in progressData) { + if (item is Map) { + _todayProgressList.add(UserProgressForTodayModel.fromJson(item as Map)); + } + } + + // Update consumed amount and daily goal from API response + if (_todayProgressList.isNotEmpty) { + final todayData = _todayProgressList.first; + if (todayData.quantityConsumed != null) { + _totalConsumedMl = todayData.quantityConsumed!.toInt(); + log('Updated consumed from API: $_totalConsumedMl ml'); + } + if (todayData.quantityLimit != null) { + _dailyGoalMl = todayData.quantityLimit!.toInt(); + log('Updated daily goal from API: $_dailyGoalMl ml'); + } + } + + break; + + case ProgressType.week: + _weekProgressList.clear(); + for (var item in progressData) { + if (item is Map) { + _weekProgressList.add(UserProgressForWeekModel.fromJson(item as Map)); + } + } + log('Week Progress: ${_weekProgressList.length} items'); + break; + + case ProgressType.month: + _monthProgressList.clear(); + for (var item in progressData) { + if (item is Map) { + _monthProgressList.add(UserProgressForMonthModel.fromJson(item as Map)); + } + } + log('Month Progress: ${_monthProgressList.length} items'); + break; + } + } + } catch (e) { + log('Error parsing progress data: $e'); + } + }); + } catch (e) { + log('Exception in fetchUserProgressForMonitoring: $e'); + } finally { + _isLoading = false; + notifyListeners(); + } + } + + Future fetchUserDetailsForMonitoring({Function(dynamic)? onSuccess, Function(String)? onError}) async { + try { + _isLoading = true; + + notifyListeners(); + + final authenticated = _appState.getAuthenticatedUser(); + if (authenticated == null) { + _isLoading = false; + notifyListeners(); + if (onError != null) onError('User not authenticated'); + return; + } + final mobile = (authenticated.mobileNumber ?? '').replaceAll('+', ''); + final identification = authenticated.patientIdentificationNo ?? ''; + + final result = await waterMonitorRepo.getUserDetailsForWaterMonitoring( + progress: 1, + mobileNumber: mobile, + identificationNo: identification, + ); + + result.fold((failure) { + _userDetailData = null; + if (onError != null) onError(failure.message); + }, (apiModel) { + _userDetailData = apiModel.data; + + // Populate form fields from the fetched data + if (_userDetailData != null) { + _populateFormFields(_userDetailData); + } + + if (onSuccess != null) onSuccess(_userDetailData); + }); + } catch (e) { + _userDetailData = null; + if (onError != null) onError(e.toString()); + } finally { + _isLoading = false; + notifyListeners(); + + if (_userDetailData == null) { + try { + _navigationService.pushAndReplace(AppRoutes.waterMonitorSettingsScreen); + } catch (navErr) { + log('Navigation to water monitor settings failed: $navErr'); + } + } + } + } + + /// Populates form fields from the API response data + void _populateFormFields(dynamic data) { + if (data == null) return; + + try { + // Parse the response and populate fields + if (data is Map) { + // Name + if (data['FirstName'] != null) { + nameController.text = data['FirstName'].toString(); + } + + // Gender + if (data['Gender'] != null) { + final gender = data['Gender'].toString(); + if (gender == 'M' || gender == 'Male') { + _selectedGender = 'Male'; + } else if (gender == 'F' || gender == 'Female') { + _selectedGender = 'Female'; + } + } + + // Age - calculate from DOB if available + if (data['DOB'] != null) { + final dob = data['DOB'].toString(); + final age = _calculateAgeFromDOB(dob); + if (age > 0) { + ageController.text = age.toString(); + } + } + + // Height + if (data['Height'] != null) { + heightController.text = data['Height'].toString(); + // Set height unit + if (data['IsHeightInCM'] != null) { + _selectedHeightUnit = data['IsHeightInCM'] == true ? 'cm' : 'in'; + } + } + + // Weight + if (data['Weight'] != null) { + weightController.text = data['Weight'].toString(); + // Set weight unit + if (data['IsWeightInKG'] != null) { + _selectedWeightUnit = data['IsWeightInKG'] == true ? 'kg' : 'lb'; + } + } + + // Activity Level - map ActivityID to activity level + if (data['ActivityID'] != null) { + final activityId = data['ActivityID'].toString(); + _selectedActivityLevel = _getActivityLevelFromID(activityId); + } + + // Number of reminders (if available in response) + // Note: This may not be in the response, keeping default if not present + + notifyListeners(); + } + } catch (e) { + log('Error populating form fields: $e'); + } + } + + /// Calculate age from DOB string in format /Date(milliseconds+0300)/ + int _calculateAgeFromDOB(String dobString) { + try { + // Parse the /Date(milliseconds+0300)/ format + final regex = RegExp(r'\/Date\((\d+)'); + final match = regex.firstMatch(dobString); + if (match != null) { + final milliseconds = int.tryParse(match.group(1)!); + if (milliseconds != null) { + final dob = DateTime.fromMillisecondsSinceEpoch(milliseconds); + final now = DateTime.now(); + int age = now.year - dob.year; + if (now.month < dob.month || (now.month == dob.month && now.day < dob.day)) { + age--; + } + return age; + } + } + } catch (e) { + log('Error calculating age from DOB: $e'); + } + return 0; + } + + /// Map activity ID to activity level string + String _getActivityLevelFromID(String activityId) { + switch (activityId) { + case '1': + return "Almost Inactive (no exercise)"; + case '2': + return "Lightly active"; + case '3': + return "Lightly active (1-3) days per week"; + case '4': + return "Super active (very hard exercise)"; + default: + return "Lightly active"; + } + } + + /// Populate form fields from authenticated user data (for new users) + void populateFromAuthenticatedUser() { + try { + final authenticated = _appState.getAuthenticatedUser(); + if (authenticated == null) return; + + // Name - use firstName if available + if (authenticated.firstName != null && authenticated.firstName!.isNotEmpty) { + nameController.text = authenticated.firstName!; + } + + // Gender - map from patient gender + if (authenticated.gender != null) { + final gender = (authenticated.gender == 1 ? 'male' : 'female').toLowerCase(); + if (gender.contains('m') || gender == 'male') { + _selectedGender = 'Male'; + } else if (gender.contains('f') || gender == 'female') { + _selectedGender = 'Female'; + } + } + + // Age - calculate from DOB if available + if (authenticated.dateofBirth != null && authenticated.dateofBirth!.isNotEmpty) { + final age = _calculateAgeFromDOB(authenticated.dateofBirth!); + if (age > 0) { + ageController.text = age.toString(); + } + } + + // Set default units and activity level + _selectedHeightUnit = 'cm'; + _selectedWeightUnit = 'kg'; + _selectedActivityLevel = 'Lightly active'; + _selectedNumberOfReminders = '3 Time'; + + log('Form fields populated from authenticated user: ${authenticated.firstName}'); + notifyListeners(); + } catch (e) { + log('Error populating from authenticated user: $e'); + } + } + + // Reset all fields to default + void resetFields() { + nameController.clear(); + heightController.clear(); + weightController.clear(); + ageController.clear(); + _selectedHeightUnit = 'cm'; + _selectedWeightUnit = 'kg'; + _selectedActivityLevel = 'Lightly active'; + _selectedNumberOfReminders = '3 Time'; + _selectedGender = "Male"; + notifyListeners(); + } + + // Setters with notification + void setFilterDuration(String duration) async { + _selectedDuration = duration; + notifyListeners(); + // Fetch new progress data when duration filter changes + await fetchUserProgressForMonitoring(); + } + + // Setters with notification + void setGraphView(bool value) { + _isGraphView = value; + notifyListeners(); + } + + // Setters with notification + void setGender(String gender) { + _selectedGender = gender; + notifyListeners(); + } + + void setHeightUnit(String unit) { + _selectedHeightUnit = unit; + notifyListeners(); + } + + void setWeightUnit(String unit) { + _selectedWeightUnit = unit; + notifyListeners(); + } + + void setActivityLevel(String level) { + _selectedActivityLevel = level; + notifyListeners(); + } + + void setNumberOfReminders(String number) { + _selectedNumberOfReminders = number; + notifyListeners(); + } + + // Validation methods + bool get isValid { + _validationError = null; // Clear previous error + + if (nameController.text.trim().isEmpty) { + _validationError = 'Name is required'; + return false; + } + + if (ageController.text.trim().isEmpty) { + _validationError = 'Age is required'; + return false; + } + + if (!_isAgeValid()) { + _validationError = validateAge(); + return false; + } + + if (heightController.text.trim().isEmpty) { + _validationError = 'Height is required'; + return false; + } + + if (!_isHeightValid()) { + _validationError = validateHeight(); + return false; + } + + if (weightController.text.trim().isEmpty) { + _validationError = 'Weight is required'; + return false; + } + + if (!_isWeightValid()) { + _validationError = validateWeight(); + return false; + } + + return true; + } + + bool _isAgeValid() { + final age = int.tryParse(ageController.text.trim()); + return age != null && age >= 11 && age <= 120; + } + + bool _isHeightValid() { + final height = double.tryParse(heightController.text.trim()); + return height != null && height > 0; + } + + bool _isWeightValid() { + final weight = double.tryParse(weightController.text.trim()); + return weight != null && weight > 0; + } + + String? validateAge() { + if (ageController.text.trim().isEmpty) { + return 'Age is required'.needTranslation; + } + final age = int.tryParse(ageController.text.trim()); + if (age == null) { + return 'Invalid age'.needTranslation; + } + if (age < 11 || age > 120) { + return 'Age must be between 11 and 120'.needTranslation; + } + return null; + } + + String? validateHeight() { + if (heightController.text.trim().isEmpty) { + return 'Height is required'.needTranslation; + } + final height = double.tryParse(heightController.text.trim()); + if (height == null || height <= 0) { + return 'Invalid height'.needTranslation; + } + return null; + } + + String? validateWeight() { + if (weightController.text.trim().isEmpty) { + return 'Weight is required'.needTranslation; + } + final weight = double.tryParse(weightController.text.trim()); + if (weight == null || weight <= 0) { + return 'Invalid weight'.needTranslation; + } + return null; + } + + String _getApiCompatibleGender() { + if (_selectedGender == "Female") { + return "F"; + } + return "M"; + } + + // Save settings + Future saveSettings() async { + if (!isValid) { + notifyListeners(); // Notify so error can be read + return false; + } + + try { + _isLoading = true; + _validationError = null; + notifyListeners(); + + // Determine if this is an update or insert + final isUpdate = _userDetailData != null; + + // Get authenticated user for mobile number and identification number + final authenticated = _appState.getAuthenticatedUser(); + final mobile = (authenticated?.mobileNumber?.replaceAll('+', '') ?? '').replaceFirst("0", ""); + final identification = authenticated?.patientIdentificationNo ?? ''; + final zipCode = authenticated?.zipCode ?? '966'; + final email = authenticated?.emailAddress ?? ''; + + // Get activity ID based on selected activity level + String activityID = _getActivityID(); + + // Create request model with user detail fields only + final requestModel = UpdateUserDetailRequestModel( + firstName: nameController.text.trim(), + lastName: nameController.text.trim(), + firstNameN: nameController.text.trim(), + middleName: '', + middleNameN: '', + lastNameN: nameController.text.trim(), + gender: _getApiCompatibleGender(), + dOB: _calculateDOBFromAge(), + height: double.tryParse(heightController.text.trim()), + isHeightInCM: _selectedHeightUnit == 'cm', + weight: double.tryParse(weightController.text.trim()), + isWeightInKG: _selectedWeightUnit == 'kg', + activityID: activityID, + isNotificationOn: true, + mobileNumber: mobile, + identificationNo: identification, + email: email, + zipCode: zipCode, + ); + + // Call the API + final result = await waterMonitorRepo.updateOrInsertUserDetailForWaterMonitoring( + requestModel: requestModel, + isUpdate: isUpdate, + ); + + return result.fold( + (failure) { + _validationError = failure.message; + _isLoading = false; + notifyListeners(); + return false; + }, + (apiModel) async { + // Update local data with response + _userDetailData = apiModel.data; + // Fetch daily progress to get the updated goal and consumed data from API + await fetchUserProgressForMonitoring(); + + _isLoading = false; + notifyListeners(); + return true; + }, + ); + } catch (e) { + _validationError = e.toString(); + _isLoading = false; + notifyListeners(); + return false; + } + } + + // Helper method to get activity ID based on activity level + String _getActivityID() { + switch (_selectedActivityLevel) { + case "Almost Inactive (no exercise)": + return "1"; + case "Lightly active": + return "2"; + case "Lightly active (1-3) days per week": + return "3"; + case "Super active (very hard exercise)": + return "4"; + default: + return "2"; + } + } + + // Helper method to calculate DOB from age + String _calculateDOBFromAge() { + final age = int.tryParse(ageController.text.trim()) ?? 0; + if (age > 0) { + final currentYear = DateTime.now().year; + final birthYear = currentYear - age; + // Create a DateTime for January 1st of the birth year + final birthDate = DateTime(birthYear, 1, 1); + // Convert to API format: /Date(milliseconds+0300)/ using DateUtil + return DateUtil.convertDateToString(birthDate); + } + return ""; + } + + @override + void dispose() { + nameController.dispose(); + heightController.dispose(); + weightController.dispose(); + ageController.dispose(); + super.dispose(); + } + + List _cups = []; + String? _selectedCupId; + int _totalConsumedMl = 0; // Loaded from API + int _dailyGoalMl = 0; // Loaded from API + + // Calibration: portion of the bottle SVG height that is fillable (0.0 - 1.0) + double _fillableHeightPercent = 0.7; + + List get cups => _cups; + + WaterCupModel? get selectedCup { + if (_cups.isEmpty) return null; + return _cups.firstWhere((c) => c.id == _selectedCupId, orElse: () => _cups.first); + } + + int get totalConsumedMl => _totalConsumedMl; + + int get dailyGoalMl => _dailyGoalMl; + + // Portion of bottle drawable height that is fillable. + double get fillableHeightPercent => _fillableHeightPercent; + + void setFillableHeightPercent(double v) { + _fillableHeightPercent = v.clamp(0.0, 1.0); + notifyListeners(); + } + + // Normalized progress in 0.0 - 1.0 (ensure double) + double get progress { + if (_dailyGoalMl == 0) return 0.0; + final p = _totalConsumedMl / _dailyGoalMl; + return p.clamp(0.0, 1.0).toDouble(); + } + + // Convenience percent (0 - 100) + double get progressPercent => (progress * 100.0).clamp(0.0, 100.0).toDouble(); + + // Calculate hydration status based on progress + String get hydrationStatus { + final percent = progressPercent; + + if (percent >= 90) { + return "Well Hydrated"; + } else if (percent >= 70) { + return "Hydrated"; + } else if (percent >= 50) { + return "Moderately Hydrated"; + } else if (percent >= 30) { + return "Slightly Dehydrated"; + } else { + return "Dehydrated"; + } + } + + // Get hydration status color + Color get hydrationStatusColor { + final percent = progressPercent; + + if (percent >= 90) { + return AppColors.successColor; // Dark Green + } else if (percent >= 70) { + return AppColors.successColor; // Green + } else if (percent >= 50) { + return AppColors.warningColorYellow; //orange + } else if (percent >= 30) { + return AppColors.warningColorYellow; // Orange + } else { + return AppColors.errorColor; // Red + } + } + + String get nextDrinkTime { + if (progressPercent >= 100) { + return "Goal Achieved!"; + } + + // Get number of reminders from selected string (e.g., "3 Time" -> 3) + final remindersPerDay = int.tryParse(_selectedNumberOfReminders.replaceAll(' Time', '').trim()) ?? 3; + + // Define waking hours (e.g., 6 AM to 10 PM = 16 hours) + const wakingHoursStart = 6; // 6 AM + const wakingHoursEnd = 22; // 10 PM + const totalWakingHours = wakingHoursEnd - wakingHoursStart; + + // Calculate interval between drinks in hours + final intervalHours = totalWakingHours / remindersPerDay; + + // Get current time + final now = DateTime.now(); + final currentHour = now.hour + (now.minute / 60.0); + + // If before waking hours, next drink is at start time + if (currentHour < wakingHoursStart) { + return "${wakingHoursStart.toString().padLeft(2, '0')}:00 AM"; + } + + if (currentHour >= wakingHoursEnd) { + return "Tomorrow ${wakingHoursStart.toString().padLeft(2, '0')}:00 AM"; + } + + // Calculate which interval we're in + final hoursSinceWakeup = currentHour - wakingHoursStart; + final currentInterval = (hoursSinceWakeup / intervalHours).floor(); + + // Calculate next drink time + final nextDrinkHour = wakingHoursStart + ((currentInterval + 1) * intervalHours); + + // If next drink time is past bedtime, show tomorrow + if (nextDrinkHour >= wakingHoursEnd) { + return "Tomorrow ${wakingHoursStart.toString().padLeft(2, '0')}:00 AM"; + } + + // Format the time + final hour = nextDrinkHour.floor(); + final minute = ((nextDrinkHour - hour) * 60).round(); + + // Convert to 12-hour format + final hour12 = hour > 12 ? hour - 12 : (hour == 0 ? 12 : hour); + final period = hour >= 12 ? 'PM' : 'AM'; + + return "${hour12.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')} $period"; + } + + /// Get time until next drink in minutes + int get minutesUntilNextDrink { + if (progressPercent >= 100) return 0; + + final remindersPerDay = int.tryParse(_selectedNumberOfReminders.replaceAll(' Time', '').trim()) ?? 3; + const wakingHoursStart = 6; + const wakingHoursEnd = 22; + const totalWakingHours = wakingHoursEnd - wakingHoursStart; + final intervalHours = totalWakingHours / remindersPerDay; + + final now = DateTime.now(); + final currentHour = now.hour + (now.minute / 60.0); + + if (currentHour < wakingHoursStart) { + final minutesUntil = ((wakingHoursStart - currentHour) * 60).round(); + return minutesUntil; + } + + if (currentHour >= wakingHoursEnd) { + final hoursUntilTomorrow = 24 - currentHour + wakingHoursStart; + return (hoursUntilTomorrow * 60).round(); + } + + final hoursSinceWakeup = currentHour - wakingHoursStart; + final currentInterval = (hoursSinceWakeup / intervalHours).floor(); + final nextDrinkHour = wakingHoursStart + ((currentInterval + 1) * intervalHours); + + if (nextDrinkHour >= wakingHoursEnd) { + final hoursUntilTomorrow = 24 - currentHour + wakingHoursStart; + return (hoursUntilTomorrow * 60).round(); + } + + final minutesUntil = ((nextDrinkHour - currentHour) * 60).round(); + return minutesUntil.clamp(0, 1440); + } + + // Allow updating consumed and goal through the vm so UI doesn't manipulate internal fields directly + void setTotalConsumedMl(int ml) { + _totalConsumedMl = ml; + notifyListeners(); + } + + void addConsumedMl(int ml) { + _totalConsumedMl = (_totalConsumedMl + ml).clamp(0, 1000000); + notifyListeners(); + } + + void subtractConsumedMl(int ml) { + _totalConsumedMl = (_totalConsumedMl - ml).clamp(0, 1000000); + notifyListeners(); + } + + void setDailyGoal(int ml) { + _dailyGoalMl = ml; + notifyListeners(); + } + + void _initializeDefaultCups() { + _cups = [ + WaterCupModel( + id: 'default_125', + name: '125ml', + capacityMl: 125, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + WaterCupModel( + id: 'default_150', + name: '150ml', + capacityMl: 150, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + WaterCupModel( + id: 'default_175', + name: '175ml', + capacityMl: 175, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + WaterCupModel( + id: 'default_200', + name: '200ml', + capacityMl: 200, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + WaterCupModel( + id: 'default_250', + name: '250ml', + capacityMl: 250, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + WaterCupModel( + id: 'default_300', + name: '300ml', + capacityMl: 300, + iconPath: AppAssets.cupEmpty, + isDefault: true, + ), + ]; + _selectedCupId = _cups.first.id; + notifyListeners(); + } + + void selectCup(String cupId) { + _selectedCupId = cupId; + notifyListeners(); + } + + void addCup(WaterCupModel cup) { + _cups.add(cup); + notifyListeners(); + } + + void updateCup(WaterCupModel updatedCup) { + final index = _cups.indexWhere((c) => c.id == updatedCup.id); + if (index != -1) { + _cups[index] = updatedCup; + notifyListeners(); + } + } + + // Public alias for deleting/removing a cup. Keeps API intention clear in UI code. + void removeCup(String cupId) { + deleteCup(cupId); + } + + void deleteCup(String cupId) { + final cup = _cups.firstWhere((c) => c.id == cupId); + if (cup.isDefault) return; // can't delete default cups + + _cups.removeWhere((c) => c.id == cupId); + if (_selectedCupId == cupId) { + _selectedCupId = _cups.first.id; + } + notifyListeners(); + } + + // Returns the currently selected cup capacity in ml (0 if none) + int get selectedCupCapacityMl => selectedCup?.capacityMl ?? 0; + + /// Increment the consumed amount by the currently selected cup capacity. + /// This centralizes business logic here so UI just calls this method. + void incrementBySelectedCup() { + if (selectedCup != null) { + addConsumedMl(selectedCup!.capacityMl); + } + } + + /// Decrement the consumed amount by the currently selected cup capacity. + /// Ensures value is clamped inside the VM (subtractConsumedMl already clamps). + void decrementBySelectedCup() { + if (selectedCup != null) { + subtractConsumedMl(selectedCup!.capacityMl); + } + } + + /// Insert user activity (record water intake) + Future insertUserActivity({required int quantityIntake}) async { + try { + _isLoading = true; + notifyListeners(); + + // Get authenticated user info + final authenticated = _appState.getAuthenticatedUser(); + if (authenticated == null) { + _isLoading = false; + notifyListeners(); + return false; + } + + final mobile = (authenticated.mobileNumber ?? '').replaceAll('+', '').replaceFirst("0", ""); + final identification = authenticated.patientIdentificationNo ?? ''; + + // Create request model + final requestModel = InsertUserActivityRequestModel( + identificationNo: identification, + mobileNumber: mobile, + quantityIntake: quantityIntake, + ); + + // Call the API + final result = await waterMonitorRepo.insertUserActivity(requestModel: requestModel); + + return result.fold( + (failure) { + log('Error inserting user activity: ${failure.message}'); + _isLoading = false; + notifyListeners(); + return false; + }, + (apiModel) { + log("Insert user activity success: ${apiModel.data.toString()}"); + // Update consumed amount and goal from the response + if (apiModel.data != null && apiModel.data is List && (apiModel.data as List).isNotEmpty) { + final progressData = (apiModel.data as List).first; + if (progressData is Map) { + // Update consumed amount + if (progressData.containsKey('QuantityConsumed')) { + final consumed = progressData['QuantityConsumed']; + if (consumed != null) { + _totalConsumedMl = (consumed is num) ? consumed.toInt() : int.tryParse(consumed.toString()) ?? _totalConsumedMl; + log('Updated consumed after insert: $_totalConsumedMl ml'); + } + } + // Update daily goal + if (progressData.containsKey('QuantityLimit')) { + final limit = progressData['QuantityLimit']; + if (limit != null) { + _dailyGoalMl = (limit is num) ? limit.toInt() : int.tryParse(limit.toString()) ?? _dailyGoalMl; + log('Updated daily goal after insert: $_dailyGoalMl ml'); + } + } + } + + // Refresh progress data to ensure consistency + fetchUserProgressForMonitoring(); + } + + _isLoading = false; + notifyListeners(); + return true; + }, + ); + } catch (e) { + log('Exception in insertUserActivity: $e'); + _isLoading = false; + notifyListeners(); + return false; + } + } + + /// Undo last user activity + Future undoUserActivity() async { + try { + _isLoading = true; + notifyListeners(); + + // Get authenticated user info + final authenticated = _appState.getAuthenticatedUser(); + if (authenticated == null) { + _isLoading = false; + notifyListeners(); + return false; + } + + final mobile = (authenticated.mobileNumber ?? '').replaceAll('+', '').replaceFirst("0", ""); + final identification = authenticated.patientIdentificationNo ?? ''; + + // Create request model + final requestModel = UndoUserActivityRequestModel( + progress: _getProgressIdFromDuration(), + mobileNumber: mobile, + identificationNo: identification, + ); + + // Call the API + final result = await waterMonitorRepo.undoUserActivity(requestModel: requestModel); + + return result.fold( + (failure) { + log('Error undoing user activity: ${failure.message}'); + _isLoading = false; + notifyListeners(); + return false; + }, + (apiModel) { + log("Undo user activity success: ${apiModel.data.toString()}"); + + // Update consumed amount and goal from the response + if (apiModel.data != null && apiModel.data is List && (apiModel.data as List).isNotEmpty) { + final progressData = (apiModel.data as List).first; + if (progressData is Map) { + // Update consumed amount + if (progressData.containsKey('QuantityConsumed')) { + final consumed = progressData['QuantityConsumed']; + if (consumed != null) { + _totalConsumedMl = (consumed is num) ? consumed.toInt() : int.tryParse(consumed.toString()) ?? _totalConsumedMl; + log('Updated consumed after undo: $_totalConsumedMl ml'); + } + } + // Update daily goal + if (progressData.containsKey('QuantityLimit')) { + final limit = progressData['QuantityLimit']; + if (limit != null) { + _dailyGoalMl = (limit is num) ? limit.toInt() : int.tryParse(limit.toString()) ?? _dailyGoalMl; + log('Updated daily goal after undo: $_dailyGoalMl ml'); + } + } + } + } + fetchUserProgressForMonitoring(); + _isLoading = false; + notifyListeners(); + return true; + }, + ); + } catch (e) { + log('Exception in undoUserActivity: $e'); + _isLoading = false; + notifyListeners(); + return false; + } + } + + /// Schedule water reminders based on user's reminder settings + Future scheduleWaterReminders() async { + try { + final notificationService = getIt.get(); + + // Request permission first + final hasPermission = await notificationService.requestPermissions(); + if (!hasPermission) { + log('Notification permission denied'); + return false; + } + + // Calculate reminder times based on _selectedNumberOfReminders + final reminderTimes = _calculateReminderTimes(); + + if (reminderTimes.isEmpty) { + log('No reminder times calculated'); + return false; + } + + // Schedule water reminders + await notificationService.scheduleWaterReminders( + reminderTimes: reminderTimes, + title: 'Time to Drink Water! 💧'.needTranslation, + body: 'Stay hydrated! Drink ${selectedCupCapacityMl}ml of water.'.needTranslation, + ); + + // Save reminder enabled state to cache + _isWaterReminderEnabled = true; + await _cacheService.saveBool(key: CacheConst.waterReminderEnabled, value: true); + + log('Scheduled ${reminderTimes.length} water reminders successfully'); + notifyListeners(); + return true; + } catch (e) { + log('Exception in scheduleWaterReminders: $e'); + return false; + } + } + + /// Calculate reminder times based on selected number of reminders + List _calculateReminderTimes() { + try { + final remindersPerDay = int.tryParse(_selectedNumberOfReminders.replaceAll(' Time', '').trim()) ?? 3; + + const wakingHoursStart = 6; // 6 AM + const wakingHoursEnd = 22; // 10 PM + const totalWakingHours = wakingHoursEnd - wakingHoursStart; + + final intervalHours = totalWakingHours / remindersPerDay; + + List times = []; + final now = DateTime.now(); + + for (int i = 0; i < remindersPerDay; i++) { + final hourDecimal = wakingHoursStart + (i * intervalHours); + final hour = hourDecimal.floor(); + final minute = ((hourDecimal - hour) * 60).round(); + + final reminderTime = DateTime( + now.year, + now.month, + now.day, + hour, + minute, + ); + + times.add(reminderTime); + } + + return times; + } catch (e) { + log('Error calculating reminder times: $e'); + return []; + } + } + + /// Cancel all water reminders + Future cancelWaterReminders() async { + try { + final notificationService = GetIt.instance(); + + // Get pending notifications and cancel water reminders (IDs 5000-5999) + final pendingNotifications = await notificationService.getPendingNotifications(); + for (final notification in pendingNotifications) { + if (notification.id >= 5000 && notification.id < 6000) { + await notificationService.cancelNotification(notification.id); + } + } + + // Save reminder disabled state to cache + _isWaterReminderEnabled = false; + await _cacheService.saveBool(key: CacheConst.waterReminderEnabled, value: false); + + log('Cancelled all water reminders'); + notifyListeners(); + return true; + } catch (e) { + log('Exception in cancelWaterReminders: $e'); + return false; + } + } + + /// Get list of scheduled water reminder times + Future> getScheduledReminderTimes() async { + try { + final notificationService = GetIt.instance(); + final pendingNotifications = await notificationService.getPendingNotifications(); + + List times = []; + for (final notification in pendingNotifications) { + if (notification.id >= 5000 && notification.id < 6000) { + // Note: PendingNotificationRequest doesn't contain scheduled time + // We can only return the calculated times based on current settings + times = _calculateReminderTimes(); + break; + } + } + + return times; + } catch (e) { + log('Exception in getScheduledReminderTimes: $e'); + return []; + } + } + + /// Schedule a test notification after 5 seconds + /// Useful for testing notification functionality + Future scheduleTestNotification() async { + try { + final notificationService = GetIt.instance(); + + // Request permission first + final hasPermission = await notificationService.requestPermissions(); + if (!hasPermission) { + log('Notification permission denied for test notification'); + return false; + } + + // Schedule notification 5 seconds from now + final scheduledTime = DateTime.now().add(const Duration(seconds: 5)); + + await notificationService.scheduleNotification( + id: 9999, + // Use a unique ID for test notifications + title: 'Time to Drink Water! 💧'.needTranslation, + body: 'Stay hydrated! Drink ${selectedCupCapacityMl}ml of water.'.needTranslation, + scheduledDate: scheduledTime, + payload: 'test_notification', + ); + + log('Test notification scheduled for 5 seconds from now'); + return true; + } catch (e) { + log('Exception in scheduleTestNotification: $e'); + return false; + } + } +} diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index d76422b..ea0bcb8 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -2,7 +2,7 @@ // ignore_for_file: constant_identifier_names -abstract class LocaleKeys { +abstract class LocaleKeys { static const english = 'english'; static const arabic = 'arabic'; static const login = 'login'; @@ -189,7 +189,6 @@ abstract class LocaleKeys { static const firstName = 'firstName'; static const middleName = 'middleName'; static const lastName = 'lastName'; - static const female = 'female'; static const preferredLanguage = 'preferredLanguage'; static const locationsRegister = 'locationsRegister'; static const ksa = 'ksa'; @@ -801,7 +800,7 @@ abstract class LocaleKeys { static const fullName = 'fullName'; static const married = 'married'; static const uae = 'uae'; - static const malE = 'male'; + static const malE = 'malE'; static const loginBy = 'loginBy'; static const loginByOTP = 'loginByOTP'; static const guest = 'guest'; @@ -876,4 +875,6 @@ abstract class LocaleKeys { static const walkin = 'walkin'; static const laserClinic = 'laserClinic'; static const continueString = 'continueString'; + static const covid_info = 'covid_info'; + } diff --git a/lib/main.dart b/lib/main.dart index 6a065fe..9600d5e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -22,13 +22,18 @@ import 'package:hmg_patient_app_new/features/lab/history/lab_history_viewmodel.d import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.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_view_model.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_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; @@ -67,7 +72,7 @@ Future callInitializations() async { WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); - AppDependencies.addDependencies(); + await AppDependencies.addDependencies(); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); HttpOverrides.global = MyHttpOverrides(); await callAppStateInitializations(); @@ -105,6 +110,9 @@ void main() async { ChangeNotifierProvider( create: (_) => getIt.get(), ), + ChangeNotifierProvider( + create: (_) => getIt.get(), + ), ChangeNotifierProvider( create: (_) => getIt.get(), ), @@ -147,8 +155,20 @@ void main() async { ChangeNotifierProvider( create: (_) => getIt.get(), ), + ChangeNotifierProvider( + create: (_) => getIt.get(), + ), ChangeNotifierProvider( create: (_) => getIt.get(), + ), + ChangeNotifierProvider( + create: (_) => getIt.get(), + ), + ChangeNotifierProvider( + create: (_) => getIt.get(), + ), + ChangeNotifierProvider( + create: (_) => getIt.get(), ) ], child: MyApp()), ), @@ -171,11 +191,7 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'Dr. AlHabib', builder: (context, mchild) { - return MediaQuery( - data: MediaQuery.of(context).copyWith( - textScaler: TextScaler.linear(1.0), - ), - child: mchild!); + return MediaQuery(data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(1.0)), child: mchild!); }, showSemanticsDebugger: false, debugShowCheckedModeBanner: false, diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index 7f863a1..bd81584 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -1,13 +1,11 @@ import 'dart:async'; -import 'dart:collection'; -import 'dart:io'; -import 'package:device_calendar/device_calendar.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; @@ -31,21 +29,17 @@ import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointmen import 'package:hmg_patient_app_new/presentation/appointments/widgets/ask_doctor_request_type_select.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart'; -import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart'; -import 'package:hmg_patient_app_new/presentation/medical_file/widgets/lab_rad_card.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_detail_page.dart'; -import 'package:hmg_patient_app_new/presentation/prescriptions/prescriptions_list_page.dart'; -import 'package:hmg_patient_app_new/presentation/radiology/radiology_orders_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; -import '../../core/dependencies.dart'; import '../medical_file/widgets/medical_file_card.dart'; class AppointmentDetailsPage extends StatefulWidget { @@ -70,7 +64,6 @@ class _AppointmentDetailsPageState extends State { scheduleMicrotask(() async { CalenderUtilsNew calendarUtils = await CalenderUtilsNew.instance; var doesExist = await calendarUtils.checkIfEventExist("${widget.patientAppointmentHistoryResponseModel.appointmentNo}"); - print("the appointment reminder exist $doesExist"); myAppointmentsViewModel.setAppointmentReminder(doesExist, widget.patientAppointmentHistoryResponseModel); setState((){ @@ -82,7 +75,6 @@ class _AppointmentDetailsPageState extends State { @override Widget build(BuildContext context) { - AppState appState = getIt.get(); myAppointmentsViewModel = Provider.of(context, listen: false); prescriptionsViewModel = Provider.of(context, listen: false); bookAppointmentsViewModel = Provider.of(context, listen: false); @@ -143,10 +135,7 @@ class _AppointmentDetailsPageState extends State { }, onCancelTap: () async { myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); - var isEventAddedOrRemoved = await CalenderUtilsNew.instance.checkAndRemove( id:"${widget.patientAppointmentHistoryResponseModel.appointmentNo}", ); - setState(() { - myAppointmentsViewModel.setAppointmentReminder(isEventAddedOrRemoved, widget.patientAppointmentHistoryResponseModel); - }); + LoaderBottomSheet.showLoader(loadingText: "Cancelling Appointment, Please Wait...".needTranslation); await myAppointmentsViewModel.cancelAppointment( patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, @@ -166,6 +155,10 @@ class _AppointmentDetailsPageState extends State { isFullScreen: false, ); }); + var isEventAddedOrRemoved = await CalenderUtilsNew.instance.checkAndRemove( id:"${widget.patientAppointmentHistoryResponseModel.appointmentNo}", ); + setState(() { + myAppointmentsViewModel.setAppointmentReminder(isEventAddedOrRemoved, widget.patientAppointmentHistoryResponseModel); + }); }, onRescheduleTap: () async { openDoctorScheduleCalendar(); @@ -175,90 +168,105 @@ class _AppointmentDetailsPageState extends State { !AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) ? Column( children: [ - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.r, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - "Appointment Status".needTranslation.toText16(isBold: true), - ], - ), - SizedBox(height: 4.h), - (!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel) - ? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) - : "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)), - SizedBox(height: 16.h), - //TODO Add countdown timer in case of LiveCare Appointment - widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false - ? Row( - children: [ - Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 40.h, height: 40.h), - SizedBox(width: 12.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "The doctor will call you once the appointment time approaches." - .needTranslation - .toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), - ], + Consumer(builder: (context, bookAppointmentsVM, child) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Appointment Status".needTranslation.toText16(isBold: true), + ], + ), + SizedBox(height: 4.h), + (!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel) + ? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) + : "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)), + SizedBox(height: 16.h), + //TODO Add countdown timer in case of LiveCare Appointment + widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false + ? Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 40.h, height: 40.h), + SizedBox(width: 12.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "The doctor will call you once the appointment time approaches." + .needTranslation + .toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + ], + ), ), - ), - ], - ) - : Stack( - children: [ - ClipRRect( - clipBehavior: Clip.hardEdge, - borderRadius: BorderRadius.circular(24.r), - // Todo: what is this???? Api Key??? 😲 - child: Image.network( - "https://maps.googleapis.com/maps/api/staticmap?center=${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&zoom=14&size=350x165&maptype=roadmap&markers=color:red%7C${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&key=AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng", - fit: BoxFit.contain, + ], + ) + : Stack( + children: [ + ClipRRect( + clipBehavior: Clip.hardEdge, + borderRadius: BorderRadius.circular(24.r), + // Todo: what is this???? Api Key??? 😲 + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&zoom=14&size=350x165&maptype=roadmap&markers=color:red%7C${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&key=${ApiKeyConstants.googleMapsApiKey}", + fit: BoxFit.contain, + ), ), - ), - Positioned( - bottom: 0, - child: SizedBox( - width: MediaQuery.of(context).size.width * 0.785, - child: CustomButton( - text: "Get Directions".needTranslation, - onPressed: () { - MapsLauncher.launchCoordinates( - double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), - double.parse(widget.patientAppointmentHistoryResponseModel.longitude!), - widget.patientAppointmentHistoryResponseModel.projectName); - }, - backgroundColor: AppColors.textColor.withValues(alpha: 0.8), - borderColor: AppointmentType.getNextActionButtonColor( - widget.patientAppointmentHistoryResponseModel.nextAction) - .withValues(alpha: 0.01), - textColor: AppColors.whiteColor, - fontSize: 14.f, - fontWeight: FontWeight.w500, - borderRadius: 12.r, - padding: EdgeInsets.symmetric(horizontal: 10.w), - height: 40.h, - icon: AppAssets.directions_icon, - iconColor: AppColors.whiteColor, - iconSize: 14.h, - ).paddingAll(12.h), + Positioned( + bottom: 0, + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.785, + child: CustomButton( + text: "Get Directions".needTranslation, + onPressed: () { + MapsLauncher.launchCoordinates(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), + double.parse(widget.patientAppointmentHistoryResponseModel.longitude!), widget.patientAppointmentHistoryResponseModel.projectName); + }, + backgroundColor: AppColors.textColor.withValues(alpha: 0.8), + borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withValues(alpha: 0.01), + textColor: AppColors.whiteColor, + fontSize: 14.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 40.h, + icon: AppAssets.directions_icon, + iconColor: AppColors.whiteColor, + iconSize: 14.h, + ).paddingAll(12.h), + ), ), - ), - ], - ), - ], + ], + ), + SizedBox(height: 8.h), + bookAppointmentsViewModel.appointmentNearestGateResponseModel != null ? Wrap( + direction: Axis.horizontal, + spacing: 8.w, + runSpacing: 8.h, + children: [ + AppCustomChipWidget( + labelText: bookAppointmentsVM.isAppointmentNearestGateLoading + ? "Floor: Ground Floor" + : "Floor: ${getIt.get().isArabic() ? bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocationN : bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocation}", + ).toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading), + AppCustomChipWidget( + labelText: + "Nearest Gate: ${getIt.get().isArabic() ? bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumberN : bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumber}") + .toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading), + ], + ) : SizedBox.shrink(), + ], + ), ), - ), - ), + ); + }), SizedBox(height: 16.h), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( @@ -343,17 +351,17 @@ class _AppointmentDetailsPageState extends State { ) // : SizedBox.shrink() : GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - crossAxisSpacing: 16.h, - mainAxisSpacing: 16.w, - mainAxisExtent: 115.h, - ), - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - shrinkWrap: true, - children: [ - MedicalFileCard( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 16.h, + mainAxisSpacing: 16.w, + mainAxisExtent: 115.h, + ), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + shrinkWrap: true, + children: [ + MedicalFileCard( label: LocaleKeys.labResults.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, @@ -390,7 +398,7 @@ class _AppointmentDetailsPageState extends State { label: "${LocaleKeys.radiology.tr(context: context)} ${LocaleKeys.radiologySubtitle.tr(context: context)}", textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.allergy_info_icon, + svgIcon: AppAssets.radiology_icon, isLargeText: true, iconSize: 36.w, ).onPress(() async { @@ -442,13 +450,15 @@ class _AppointmentDetailsPageState extends State { ); Navigator.of(context).push( CustomPageRoute( - page: PrescriptionDetailPage(isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel), + page: PrescriptionDetailPage( + isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel), ), ); } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "You don't have any prescriptions for this appointment.".needTranslation), + child: Utils.getErrorWidget( + loadingText: "You don't have any prescriptions for this appointment.".needTranslation), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -469,11 +479,11 @@ class _AppointmentDetailsPageState extends State { // Navigator.of(context).push( // CustomPageRoute( // page: VaccineListPage(), - // ), - // ); - }), - ], - ), + // ), + // ); + }), + ], + ), // Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ diff --git a/lib/presentation/appointments/appointment_payment_page.dart b/lib/presentation/appointments/appointment_payment_page.dart index faf1c2a..ccd7018 100644 --- a/lib/presentation/appointments/appointment_payment_page.dart +++ b/lib/presentation/appointments/appointment_payment_page.dart @@ -149,7 +149,7 @@ class _AppointmentPaymentPageState extends State { children: [ Image.asset(AppAssets.visa, width: 50.h, height: 50.h), SizedBox(width: 8.h), - Image.asset(AppAssets.Mastercard, width: 40.h, height: 40.h), + Image.asset(AppAssets.mastercard, width: 40.h, height: 40.h), ], ).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), SizedBox(height: 16.h), @@ -191,7 +191,7 @@ class _AppointmentPaymentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(AppAssets.tamara_en, width: 72.h, height: 25.h) + Image.asset(AppAssets.tamaraEng, width: 72.h, height: 25.h) .toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), SizedBox(height: 16.h), "Tamara" diff --git a/lib/presentation/appointments/appointment_queue_page.dart b/lib/presentation/appointments/appointment_queue_page.dart index f48f1eb..124bf25 100644 --- a/lib/presentation/appointments/appointment_queue_page.dart +++ b/lib/presentation/appointments/appointment_queue_page.dart @@ -42,7 +42,11 @@ class AppointmentQueuePage extends StatelessWidget { color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: false, - side: BorderSide(color: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), width: 2.w), + side: BorderSide( + color: myAppointmentsVM.isAppointmentQueueDetailsLoading + ? AppColors.whiteColor + : Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), + width: 2.w), ), child: Padding( padding: EdgeInsets.all(16.h), @@ -59,16 +63,25 @@ class AppointmentQueuePage extends StatelessWidget { ), Utils.buildSvgWithAssets(icon: AppAssets.waiting_icon, width: 24.h, height: 24.h), ], - ), + ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 10.h), - "Hala ${appState!.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), + "Hala ${appState!.getAuthenticatedUser()!.firstName}!!!" + .needTranslation + .toText16(isBold: true) + .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 8.h), - "Thank you for your patience, here is your queue number.".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "Thank you for your patience, here is your queue number." + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight) + .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 8.h), - "IMD W-A-5".needTranslation.toText32(isBold: true), + myAppointmentsVM.currentPatientQueueDetails.queueNo! + .toText32(isBold: true) + .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 8.h), CustomButton( - text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus), + text: Utils.getCardButtonText( + myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""), onPressed: () {}, backgroundColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus), borderColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.01), @@ -80,66 +93,82 @@ class AppointmentQueuePage extends StatelessWidget { height: 40.h, iconColor: AppColors.whiteColor, iconSize: 18.h, - ), + ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), ], ), ), ), SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: true, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "Serving Now".needTranslation.toText16(isBold: true), - SizedBox(height: 18.h), - ListView.separated( - padding: EdgeInsets.zero, - shrinkWrap: true, - itemCount: 3, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (BuildContext context, int index) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "IMD W-A-2".needTranslation.toText17(isBold: true), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - "Room: S2".toText12(fontWeight: FontWeight.w500), - SizedBox(width: 8.w), - AppCustomChipWidget( - deleteIcon: AppAssets.call_for_vitals, - labelText: "Call for vital signs".needTranslation, - iconColor: AppColors.primaryRedColor, - textColor: AppColors.primaryRedColor, - iconSize: 14.w, - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1), - labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h), - ), - ], - ), - ], - ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h), + myAppointmentsVM.patientQueueDetailsList.isNotEmpty + ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, ), - ], - ), - ), - ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Serving Now" + .needTranslation + .toText16(isBold: true) + .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), + SizedBox(height: 18.h), + ListView.separated( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: myAppointmentsVM.patientQueueDetailsList.length, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (BuildContext context, int index) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + myAppointmentsVM.patientQueueDetailsList[index].queueNo!.toText17(isBold: true), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + "Room: ${myAppointmentsVM.patientQueueDetailsList[index].roomNo}" + .toText12(fontWeight: FontWeight.w500), + SizedBox(width: 8.w), + AppCustomChipWidget( + deleteIcon: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 + ? AppAssets.call_for_vitals + : AppAssets.call_for_doctor, + labelText: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 + ? "Call for vital signs".needTranslation + : "Call for Doctor".needTranslation, + iconColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 + ? AppColors.primaryRedColor + : AppColors.successColor, + textColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 + ? AppColors.primaryRedColor + : AppColors.successColor, + iconSize: 14.w, + backgroundColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 + ? AppColors.primaryRedColor.withValues(alpha: 0.1) + : AppColors.successColor.withValues(alpha: 0.1), + labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h), + ), + ], + ), + ], + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h), + ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), + ], + ), + ), + ) + : SizedBox.shrink(), SizedBox(height: 16.h), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, - borderRadius: 20.h, + borderRadius: 24.4, hasShadow: true, ), child: Padding( @@ -162,19 +191,29 @@ class AppointmentQueuePage extends StatelessWidget { // Are there any side effects I should know about? // When should I come back for a follow-up? - "• ${"What can I do to improve my overall health?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "• ${"What can I do to improve my overall health?"}" + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"Are there any routine screenings I should get?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "• ${"Are there any routine screenings I should get?"}" + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"What is this medication for?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "• ${"What is this medication for?"}" + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"Are there any side effects I should know about?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "• ${"Are there any side effects I should know about?"}" + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"When should I come back for a follow-up?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + "• ${"When should I come back for a follow-up?"}" + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 16.h), ], - ), + ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), ), ), ], diff --git a/lib/presentation/appointments/my_appointments_page.dart b/lib/presentation/appointments/my_appointments_page.dart index 934aca4..eb72bc6 100644 --- a/lib/presentation/appointments/my_appointments_page.dart +++ b/lib/presentation/appointments/my_appointments_page.dart @@ -4,6 +4,9 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -19,6 +22,7 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointme import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/date_range_calender.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; @@ -35,6 +39,7 @@ class MyAppointmentsPage extends StatefulWidget { } class _MyAppointmentsPageState extends State { + int? expandedIndex; late MyAppointmentsViewModel myAppointmentsViewModel; late BookAppointmentsViewModel bookAppointmentsViewModel; @@ -68,6 +73,9 @@ class _MyAppointmentsPageState extends State { CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { + setState(() { + expandedIndex = null; + }); myAppointmentsViewModel.onTabChange(index); myAppointmentsViewModel.updateListWRTTab(index); context.read().flush(); @@ -91,17 +99,55 @@ class _MyAppointmentsPageState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(height: 16.h), + // Clinic & Hospital Sort + Row( + children: [ + CustomButton( + text: LocaleKeys.byClinic.tr(context: context), + onPressed: () { + myAppointmentsVM.setIsAppointmentsSortByClinic(true); + }, + backgroundColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + textColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.byHospital.tr(context: context), + onPressed: () { + myAppointmentsVM.setIsAppointmentsSortByClinic(false); + }, + backgroundColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + borderColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + textColor: myAppointmentsVM.isAppointmentsSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ).paddingSymmetrical(24.h, 0.h), Visibility(visible: myAppointmentsVM.availableFilters.isNotEmpty, child: getAppointmentFilters(myAppointmentsVM)), - ListView.separated( - padding: EdgeInsets.only(top: 16.h), + SizedBox(height: 8.h), + // Expandable list + ListView.builder( + padding: EdgeInsets.only(top: 8.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: myAppointmentsVM.isMyAppointmentsLoading - ? 5 + ? 4 : filteredAppointmentList.isNotEmpty - ? filteredAppointmentList.length + ? myAppointmentsVM.patientAppointmentsViewList.length : 1, itemBuilder: (context, index) { + final isExpanded = expandedIndex == index; return myAppointmentsVM.isMyAppointmentsLoading ? Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), @@ -123,15 +169,83 @@ class _MyAppointmentsPageState extends State { child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), - child: AppointmentCard( - patientAppointmentHistoryResponseModel: filteredAppointmentList[index], - myAppointmentsViewModel: myAppointmentsViewModel, - bookAppointmentsViewModel: bookAppointmentsViewModel, - isLoading: false, - isFromHomePage: false, + margin: EdgeInsets.symmetric(vertical: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), + child: InkWell( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppCustomChipWidget( + labelText: + "${myAppointmentsVM.patientAppointmentsViewList[index].patientDoctorAppointmentList!.length} Appointments"), + Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + ], + ), + SizedBox(height: 8.h), + myAppointmentsVM.patientAppointmentsViewList[index].filterName!.toText16(isBold: true) + ], + ), + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeIn, + switchOutCurve: Curves.easeOut, + transitionBuilder: (Widget child, Animation animation) { + return FadeTransition( + opacity: animation, + child: SizeTransition( + sizeFactor: animation, + axisAlignment: 0.0, + child: child, + ), + ); + }, + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 0.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...myAppointmentsVM.patientAppointmentsViewList[index].patientDoctorAppointmentList!.map((appointment) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppointmentCard( + patientAppointmentHistoryResponseModel: appointment, + myAppointmentsViewModel: myAppointmentsViewModel, + bookAppointmentsViewModel: bookAppointmentsViewModel, + isLoading: false, + isFromHomePage: false, + ), + SizedBox(height: 8.h), + Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h).paddingSymmetrical(16.w, 0.h), + SizedBox(height: 8.h), + ], + ); + }), + ], + ), + ) + : SizedBox.shrink(), + ), + ], + ), ), - ).paddingSymmetrical(24.h, 0.h), + ), ), ), ) @@ -160,8 +274,7 @@ class _MyAppointmentsPageState extends State { ).paddingSymmetrical(48.h, 0.h), ); }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), - ), + ).paddingSymmetrical(24.h, 0.h), SizedBox(height: 24.h), ], ); diff --git a/lib/presentation/appointments/my_doctors_page.dart b/lib/presentation/appointments/my_doctors_page.dart index 51e9703..3740a4a 100644 --- a/lib/presentation/appointments/my_doctors_page.dart +++ b/lib/presentation/appointments/my_doctors_page.dart @@ -1,6 +1,5 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; @@ -21,169 +20,377 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import '../../widgets/chip/app_custom_chip_widget.dart'; +import '../../widgets/buttons/custom_button.dart'; -class MyDoctorsPage extends StatelessWidget { +class MyDoctorsPage extends StatefulWidget { MyDoctorsPage({super.key}); + @override + State createState() => _MyDoctorsPageState(); +} + +class _MyDoctorsPageState extends State { late MyAppointmentsViewModel myAppointmentsViewModel; late BookAppointmentsViewModel bookAppointmentsViewModel; + bool isSortByClinic = true; // default like lab page + int? expandedIndex; + final Map _groupKeys = {}; + @override Widget build(BuildContext context) { - AppState appState = getIt.get(); myAppointmentsViewModel = Provider.of(context, listen: false); bookAppointmentsViewModel = Provider.of(context, listen: false); - return Scaffold( - backgroundColor: AppColors.bgScaffoldColor, - body: CollapsingListView( + + return CollapsingListView( title: LocaleKeys.myDoctor.tr(context: context), - child: SingleChildScrollView( - child: Consumer(builder: (context, myAppointmentsVM, child) { + child: Consumer(builder: (context, myAppointmentsVM, child) { + // build grouped lists from the flat list + final clinicMap = >{}; + final hospitalMap = >{}; + + for (var doc in myAppointmentsVM.patientMyDoctorsList) { + final clinicKey = (doc.clinicName ?? 'Unknown').trim(); + clinicMap.putIfAbsent(clinicKey, () => []).add(doc); + + final hospitalKey = (doc.projectName ?? doc.projectID?.toString() ?? 'Unknown').toString().trim(); + hospitalMap.putIfAbsent(hospitalKey, () => []).add(doc); + } + + final patientMyDoctorsByClinic = clinicMap.values.toList(); + final patientMyDoctorsByHospital = hospitalMap.values.toList(); + final patientMyDoctorsViewList = isSortByClinic ? patientMyDoctorsByClinic : patientMyDoctorsByHospital; + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 16.h), + // Add Clinic / Hospital toggle buttons styled like LabOrdersPage + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Row( + children: [ + CustomButton( + text: LocaleKeys.byClinic.tr(context: context), + onPressed: () { + setState(() { + isSortByClinic = true; + expandedIndex = null; + }); + }, + backgroundColor: isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + textColor: isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + + + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.byHospital.tr(context: context), + onPressed: () { + setState(() { + isSortByClinic = false; + expandedIndex = null; + }); + }, + backgroundColor: isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + borderColor: isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + textColor: isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + + ), + ], + ), + ), + SizedBox(height: 16.h), ListView.separated( scrollDirection: Axis.vertical, - itemCount: myAppointmentsVM.isPatientMyDoctorsLoading ? 5 : myAppointmentsVM.patientMyDoctorsList.length, + itemCount: myAppointmentsVM.isPatientMyDoctorsLoading ? 5 : (patientMyDoctorsViewList.isNotEmpty ? patientMyDoctorsViewList.length : 0), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(left: 24.h, right: 24.h), itemBuilder: (context, index) { - return myAppointmentsVM.isPatientMyDoctorsLoading - ? Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: true, - ), - child: Padding( - padding: EdgeInsets.all(14.h), - child: Column( + if (myAppointmentsVM.isPatientMyDoctorsLoading) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(14.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.network( - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - width: 63.h, - height: 63.h, - fit: BoxFit.cover, - ).circle(100).toShimmer2(isShow: true), - SizedBox(width: 16.h), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "Dr John Smith".toText16(isBold: true).toShimmer2(isShow: true), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 3.h, - runSpacing: 4.h, - children: [ - AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h), - AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h), - ], - ), - ], - ), - ), - ], - ), - ], - ), - ), - ) - : AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: true, - ), - child: Padding( - padding: EdgeInsets.all(14.h), + Image.network( + "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + width: 63.h, + height: 63.h, + fit: BoxFit.cover, + ).circle(100).toShimmer2(isShow: true), + SizedBox(width: 16.h), + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.network( - myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!, - width: 63.h, - height: 63.h, - fit: BoxFit.cover, - ).circle(100).toShimmer2(isShow: false), - SizedBox(width: 16.h), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (myAppointmentsVM.patientMyDoctorsList[index].doctorName).toString().toText16(isBold: true).toShimmer2(isShow: false), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 3.h, - runSpacing: 4.h, - children: [ - AppCustomChipWidget(labelText: myAppointmentsVM.patientMyDoctorsList[index].clinicName).toShimmer2(isShow: false, width: 16.h), - AppCustomChipWidget(labelText: myAppointmentsVM.patientMyDoctorsList[index].projectName).toShimmer2(isShow: false, width: 16.h), - ], - ), - ], - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + "Dr John Smith".toText16(isBold: true).toShimmer2(isShow: true), + SizedBox(height: 8.h), + Wrap( + direction: Axis.horizontal, + spacing: 3.h, + runSpacing: 4.h, children: [ - "".toText16(), - Transform.flip( - flipX: appState.isArabic(), - child: - Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon_small, width: 15.h, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)), + AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h), + AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h), ], ), ], ), ), - ).onPress(() async { - bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( - clinicID: myAppointmentsVM.patientMyDoctorsList[index].clinicID, - projectID: myAppointmentsVM.patientMyDoctorsList[index].projectID, - doctorID: myAppointmentsVM.patientMyDoctorsList[index].doctorID, - )); - LoaderBottomSheet.showLoader(); - await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { - LoaderBottomSheet.hideLoader(); - Navigator.of(context).push( - CustomPageRoute( - page: DoctorProfilePage(), - ), - ); - }, onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); - }), + ], ), + ], + ), + ), + ); + } + + final group = patientMyDoctorsViewList[index]; + final displayName = isSortByClinic ? (group.first.clinicName ?? 'Unknown') : (group.first.projectName ?? 'Unknown'); + final isExpanded = expandedIndex == index; + + return Container( + key: _groupKeys.putIfAbsent(index, () => GlobalKey()), + margin: EdgeInsets.only(bottom: 12.h), + padding: EdgeInsets.all(16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + WidgetsBinding.instance.addPostFrameCallback((_) { + final key = _groupKeys[index]; + if (key != null && key.currentContext != null && expandedIndex == index) { + Scrollable.ensureVisible( + key.currentContext!, + duration: Duration(milliseconds: 350), + curve: Curves.easeInOut, + alignment: 0.1, + ); + } + }); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${group.length} ${'doctors'.needTranslation}", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(isExpanded ? Icons.expand_less : Icons.chevron_right, color: AppColors.greyColor), + ], + ), + SizedBox(height: 8.h), + Text( + displayName, + style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), + overflow: TextOverflow.ellipsis, + ), + ], ), - ); + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 400), + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.only(top: 12.h), + child: Column( + children: group.map((doctor) { + return Container( + margin: EdgeInsets.only(bottom: 12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(14.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.network( + (doctor?.doctorImageURL ?? doctor?.doctorImage ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png"), + width: 24.h, + height: 24.h, + fit: BoxFit.cover, + ).circle(100), + SizedBox(width: 8.h), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (doctor?.doctorName ?? "").toString().toText14(weight: FontWeight.w500), + SizedBox(height: 6.h), + ], + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + CustomButton( + text: isSortByClinic ? (doctor?.clinicName ?? "") : (doctor?.projectName ?? ""), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Expanded( + flex: 6, + child: CustomButton( + text: "View Profile".needTranslation.tr(context: context), + onPressed: () async { + bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( + clinicID: doctor?.clinicID ?? 0, + projectID: doctor?.projectID ?? 0, + doctorID: doctor?.doctorID ?? 0, + )); + LoaderBottomSheet.showLoader(); + await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorProfilePage(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }, + backgroundColor: AppColors.bgRedLightColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 14, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ), + SizedBox(width: 8.h), + Expanded( + flex: 1, + child: Container( + height: 40.h, + width: 40.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.textColor, + borderRadius: 12, + ), + child: Padding( + padding: EdgeInsets.all(12.h), + child: Transform.flip( + flipX: getIt().isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.whiteColor, + fit: BoxFit.contain, + ), + ), + ), + ).onPress(() async { + bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( + clinicID: doctor?.clinicID ?? 0, + projectID: doctor?.projectID ?? 0, + doctorID: doctor?.doctorID ?? 0, + )); + LoaderBottomSheet.showLoader(); + await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorProfilePage(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }), + ), + ], + ), + ], + ), + ), + ); + }).toList(), + ), + ) + : SizedBox.shrink(), + ), + ], + ), + ); }, separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), @@ -191,8 +398,6 @@ class MyDoctorsPage extends StatelessWidget { ], ); }), - ), - ), ); } } diff --git a/lib/presentation/appointments/widgets/AppointmentFilter.dart b/lib/presentation/appointments/widgets/AppointmentFilter.dart index 98da22d..6546c65 100644 --- a/lib/presentation/appointments/widgets/AppointmentFilter.dart +++ b/lib/presentation/appointments/widgets/AppointmentFilter.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:smooth_corner/smooth_corner.dart'; diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart index e6b974e..64dc803 100644 --- a/lib/presentation/appointments/widgets/appointment_card.dart +++ b/lib/presentation/appointments/widgets/appointment_card.dart @@ -38,7 +38,7 @@ class AppointmentCard extends StatelessWidget { final MedicalFileViewModel? medicalFileViewModel; final ContactUsViewModel? contactUsViewModel; final BookAppointmentsViewModel bookAppointmentsViewModel; - + final bool isForRate; const AppointmentCard({ super.key, required this.patientAppointmentHistoryResponseModel, @@ -51,6 +51,7 @@ class AppointmentCard extends StatelessWidget { this.isForFeedback = false, this.medicalFileViewModel, this.contactUsViewModel, + this.isForRate =false }); @override @@ -63,11 +64,11 @@ class AppointmentCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildHeader(context, appState), + isForRate ? SizedBox(): _buildHeader(context, appState), SizedBox(height: 16.h), _buildDoctorRow(context), SizedBox(height: 16.h), - _buildActionArea(context, appState), + isForRate ? SizedBox(): _buildActionArea(context, appState), ], ), ), @@ -128,7 +129,7 @@ class AppointmentCard extends StatelessWidget { children: [ Image.network( isLoading ? 'https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png' : patientAppointmentHistoryResponseModel.doctorImageURL!, - width: 63.w, + width: 63.h, height: 63.h, fit: BoxFit.cover, ).circle(100.r).toShimmer2(isShow: isLoading), @@ -178,19 +179,28 @@ class AppointmentCard extends StatelessWidget { ? '${patientAppointmentHistoryResponseModel.clinicName!.substring(0, 12)}...' : patientAppointmentHistoryResponseModel.clinicName!), ).toShimmer2(isShow: isLoading), - AppCustomChipWidget(labelText: isLoading ? 'Olaya' : patientAppointmentHistoryResponseModel.projectName!).toShimmer2(isShow: isLoading), AppCustomChipWidget( + labelText: isLoading + ? 'Olaya' + : patientAppointmentHistoryResponseModel.projectName!.length > 15 + ? '${patientAppointmentHistoryResponseModel.projectName!.substring(0, 12)}...' + : patientAppointmentHistoryResponseModel.projectName!) + .toShimmer2(isShow: isLoading), + AppCustomChipWidget( + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), icon: AppAssets.appointment_calendar_icon, labelText: isLoading ? 'Cardiology' : "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)}", ).toShimmer2(isShow: isLoading), - AppCustomChipWidget( - isIconPNG: true, - icon: getIt.get().getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, - iconSize: 18.h, - labelText: isLoading ? 'Cardiology' : "Patient: ${getIt.get().getAuthenticatedUser()!.firstName!}", - ).toShimmer2(isShow: isLoading), + + // AppCustomChipWidget( + // labelPadding: EdgeInsetsDirectional.only(start: -2.w, end: 6.w), + // isIconPNG: true, + // icon: getIt.get().getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, + // iconSize: 18.h, + // labelText: isLoading ? 'Cardiology' : "Patient: ${getIt.get().getAuthenticatedUser()!.firstName!}", + // ).toShimmer2(isShow: isLoading), // if (!isFromMedicalReport) // AppCustomChipWidget( // icon: AppAssets.appointment_time_icon, @@ -235,7 +245,8 @@ class AppointmentCard extends StatelessWidget { fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.symmetric(horizontal: 10.w), - height: isTablet || isFoldable ? 46.h : 40.h, + // height: isTablet || isFoldable ? 46.h : 40.h, + height: 40.h, icon: AppAssets.checkmark_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, @@ -261,7 +272,7 @@ class AppointmentCard extends StatelessWidget { fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.symmetric(horizontal: 10.w), - height: isTablet || isFoldable ? 46.h : 40.h, + height: 40.h, icon: AppointmentType.getNextActionIcon(patientAppointmentHistoryResponseModel.nextAction), iconColor: AppointmentType.getNextActionTextColor(patientAppointmentHistoryResponseModel.nextAction), iconSize: 15.h, @@ -333,7 +344,8 @@ class AppointmentCard extends StatelessWidget { fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.symmetric(horizontal: 10.w), - height: isTablet || isFoldable ? 46.h : 40.h, + // height: isTablet || isFoldable ? 46.h : 40.h, + height: 40.h, icon: AppAssets.ask_doctor_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, @@ -346,14 +358,14 @@ class AppointmentCard extends StatelessWidget { backgroundColor: AppColors.greyColor, borderColor: AppColors.greyColor, textColor: AppColors.blackColor, - fontSize: 14.f, + fontSize: 12.f, fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.symmetric(horizontal: 10.w), - height: isTablet || isFoldable ? 46.h : 40.h, + height: 40.h, icon: AppAssets.rebook_appointment_icon, iconColor: AppColors.blackColor, - iconSize: 16.h, + iconSize: 14.h, ); } @@ -366,6 +378,7 @@ class AppointmentCard extends StatelessWidget { ), ); } else { + bookAppointmentsViewModel.getAppointmentNearestGate(projectID: patientAppointmentHistoryResponseModel.projectID, clinicID: patientAppointmentHistoryResponseModel.clinicID); Navigator.of(context) .push( CustomPageRoute( diff --git a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart index f430447..d118a5e 100644 --- a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart +++ b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart @@ -14,7 +14,6 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/appointment_queue_page.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:barcode_scan2/barcode_scan2.dart'; @@ -22,7 +21,6 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/nfc/nfc_reader_sheet.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; class AppointmentCheckinBottomSheet extends StatelessWidget { AppointmentCheckinBottomSheet({super.key, required this.patientAppointmentHistoryResponseModel, required this.myAppointmentsViewModel}); @@ -60,7 +58,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; print(dist); if (dist <= projectDetailListModel.geofenceRadius!) { - sendCheckInRequest(projectDetailListModel.checkInQrCode!, context); + sendCheckInRequest(projectDetailListModel.checkInQrCode!, 3, context); } else { showCommonBottomSheetWithoutHeight(context, title: "Error".needTranslation, @@ -79,7 +77,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { - sendCheckInRequest(nfcId, context); + sendCheckInRequest(nfcId, 1, context); }); }, onCancel: () {}); }); @@ -92,7 +90,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { ).onPress(() async { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { - sendCheckInRequest(onlineCheckInQRCode, context); + sendCheckInRequest(onlineCheckInQRCode, 2, context); } else {} }), ], @@ -140,15 +138,16 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { ); } - void sendCheckInRequest(String scannedCode, BuildContext context) async { + void sendCheckInRequest(String scannedCode, int checkInType, BuildContext context) async { LoaderBottomSheet.showLoader(loadingText: "Processing Check-In...".needTranslation); await myAppointmentsViewModel.sendCheckInNfcRequest( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel, scannedCode: scannedCode, - checkInType: 2, + checkInType: checkInType, onSuccess: (apiResponse) { LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight(context, title: "Success".needTranslation, child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () { + showCommonBottomSheetWithoutHeight(context, title: "Success".needTranslation, child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () async { + await myAppointmentsViewModel.getPatientAppointmentQueueDetails(); Navigator.of(context).pop(); Navigator.pushAndRemoveUntil( context, diff --git a/lib/presentation/appointments/widgets/appointment_doctor_card.dart b/lib/presentation/appointments/widgets/appointment_doctor_card.dart index 96d538b..ccf6674 100644 --- a/lib/presentation/appointments/widgets/appointment_doctor_card.dart +++ b/lib/presentation/appointments/widgets/appointment_doctor_card.dart @@ -47,7 +47,7 @@ class AppointmentDoctorCard extends StatelessWidget { children: [ Image.network( patientAppointmentHistoryResponseModel.doctorImageURL!, - width: 63.w, + width: 63.h, height: 63.h, fit: BoxFit.cover, ).circle(100.r), @@ -99,6 +99,7 @@ class AppointmentDoctorCard extends StatelessWidget { labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), ), AppCustomChipWidget( + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), icon: AppAssets.doctor_calendar_icon, labelText: "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang( DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), @@ -106,6 +107,7 @@ class AppointmentDoctorCard extends StatelessWidget { )}", ), AppCustomChipWidget( + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), icon: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppAssets.walkin_appointment_icon : AppAssets.small_livecare_icon, @@ -165,14 +167,14 @@ class AppointmentDoctorCard extends StatelessWidget { backgroundColor: AppColors.greyColor, borderColor: AppColors.greyColor, textColor: AppColors.blackColor, - fontSize: 14.f, + fontSize: 12.f, fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), height: 40.h, icon: AppAssets.rebook_appointment_icon, iconColor: AppColors.blackColor, - iconSize: 16.h, + iconSize: 14.h, ); } else { return patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false diff --git a/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart b/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart index 69cdca3..01aab4e 100644 --- a/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart +++ b/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; -import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; diff --git a/lib/presentation/appointments/widgets/faculity_selection/facility_selection_item.dart b/lib/presentation/appointments/widgets/faculity_selection/facility_selection_item.dart index c7ef3a9..2f5589c 100644 --- a/lib/presentation/appointments/widgets/faculity_selection/facility_selection_item.dart +++ b/lib/presentation/appointments/widgets/faculity_selection/facility_selection_item.dart @@ -4,10 +4,8 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; -import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; class FacilitySelectionItem extends StatelessWidget { diff --git a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart index cacc9d3..cb27f9f 100644 --- a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart @@ -8,8 +8,6 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart' - show MyAppointmentsViewModel; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/faculity_selection/facility_selection_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body_for_doctor_filter.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body_for_doctor_filter.dart index 58a0d00..a2d22cd 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body_for_doctor_filter.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body_for_doctor_filter.dart @@ -1,21 +1,14 @@ import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; -import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart'; class HospitalBottomSheetBodyForDoctorFilter extends StatelessWidget { diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart index 660f95e..b01b541 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart @@ -7,7 +7,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart index b023f7a..cbf68f6 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart @@ -4,7 +4,6 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:provider/provider.dart' show Consumer; diff --git a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart index 754db53..969e23a 100644 --- a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart +++ b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart @@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; diff --git a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart index 6bc8007..2def72c 100644 --- a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart +++ b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart @@ -6,7 +6,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart' show MyAppointmentsViewModel; import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart' show RegionListItem; import 'package:provider/provider.dart'; diff --git a/lib/presentation/authentication/login.dart b/lib/presentation/authentication/login.dart index 28430a8..c14e957 100644 --- a/lib/presentation/authentication/login.dart +++ b/lib/presentation/authentication/login.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; diff --git a/lib/presentation/blood_donation/widgets/select_blood_group_widget.dart b/lib/presentation/blood_donation/widgets/select_blood_group_widget.dart index f9cadb2..a5ac071 100644 --- a/lib/presentation/blood_donation/widgets/select_blood_group_widget.dart +++ b/lib/presentation/blood_donation/widgets/select_blood_group_widget.dart @@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart'; -import 'package:hmg_patient_app_new/presentation/blood_donation/widgets/city_list_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; class SelectBloodGroupWidget extends StatelessWidget { diff --git a/lib/presentation/blood_donation/widgets/select_city_widget.dart b/lib/presentation/blood_donation/widgets/select_city_widget.dart index a0e8477..8e2f9a0 100644 --- a/lib/presentation/blood_donation/widgets/select_city_widget.dart +++ b/lib/presentation/blood_donation/widgets/select_city_widget.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart'; import 'package:hmg_patient_app_new/presentation/blood_donation/widgets/city_list_item.dart'; -import 'package:hmg_patient_app_new/theme/colors.dart'; class SelectCityWidget extends StatelessWidget { SelectCityWidget({super.key, required this.bloodDonationViewModel}); diff --git a/lib/presentation/blood_donation/widgets/select_gender_widget.dart b/lib/presentation/blood_donation/widgets/select_gender_widget.dart index b253331..67cd4bb 100644 --- a/lib/presentation/blood_donation/widgets/select_gender_widget.dart +++ b/lib/presentation/blood_donation/widgets/select_gender_widget.dart @@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart'; -import 'package:hmg_patient_app_new/presentation/blood_donation/widgets/city_list_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; class SelectGenderWidget extends StatelessWidget { diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index 0ad58cc..5aa1b7c 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -4,11 +4,11 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; -import 'package:hmg_patient_app_new/core/utils/size_config.dart'; -import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; @@ -25,7 +25,6 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immed import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/select_immediate_livecare_clinic_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/search_doctor_by_name.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart'; -import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -55,7 +54,7 @@ class _BookAppointmentPageState extends State { void initState() { authVM = context.read(); scheduleMicrotask(() { - bookAppointmentsViewModel.selectedTabIndex = 0; + // bookAppointmentsViewModel.selectedTabIndex = 0; bookAppointmentsViewModel.initBookAppointmentViewModel(); bookAppointmentsViewModel.getLocation(); immediateLiveCareViewModel.initImmediateLiveCare(); @@ -69,147 +68,142 @@ class _BookAppointmentPageState extends State { immediateLiveCareViewModel = Provider.of(context, listen: false); appState = getIt.get(); regionalViewModel = Provider.of(context, listen: true); + getSelectedTabData(bookAppointmentsViewModel.selectedTabIndex); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, - body: CollapsingListView( - title: LocaleKeys.bookAppo.tr(context: context), - isLeading: true, - leadingCallback: () { - Navigator.pushAndRemoveUntil( - context, - CustomPageRoute( - page: LandingNavigation(), - ), - (r) => false); - }, - child: SingleChildScrollView( - child: Consumer(builder: (context, bookAppointmentsVM, child) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 16.h), - CustomTabBar( - activeTextColor: Color(0xffED1C2B), - activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), - tabs: [ - CustomTabBarModel(null, "General".needTranslation), - CustomTabBarModel(null, "LiveCare".needTranslation), - ], - onTabChange: (index) { - bookAppointmentsVM.onTabChanged(index); - }, - ).paddingSymmetrical(24.h, 0.h), - SizedBox(height: 24.h), - getSelectedTabData(bookAppointmentsVM.selectedTabIndex), - SizedBox(height: 24.h), - "Recent Visits".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0.h), - SizedBox(height: 16.h), - Consumer(builder: (context, myAppointmentsVM, child) { - return myAppointmentsVM.isPatientMyDoctorsLoading - ? Column( - crossAxisAlignment: CrossAxisAlignment.center, + body: Column( + children: [ + Expanded( + child: CollapsingListView( + title: LocaleKeys.bookAppo.tr(context: context), + isLeading: true, + child: SingleChildScrollView( + child: Consumer(builder: (context, bookAppointmentsVM, child) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.network( - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - width: 64.w, - height: 64.h, - fit: BoxFit.cover, - ).circle(100).toShimmer2(isShow: true, radius: 50.r), - SizedBox(height: 8.h), - ("Dr. John Smith Smith Smith") - .toString() - .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) - .toShimmer2(isShow: true), - ], - ) - : myAppointmentsVM.patientMyDoctorsList.isEmpty - ? Container( - width: SizeConfig.screenWidth, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.r, - hasShadow: false, - ), - child: Utils.getNoDataWidget( - context, - noDataText: "You don't have any completed visits yet".needTranslation, - isSmallWidget: true, - width: 62.w, - height: 62.h, - ), - ).paddingSymmetrical(24.w, 0.h) - : SizedBox( - height: 110.h, - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: myAppointmentsVM.patientMyDoctorsList.length, - shrinkWrap: true, - padding: EdgeInsets.only(left: 24.w, right: 24.w), - itemBuilder: (context, index) { - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - horizontalOffset: 100.0, - child: FadeInAnimation( - child: SizedBox( - // width: 80.w, - child: Column( + SizedBox(height: 16.h), + CustomTabBar( + activeTextColor: Color(0xffED1C2B), + activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), + initialIndex: bookAppointmentsVM.selectedTabIndex, + tabs: [ + CustomTabBarModel(null, "General".needTranslation), + CustomTabBarModel(null, "LiveCare".needTranslation), + ], + onTabChange: (index) { + bookAppointmentsVM.onTabChanged(index); + }, + ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 24.h), + getSelectedTabData(bookAppointmentsVM.selectedTabIndex), + SizedBox(height: 24.h), + if (appState.isAuthenticated) ...[ + Consumer(builder: (context, myAppointmentsVM, child) { + return myAppointmentsVM.isPatientMyDoctorsLoading + ? Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.network( - myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!, + "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 64.w, height: 64.h, fit: BoxFit.cover, - ).circle(100).toShimmer2(isShow: false, radius: 50.r), + ).circle(100).toShimmer2(isShow: true, radius: 50.r), SizedBox(height: 8.h), - SizedBox( - width: 80.w, - child: (myAppointmentsVM.patientMyDoctorsList[index].doctorName) - .toString() - .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) - .toShimmer2(isShow: false), - ), + ("Dr. John Smith Smith Smith") + .toString() + .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) + .toShimmer2(isShow: true), ], - ), - ).onPress(() async { - bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( - clinicID: myAppointmentsVM.patientMyDoctorsList[index].clinicID, - projectID: myAppointmentsVM.patientMyDoctorsList[index].projectID, - doctorID: myAppointmentsVM.patientMyDoctorsList[index].doctorID, - )); - LoaderBottomSheet.showLoader(); - await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { - LoaderBottomSheet.hideLoader(); - Navigator.of(context).push( - CustomPageRoute( - page: DoctorProfilePage(), - ), - ); - }, onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); - }), - ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h), - ), + ) + : myAppointmentsVM.patientMyDoctorsList.isEmpty + ? SizedBox() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (appState.isAuthenticated) ...[], + "Recent Visits".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0.h), + SizedBox(height: 16.h), + SizedBox( + height: 110.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: myAppointmentsVM.patientMyDoctorsList.length, + shrinkWrap: true, + padding: EdgeInsets.only(left: 24.w, right: 24.w), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: SizedBox( + // width: 80.w, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.network( + myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!, + width: 64.h, + height: 64.h, + fit: BoxFit.cover, + ).circle(100).toShimmer2(isShow: false, radius: 50.r), + SizedBox(height: 8.h), + SizedBox( + width: 80.w, + child: (myAppointmentsVM.patientMyDoctorsList[index].doctorName) + .toString() + .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) + .toShimmer2(isShow: false), + ), + ], + ), + ).onPress(() async { + bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( + clinicID: myAppointmentsVM.patientMyDoctorsList[index].clinicID, + projectID: myAppointmentsVM.patientMyDoctorsList[index].projectID, + doctorID: myAppointmentsVM.patientMyDoctorsList[index].doctorID, + )); + LoaderBottomSheet.showLoader(); + await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorProfilePage(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }), + ), + ), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h), + ), + ), + ], + ); + }), + ], + ], ); }), - ], - ); - }), - ), + ), + ), + ), + _buildSymptomsBottomCard(), + ], ), ); } @@ -331,10 +325,12 @@ class _BookAppointmentPageState extends State { ).paddingSymmetrical(24.h, 0.h); case 1: //TODO: Get LiveCare type Select UI from Hussain - return appState.isAuthenticated - ? Column( - children: [ - Container( + return + // appState.isAuthenticated + // ? + Column( + children: [ + Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.h, @@ -453,13 +449,45 @@ class _BookAppointmentPageState extends State { ), ], ).paddingSymmetrical(24.h, 0.h) - : getLiveCareNotLoggedInUI(); + // : getLiveCareNotLoggedInUI() + ; default: SizedBox.shrink(); } return Container(); } + Widget _buildSymptomsBottomCard() { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Not sure? help me choose a clinic!".needTranslation.toText16(weight: FontWeight.w600, color: AppColors.textColor), + SizedBox(height: 4.h), + "Mention your symptoms and find the list of doctors accordingly".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: AppColors.greyTextColor, + ), + ], + ), + ), + SizedBox(width: 16.w), + CustomButton( + height: 40.h, + text: "", + onPressed: () => context.navigateWithName(AppRoutes.userInfoSelection), + icon: AppAssets.arrow_forward, + ) + ], + ).paddingAll(24.w), + ); + } + void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) { regionalViewModel.flush(); regionalViewModel.setBottomSheetType(type); diff --git a/lib/presentation/book_appointment/doctor_filter/RegionChips.dart b/lib/presentation/book_appointment/doctor_filter/RegionChips.dart index c81e548..19e391e 100644 --- a/lib/presentation/book_appointment/doctor_filter/RegionChips.dart +++ b/lib/presentation/book_appointment/doctor_filter/RegionChips.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart' - show BookAppointmentsViewModel; import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; diff --git a/lib/presentation/book_appointment/doctor_filter/clinic_bottomsheet.dart b/lib/presentation/book_appointment/doctor_filter/clinic_bottomsheet.dart index 155d8e3..982fc54 100644 --- a/lib/presentation/book_appointment/doctor_filter/clinic_bottomsheet.dart +++ b/lib/presentation/book_appointment/doctor_filter/clinic_bottomsheet.dart @@ -2,26 +2,16 @@ import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; -import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_filter/clinic_item.dart'; -import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/clinic_card.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; -import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart'; -import '../../../features/book_appointments/models/resp_models/get_clinic_list_response_model.dart' show GetClinicsListResponseModel; class ClinicBottomSheet extends StatelessWidget { late BookAppointmentsViewModel appointmentsViewModel; diff --git a/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart b/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart index 6e51f8a..e4d11bd 100644 --- a/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart +++ b/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart @@ -9,7 +9,6 @@ import 'package:hmg_patient_app_new/features/book_appointments/book_appointments import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body_for_doctor_filter.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_filter/RegionChips.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_filter/clinic_bottomsheet.dart'; diff --git a/lib/presentation/book_appointment/doctor_filter/facility_Chips.dart b/lib/presentation/book_appointment/doctor_filter/facility_Chips.dart index f416ed4..e64c53f 100644 --- a/lib/presentation/book_appointment/doctor_filter/facility_Chips.dart +++ b/lib/presentation/book_appointment/doctor_filter/facility_Chips.dart @@ -4,8 +4,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart' - show BookAppointmentsViewModel; import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; diff --git a/lib/presentation/book_appointment/doctor_profile_page.dart b/lib/presentation/book_appointment/doctor_profile_page.dart index c3f4ad9..5ce7fac 100644 --- a/lib/presentation/book_appointment/doctor_profile_page.dart +++ b/lib/presentation/book_appointment/doctor_profile_page.dart @@ -1,18 +1,13 @@ -import 'dart:math'; -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; -import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/book_appointment/laser/laser_appointment.dart b/lib/presentation/book_appointment/laser/laser_appointment.dart index 440ae45..19a3800 100644 --- a/lib/presentation/book_appointment/laser/laser_appointment.dart +++ b/lib/presentation/book_appointment/laser/laser_appointment.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart' show CapExtension; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; @@ -82,7 +83,7 @@ class LaserAppointment extends StatelessWidget { activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null,LocaleKeys.malE.tr()), - CustomTabBarModel(null,LocaleKeys.female.tr()), + CustomTabBarModel(null, "Female".needTranslation), ], onTabChange: (index) { var viewmodel = context.read(); diff --git a/lib/presentation/book_appointment/laser/widgets/body_type_listing.dart b/lib/presentation/book_appointment/laser/widgets/body_type_listing.dart index d8fa736..baf72d2 100644 --- a/lib/presentation/book_appointment/laser/widgets/body_type_listing.dart +++ b/lib/presentation/book_appointment/laser/widgets/body_type_listing.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/LaserCategoryType.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -45,20 +44,22 @@ class BodyTypeListing extends StatelessWidget { ? AppColors.chipPrimaryRedBorderColor : AppColors.blackColor, iconSize: 16, - labelPadding: - EdgeInsetsDirectional.only(start: 8.h, end: 0.h), - padding: - EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.h), - deleteIconSize: Size(18.h, 18.h), - shape: SmoothRectangleBorder( - borderRadius: BorderRadius.circular(10), - smoothness: 10, + labelPadding: EdgeInsetsDirectional.only(start: 8.w, end: 8.w), + padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.w), + deleteIconSize: Size(18.w, 18.h), + shape: SmoothRectangleBorder( + borderRadius: BorderRadius.circular(10.r), + smoothness: 10, side: BorderSide( color: index == selectedBodyAreaIndex ? AppColors.chipPrimaryRedBorderColor : AppColors.borderGrayColor, width: 1), - )).onPress(() => onCategoryChanged(index)))) + )).onPress( + () => onCategoryChanged(index), + ), + ), + ) ], ), ); diff --git a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart index b586da1..2371f4a 100644 --- a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart +++ b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart @@ -1,3 +1,4 @@ + import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; @@ -64,7 +65,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { child: Row( children: [ Image.asset( - appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, + appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 52.h, height: 52.h, ), @@ -322,15 +323,29 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { } Future askVideoCallPermission() async { - Map statuses = await [Permission.camera, Permission.microphone, Permission.notification].request(); + bool hasPermission = false; + if (Platform.isIOS) { + Map statuses = await [Permission.camera, Permission.microphone].request(); - if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted && statuses[Permission.notification] == PermissionStatus.granted) { - // Camera permission granted - return true; + if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted) { + // Camera permission granted + hasPermission = true; + } else { + hasPermission = false; + } } else { - return false; + Map statuses = await [Permission.camera, Permission.microphone, Permission.notification].request(); + + if (statuses[Permission.camera] == PermissionStatus.granted && statuses[Permission.microphone] == PermissionStatus.granted && statuses[Permission.notification] == PermissionStatus.granted) { + // Camera permission granted + hasPermission = true; + } else { + hasPermission = false; + } } + return hasPermission; + // if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { // return false; // } diff --git a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart index 914ac4a..48e79b1 100644 --- a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart +++ b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart @@ -11,30 +11,25 @@ import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.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/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immediate_livecare_pending_request_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:smooth_corner/smooth_corner.dart'; @@ -147,7 +142,7 @@ class _ImmediateLiveCarePaymentPageState extends State { Expanded( child: CollapsingListView( title: LocaleKeys.reviewAppointment.tr(context: context), - child: SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 24.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 24.h), - LocaleKeys.docInfo.tr(context: context).toText16(isBold: true), - SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.network( - bookAppointmentsViewModel.selectedDoctor.doctorImageURL!, - width: 50.h, - height: 50.h, - fit: BoxFit.cover, - ).circle(100), - SizedBox(width: 8.h), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - SizedBox( - width: MediaQuery.of(context).size.width * 0.49, - child: - "${bookAppointmentsViewModel.selectedDoctor.doctorTitle} ${bookAppointmentsViewModel.selectedDoctor.name}".toString().toText16(isBold: true, maxlines: 1), - ), - Image.network( - bookAppointmentsViewModel.selectedDoctor.nationalityFlagURL!, - width: 20.h, - height: 15.h, - fit: BoxFit.cover, - ), - ], - ), - SizedBox(height: 2.h), - (bookAppointmentsViewModel.selectedDoctor.speciality!.isNotEmpty ? bookAppointmentsViewModel.selectedDoctor.speciality!.first : "") - .toString() - .toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor, maxLine: 1), - ], - ), - ], - ), - SizedBox(height: 12.h), - Wrap( - direction: Axis.horizontal, - spacing: 8.h, - runSpacing: 8.h, - children: [ - AppCustomChipWidget( - labelText: "${LocaleKeys.clinic.tr(context: context)}: ${bookAppointmentsViewModel.selectedDoctor.clinicName}".needTranslation, - ), - AppCustomChipWidget( - labelText: "${LocaleKeys.branch.tr(context: context)} ${bookAppointmentsViewModel.selectedDoctor.projectName}".needTranslation, - ), - AppCustomChipWidget( - labelText: - "${LocaleKeys.date.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? DateUtil.formatDateToDate(DateTime.now(), false) : bookAppointmentsViewModel.selectedAppointmentDate}" - .needTranslation, - ), - AppCustomChipWidget( - labelText: - "${LocaleKeys.time.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? "Waiting Appointment".needTranslation : bookAppointmentsViewModel.selectedAppointmentTime}" - .needTranslation, - ), - ], - ), - ], + child: Consumer(builder: (context, bookAppointmentsVM, child) { + return SingleChildScrollView( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + LocaleKeys.docInfo.tr(context: context).toText16(isBold: true), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, ), - ), - ), - SizedBox(height: 24.h), - LocaleKeys.patientInfo.tr(context: context).toText16(isBold: true), - SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Image.asset( - appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, - width: 52.h, - height: 52.h, - ), - SizedBox(width: 8.h), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText16(isBold: true), - SizedBox(height: 8.h), - AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old"), - ], - ), - ], + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.network( + bookAppointmentsViewModel.selectedDoctor.doctorImageURL!, + width: 50.h, + height: 50.h, + fit: BoxFit.cover, + ).circle(100), + SizedBox(width: 8.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + SizedBox( + width: MediaQuery.of(context).size.width * 0.49, + child: "${bookAppointmentsViewModel.selectedDoctor.doctorTitle} ${bookAppointmentsViewModel.selectedDoctor.name}" + .toString() + .toText16(isBold: true, maxlines: 1), + ), + Image.network( + bookAppointmentsViewModel.selectedDoctor.nationalityFlagURL!, + width: 20.h, + height: 15.h, + fit: BoxFit.cover, + ), + ], + ), + SizedBox(height: 2.h), + (bookAppointmentsViewModel.selectedDoctor.speciality!.isNotEmpty ? bookAppointmentsViewModel.selectedDoctor.speciality!.first : "") + .toString() + .toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor, maxLine: 1), + ], + ), + ], + ), + SizedBox(height: 12.h), + Wrap( + direction: Axis.horizontal, + spacing: 8.h, + runSpacing: 8.h, + children: [ + AppCustomChipWidget( + labelText: "${LocaleKeys.clinic.tr(context: context)}: ${bookAppointmentsViewModel.selectedDoctor.clinicName}".needTranslation, + ), + AppCustomChipWidget( + labelText: "${LocaleKeys.branch.tr(context: context)} ${bookAppointmentsViewModel.selectedDoctor.projectName}".needTranslation, + ), + AppCustomChipWidget( + labelText: + "${LocaleKeys.date.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? DateUtil.formatDateToDate(DateTime.now(), false) : bookAppointmentsViewModel.selectedAppointmentDate}" + .needTranslation, + ), + AppCustomChipWidget( + labelText: + "${LocaleKeys.time.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? "Waiting Appointment".needTranslation : bookAppointmentsViewModel.selectedAppointmentTime}" + .needTranslation, + ), + ], + ), + ], + ), ), ), - ), - SizedBox(height: 24.h), - "Hospital Information".needTranslation.toText16(isBold: true), - SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.h, - hasShadow: false, + SizedBox(height: 24.h), + LocaleKeys.patientInfo.tr(context: context).toText16(isBold: true), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( + children: [ + Image.asset( + appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, + width: 52.h, + height: 52.h, + ), + SizedBox(width: 8.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText16(isBold: true), + SizedBox(height: 8.h), + AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old"), + ], + ), + ], + ), + ), ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - bookAppointmentsViewModel.selectedDoctor.projectName!.toText16(isBold: true), - ], + SizedBox(height: 24.h), + "Hospital Information".needTranslation.toText16(isBold: true), + SizedBox(height: 16.h), + Container( + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + bookAppointmentsViewModel.selectedDoctor.projectName!.toText16(isBold: true), + SizedBox(height: 8.h), + Wrap( + direction: Axis.horizontal, + spacing: 8.w, + runSpacing: 8.h, + children: [ + AppCustomChipWidget( + labelText: bookAppointmentsVM.isAppointmentNearestGateLoading + ? "Floor: Ground Floor" + : "Floor: ${getIt.get().isArabic() ? bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocationN : bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocation}", + ).toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading), + AppCustomChipWidget( + labelText: + "Nearest Gate: ${getIt.get().isArabic() ? bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumberN : bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumber}") + .toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading), + ], + ), + ], + ), ), ), - ), - ], - ), - ), + ], + ), + ); + }), ), ), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, - borderRadius: 24.h, + borderRadius: 24.r, hasShadow: true, ), child: CustomButton( diff --git a/lib/presentation/book_appointment/search_doctor_by_name.dart b/lib/presentation/book_appointment/search_doctor_by_name.dart index bdb6773..d008497 100644 --- a/lib/presentation/book_appointment/search_doctor_by_name.dart +++ b/lib/presentation/book_appointment/search_doctor_by_name.dart @@ -2,8 +2,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; -import 'package:hmg_patient_app_new/core/app_state.dart'; -import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -21,7 +19,6 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; import '../../features/book_appointments/models/resp_models/doctors_list_response_model.dart'; diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart index d0bd740..450e86b 100644 --- a/lib/presentation/book_appointment/select_clinic_page.dart +++ b/lib/presentation/book_appointment/select_clinic_page.dart @@ -6,6 +6,7 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -27,17 +28,19 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; class SelectClinicPage extends StatefulWidget { bool isFromRegionFlow; + HealthCalculatorsTypeEnum? calculatorType; + dynamic calculatedResult; - SelectClinicPage({super.key, this.isFromRegionFlow = false}); + SelectClinicPage({super.key, this.isFromRegionFlow = false, this.calculatorType, this.calculatedResult}); @override State createState() => _SelectClinicPageState(); @@ -69,131 +72,873 @@ class _SelectClinicPageState extends State { bookAppointmentsViewModel = Provider.of(context, listen: false); regionalViewModel = Provider.of(context, listen: true); appState = getIt.get(); - return Scaffold( - backgroundColor: AppColors.bgScaffoldColor, - body: CollapsingListView( - title: bookAppointmentsViewModel.isLiveCareSchedule ? "Select LiveCare Clinic".needTranslation : LocaleKeys.selectClinic.tr(context: context), - child: SingleChildScrollView( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 24.h), - child: Consumer(builder: (context, bookAppointmentsVM, child) { - return Column( - children: [ - SizedBox(height: 16.h), - TextInputWidget( - labelText: LocaleKeys.search.tr(context: context), - hintText: LocaleKeys.clinicName.tr(context: context), - controller: searchEditingController, - isEnable: true, - prefix: null, - autoFocus: false, - isBorderAllowed: false, - keyboardType: TextInputType.text, - focusNode: textFocusNode, - suffix: searchEditingController.text.isNotEmpty - ? GestureDetector( - onTap: () { - searchEditingController.clear(); - bookAppointmentsViewModel.filterClinics(""); - textFocusNode.unfocus(); - }, - child: Utils.buildSvgWithAssets(icon: AppAssets.close_bottom_sheet_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown), - ) - : null, - onChange: (value) { - bookAppointmentsViewModel.filterClinics(value!); - }, - padding: EdgeInsets.symmetric( - vertical: ResponsiveExtension(10).h, - horizontal: ResponsiveExtension(15).h, + if (widget.calculatorType != null) { + return CollapsingListView( + title: "Your ${widget.calculatorType!.name.toCamelCase}", + bottomChild: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))), + padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h), + child: CustomButton( + text: LocaleKeys.bookAppo.tr(), + onPressed: () { + if (widget.calculatedResult["clinicId"] == null) { + bookAppointmentsViewModel.setIsDoctorsListLoading(true); + bookAppointmentsViewModel.isGetDocForHealthCal = true; + bookAppointmentsViewModel.calculationID = widget.calculatedResult["calculationID"]; + Navigator.push(context, CustomPageRoute(page: SelectDoctorPage())); + } else { + onClinicSelected(GetClinicsListResponseModel(clinicID: widget.calculatedResult["clinicId"], clinicDescription: "asdfds", clinicDescriptionN: "asdfds")); + } + }, + icon: null, + fontSize: 16.f, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + borderRadius: 12.r, + fontWeight: FontWeight.w500), + ), + child: getCalculatorResultWidget(type: widget.calculatorType!, calculatedResult: widget.calculatedResult).paddingSymmetrical(18.w, 24.h), + ); + } else { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: bookAppointmentsViewModel.isLiveCareSchedule ? "Select LiveCare Clinic".needTranslation : LocaleKeys.selectClinic.tr(context: context), + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Consumer(builder: (context, bookAppointmentsVM, child) { + return Column( + children: [ + SizedBox(height: 16.h), + TextInputWidget( + labelText: LocaleKeys.search.tr(context: context), + hintText: LocaleKeys.clinicName.tr(context: context), + controller: searchEditingController, + isEnable: true, + prefix: null, + autoFocus: false, + isBorderAllowed: false, + keyboardType: TextInputType.text, + focusNode: textFocusNode, + suffix: searchEditingController.text.isNotEmpty + ? GestureDetector( + onTap: () { + searchEditingController.clear(); + bookAppointmentsViewModel.filterClinics(""); + textFocusNode.unfocus(); + }, + child: Utils.buildSvgWithAssets(icon: AppAssets.close_bottom_sheet_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown), + ) + : null, + onChange: (value) { + bookAppointmentsViewModel.filterClinics(value!); + }, + padding: EdgeInsets.symmetric( + vertical: ResponsiveExtension(10).h, + horizontal: ResponsiveExtension(15).h, + ), ), - ), - bookAppointmentsVM.isLiveCareSchedule - ? ListView.separated( - padding: EdgeInsets.only(top: 24.h), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: bookAppointmentsVM.isClinicsListLoading ? 5 : bookAppointmentsVM.liveCareClinicsList.length, - itemBuilder: (context, index) { - return bookAppointmentsVM.isClinicsListLoading - ? ClinicCard( - bookAppointmentsVM: bookAppointmentsVM, - liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), - clinicsListResponseModel: GetClinicsListResponseModel(), - isLoading: bookAppointmentsVM.isClinicsListLoading, - ) - : AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 500), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), - child: ClinicCard( - bookAppointmentsVM: bookAppointmentsVM, - liveCareClinicsResponseModel: bookAppointmentsVM.liveCareClinicsList[index], - clinicsListResponseModel: GetClinicsListResponseModel(), - isLoading: bookAppointmentsVM.isClinicsListLoading, - ).onPress(() { - onLiveCareClinicSelected(bookAppointmentsVM.liveCareClinicsList[index]); - }), + bookAppointmentsVM.isLiveCareSchedule + ? ListView.separated( + padding: EdgeInsets.only(top: 24.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: bookAppointmentsVM.isClinicsListLoading ? 5 : bookAppointmentsVM.liveCareClinicsList.length, + itemBuilder: (context, index) { + return bookAppointmentsVM.isClinicsListLoading + ? ClinicCard( + bookAppointmentsVM: bookAppointmentsVM, + liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), + clinicsListResponseModel: GetClinicsListResponseModel(), + isLoading: bookAppointmentsVM.isClinicsListLoading, + ) + : AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 500), + child: SlideAnimation( + verticalOffset: 100.0, + child: FadeInAnimation( + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), + child: ClinicCard( + bookAppointmentsVM: bookAppointmentsVM, + liveCareClinicsResponseModel: bookAppointmentsVM.liveCareClinicsList[index], + clinicsListResponseModel: GetClinicsListResponseModel(), + isLoading: bookAppointmentsVM.isClinicsListLoading, + ).onPress(() { + onLiveCareClinicSelected(bookAppointmentsVM.liveCareClinicsList[index]); + }), + ), ), ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), - ) - : ListView.separated( - padding: EdgeInsets.only(top: 24.h), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: bookAppointmentsVM.isClinicsListLoading ? 5 : bookAppointmentsVM.filteredClinicsList.length, - itemBuilder: (context, index) { - return bookAppointmentsVM.isClinicsListLoading - ? ClinicCard( - bookAppointmentsVM: bookAppointmentsVM, - liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), - clinicsListResponseModel: GetClinicsListResponseModel(), - isLoading: bookAppointmentsVM.isClinicsListLoading, - ) - : AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 500), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), - child: ClinicCard( - bookAppointmentsVM: bookAppointmentsVM, - liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), - clinicsListResponseModel: bookAppointmentsVM.filteredClinicsList[index], - isLoading: bookAppointmentsVM.isClinicsListLoading, - ).onPress(() { - onClinicSelected(bookAppointmentsVM.filteredClinicsList[index]); - }), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), + ) + : ListView.separated( + padding: EdgeInsets.only(top: 24.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: bookAppointmentsVM.isClinicsListLoading ? 5 : bookAppointmentsVM.filteredClinicsList.length, + itemBuilder: (context, index) { + return bookAppointmentsVM.isClinicsListLoading + ? ClinicCard( + bookAppointmentsVM: bookAppointmentsVM, + liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), + clinicsListResponseModel: GetClinicsListResponseModel(), + isLoading: bookAppointmentsVM.isClinicsListLoading, + ) + : AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 500), + child: SlideAnimation( + verticalOffset: 100.0, + child: FadeInAnimation( + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), + child: ClinicCard( + bookAppointmentsVM: bookAppointmentsVM, + liveCareClinicsResponseModel: GetLiveCareClinicsResponseModel(), + clinicsListResponseModel: bookAppointmentsVM.filteredClinicsList[index], + isLoading: bookAppointmentsVM.isClinicsListLoading, + ).onPress(() { + onClinicSelected(bookAppointmentsVM.filteredClinicsList[index]); + }), + ), ), ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), + ), + ], + ); + }), + ), + ), + ), + ); + } + } + + Widget getCalculatorResultWidget({required HealthCalculatorsTypeEnum type, dynamic calculatedResult}) { + switch (widget.calculatorType!) { + case HealthCalculatorsTypeEnum.bmi: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.calories: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.bmr: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.idealBodyWeight: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.bodyFat: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.crabsProteinFat: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.ovulation: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.deliveryDueDate: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.bloodSugar: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.bloodCholesterol: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + case HealthCalculatorsTypeEnum.triglycerides: + return resultWidget(type: widget.calculatorType!, calculatedResult: calculatedResult); + } + } + + Widget resultWidget({required HealthCalculatorsTypeEnum type, dynamic calculatedResult}) { + return Column( + children: [ + if (type == HealthCalculatorsTypeEnum.bmi) ...[ + if (calculatedResult["bmiCategory"] == "Normal") ...[ + calorieWidget( + title: calculatedResult["bmiCategory"], + calories: calculatedResult["bmiResult"], + description: + 'Your BMI is within the healthy range. Continue a balanced diet, regular physical activity, and routine checkups to maintain good health. Monitor any significant changes over time.', + color: Colors.green, + icon: Icons.scale, + hide: true, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["bmiCategory"] == "Underweight") ...[ + calorieWidget( + title: calculatedResult["bmiCategory"], + calories: calculatedResult["bmiResult"], + description: + 'BMI suggests you are underweight. Consider increasing calorie intake with nutrient-dense foods, include resistance training to build muscle, and consult a healthcare professional to check for underlying causes.', + color: Colors.orange, + hide: true, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["bmiCategory"] == "Overweight") ...[ + calorieWidget( + title: calculatedResult["bmiCategory"], + calories: calculatedResult["bmiResult"], + description: + 'BMI indicates overweight. Aim for gradual, sustainable weight loss through a modest calorie deficit, regular physical activity, and healthier food choices. Seek medical advice before major lifestyle changes.', + color: Colors.red, + hide: true, + icon: Icons.warning_rounded, + ), + ] + ] else if (type == HealthCalculatorsTypeEnum.calories) ...[ + if (calculatedResult["calorieRange"] == "Normal") ...[ + calorieWidget( + title: calculatedResult["calorieRange"], + calories: calculatedResult["calories"], + description: + 'Estimated daily calories to maintain your current weight given your activity level and metabolism. Use this as a baseline: increase slightly for muscle gain, or create a small deficit for gradual weight loss. Track progress and adjust every 2–4 weeks.', + color: Colors.green, + icon: Icons.scale, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["calorieRange"] == "Low") ...[ + calorieWidget( + title: calculatedResult["calorieRange"], + calories: calculatedResult["calories"], + description: + 'A moderate calorie reduction designed for steady, sustainable weight loss (typically 0.25–0.5 kg per week). Combine with resistance training and adequate protein to preserve muscle. Avoid extreme cuts and consult a professional if you have medical conditions.', + color: Colors.orange, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["calorieRange"] == "High") ...[ + calorieWidget( + title: calculatedResult["calorieRange"], + calories: calculatedResult["calories"], + description: + 'A large calorie reduction that may produce faster weight loss but can be hard to sustain and increase risk of nutrient deficiencies, fatigue, or muscle loss. Not recommended long-term; seek guidance from a healthcare or nutrition professional before continuing.', + color: Colors.red, + icon: Icons.warning_rounded, + ), + ] + ] else if (type == HealthCalculatorsTypeEnum.bmr) ...[ + if (calculatedResult["bmrRange"] == "Normal") ...[ + calorieWidget( + title: calculatedResult["bmrRange"], + calories: calculatedResult["bmr"], + description: + 'Your Basal Metabolic Rate (BMR) is within the expected range for your profile. BMR is the energy your body needs at rest to maintain vital functions (breathing, circulation, temperature). Use this value as the baseline for estimating total daily energy needs by applying an activity multiplier. Maintain a balanced diet and regular physical activity to support metabolic health.', + color: Colors.green, + hide: true, + icon: Icons.scale, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["bmrRange"] == "Low") ...[ + calorieWidget( + title: calculatedResult["bmrRange"], + calories: calculatedResult["bmr"], + description: + 'Your BMR is lower than typical for your profile. Possible causes include lower lean muscle mass, age-related metabolic decline, or metabolic adaptation from prolonged calorie restriction. Consider focusing on resistance training to build/maintain muscle, ensure adequate protein and micronutrient intake, and consult a healthcare professional if this is unexpected.', + color: Colors.orange, + hide: true, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["bmrRange"] == "High") ...[ + calorieWidget( + title: calculatedResult["bmrRange"], + calories: calculatedResult["bmr"], + description: + 'Your BMR is higher than average for your profile. This can reflect greater lean mass, younger age, or a naturally higher metabolic rate, meaning you burn more energy at rest. Use this information to tailor calorie targets: higher needs for maintenance or muscle gain, moderate deficit for weight loss. Seek medical advice if you notice rapid unexplained changes.', + color: Colors.red, + hide: true, + icon: Icons.warning_rounded, + ), + ] + ] else if (type == HealthCalculatorsTypeEnum.idealBodyWeight) ...[ + if (calculatedResult["status"] == "Normal") ...[ + calorieWidget( + title: calculatedResult["status"], + calories: calculatedResult["ibw"], + hide: true, + description: (() { + final diff = calculatedResult["difference"]; + if (diff is num) { + if (diff == 0) { + return 'Your weight is at the ideal target. Maintain your current habits — balanced diet and regular activity — to keep this.'; + } else if (diff > 0) { + return 'You are below the ideal weight by ${diff.toStringAsFixed(1)} kg. Aim to gradually increase weight with a modest calorie surplus, nutrient-dense foods, and resistance training.'; + } else { + return 'You are above the ideal weight by ${diff.abs().toStringAsFixed(1)} kg. Aim for a gradual, sustainable weight reduction through a moderate calorie deficit, increased activity, and balanced nutrition.'; + } + } + return 'Your weight is close to the ideal range. Maintain a balanced diet and regular activity; follow personalized advice from a healthcare professional if needed.'; + })(), + color: Colors.green, + icon: Icons.scale, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["status"] == "Underweight") ...[ + calorieWidget( + title: calculatedResult["status"], + calories: calculatedResult["ibw"], + hide: true, + description: (() { + final diff = calculatedResult["difference"]; + if (diff is num) { + return 'You are below the ideal weight by ${diff.toStringAsFixed(1)} kg. Focus on increasing calorie intake with nutrient-dense foods, prioritize protein and resistance training to build healthy mass, and consider consulting a healthcare professional.'; + } + return 'You appear underweight compared to the ideal. Consider increasing calorie intake with nutrient-dense foods and resistance training; seek professional guidance if needed.'; + })(), + color: Colors.orange, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["status"] == "Overweight") ...[ + calorieWidget( + title: calculatedResult["status"], + calories: calculatedResult["ibw"], + hide: true, + description: (() { + final diff = calculatedResult["difference"]; + if (diff is num) { + return 'You are above the ideal weight by ${diff.abs().toStringAsFixed(1)} kg. Aim for a gradual, sustainable weight loss strategy — moderate calorie deficit, regular physical activity, and balanced nutrition. Consult a professional before major changes.'; + } + return 'You appear above the ideal weight. Consider a gradual, sustainable calorie deficit combined with activity and balanced nutrition; consult a professional if needed.'; + })(), + color: Colors.red, + icon: Icons.warning_rounded, + ), + ] + ] else if (type == HealthCalculatorsTypeEnum.crabsProteinFat) ...[ + if (calculatedResult["dietType"] == "Very Low Crabs") ...[ + calorieWidget( + title: calculatedResult["dietType"].toString(), + calories: calculatedResult["totalCalories"], + description: (() { + final total = calculatedResult["totalCalories"]; + final carbsG = calculatedResult["carbsGrams"]; + final carbsC = calculatedResult["carbsCalories"]; + final protG = calculatedResult["proteinGrams"]; + final protC = calculatedResult["proteinCalories"]; + final fatG = calculatedResult["fatGrams"]; + final fatC = calculatedResult["fatCalories"]; + final base = + 'Very low‑carb (ketogenic) approach: minimal carbohydrates, higher fat and moderate protein. May support rapid weight loss and improved blood sugar control for some, but can be hard to sustain and may cause nutrient gaps. Monitor hydration/electrolytes and consult a professional for long‑term use.'; + // if (total is num) { + // return '$base\n\nTotal: ${total.toStringAsFixed(0)} kcal.\n\nBreakdown: Carbs ${carbsG is num ? carbsG.toStringAsFixed(0) + " g" : "N/A"} (${carbsC is num ? carbsC.toStringAsFixed(0) + " kcal" : "N/A"}),\nProtein ${protG is num ? protG.toStringAsFixed(0) + " g" : "N/A"} (${protC is num ? protC.toStringAsFixed(0) + " kcal" : "N/A"}),\nFat ${fatG is num ? fatG.toStringAsFixed(1) + " g" : "N/A"} (${fatC is num ? fatC.toStringAsFixed(0) + " kcal" : "N/A"}).'; + // } + return base; + })(), + chipsItems: [ + ('Carbohydrates: ' + calculatedResult["carbsGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["carbsCalories"].toStringAsFixed(0) + ' kcal'), + ('Protein: ' + calculatedResult["proteinGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["proteinCalories"].toStringAsFixed(0) + ' kcal'), + ('Fat: ' + calculatedResult["fatGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["fatCalories"].toStringAsFixed(0) + ' kcal'), + ], + color: Colors.orange, + hide: true, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["dietType"] == "Low Crabs") ...[ + calorieWidget( + title: calculatedResult["dietType"].toString(), + calories: calculatedResult["totalCalories"], + description: (() { + final total = calculatedResult["totalCalories"]; + final carbsG = calculatedResult["carbsGrams"]; + final carbsC = calculatedResult["carbsCalories"]; + final protG = calculatedResult["proteinGrams"]; + final protC = calculatedResult["proteinCalories"]; + final fatG = calculatedResult["fatGrams"]; + final fatC = calculatedResult["fatCalories"]; + final base = + 'Low‑carb, higher‑protein plan: reduced carbohydrates with increased protein to support satiety and muscle maintenance. Helpful for weight management and glycemic control when balanced with vegetables and healthy fats. Ensure adequate fiber and micronutrients.'; + // if (total is num) { + // return '$base\n\nTotal: ${total.toStringAsFixed(0)} kcal.\n\nBreakdown:\nCarbs ${carbsG is num ? carbsG.toStringAsFixed(0) + " g" : "N/A"} (${carbsC is num ? carbsC.toStringAsFixed(0) + " kcal" : "N/A"}),\nProtein ${protG is num ? protG.toStringAsFixed(0) + " g" : "N/A"} (${protC is num ? protC.toStringAsFixed(0) + " kcal" : "N/A"}),\nFat ${fatG is num ? fatG.toStringAsFixed(1) + " g" : "N/A"} (${fatC is num ? fatC.toStringAsFixed(0) + " kcal" : "N/A"}).'; + // } + return base; + })(), + chipsItems: [ + ('Carbohydrates: ' + calculatedResult["carbsGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["carbsCalories"].toStringAsFixed(0) + ' kcal'), + ('Protein: ' + calculatedResult["proteinGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["proteinCalories"].toStringAsFixed(0) + ' kcal'), + ('Fat: ' + calculatedResult["fatGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["fatCalories"].toStringAsFixed(0) + ' kcal'), + ], + color: Colors.orange, + hide: true, + icon: Icons.trending_down, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["dietType"] == "Moderate Crabs") ...[ + calorieWidget( + title: calculatedResult["dietType"].toString(), + calories: calculatedResult["totalCalories"], + description: (() { + final total = calculatedResult["totalCalories"]; + final carbsG = calculatedResult["carbsGrams"]; + final carbsC = calculatedResult["carbsCalories"]; + final protG = calculatedResult["proteinGrams"]; + final protC = calculatedResult["proteinCalories"]; + final fatG = calculatedResult["fatGrams"]; + final fatC = calculatedResult["fatCalories"]; + final base = + 'Moderate carbohydrate intake with balanced protein and fats: provides steady energy for daily activity and exercise while allowing flexibility. Suitable for many people aiming for sustainable weight management and performance.'; + // if (total is num) { + // return '$base\n\nTotal: ${total.toStringAsFixed(0)} kcal.\n\nBreakdown:\nCarbs ${carbsG is num ? carbsG.toStringAsFixed(0) + " g" : "N/A"} (${carbsC is num ? carbsC.toStringAsFixed(0) + " kcal" : "N/A"}),\nProtein ${protG is num ? protG.toStringAsFixed(0) + " g" : "N/A"} (${protC is num ? protC.toStringAsFixed(0) + " kcal" : "N/A"}),\nFat ${fatG is num ? fatG.toStringAsFixed(1) + " g" : "N/A"} (${fatC is num ? fatC.toStringAsFixed(0) + " kcal" : "N/A"}).'; + // } + return base; + })(), + chipsItems: [ + ('Carbohydrates: ' + calculatedResult["carbsGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["carbsCalories"].toStringAsFixed(0) + ' kcal'), + ('Protein: ' + calculatedResult["proteinGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["proteinCalories"].toStringAsFixed(0) + ' kcal'), + ('Fat: ' + calculatedResult["fatGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["fatCalories"].toStringAsFixed(0) + ' kcal'), + ], + color: Colors.green, + hide: true, + icon: Icons.scale, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["dietType"] == "USDA Guidelines ") ...[ + calorieWidget( + title: calculatedResult["dietType"].toString(), + calories: calculatedResult["totalCalories"], + description: (() { + final total = calculatedResult["totalCalories"]; + final carbsG = calculatedResult["carbsGrams"]; + final carbsC = calculatedResult["carbsCalories"]; + final protG = calculatedResult["proteinGrams"]; + final protC = calculatedResult["proteinCalories"]; + final fatG = calculatedResult["fatGrams"]; + final fatC = calculatedResult["fatCalories"]; + final base = + 'USDA‑based balanced pattern: emphasizes fruits, vegetables, whole grains, lean proteins, and limited added sugars and saturated fats. Evidence‑based framework for general health, nutrient adequacy, and chronic disease prevention.'; + // if (total is num) { + // return '$base\n\nTotal: ${total.toStringAsFixed(0)} kcal.\n\nBreakdown:\nCarbs ${carbsG is num ? carbsG.toStringAsFixed(0) + " g" : "N/A"} (${carbsC is num ? carbsC.toStringAsFixed(0) + " kcal" : "N/A"}),\nProtein ${protG is num ? protG.toStringAsFixed(0) + " g" : "N/A"} (${protC is num ? protC.toStringAsFixed(0) + " kcal" : "N/A"}),\nFat ${fatG is num ? fatG.toStringAsFixed(1) + " g" : "N/A"} (${fatC is num ? fatC.toStringAsFixed(0) + " kcal" : "N/A"}).'; + // } + + return base; + })(), + chipsItems: [ + ('Carbohydrates: ' + calculatedResult["carbsGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["carbsCalories"].toStringAsFixed(0) + ' kcal'), + ('Protein: ' + calculatedResult["proteinGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["proteinCalories"].toStringAsFixed(0) + ' kcal'), + ('Fat: ' + calculatedResult["fatGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["fatCalories"].toStringAsFixed(0) + ' kcal'), + ], + color: Colors.green, + hide: true, + icon: Icons.scale, + ), + SizedBox(height: 16.h), + ] else if (calculatedResult["dietType"] == "Zone Diet") ...[ + calorieWidget( + title: calculatedResult["dietType"].toString(), + calories: calculatedResult["totalCalories"], + description: (() { + final total = calculatedResult["totalCalories"]; + final carbsG = calculatedResult["carbsGrams"]; + final carbsC = calculatedResult["carbsCalories"]; + final protG = calculatedResult["proteinGrams"]; + final protC = calculatedResult["proteinCalories"]; + final fatG = calculatedResult["fatGrams"]; + final fatC = calculatedResult["fatCalories"]; + final base = + 'Zone Diet (~40% carbs / 30% protein / 30% fat): emphasizes hormonal balance and portion control. May improve body composition and energy for some, but requires planning; personalize with a nutrition professional.'; + // if (total is num) { + // return '$base\n\nTotal: ${total.toStringAsFixed(0)} kcal.\n\nBreakdown:\nCarbs ${carbsG is num ? carbsG.toStringAsFixed(0) + " g" : "N/A"} (${carbsC is num ? carbsC.toStringAsFixed(0) + " kcal" : "N/A"}),\nProtein ${protG is num ? protG.toStringAsFixed(0) + " g" : "N/A"} (${protC is num ? protC.toStringAsFixed(0) + " kcal" : "N/A"}),\nFat ${fatG is num ? fatG.toStringAsFixed(1) + " g" : "N/A"} (${fatC is num ? fatC.toStringAsFixed(0) + " kcal" : "N/A"}).'; + // } + return base; + })(), + chipsItems: [ + ('Carbohydrates: ' + calculatedResult["carbsGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["carbsCalories"].toStringAsFixed(0) + ' kcal'), + ('Protein: ' + calculatedResult["proteinGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["proteinCalories"].toStringAsFixed(0) + ' kcal'), + ('Fat: ' + calculatedResult["fatGrams"].toStringAsFixed(0) + 'g = ' + calculatedResult["fatCalories"].toStringAsFixed(0) + ' kcal'), + ], + color: Colors.orange, + hide: true, + icon: Icons.warning_rounded, + ), + ] + ] else if (type == HealthCalculatorsTypeEnum.ovulation) ...[ + Column( + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.nextPeriodAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["lastPeriodDate"].toString().toText16(color: AppColors.successColor, weight: FontWeight.w600), + ], ), - ], - ); - }), + ], + ), + SizedBox(height: 8.h), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: calculatedResult["lastPeriodDay"].toString(), + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + SizedBox(height: 16.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.ovulationAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["ovulationDate"].toString().toText16(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + SizedBox(height: 8.h), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: calculatedResult["ovulationDay"].toString(), + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + SizedBox(height: 16.h), + "Fertility Window".toText16(color: AppColors.textColor, weight: FontWeight.w600), + SizedBox(height: 8.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.fertileAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["fertileWindowStart"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + SizedBox( + width: 4.w, + ), + "-".toText16(isBold: true, color: AppColors.successColor), + SizedBox( + width: 4.w, + ), + calculatedResult["fertileWindowEnd"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + SizedBox(height: 8.h), + "This is your fertile window. Maintaining a healthy calorie range supports your body during this period, considering your Basal Metabolic Rate and activity. Your Body Mass Index is within the healthy range." + .toText12(height: 1.5, color: AppColors.textColorLight, fontWeight: FontWeight.w500) + ], + ), + ), + SizedBox( + height: 16.h, + ), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.bulb), + SizedBox( + width: 8.w, + ), + Row( + children: [ + "Tips to keep in mind".toText16(color: AppColors.textColor, weight: FontWeight.w600), + ], + ), + ], + ), + SizedBox(height: 8.h), + Column( + children: [ + _buildTipRow("Drink before you feel thirsty."), + SizedBox(height: 4.h), + _buildTipRow("Keep a refillable bottle next to you."), + SizedBox(height: 4.h), + _buildTipRow("Track your daily intake to stay motivated."), + SizedBox(height: 4.h), + _buildTipRow("Choose sparkling water instead of soda."), + ], + ).paddingOnly(left: 4.w, right: 4.w) + ], + ), + ), + ], + ) + ] else if (type == HealthCalculatorsTypeEnum.deliveryDueDate) ...[ + Column( + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.pregnancyDueDateAccordion, width: 30.h, height: 30.h), + SizedBox(width: 8.w), + calculatedResult["dueDate"].toString().toText16(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + Expanded(child: SizedBox(width: 8.w)), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: calculatedResult["dueDateDay"].toString(), + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + ], + ), + ], + ), + ), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "First Trimester".toText16(color: AppColors.textColor, weight: FontWeight.w600), + Expanded(child: SizedBox(width: 8.h)), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: "${calculatedResult["firstTrimester"]["weeks"]} Weeks", + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.fertileAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["firstTrimester"]["start"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + SizedBox( + width: 4.w, + ), + "-".toText16(isBold: true, color: AppColors.successColor), + SizedBox( + width: 4.w, + ), + calculatedResult["firstTrimester"]["end"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + SizedBox(height: 8.h), + ], + ), + ), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Second Trimester".toText16(color: AppColors.textColor, weight: FontWeight.w600), + Expanded(child: SizedBox(width: 8.h)), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: "${calculatedResult["secondTrimester"]["weeks"]} Weeks", + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.ovulationAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["secondTrimester"]["start"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + SizedBox( + width: 4.w, + ), + "-".toText16(isBold: true, color: AppColors.successColor), + SizedBox( + width: 4.w, + ), + calculatedResult["secondTrimester"]["end"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + SizedBox(height: 8.h), + ], + ), + ), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Third Trimester".toText16(color: AppColors.textColor, weight: FontWeight.w600), + Expanded(child: SizedBox(width: 8.h)), + CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: "${calculatedResult["thirdTrimester"]["weeks"]} Weeks", + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.pregnancyDayAccordion, width: 30.h, height: 30.h), + SizedBox( + width: 8.w, + ), + calculatedResult["thirdTrimester"]["start"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + SizedBox( + width: 4.w, + ), + "-".toText16(isBold: true, color: AppColors.successColor), + SizedBox( + width: 4.w, + ), + calculatedResult["thirdTrimester"]["end"].toString().toText13(color: AppColors.successColor, weight: FontWeight.w600), + ], + ), + SizedBox(height: 8.h), + ], + ), + ), + ], + ) + ], + ], + ); + } + + Widget _buildTipRow(String text) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 6.h, right: 8.w), + child: CircleAvatar( + radius: 3.r, + backgroundColor: AppColors.textColorLight, ), ), + Expanded( + child: text.toText12(color: AppColors.textColorLight, fontWeight: FontWeight.w500, height: 1.2.h), + ), + ], + ); + } + + Widget calorieWidget({required String title, required dynamic calories, required String description, required Color color, required IconData icon, bool hide = false, List? chipsItems}) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + ('${calories.toStringAsFixed(0)}').toText32(color: getTextColor(title), isBold: true), + SizedBox(width: 10.w), + hide ? SizedBox() : 'kcal/day'.toText12(color: AppColors.inputLabelTextColor, isBold: true, fontWeight: FontWeight.w600) + ], + ), + _buildStatusIcon(title) + ], + ), + SizedBox(height: 16.h), + if (chipsItems != null && chipsItems.isNotEmpty) ...[ + Wrap( + spacing: 8.0, // Horizontal space between chips + runSpacing: 4.0, // Vertical space between rows of chips + children: chipsItems.map((item) { + return CustomChipWidget( + height: 30.h, + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: item, + iconAsset: null, + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor) + .paddingOnly(bottom: 4.h); + }).toList(), + ), + SizedBox(height: 8.h), + ], + title.toText16(color: AppColors.textColor, weight: FontWeight.w600), + SizedBox(height: 8.h), + description.toText12(height: 1.2.h, color: AppColors.textColorLight, fontWeight: FontWeight.w500) + ], ), ); } + Widget _buildStatusIcon(String title) { + final key = title.trim(); + if (key == 'Maintenance Calories' || key == 'Normal' || key == 'Ideal Weight' || key == 'Moderate Crabs' || key == 'USDA Guidelines') { + return Utils.buildSvgWithAssets(icon: AppAssets.checkmark_icon, width: 24.w, height: 24.h); + } else if (key == 'Moderate Deficit' || key == 'Low' || key == 'Underweight' || key == 'Very Low Crabs' || key == 'Low Crabs' || key == 'Zone Diet') { + return Utils.buildSvgWithAssets(icon: AppAssets.trade_down_yellow, width: 24.w, height: 24.h); + } else if (key == 'Aggressive Deficit' || key == 'High' || key == 'Overweight' || key == "Obese") { + return Utils.buildSvgWithAssets(icon: AppAssets.trade_down_red, width: 24.w, height: 24.h); + } else { + return SizedBox(); + } + } + + Color getTextColor(String title) { + final key = title.trim(); + if (key == 'Maintenance Calories' || key == 'Normal' || key == 'Ideal Weight' || key == 'Moderate Crabs' || key == 'USDA Guidelines') { + return AppColors.successColor; + } else if (key == 'Moderate Deficit' || key == 'Low' || key == 'Underweight' || key == 'Very Low Crabs' || key == 'Low Crabs' || key == 'Zone Diet') { + return AppColors.warningColor; + } else if (key == 'Aggressive Deficit' || key == 'High' || key == 'Overweight' || key == "Obese") { + return AppColors.errorColor; + } else { + return Colors.black; + } + } + void onLiveCareClinicSelected(GetLiveCareClinicsResponseModel clinic) { bookAppointmentsViewModel.setLiveCareSelectedClinic(clinic); bookAppointmentsViewModel.setIsDoctorsListLoading(true); @@ -210,9 +955,12 @@ class _SelectClinicPageState extends State { if (clinic.isLiveCareClinicAndOnline ?? false) { Navigator.of(context).push( CustomPageRoute( - page: SelectLivecareClinicPage(onNegativeClicked: (){ + page: SelectLivecareClinicPage( + onNegativeClicked: () { handleDoctorScreen(clinic); - },), + }, + selectedClinic: clinic, + ), ), ); } else { @@ -226,9 +974,7 @@ class _SelectClinicPageState extends State { //Dental Clinic Flow if (clinic.clinicID == 17) { if (appState.isAuthenticated) { - initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel - .currentlySelectedHospitalFromRegionFlow ?? - "0")); + initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel.currentlySelectedHospitalFromRegionFlow ?? "0")); return; } else { bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); @@ -239,8 +985,7 @@ class _SelectClinicPageState extends State { ); return; } - } - else if (clinic.clinicID == 253) { + } else if (clinic.clinicID == 253) { bookAppointmentsViewModel.resetLaserData(); bookAppointmentsViewModel.getLaserClinic(); Navigator.push( @@ -267,8 +1012,7 @@ class _SelectClinicPageState extends State { } } - void openRegionListBottomSheet( - BuildContext context, RegionBottomSheetType type) { + void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) { bookAppointmentsViewModel.setProjectID(null); regionalViewModel.flush(); @@ -276,12 +1020,11 @@ class _SelectClinicPageState extends State { // AppointmentViaRegionViewmodel? viewmodel = null; showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer(builder: (_, data, __) => getTitle(data)), isDismissible: false, child: Consumer(builder: (_, data, __) { - return getRegionalSelectionWidget(data); - }), callBackFunc: () { - }); + return getRegionalSelectionWidget(data); + }), callBackFunc: () {}); } - Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { + Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { if (data.bottomSheetState == AppointmentViaRegionState.REGION_SELECTION) { return RegionBottomSheetBody(); } @@ -306,7 +1049,7 @@ class _SelectClinicPageState extends State { if (appState.isAuthenticated) { initDentalAppointment(); return SizedBox.shrink(); - }else { + } else { bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); } } @@ -319,8 +1062,7 @@ class _SelectClinicPageState extends State { } bookAppointmentsViewModel.setProjectID(id); return SizedBox.shrink(); - } - else { + } else { return SizedBox.shrink(); } return SizedBox.shrink(); @@ -474,9 +1216,7 @@ class _SelectClinicPageState extends State { void initDentalAppointment() async { await Future.delayed(Duration(milliseconds: 300)); - initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel - .currentlySelectedHospitalFromRegionFlow ?? - "0")); + initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel.currentlySelectedHospitalFromRegionFlow ?? "0")); return; } } diff --git a/lib/presentation/book_appointment/select_doctor_page.dart b/lib/presentation/book_appointment/select_doctor_page.dart index 46c3774..d77e152 100644 --- a/lib/presentation/book_appointment/select_doctor_page.dart +++ b/lib/presentation/book_appointment/select_doctor_page.dart @@ -17,6 +17,7 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_profile import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; @@ -32,20 +33,30 @@ class SelectDoctorPage extends StatefulWidget { class _SelectDoctorPageState extends State { TextEditingController searchEditingController = TextEditingController(); + int? expandedIndex; FocusNode textFocusNode = FocusNode(); late AppState appState; late BookAppointmentsViewModel bookAppointmentsViewModel; + // Scroll controller to control page scrolling when a group expands + late ScrollController _scrollController; + // Map of keys for each item to allow scrolling to them + final Map _itemKeys = {}; + @override void initState() { + _scrollController = ScrollController(); scheduleMicrotask(() { + bookAppointmentsViewModel.setIsNearestAppointmentSelected(false); if (bookAppointmentsViewModel.isLiveCareSchedule) { bookAppointmentsViewModel.getLiveCareDoctorsList(); } else { if (bookAppointmentsViewModel.selectedClinic.clinicID == 17) { bookAppointmentsViewModel.getDentalChiefComplaintDoctorsList(); + } else if (bookAppointmentsViewModel.isGetDocForHealthCal) { + bookAppointmentsViewModel.getDoctorsListByHealthCal(); } else { bookAppointmentsViewModel.getDoctorsList(); } @@ -54,6 +65,12 @@ class _SelectDoctorPageState extends State { super.initState(); } + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { bookAppointmentsViewModel = Provider.of(context, listen: false); @@ -63,6 +80,7 @@ class _SelectDoctorPageState extends State { body: CollapsingListView( title: "Choose Doctor".needTranslation, child: SingleChildScrollView( + controller: _scrollController, child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), child: Consumer(builder: (context, bookAppointmentsVM, child) { @@ -105,23 +123,80 @@ class _SelectDoctorPageState extends State { ), ], ), + SizedBox(height: 16.h), + Row( + children: [ + CustomButton( + text: LocaleKeys.byClinic.tr(context: context), + onPressed: () { + bookAppointmentsVM.setIsSortByClinic(true); + }, + backgroundColor: bookAppointmentsVM.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: bookAppointmentsVM.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + textColor: bookAppointmentsVM.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.byHospital.tr(context: context), + onPressed: () { + bookAppointmentsVM.setIsSortByClinic(false); + }, + backgroundColor: bookAppointmentsVM.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + borderColor: bookAppointmentsVM.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor, + textColor: bookAppointmentsVM.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ).paddingSymmetrical(0.h, 0.h), + SizedBox(height: 16.h), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.nearestAppo.tr(context: context).toText13(isBold: true), + SizedBox(height: 4.h), + "View nearest available appointments".needTranslation.toText11(color: AppColors.textColorLight, weight: FontWeight.w500), + ], + ), + const Spacer(), + Switch( + activeThumbColor: AppColors.successColor, + activeTrackColor: AppColors.successColor.withValues(alpha: .15), + value: bookAppointmentsVM.isNearestAppointmentSelected, + onChanged: (newValue) async { + bookAppointmentsVM.setIsNearestAppointmentSelected(newValue); + + }, + ), + ], + ), ListView.separated( - padding: EdgeInsets.only(top: 24.h), + padding: EdgeInsets.only(top: 16.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: bookAppointmentsVM.isDoctorsListLoading ? 5 - : (bookAppointmentsVM.isLiveCareSchedule - ? (bookAppointmentsVM.liveCareDoctorsList.isNotEmpty ? bookAppointmentsVM.liveCareDoctorsList.length : 1) - : (bookAppointmentsVM.doctorsList.isNotEmpty ? bookAppointmentsVM.doctorsList.length : 1)), + : (bookAppointmentsVM.doctorsListGrouped.isNotEmpty ? bookAppointmentsVM.doctorsListGrouped.length : 1), itemBuilder: (context, index) { + final isExpanded = expandedIndex == index; return bookAppointmentsVM.isDoctorsListLoading ? DoctorCard( doctorsListResponseModel: DoctorsListResponseModel(), isLoading: true, bookAppointmentsViewModel: bookAppointmentsViewModel, ) - : checkIsDoctorsListEmpty() + : bookAppointmentsVM.doctorsListGrouped.isEmpty ? Utils.getNoDataWidget(context, noDataText: "No Doctor found for selected criteria...".needTranslation) : AnimationConfiguration.staggeredList( position: index, @@ -130,40 +205,107 @@ class _SelectDoctorPageState extends State { verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( + key: _itemKeys.putIfAbsent(index, () => GlobalKey()), duration: Duration(milliseconds: 300), curve: Curves.easeInOut, - decoration: - RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), - child: DoctorCard( - doctorsListResponseModel: bookAppointmentsVM.isLiveCareSchedule - ? bookAppointmentsVM.liveCareDoctorsList[index] - : bookAppointmentsVM.doctorsList[index], - isLoading: false, - bookAppointmentsViewModel: bookAppointmentsViewModel, - ).onPress(() async { - bookAppointmentsVM.setSelectedDoctor(bookAppointmentsVM.isLiveCareSchedule - ? bookAppointmentsVM.liveCareDoctorsList[index] - : bookAppointmentsVM.doctorsList[index]); - // bookAppointmentsVM.setSelectedDoctor(DoctorsListResponseModel()); - LoaderBottomSheet.showLoader(); - await bookAppointmentsVM.getDoctorProfile(onSuccess: (dynamic respData) { - LoaderBottomSheet.hideLoader(); - Navigator.of(context).push( - CustomPageRoute( - page: DoctorProfilePage(), - ), - ); - }, onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); - }), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), + child: InkWell( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + // After rebuild, ensure the expanded item is visible + WidgetsBinding.instance.addPostFrameCallback((_) { + final key = _itemKeys[index]; + if (key != null && key.currentContext != null && expandedIndex == index) { + Scrollable.ensureVisible( + key.currentContext!, + duration: Duration(milliseconds: 350), + curve: Curves.easeInOut, + alignment: 0.1, + ); + } + }); + }, + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Header row with count badge and expand/collapse icon + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${bookAppointmentsVM.doctorsListGrouped[index].length} ${'doctors'.needTranslation}", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + ], + ), + SizedBox(height: 8.h), + // Clinic/Hospital name as group title + Text( + bookAppointmentsVM.isSortByClinic + ? (bookAppointmentsVM.doctorsListGrouped[index].first.clinicName ?? 'Unknown') + : (bookAppointmentsVM.doctorsListGrouped[index].first.projectName ?? 'Unknown'), + style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), + overflow: TextOverflow.ellipsis, + ), + // Expanded content - list of doctors in this group + AnimatedSwitcher( + duration: Duration(milliseconds: 400), + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.only(top: 12.h), + child: Column( + children: bookAppointmentsVM.doctorsListGrouped[index].map((doctor) { + return Container( + margin: EdgeInsets.only(bottom: 12.h), + child: DoctorCard( + doctorsListResponseModel: doctor, + isLoading: false, + bookAppointmentsViewModel: bookAppointmentsViewModel, + ).onPress(() async { + bookAppointmentsVM.setSelectedDoctor(doctor); + LoaderBottomSheet.showLoader(); + await bookAppointmentsVM.getDoctorProfile(onSuccess: (dynamic respData) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorProfilePage(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }), + ); + }).toList(), + ), + ) + : SizedBox.shrink(), + ), + ], + ), + ), + ), ), ), ), diff --git a/lib/presentation/book_appointment/select_livecare_clinic_page.dart b/lib/presentation/book_appointment/select_livecare_clinic_page.dart index 719452d..2362617 100644 --- a/lib/presentation/book_appointment/select_livecare_clinic_page.dart +++ b/lib/presentation/book_appointment/select_livecare_clinic_page.dart @@ -1,22 +1,37 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart'; +import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; +import 'package:hmg_patient_app_new/features/immediate_livecare/models/resp_models/get_livecare_immediate_clinics_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:provider/provider.dart'; class SelectLivecareClinicPage extends StatelessWidget { final VoidCallback? onNegativeClicked; - const SelectLivecareClinicPage({super.key, this.onNegativeClicked}); + late GetClinicsListResponseModel selectedClinic; + + SelectLivecareClinicPage({super.key, this.onNegativeClicked, required this.selectedClinic}); + + late ImmediateLiveCareViewModel immediateLiveCareViewModel; @override Widget build(BuildContext context) { + immediateLiveCareViewModel = Provider.of(context, listen: false); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: Column( @@ -103,7 +118,36 @@ class SelectLivecareClinicPage extends StatelessWidget { children: [ CustomButton( text: "Yes please, I am in a hurry".needTranslation, - onPressed: () {}, + onPressed: () async { + Navigator.pop(context); + GetLiveCareClinicListResponseModel liveCareClinic = GetLiveCareClinicListResponseModel( + iD: selectedClinic.liveCareClinicID, + serviceID: selectedClinic.liveCareServiceID, + serviceName: selectedClinic.clinicDescription, + serviceNameN: selectedClinic.clinicDescriptionN, + ); + + immediateLiveCareViewModel.setLiveCareSelectedCallType(1); + immediateLiveCareViewModel.setImmediateLiveCareSelectedClinic(liveCareClinic); + LoaderBottomSheet.showLoader(loadingText: "Fetching fees, Please wait...".needTranslation); + await immediateLiveCareViewModel.getLiveCareImmediateAppointmentFees(onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + Navigator.of(getIt.get().navigatorKey.currentContext!).push( + CustomPageRoute( + page: ImmediateLiveCarePaymentDetails(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, textColor: AppColors.whiteColor, diff --git a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart index 965844a..4a2a304 100644 --- a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart +++ b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -143,6 +142,7 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { bookAppointmentsViewModel.waitingAppointmentProjectID, onSuccess: (value) { LoaderBottomSheet.hideLoader(); + bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.waitingAppointmentProjectID, clinicID: bookAppointmentsViewModel.waitingAppointmentDoctor!.clinicID!); bookAppointmentsViewModel.setIsWaitingAppointmentSelected(true); Navigator.of(context).push( CustomPageRoute( diff --git a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart index 8f9943c..8cfe6dd 100644 --- a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart +++ b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart @@ -152,7 +152,7 @@ class _WaitingAppointmentPaymentPageState extends State { ), ); } else { + bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!); bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime); Navigator.of(context).pop(); Navigator.of(context).push( diff --git a/lib/presentation/book_appointment/widgets/doctor_card.dart b/lib/presentation/book_appointment/widgets/doctor_card.dart index 7257dbf..ffe26ff 100644 --- a/lib/presentation/book_appointment/widgets/doctor_card.dart +++ b/lib/presentation/book_appointment/widgets/doctor_card.dart @@ -110,17 +110,19 @@ class DoctorCard extends StatelessWidget { AppCustomChipWidget( labelText: "Branch: ${isLoading ? "Olaya Hospital" : doctorsListResponseModel.projectName}".needTranslation, ).toShimmer2(isShow: isLoading), - AppCustomChipWidget( + doctorsListResponseModel.decimalDoctorRate != null ? AppCustomChipWidget( icon: AppAssets.rating_icon, iconColor: AppColors.ratingColorYellow, labelText: "Rating: ${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".needTranslation, - ).toShimmer2(isShow: isLoading), - doctorsListResponseModel.nearestFreeSlot != null + ).toShimmer2(isShow: isLoading) : SizedBox(), + bookAppointmentsViewModel.isNearestAppointmentSelected + ? doctorsListResponseModel.nearestFreeSlot != null ? AppCustomChipWidget( labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation, backgroundColor: AppColors.successColor, textColor: AppColors.whiteColor, ).toShimmer2(isShow: isLoading) + : SizedBox.shrink() : SizedBox.shrink(), ], ), diff --git a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart index b6164d9..18b656c 100644 --- a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart +++ b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart @@ -2,7 +2,6 @@ import 'dart:developer'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; @@ -22,6 +21,7 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -155,100 +155,24 @@ class _CmcSelectionReviewPageState extends State { } Widget _buildHospitalMap(HospitalsModel selectedHospital) { - final String lat = selectedHospital.latitude ?? "0.0"; - final String lng = selectedHospital.longitude ?? "0.0"; + final String lat = ((selectedHospital.latitude == null || selectedHospital.latitude!.isEmpty) ? "0.0" : selectedHospital.latitude) ?? "0.0"; + final String lng = ((selectedHospital.longitude == null || selectedHospital.longitude!.isEmpty) ? "0.0" : selectedHospital.longitude) ?? "0.0"; log("selectedHospital: $lng and $lat"); if (lat == "0.0" || lng == "0.0") return SizedBox.shrink(); - final String staticMapUrl = - "https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"; - - return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(12.r), - child: Image.network( - staticMapUrl, - height: 200.h, - width: double.infinity, - fit: BoxFit.cover, - loadingBuilder: (context, child, loadingProgress) { - if (loadingProgress == null) return child; - return Container( - height: 200.h, - decoration: BoxDecoration( - color: AppColors.bgScaffoldColor, - borderRadius: BorderRadius.circular(12.r), - ), - child: Center( - child: CircularProgressIndicator( - color: AppColors.primaryRedColor, - ), - ), - ); - }, - errorBuilder: (context, error, stackTrace) { - return Container( - height: 200.h, - decoration: BoxDecoration( - color: AppColors.bgScaffoldColor, - borderRadius: BorderRadius.circular(12.r), - ), - child: Center( - child: Icon( - Icons.error_outline, - size: 48.h, - color: AppColors.greyTextColor, - ), - ), - ); - }, - ), - ), - Positioned( - bottom: 12.h, - right: 12.w, - child: InkWell( - onTap: () => _launchDirections(selectedHospital), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 8.h), - decoration: BoxDecoration( - color: AppColors.whiteColor, - borderRadius: BorderRadius.circular(1000.r), - boxShadow: [ - BoxShadow( - color: Color.fromARGB(26, 0, 0, 0), - blurRadius: 8, - offset: Offset(0, 2), - ), - ], - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.directions_icon, - width: 16.w, - height: 16.h, - ), - SizedBox(width: 6.w), - Text( - "Get Directions".needTranslation, - style: TextStyle( - fontSize: 12.f, - fontWeight: FontWeight.w600, - color: AppColors.blackColor, - letterSpacing: -0.4, - ), - ), - ], - ), - ), - ), - ), - ], + final appState = getIt.get(); + final isArabic = appState.isArabic(); + final hospitalName = isArabic ? (selectedHospital.nameN ?? selectedHospital.name ?? '') : (selectedHospital.name ?? ''); + + return LocationMapWidget( + latitude: double.parse(lat), + longitude: double.parse(lng), + address: hospitalName, + showAddress: false, + padding: EdgeInsets.zero, + onDirectionsTap: () => _launchDirections(selectedHospital), ); } diff --git a/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart b/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart index 5529b93..8b9ad89 100644 --- a/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart +++ b/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart @@ -366,7 +366,12 @@ class _ComprehensiveCheckupPageState extends State { if (pendingOrder == null && _selectedServiceId != null) { return SafeArea( top: false, - child: Padding( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h), child: CustomButton( borderWidth: 0, diff --git a/lib/presentation/contact_us/feedback_page.dart b/lib/presentation/contact_us/feedback_page.dart index db7c218..078b3a1 100644 --- a/lib/presentation/contact_us/feedback_page.dart +++ b/lib/presentation/contact_us/feedback_page.dart @@ -8,13 +8,10 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/widgets/feedback_appointment_selection.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -349,7 +346,7 @@ class FeedbackPage extends StatelessWidget { fontWeight: FontWeight.w500, borderRadius: 10.r, padding: EdgeInsets.symmetric(horizontal: 10.w), - height: isTablet || isFoldable ? 46.h : 40.h, + height: 40.h, icon: AppAssets.file_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, diff --git a/lib/presentation/contact_us/find_us_page.dart b/lib/presentation/contact_us/find_us_page.dart index a4e4258..5957bb8 100644 --- a/lib/presentation/contact_us/find_us_page.dart +++ b/lib/presentation/contact_us/find_us_page.dart @@ -4,14 +4,11 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; -import 'package:hmg_patient_app_new/features/medical_file/models/patient_sickleave_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/widgets/find_us_item_card.dart'; -import 'package:hmg_patient_app_new/presentation/medical_file/widgets/patient_sick_leave_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; diff --git a/lib/presentation/contact_us/widgets/find_us_item_card.dart b/lib/presentation/contact_us/widgets/find_us_item_card.dart index a59959f..96375c0 100644 --- a/lib/presentation/contact_us/widgets/find_us_item_card.dart +++ b/lib/presentation/contact_us/widgets/find_us_item_card.dart @@ -4,13 +4,11 @@ import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; diff --git a/lib/presentation/covid19test/covid19_landing_page.dart b/lib/presentation/covid19test/covid19_landing_page.dart new file mode 100644 index 0000000..62bd651 --- /dev/null +++ b/lib/presentation/covid19test/covid19_landing_page.dart @@ -0,0 +1,283 @@ +import 'dart:async'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:provider/provider.dart'; + +import 'covid_19_questionnaire.dart'; + +class Covid19LandingPage extends StatefulWidget { +const Covid19LandingPage({super.key}); + +@override +State createState() => _Covid19LandingPageState(); +} + +class _Covid19LandingPageState extends State { + + late HabibWalletViewModel habibWalletVM; + int? _selectedBranchIndex; + + @override + void initState() { + habibWalletVM = Provider.of(context, listen: false); + scheduleMicrotask(() { + getProjectList(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Column( + children: [ + Expanded( + child: CollapsingListView( + title: "COVID-19", + child: Padding( + padding: EdgeInsets.all(24.w), + child: SingleChildScrollView( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Get the results in Few Hours" + .toText18( + color: AppColors.textColor, + weight: FontWeight.w600, + ), + SizedBox(height: 16.h), + LocaleKeys.covid_info + .tr() + .toText14( + color: AppColors.greyTextColor, + weight: FontWeight.w400, + height: 1.6, + ), + ], + ), + ), + ), + ), + ), + ), + ), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + // borderRadius: 24.r, + hasShadow: true, + customBorder: BorderRadius.only(topLeft:Radius.circular(24.r) , topRight:Radius.circular(24.r)) + ), + child: SizedBox( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomButton( + text: "SelectLocation".needTranslation, + onPressed: () { + _showBranchBottomSheet(context); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 50.h, + iconSize: 18.h, + ).paddingSymmetrical(16.h, 24.w), + ], + ), + ), + ), + ], + )); + } + void _showBranchBottomSheet(BuildContext context, ) { + // Set first branch as selected by default + setState(() { + _selectedBranchIndex = 0; + }); + + showCommonBottomSheet( + + context, + title: "Select Branch".needTranslation, + height: ResponsiveExtension.screenHeight * 0.651, + child: StatefulBuilder( + builder: (context, setBottomSheetState) { + return Consumer( + builder: (context, habibWalletVM, child) { + + final hospitals = habibWalletVM.advancePaymentHospitals; + if (hospitals.isEmpty) { + return const Center( + child: Padding( + padding: EdgeInsets.all(16.0), + child: Text('No branches available'), + ), + ); + } + + return Column( + children: [ + Expanded( + child:Container( + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h, bottom: 24.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + hasShadow: true, + customBorder: BorderRadius.only( + topLeft: Radius.circular(24.r), + topRight: Radius.circular(24.r), + ), + ), child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), + itemBuilder: (context, index) { + final branch = hospitals[index]; + final isSelected = _selectedBranchIndex == index; + return GestureDetector( + onTap: () { + setBottomSheetState(() { + _selectedBranchIndex = index; + }); + setState(() { + _selectedBranchIndex = index; + }); + }, + child: Container( + + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), + child: Row( + children: [ + // Radio button + Container( + width: 20.w, + height: 20.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: isSelected + ? AppColors.primaryRedColor + : AppColors.greyTextColor.withValues(alpha: 0.3), + width: 2, + ), + ), + child: isSelected + ? Center( + child: Container( + width: 10.w, + height: 10.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColors.primaryRedColor, + ), + ), + ) + : null, + ), + SizedBox(width: 12.w), + // Branch details + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox(height: 4.h), + (branch.desciption ?? 'Unknown').toText14( + color: AppColors.textColor, + weight: FontWeight.w600, + ), + ], + ), + ), + // Location icon + + ], + ), + ), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 12.h), + itemCount: hospitals.length, + )), + ), + // Next button + Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + hasShadow: true, + customBorder: BorderRadius.only( + topLeft: Radius.circular(24.r), + topRight: Radius.circular(24.r), + ), + ), + child: SafeArea( + top: false, + child: CustomButton( + text: "Next".needTranslation, + onPressed: (){ + + Navigator.of(context) + .push( + CustomPageRoute( + page: Covid19Questionnaire(selectedHospital: hospitals[_selectedBranchIndex!],), + ), + ); + + }, + backgroundColor: _selectedBranchIndex != null + ? AppColors.primaryRedColor + : AppColors.greyTextColor.withValues(alpha: 0.3), + borderColor: _selectedBranchIndex != null + ? AppColors.primaryRedColor + : AppColors.greyTextColor.withValues(alpha: 0.3), + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w600, + borderRadius: 12.r, + height: 56.h, + ), + ), + ), + ], + ); + }, + ); + }, + ), + + ); + } + + getProjectList() async{ + await habibWalletVM.getProjectsList(); + } +} + + diff --git a/lib/presentation/covid19test/covid_19_questionnaire.dart b/lib/presentation/covid19test/covid_19_questionnaire.dart new file mode 100644 index 0000000..8608d80 --- /dev/null +++ b/lib/presentation/covid19test/covid_19_questionnaire.dart @@ -0,0 +1,152 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/covid_questionnare_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; +import 'package:hmg_patient_app_new/presentation/covid19test/covid_review_screen.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/CustomSwitch.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; + +import 'package:provider/provider.dart'; + +class Covid19Questionnaire extends StatefulWidget { + final HospitalsModel selectedHospital; + const Covid19Questionnaire({super.key, required this.selectedHospital}); + + @override + State createState() => _Covid19QuestionnaireState(); +} + +class _Covid19QuestionnaireState extends State { + late HmgServicesViewModel hmgServicesViewModel; + List qaList = []; + + + @override + void initState() { + hmgServicesViewModel = Provider.of(context, listen: false); + scheduleMicrotask(() { + setState(() { + qaList = hmgServicesViewModel.getQuestionsFromJson(); + }); + }); + super.initState(); + } + + void _toggleAnswer(int index, bool value) { + setState(() { + qaList[index].ans = value ? 1 : 0; + }); + } + + @override + Widget build(BuildContext context) { + return CollapsingListView( + title: "COVID-19", + bottomChild: Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + hasShadow: true, + customBorder: BorderRadius.only( + topLeft: Radius.circular(24.r), + topRight: Radius.circular(24.r), + ), + ),child: CustomButton( + text: "Next".needTranslation, + onPressed: () { + moveToNextPage(context); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w600, + borderRadius: 12.r, + height: 56.h, + )), + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(24.w), + child: Column( + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Please answer below questionnaire:".toText14( + color: AppColors.textColor, + weight: FontWeight.w500, + ), + SizedBox(height: 20.h), + // Question list + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: qaList.length, + separatorBuilder: (context, index) => SizedBox(height: 16.h), + itemBuilder: (context, index) { + final question = qaList[index]; + final isAnswerYes = question.ans == 1; + + return Row( + children: [ + Expanded( + child: (question.questionEn ?? '').toText14( + color: AppColors.textColor, + weight: FontWeight.w400, + ), + ), + SizedBox(width: 12.w), + CustomSwitch( + value: isAnswerYes, + onChanged: (value) => _toggleAnswer(index, value), + ), + ], + ); + }, + ), + ], + ), + ), + ), + SizedBox(height: 16.h), + // Next button + + ], + ), + ), + + ), + ); + + + } + moveToNextPage(BuildContext context) async{ + LoaderBottomSheet.showLoader(); + await hmgServicesViewModel.getCovidProcedureList(); + await hmgServicesViewModel.getPaymentInfo(procedureID: hmgServicesViewModel.covidTestProcedureList[0].procedureId!); + LoaderBottomSheet.hideLoader(); + Navigator.of(context) + .push( + CustomPageRoute( + page: CovidReviewScreen(selectedHospital: widget.selectedHospital, qaList: qaList), + ), + ); + } +} diff --git a/lib/presentation/covid19test/covid_payment_screen.dart b/lib/presentation/covid19test/covid_payment_screen.dart new file mode 100644 index 0000000..42e7736 --- /dev/null +++ b/lib/presentation/covid19test/covid_payment_screen.dart @@ -0,0 +1,565 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; +import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:provider/provider.dart'; +import 'package:smooth_corner/smooth_corner.dart'; + +// Added imports required by this file +import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/core/cache_consts.dart'; + +/// A reusable payment screen for COVID-related payments. +/// +/// This screen re-uses the same UI pattern and payment flow used by +/// `AppointmentPaymentPage` (in-app browser, Apple Pay and payfort status checks), +/// but it keeps the post-payment handling generic (shows success / failure) +/// so it can be safely used for COVID test purchases without appointment-specific APIs. +class CovidPaymentScreen extends StatefulWidget { + final double amount; + final int projectID; + final int clinicID; + final String procedureId; + final double taxAmount; + final String title; + + const CovidPaymentScreen({ + super.key, + required this.amount, + required this.projectID, + required this.clinicID, + required this.procedureId, + this.taxAmount = 0.0, + this.title = "COVID Payment", + }); + + @override + State createState() => _CovidPaymentScreenState(); +} + +class _CovidPaymentScreenState extends State { + late PayfortViewModel payfortViewModel; + late AppState appState; + + MyInAppBrowser? browser; + String selectedPaymentMethod = ""; + String transID = ""; + + bool isShowTamara = false; // placeholder: could be enabled based on remote config + + @override + void initState() { + super.initState(); + // initialize payfort view model when the widget is ready + scheduleMicrotask(() { + payfortViewModel = Provider.of(context, listen: false); + payfortViewModel.initPayfortViewModel(); + payfortViewModel.setIsApplePayConfigurationLoading(false); + // Optionally compute if Tamara should be shown by calling a remote config API. + // For now keep it false (unless the app provides an API for it). + // Enable Tamara payment option for COVID screen + setState(() { + isShowTamara = true; + }); + }); + } + + @override + Widget build(BuildContext context) { + appState = getIt.get(); + payfortViewModel = Provider.of(context); + + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: widget.title.needTranslation, + bottomChild: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.h, + hasShadow: false, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 17.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "Amount before tax".needTranslation.toText14(isBold: true), + Utils.getPaymentAmountWithSymbol(( (widget.amount - widget.taxAmount).toString()).toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), + ], + ).paddingSymmetrical(24.h, 0.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + // Show VAT amount passed from review screen + Utils.getPaymentAmountWithSymbol((widget.taxAmount.toString()).toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: true), + ], + ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 17.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "".needTranslation.toText14(isBold: true), + Utils.getPaymentAmountWithSymbol(widget.amount.toString().toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), + ], + ).paddingSymmetrical(24.h, 0.h), + + // Apple Pay (iOS) + Platform.isIOS + ? Utils.buildSvgWithAssets( + icon: AppAssets.apple_pay_button, + width: 200.h, + height: 80.h, + fit: BoxFit.contain, + ).paddingSymmetrical(24.h, 0.h).onPress(() { + if (Utils.havePrivilege(103)) { + startApplePay(); + } else { + openPaymentURL("ApplePay"); + } + }) + : SizedBox(height: 12.h), + SizedBox(height: 12.h), + + // Action buttons: Cancel + Next (Next opens default payment flow - e.g. Visa) + // Padding( + // padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 24.h), + // child: Row( + // children: [ + // Expanded( + // child: CustomButton( + // height: 56.h, + // text: LocaleKeys.cancel.tr(), + // onPressed: () { + // Navigator.of(context).pop(); + // }, + // backgroundColor: AppColors.secondaryLightRedColor, + // borderColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.primaryRedColor, + // icon: AppAssets.cancel, + // iconColor: AppColors.primaryRedColor, + // borderRadius: 12.r, + // ), + // ), + // SizedBox(width: 8.h), + // Expanded( + // child: CustomButton( + // height: 56.h, + // text: "Next".needTranslation, + // onPressed: () { + // // Default to Visa for Next + // selectedPaymentMethod = "VISA"; + // openPaymentURL("visa"); + // }, + // backgroundColor: AppColors.primaryRedColor, + // borderColor: AppColors.primaryRedColor, + // textColor: AppColors.whiteColor, + // fontSize: 16.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.r, + // padding: EdgeInsets.symmetric(horizontal: 10.w), + // icon: AppAssets.add_icon, + // iconColor: AppColors.whiteColor, + // iconSize: 18.h, + // ), + // ), + // ], + // ), + // ), + ], + ), + ).paddingSymmetrical(0.h, 0.h), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + + // MADA tile + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset(AppAssets.mada, width: 72.h, height: 25.h), + SizedBox(height: 16.h), + "Mada".needTranslation.toText16(isBold: true), + ], + ), + SizedBox(width: 8.h), + const Spacer(), + Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.blackColor, + width: 18.h, + height: 13.h, + fit: BoxFit.contain, + ), + ), + ], + ).paddingSymmetrical(16.h, 16.h), + ).paddingSymmetrical(24.h, 0.h).onPress(() { + selectedPaymentMethod = "MADA"; + openPaymentURL("MADA"); + }), + + SizedBox(height: 16.h), + + // Visa / Mastercard tile + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset(AppAssets.visa, width: 50.h, height: 50.h), + SizedBox(width: 8.h), + Image.asset(AppAssets.mastercard, width: 40.h, height: 40.h), + ], + ), + SizedBox(height: 16.h), + "Visa or Mastercard".needTranslation.toText16(isBold: true), + ], + ), + SizedBox(width: 8.h), + const Spacer(), + Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.blackColor, + width: 18.h, + height: 13.h, + fit: BoxFit.contain, + ), + ), + ], + ).paddingSymmetrical(16.h, 16.h), + ).paddingSymmetrical(24.h, 0.h).onPress(() { + selectedPaymentMethod = "VISA"; + openPaymentURL("VISA"); + }), + + SizedBox(height: 16.h), + + // Optional Tamara tile (shown only if enabled) + isShowTamara + ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + AppAssets.tamaraEng, + width: 72.h, + height: 25.h, + fit: BoxFit.contain, + // If PNG fails to load for any reason, log and fallback to SVG asset + errorBuilder: (context, error, stackTrace) { + debugPrint('Failed to load Tamara PNG asset: $error'); + return Utils.buildSvgWithAssets( + icon: AppAssets.tamara, + width: 72.h, + height: 25.h, + fit: BoxFit.contain, + ); + }, + ), + SizedBox(height: 16.h), + "Tamara".needTranslation.toText16(isBold: true), + ], + ), + SizedBox(width: 8.h), + const Spacer(), + Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.blackColor, + width: 18.h, + height: 13.h, + fit: BoxFit.contain, + ), + ), + ], + ).paddingSymmetrical(16.h, 16.h), + ).paddingSymmetrical(24.h, 0.h).onPress(() { + selectedPaymentMethod = "TAMARA"; + openPaymentURL("TAMARA"); + }) + : SizedBox.shrink(), + + SizedBox(height: 24.h), + + // Bottom payment summary + + SizedBox(height: 24.h), + ], + ), + ), + + ), + ); + } + + void onBrowserLoadStart(String url) { + // Generic loader hook: detect success / error patterns from the in-app browser. + // Keep parsing defensive: use Uri.parse where possible. + try { + final uri = Uri.tryParse(url); + if (selectedPaymentMethod == "TAMARA" && uri != null) { + // tamara returns different query param names depending on platform; defensive checks + final params = uri.queryParameters; + if (params.isNotEmpty) { + // example keys: 'status', 'AuthorizePaymentId' (android) or 'paymentStatus', 'orderId' (iOS) + } + } + } catch (e) { + debugPrint('onBrowserLoadStart parse error: $e'); + } + + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + browser?.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + browser?.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + void onBrowserExit(bool isPaymentMade) async { + // When browser closes, check payment status using payfort view model + await checkPaymentStatus(); + } + + Future checkPaymentStatus() async { + LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); + try { + await payfortViewModel.checkPaymentStatus(transactionID: transID, onSuccess: (apiResponse) async { + // treat any successful responseMessage as success; otherwise show generic error + final success = payfortViewModel.payfortCheckPaymentStatusResponseModel?.responseMessage?.toLowerCase() == 'success'; + LoaderBottomSheet.hideLoader(); + if (success) { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getSuccessWidget(loadingText: "Payment successful".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } else { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + }); + } catch (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err.toString()), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + } + + void openPaymentURL(String paymentMethod) { + browser = MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart, context: context); + transID = Utils.getAppointmentTransID(widget.projectID, widget.clinicID, DateTime.now().millisecondsSinceEpoch); + + // Open payment browser with essential parameters; many fields are simplified here + browser?.openPaymentBrowser( + widget.amount, + "COVID Test Payment", + transID, + widget.projectID.toString(), + "CustID_${appState.getAuthenticatedUser()?.patientId ?? ''}@HMG.com", + selectedPaymentMethod, + appState.getAuthenticatedUser()?.patientType.toString() ?? "", + appState.getAuthenticatedUser() != null ? "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" : "", + appState.getAuthenticatedUser()?.patientId.toString() ?? "", + appState.getAuthenticatedUser() ?? (null as dynamic), + browser!, + false, + "2", + "", + context, + DateTime.now().toString(), + "", + 0, + 0, + "3", + ); + } + + void startApplePay() async { + showCommonBottomSheet( + context, + child: Utils.getLoadingWidget(), + callBackFunc: (str) {}, + title: "", + height: ResponsiveExtension.screenHeight * 0.3, + isCloseButtonVisible: false, + isDismissible: false, + isFullScreen: false, + ); + + transID = Utils.getAppointmentTransID(widget.projectID, widget.clinicID, DateTime.now().millisecondsSinceEpoch); + + // Prepare a minimal apple pay request using payfortViewModel's configuration + try { + await payfortViewModel.getPayfortConfigurations(serviceId: 0, projectId: widget.projectID, integrationId: 2); + + // Build minimal apple pay request (model omitted here to keep things generic) + ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest( + clientRequestID: transID, + clinicID: widget.clinicID, + currency: appState.getAuthenticatedUser() != null && appState.getAuthenticatedUser()!.outSa == 0 ? "SAR" : "AED", + customerEmail: "CustID_${appState.getAuthenticatedUser()?.patientId ?? ''}@HMG.com", + customerID: appState.getAuthenticatedUser()?.patientId, + customerName: appState.getAuthenticatedUser() != null ? "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" : "", + deviceToken: await Utils.getStringFromPrefs(CacheConst.pushToken), + voipToken: await Utils.getStringFromPrefs(CacheConst.voipToken), + doctorID: 0, + projectID: widget.projectID.toString(), + serviceID: "0", + channelID: 3, + patientID: appState.getAuthenticatedUser()?.patientId, + patientTypeID: appState.getAuthenticatedUser()?.patientType, + patientOutSA: appState.getAuthenticatedUser()?.outSa, + appointmentDate: DateTime.now().toString(), + appointmentNo: 0, + orderDescription: "COVID Test Payment", + liveServiceID: "0", + latitude: "0.0", + longitude: "0.0", + amount: widget.amount.toString(), + isSchedule: "0", + language: appState.isArabic() ? 'ar' : 'en', + languageID: appState.isArabic() ? 1 : 2, + userName: appState.getAuthenticatedUser()?.patientId, + responseContinueURL: "http://hmg.com/Documents/success.html", + backClickUrl: "http://hmg.com/Documents/success.html", + paymentOption: "ApplePay", + isMobSDK: true, + merchantReference: transID, + merchantIdentifier: payfortViewModel.payfortProjectDetailsRespModel?.merchantIdentifier, + commandType: "PURCHASE", + signature: payfortViewModel.payfortProjectDetailsRespModel?.signature, + accessCode: payfortViewModel.payfortProjectDetailsRespModel?.accessCode, + shaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel?.shaRequest, + shaResponsePhrase: payfortViewModel.payfortProjectDetailsRespModel?.shaResponse, + returnURL: "", + ); + + await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) { + // Start apple pay flow + payfortViewModel.paymentWithApplePay( + customerName: appState.getAuthenticatedUser() != null ? "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" : "", + customerEmail: "CustID_${appState.getAuthenticatedUser()?.patientId ?? ''}@HMG.com", + orderDescription: "COVID Test Payment", + orderAmount: widget.amount, + merchantReference: transID, + merchantIdentifier: payfortViewModel.payfortProjectDetailsRespModel?.merchantIdentifier ?? "", + applePayAccessCode: payfortViewModel.payfortProjectDetailsRespModel?.accessCode ?? "", + applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel?.shaRequest ?? "", + currency: appState.getAuthenticatedUser() != null && appState.getAuthenticatedUser()!.outSa == 0 ? "SAR" : "AED", + onFailed: (failureResult) async { + Navigator.of(context).pop(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: failureResult.message.toString()), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }, + onSucceeded: (successResult) async { + Navigator.of(context).pop(); + selectedPaymentMethod = successResult.paymentOption ?? "VISA"; + await checkPaymentStatus(); + }, + ); + }).catchError((e) { + Navigator.of(context).pop(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: e.toString()), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + } catch (e) { + Navigator.of(context).pop(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: e.toString()), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + } + } + diff --git a/lib/presentation/covid19test/covid_review_screen.dart b/lib/presentation/covid19test/covid_review_screen.dart new file mode 100644 index 0000000..7ccbb02 --- /dev/null +++ b/lib/presentation/covid19test/covid_review_screen.dart @@ -0,0 +1,441 @@ +import 'dart:async'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/covid_get_test_proceedure_resp.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/covid_questionnare_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/presentation/covid19test/covid_payment_screen.dart'; + +class CovidReviewScreen extends StatefulWidget { + + final HospitalsModel selectedHospital; + final List qaList; + + const CovidReviewScreen({super.key, required this.selectedHospital, required this.qaList}); + + @override + State createState() => _CovidReviewScreenState(); +} + +class _CovidReviewScreenState extends State { + + late HmgServicesViewModel hmgServicesViewModel; + bool _acceptedTerms =false; + Covid19GetTestProceduresResp? _selectedProcedure; + @override + void initState() { + super.initState(); + hmgServicesViewModel = Provider.of(context, listen: false); + scheduleMicrotask(() { + + }); + + } + + @override + Widget build(BuildContext context) { + return CollapsingListView( + title: "COVID-19", + bottomChild: Consumer(builder: (context, vm, _) { + final info = vm.covidPaymentInfo; + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: SizedBox( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (info == null) ...[ + // show a placeholder/loading while payment info is null + SizedBox(height: 24.h), + Center(child: CircularProgressIndicator()), + SizedBox(height: 24.h), + ] else ...[ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "Amount before tax".needTranslation.toText18(isBold: true), + Utils.getPaymentAmountWithSymbol( + (info.patientShareField ?? 0).toString().toText16(isBold: true), + AppColors.blackColor, + 13, + isSaudiCurrency: true), + ], + ), + SizedBox(height: 4.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "Tax Amount".needTranslation.toText14(isBold: true), + Utils.getPaymentAmountWithSymbol( + (info.patientTaxAmountField ?? 0).toString().toText16(isBold: true), + AppColors.blackColor, + 13, + isSaudiCurrency: true) + ], + ), + SizedBox(height: 18.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 150.h, + child: Utils.getPaymentMethods(), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Utils.getPaymentAmountWithSymbol( + (info.patientShareWithTaxField ?? 0).toString().toText24(isBold: true), + AppColors.blackColor, + 17, + isSaudiCurrency: true), + ], + ), + ], + ) + ], + ).paddingOnly(left: 16.h, top: 24.h, right: 16.h, bottom: 0.h), + + GestureDetector( + onTap: () { + setState(() { + _acceptedTerms = !_acceptedTerms; + }); + }, + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.r, + hasShadow: false, + ), + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), + child: Row( + children: [ + Container( + width: 20.w, + height: 20.h, + decoration: BoxDecoration( + color: _acceptedTerms + ? AppColors.primaryRedColor + : AppColors.whiteColor, + border: Border.all( + color: _acceptedTerms + ? AppColors.primaryRedColor + : AppColors.greyTextColor.withValues(alpha: 0.3), + width: 2, + ), + borderRadius: BorderRadius.circular(4.r), + ), + child: _acceptedTerms + ? Icon( + Icons.check, + size: 14.h, + color: AppColors.whiteColor, + ) + : null, + ), + SizedBox(width: 12.w), + Expanded( + child: RichText( + text: TextSpan( + style: TextStyle( + fontSize: 14.f, + color: AppColors.textColor, + fontWeight: FontWeight.w400, + ), + children: [ + const TextSpan(text: "I agree to the "), + TextSpan( + text: "terms and conditions", + style: TextStyle( + color: AppColors.primaryRedColor, + fontWeight: FontWeight.w600, + decoration: TextDecoration.underline, + decorationColor: AppColors.primaryRedColor, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + // Two-button layout: Cancel (left) and Next (right) + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 24.h), + child: Row( + children: [ + Expanded( + child: CustomButton( + height: 56.h, + text: LocaleKeys.cancel.tr(), + onPressed: () { + Navigator.of(context).pop(); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + // icon: AppAssets.cancel, + // iconColor: AppColors.primaryRedColor, + borderRadius: 12.r, + ), + ), + SizedBox(width: 8.h), + Expanded( + child: CustomButton( + height: 56.h, + text: "Next".needTranslation, + onPressed: () async { + // Validate selection and payment info + if (_selectedProcedure == null) { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Please select a procedure".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + return; + } + + if (info == null) { + // If payment info missing, attempt to fetch + LoaderBottomSheet.showLoader(); + try { + await hmgServicesViewModel.getPaymentInfo(procedureID: _selectedProcedure!.procedureId!); + } catch (e) { + debugPrint('getPaymentInfo error: $e'); + } finally { + LoaderBottomSheet.hideLoader(); + } + + if (hmgServicesViewModel.covidPaymentInfo == null) { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Payment information not available".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + return; + } + } + + // Compute amount and project/clinic IDs defensively + final paymentInfo = hmgServicesViewModel.covidPaymentInfo ?? info!; + final double amount = paymentInfo.patientShareWithTaxField ?? (paymentInfo.patientShareField?.toDouble() ?? 0.0); + + // projectID may be int or string; parse defensively + int projectID = 0; + try { + final p = widget.selectedHospital.mainProjectID; + if (p is int) projectID = p; + else if (p is String) projectID = int.tryParse(p) ?? 0; + } catch (_) {} + + int clinicID = 0; + try { + clinicID = int.tryParse(widget.selectedHospital.setupID ?? '') ?? int.tryParse(widget.selectedHospital.iD?.toString() ?? '') ?? 0; + } catch (_) {} + + // Navigate to payment screen + Navigator.of(context).push( + CustomPageRoute( + page: CovidPaymentScreen( + amount: amount, + projectID: projectID, + clinicID: clinicID, + procedureId: _selectedProcedure!.procedureId ?? '', + taxAmount: paymentInfo.patientTaxAmountField?.toDouble() ?? 0.0, + ), + ), + ); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + // icon: AppAssets.add_icon, + // iconColor: AppColors.whiteColor, + iconSize: 18.h, + ), + ), + ], + ), + ) + ] + ], + ), + ), + ); + }), + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + "Please select the procedure:".toText14( + color: AppColors.textColor, + weight: FontWeight.w500, + ), + SizedBox(height: 16.h), + + Consumer( + builder: (context, vm, _) { + final procedures = vm.covidTestProcedureList; + + // ensure default selection is first item (once available) + if (_selectedProcedure == null && procedures.isNotEmpty) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + setState(() { + _selectedProcedure = procedures[0]; + }); + + // also fetch payment info for default selection and show loader while loading + if (procedures[0].procedureId != null) { + LoaderBottomSheet.showLoader(); + hmgServicesViewModel + .getPaymentInfo(procedureID: procedures[0].procedureId!) + .whenComplete(() { + LoaderBottomSheet.hideLoader(); + }); + } + } + }); + } + + // Use a shrink-wrapped ListView.separated and match prescription styling + return Container( + + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.h), + child: ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: procedures.length, + separatorBuilder: (context, index) => Divider( + height: 1.h, + thickness: 1.h, + color: AppColors.borderOnlyColor.withValues(alpha: 0.05), + ).paddingOnly(top:8,bottom:16.h), + itemBuilder: (context, index) { + final item = procedures[index]; + // Let the radio option widget manage its own padding to avoid doubled spacing + return _buildRadioOption(value: item, title: item.procedureName ?? ''); + }, + ).paddingOnly(bottom:16.h) + ), + ); + }, + ), + ], + ), + ), + ), + ); + + } + + Widget _buildRadioOption({ + required Covid19GetTestProceduresResp value, + required String title, + }) { + final bool isSelected = _selectedProcedure?.procedureId == value.procedureId; + + return GestureDetector( + onTap: () async { + setState(() { + _selectedProcedure = value; + }); + + // show bottomsheet loader while fetching payment info + if (value.procedureId != null) { + LoaderBottomSheet.showLoader(); + try { + await hmgServicesViewModel.getPaymentInfo(procedureID: value.procedureId!, projectID: widget.selectedHospital.mainProjectID); + } catch (e) { + debugPrint('getPaymentInfo error: $e'); + } finally { + LoaderBottomSheet.hideLoader(); + } + } + }, + + + child: Row( + children: [ + Container( + width: 20.h, + height: 20.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: isSelected + ? AppColors.primaryRedColor + : AppColors.greyTextColor.withValues(alpha: 0.3), + width: 2, + ), + ), + child: isSelected + ? Center( + child: Container( + width: 10.h, + height: 10.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColors.primaryRedColor, + ), + ), + ) + : null, + ), + SizedBox(width: 12.h), + Expanded( + child: title.toText14( + color: AppColors.textColor, + weight: FontWeight.w400, + ), + ), + ], + ) + // Keep only bottom padding here and rely on the surrounding container's left/right inset + .paddingOnly(left: 0.h, right: 0.h, top: 0.h, bottom: 12.h), + ); + + } + } diff --git a/lib/presentation/e_referral/e_referral_form_manager.dart b/lib/presentation/e_referral/e_referral_form_manager.dart index f7093c5..9e5cbe8 100644 --- a/lib/presentation/e_referral/e_referral_form_manager.dart +++ b/lib/presentation/e_referral/e_referral_form_manager.dart @@ -1,6 +1,5 @@ // managers/referral_form_manager.dart import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/create_e_referral_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_all_cities_resp_model.dart'; diff --git a/lib/presentation/e_referral/e_referral_search_result.dart b/lib/presentation/e_referral/e_referral_search_result.dart index ba31f1b..8702d5a 100644 --- a/lib/presentation/e_referral/e_referral_search_result.dart +++ b/lib/presentation/e_referral/e_referral_search_result.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; diff --git a/lib/presentation/e_referral/new_e_referral.dart b/lib/presentation/e_referral/new_e_referral.dart index b28b8df..3083de1 100644 --- a/lib/presentation/e_referral/new_e_referral.dart +++ b/lib/presentation/e_referral/new_e_referral.dart @@ -24,6 +24,7 @@ import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/stepper/stepper_widget.dart'; import 'package:provider/provider.dart'; + import 'e-referral_validator.dart'; import 'e_referral_form_manager.dart'; @@ -43,7 +44,6 @@ class _NewReferralPageState extends State { double widthOfOneState = ((ResponsiveExtension.screenWidth) / 3) - (20.h); - @override void initState() { super.initState(); @@ -116,7 +116,7 @@ class _NewReferralPageState extends State { cityCode: _formManager.formData.patientCity!.iD!.toString(), cityName: _formManager.formData.patientCity!.description, requesterName: _formManager.formData.requesterName, - requesterContactNo: _formManager.formData.countryEnum.countryCode + _formManager.formData.requesterPhone, + requesterContactNo: _formManager.formData.countryEnum.countryCode + _formManager.formData.requesterPhone, requesterRelationship: _formManager.formData.relationship?.iD, otherRelationship: _formManager.formData.relationship!.iD.toString(), fullName: _formManager.formData.patientName, @@ -133,10 +133,8 @@ class _NewReferralPageState extends State { hmgServicesVM.createEReferral( requestModel: createReferralRequestModel, onSuccess: (GenericApiModel response) { - showSuccessBottomSheet(int.parse(response.data), hmgServicesVM); LoaderBottomSheet.hideLoader(); - }, onError: (errorMessage) { // Handle error (e.g., show error message) @@ -146,9 +144,6 @@ class _NewReferralPageState extends State { } void _loadData() { - - - final authVM = context.read(); final habibWalletVM = context.read(); final hmgServicesVM = context.read(); @@ -179,7 +174,7 @@ class _NewReferralPageState extends State { color: Colors.white, padding: EdgeInsets.all(ResponsiveExtension(20).h), child: CustomButton( - text: _currentStep <=1 ? LocaleKeys.next.tr() : LocaleKeys.submit.tr(), + text: _currentStep <= 1 ? LocaleKeys.next.tr() : LocaleKeys.submit.tr(), // icon: AppAssets.search_icon, iconColor: Colors.white, onPressed: () => {_handleNextStep()}, @@ -188,7 +183,7 @@ class _NewReferralPageState extends State { child: ChangeNotifierProvider.value( value: _formManager, child: SizedBox( - height: ResponsiveExtension.screenHeight * 0.65, + height: ResponsiveExtension.screenHeight * 0.65, child: Column( children: [ const SizedBox(height: 8), @@ -220,7 +215,6 @@ class _NewReferralPageState extends State { // ); } - showSuccessBottomSheet(int requestId, HmgServicesViewModel hmgServicesViewModel) { return showCommonBottomSheetWithoutHeight( context, @@ -232,9 +226,9 @@ class _NewReferralPageState extends State { Row( children: [ "Here is your Referral #: ".needTranslation.toText14( - color: AppColors.textColorLight, - weight: FontWeight.w500, - ), + color: AppColors.textColorLight, + weight: FontWeight.w500, + ), SizedBox(width: 4.w), ("$requestId").toText16(isBold: true), ], @@ -249,7 +243,7 @@ class _NewReferralPageState extends State { onPressed: () { context.pop(); context.pop(); - _currentStep =0; + _currentStep = 0; }, textColor: AppColors.whiteColor, ), diff --git a/lib/presentation/e_referral/widget/e_referral_other_details.dart b/lib/presentation/e_referral/widget/e_referral_other_details.dart index fd1649f..6efd063 100644 --- a/lib/presentation/e_referral/widget/e_referral_other_details.dart +++ b/lib/presentation/e_referral/widget/e_referral_other_details.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/validation_utils.dart'; @@ -233,7 +232,6 @@ class _OtherDetailsStepState extends State { } void _showBranchBottomSheet(BuildContext context, ReferralFormManager formManager) { - final habibWalletVM = context.read(); showCommonBottomSheetWithoutHeight( context, diff --git a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart index 3a17e5d..afe68b6 100644 --- a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart +++ b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -8,13 +7,11 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart'; import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart'; import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/AddressItem.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart' show AppointmentBottomSheet; diff --git a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart index d628c1d..13e0106 100644 --- a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart +++ b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart @@ -1,5 +1,4 @@ import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -11,8 +10,6 @@ import 'package:hmg_patient_app_new/features/emergency_services/models/resp_mode import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; -import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; -import 'package:hmg_patient_app_new/widgets/radio/custom_radio_button.dart'; import 'package:provider/provider.dart'; class RrtRequestTypeSelect extends StatelessWidget { @@ -131,8 +128,8 @@ class RrtRequestTypeSelect extends StatelessWidget { children: [ Image.asset(AppAssets.mada, width: 24.h, height: 24.h), Image.asset(AppAssets.visa, width: 24.h, height: 24.h), - Image.asset(AppAssets.Mastercard, width: 24.h, height: 24.h), - Image.asset(AppAssets.apple_pay, width: 24.h, height: 24.h), + Image.asset(AppAssets.mastercard, width: 24.h, height: 24.h), + Image.asset(AppAssets.applePay, width: 24.h, height: 24.h), ], ), Column( diff --git a/lib/presentation/emergency_services/RRT/terms_and_condition.dart b/lib/presentation/emergency_services/RRT/terms_and_condition.dart index 8a50792..1d1dac1 100644 --- a/lib/presentation/emergency_services/RRT/terms_and_condition.dart +++ b/lib/presentation/emergency_services/RRT/terms_and_condition.dart @@ -1,14 +1,10 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:provider/provider.dart'; class TermsAndCondition extends StatelessWidget { final String termsAndCondition; diff --git a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart index 83c16b6..396e509 100644 --- a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart @@ -1,15 +1,10 @@ -import 'dart:async'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/PatientER_RC.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/tracking_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart' - show CustomPageRoute; import 'package:lottie/lottie.dart'; class RequestingServicesPage extends StatelessWidget { diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart b/lib/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart index 71e589e..7d24393 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart @@ -5,22 +5,13 @@ import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/debouncer.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart'; 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/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; -import 'package:provider/provider.dart'; class HospitalBottomSheetBody extends StatelessWidget { diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart b/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart index de20d1a..be1d380 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart @@ -2,12 +2,9 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart' show AppAssets; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; -import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/PatientERTransportationMethod.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart' show TransportOptionItem; -import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; class AmbulanceOptionSelectionBottomSheet extends StatelessWidget { diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart b/lib/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart index 6f5db92..e1f7420 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart @@ -1,13 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_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/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart'; -import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_card.dart'; -import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:provider/provider.dart'; class AppointmentBottomSheet extends StatelessWidget{ diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart b/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart index 3b8d8d7..1b85165 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart @@ -2,12 +2,9 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:provider/provider.dart' show Consumer; class TypeSelectionWidget extends StatelessWidget { final String hmcCount; diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart index bce7daf..3833d32 100644 --- a/lib/presentation/emergency_services/emergency_services_page.dart +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -97,7 +97,7 @@ class EmergencyServicesPage extends StatelessWidget { }), ], ), - Lottie.asset(AppAnimations.ambulance_alert, + Lottie.asset(AppAnimations.ambulanceAlert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), "Confirmation".needTranslation.toText28(color: AppColors.whiteColor, isBold: true), @@ -200,7 +200,7 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), + Lottie.asset(AppAnimations.ambulanceAlert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), @@ -313,7 +313,7 @@ class EmergencyServicesPage extends StatelessWidget { }), ], ), - Lottie.asset(AppAnimations.ambulance_alert, + Lottie.asset(AppAnimations.ambulanceAlert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true), diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart index 0dfd081..ee061b7 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart @@ -8,7 +8,6 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart index 3aa975d..f48efe7 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart @@ -10,7 +10,6 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart index a3524fd..8de7518 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart @@ -137,7 +137,7 @@ class _ErOnlineCheckinPaymentPageState extends State children: [ Image.asset(AppAssets.visa, width: 50.h, height: 50.h), SizedBox(width: 8.h), - Image.asset(AppAssets.Mastercard, width: 40.h, height: 40.h), + Image.asset(AppAssets.mastercard, width: 40.h, height: 40.h), ], ), SizedBox(height: 16.h), @@ -176,7 +176,7 @@ class _ErOnlineCheckinPaymentPageState extends State Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(AppAssets.tamara_en, width: 72.h, height: 25.h), + Image.asset(AppAssets.tamaraEng, width: 72.h, height: 25.h), SizedBox(height: 16.h), "Tamara".needTranslation.toText16(isBold: true), ], diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart index 0b22417..d44686c 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -10,17 +9,10 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.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/my_appointments_view_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; -import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/nfc/nfc_reader_sheet.dart'; -import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; class ErOnlineCheckinSelectCheckinBottomSheet extends StatelessWidget { ErOnlineCheckinSelectCheckinBottomSheet({super.key, required this.projectID}); diff --git a/lib/presentation/emergency_services/history/er_history_listing.dart b/lib/presentation/emergency_services/history/er_history_listing.dart index b98f2f1..fe1ed31 100644 --- a/lib/presentation/emergency_services/history/er_history_listing.dart +++ b/lib/presentation/emergency_services/history/er_history_listing.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart' show AppAssets; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -9,7 +8,6 @@ import 'package:hmg_patient_app_new/features/emergency_services/emergency_servic import 'package:hmg_patient_app_new/features/emergency_services/models/OrderDisplay.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/ambulance_history_item.dart' show AmbulanceHistoryItem; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/rrt_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/emergency_services/history/widget/rrt_item.dart b/lib/presentation/emergency_services/history/widget/rrt_item.dart index 61ecced..dfb6e79 100644 --- a/lib/presentation/emergency_services/history/widget/rrt_item.dart +++ b/lib/presentation/emergency_services/history/widget/rrt_item.dart @@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/RequestStatus.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/emergency_services/nearest_er_page.dart b/lib/presentation/emergency_services/nearest_er_page.dart index 13373f1..16863bf 100644 --- a/lib/presentation/emergency_services/nearest_er_page.dart +++ b/lib/presentation/emergency_services/nearest_er_page.dart @@ -14,7 +14,6 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart' show Selector, WatchContext, ReadContext; -import '../../core/enums.dart' show SelectionTypeEnum; import '../../core/utils/debouncer.dart' show Debouncer; class NearestErPage extends StatefulWidget { diff --git a/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart b/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart index 559a0a5..c5301ea 100644 --- a/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart +++ b/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart @@ -18,7 +18,6 @@ import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart'; import '../../../theme/colors.dart'; -import '../../appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart'; class LocationInputBottomSheet extends StatelessWidget { final Debouncer debouncer = Debouncer(milliseconds: 500); diff --git a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart index 8be6ce2..1341af7 100644 --- a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart +++ b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart @@ -120,7 +120,7 @@ class _WalletPaymentConfirmPageState extends State { children: [ Image.asset(AppAssets.visa, width: 40.h, height: 40.h), SizedBox(width: 8.h), - Image.asset(AppAssets.Mastercard, width: 40.h, height: 40.h), + Image.asset(AppAssets.mastercard, width: 40.h, height: 40.h), ], ).toShimmer2(isShow: false), SizedBox(height: 16.h), diff --git a/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart b/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart index b7a16c5..086e0da 100644 --- a/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart +++ b/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart @@ -1,21 +1,10 @@ -import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/widgets/hospital_list_item.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; -import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart'; class SelectHospitalBottomSheet extends StatelessWidget { diff --git a/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart b/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart new file mode 100644 index 0000000..eb22ab6 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart @@ -0,0 +1,231 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/bf.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/blood_cholesterol.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/blood_sugar.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/bmi.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/bmr.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/calories.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/crabs.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/dduedate.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/ibw.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/ovulation.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/triglycerides.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; + +class HealthCalculatorDetailedPage extends StatefulWidget { + HealthCalculatorsTypeEnum calculatorType; + int? clinicID; + int? calculationID; + + HealthCalculatorDetailedPage({super.key, required this.calculatorType, this.clinicID, this.calculationID}); + + @override + State createState() => _HealthCalculatorDetailedPageState(); +} + +class _HealthCalculatorDetailedPageState extends State { + dynamic calculatedResult; + + @override + Widget build(BuildContext context) { + return ChangeNotifierProvider( + create: (_) => HealthCalcualtorViewModel(), + child: Consumer(builder: (context, provider, _) { + return CollapsingListView( + title: widget.calculatorType.displayName, + bottomChild: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar || + widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol || + widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides + ? SizedBox() + : Container( + decoration: + RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))), + padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h), + child: CustomButton( + text: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar || + widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol || + widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides + ? "Convert".needTranslation + : "Calculate".needTranslation, + onPressed: () { + if (calculatedResult == null) return; + + DialogService dialogService = getIt.get(); + Navigator.of(context).push(CustomPageRoute( + page: SelectClinicPage(calculatorType: widget.calculatorType, calculatedResult: calculatedResult), + )); + }, + icon: null, + fontSize: 16.f, + backgroundColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor, + borderColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor, + borderRadius: 12.r, + fontWeight: FontWeight.w500)), + child: getCalculatorWidget( + type: widget.calculatorType, + onCalculate: (result) { + // result may be directly provided by widget, but prefer provider maps if available + + switch (widget.calculatorType) { + case HealthCalculatorsTypeEnum.bmi: + calculatedResult = provider.bmiResultMap != null + ? {...?provider.bmiResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.calories: + case HealthCalculatorsTypeEnum.bmr: + calculatedResult = provider.caloriesResultMap != null + ? {...?provider.caloriesResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.idealBodyWeight: + calculatedResult = provider.ibwResultMap != null + ? {...?provider.ibwResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.bodyFat: + calculatedResult = provider.bodyFatResultMap != null + ? {...?provider.bodyFatResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.crabsProteinFat: + calculatedResult = provider.macrosResultMap != null + ? {...?provider.macrosResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.ovulation: + calculatedResult = (provider.ovulationResult is Map) + ? {...provider.ovulationResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': provider.ovulationResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.deliveryDueDate: + calculatedResult = (provider.deliveryResult is Map) + ? {...provider.deliveryResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': provider.deliveryResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.bloodSugar: + calculatedResult = (provider.bloodSugarResult is Map) + ? {...provider.bloodSugarResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': provider.bloodSugarResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.bloodCholesterol: + calculatedResult = (provider.bloodCholesterolResult is Map) + ? {...provider.bloodCholesterolResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': provider.bloodCholesterolResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + case HealthCalculatorsTypeEnum.triglycerides: + calculatedResult = (provider.triglyceridesResult is Map) + ? {...provider.triglyceridesResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID} + : {'result': provider.triglyceridesResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}; + break; + } + // switch (widget.calculatorType) { + // case HealthCalculatorsTypeEnum.bmi: + // calculatedResult = provider.bmiResultMap ?? result; + // break; + // case HealthCalculatorsTypeEnum.calories: + // case HealthCalculatorsTypeEnum.bmr: + // calculatedResult = provider.caloriesResultMap ?? result; + // break; + // case HealthCalculatorsTypeEnum.idealBodyWeight: + // calculatedResult = provider.ibwResultMap ?? result; + // break; + // case HealthCalculatorsTypeEnum.bodyFat: + // calculatedResult = provider.bodyFatResultMap ?? result; + // break; + // case HealthCalculatorsTypeEnum.crabsProteinFat: + // calculatedResult = provider.macrosResultMap ?? result; + // break; + // case HealthCalculatorsTypeEnum.ovulation: + // calculatedResult = provider.ovulationResult ?? result; + // break; + // case HealthCalculatorsTypeEnum.deliveryDueDate: + // calculatedResult = provider.deliveryResult ?? result; + // break; + // case HealthCalculatorsTypeEnum.bloodSugar: + // calculatedResult = provider.bloodSugarResult ?? result; + // case HealthCalculatorsTypeEnum.bloodCholesterol: + // calculatedResult = provider.bloodCholesterolResult ?? result; + // case HealthCalculatorsTypeEnum.triglycerides: + // calculatedResult = provider.triglyceridesResult ?? result; + // } + }, + ).paddingSymmetrical(20.w, 24.h), + ); + }), + ); + } + + Widget getCalculatorWidget({required HealthCalculatorsTypeEnum type, required Function(dynamic result) onCalculate}) { + switch (widget.calculatorType) { + case HealthCalculatorsTypeEnum.bmi: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: BMIWidget(onChange: onCalculate), + ); + + case HealthCalculatorsTypeEnum.calories: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: CaloriesWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.bmr: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: BMRWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.idealBodyWeight: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: IdealBodyWeightWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.bodyFat: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: BodyFatWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.crabsProteinFat: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: CrabsWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.ovulation: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: OvulationWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.deliveryDueDate: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: DeliveryDueDWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.bloodSugar: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: BloodSugarWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.bloodCholesterol: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: BloodCholesterolWidget(onChange: onCalculate), + ); + case HealthCalculatorsTypeEnum.triglycerides: + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))), + child: TriglyceridesWidget(onChange: onCalculate), + ); + } + } +} diff --git a/lib/presentation/health_calculators_and_converts/health_calculator_view_model.dart b/lib/presentation/health_calculators_and_converts/health_calculator_view_model.dart new file mode 100644 index 0000000..c085ac8 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/health_calculator_view_model.dart @@ -0,0 +1,1189 @@ +import 'dart:math'; + +import 'package:flutter/foundation.dart'; + +class HealthCalcualtorViewModel extends ChangeNotifier { + // BMI + double? bmiResult; + String? bmiCategory; + + // BMR / Calories + double? bmrResult; + double? caloriesResult; + String? bmrRange; + String? calorieRange; + + // IBW + double? ibwResult; + double? weightDifference; + String? weightStatus; + + // Body Fat + double? bodyFatResult; + String? bodyFatCategory; + + // Crabs/Protein/Fat + double? carbsCalories; + double? proteinCalories; + double? fatCalories; + double? carbsGrams; + double? proteinGrams; + double? fatGrams; + String? dietType; + + // Ovulation + Map? ovulationResult; + + // Delivery + Map? deliveryResult; + + Map? bloodSugarResult; + Map? bloodCholesterolResult; + Map? triglyceridesResult; + + String? _mgdlValue; + + String? get mgdlValue => _mgdlValue; + + String? _mmolValue; + + String? get mmolValue => _mmolValue; + + // Store the original entered value and which field it was entered in + String? _originalValue; + String _originalUnit = 'mg/dL'; // which field the original value was entered in + bool _isSwapped = false; // toggle state for switch + + String _activeUnit = 'mg/dL'; // current source unit + String get activeUnit => _activeUnit; + + // ================== BLOOD CHOLESTEROL ================== + String? _cholMgdlValue; + String? _cholMmolValue; + String? _cholOriginalValue; + String _cholOriginalUnit = 'mg/dL'; + bool _cholIsSwapped = false; + String _cholActiveUnit = 'mg/dL'; + + String? get cholMgdlValue => _cholMgdlValue; + + String? get cholMmolValue => _cholMmolValue; + + String get cholActiveUnit => _cholActiveUnit; + + // ================== TRIGLYCERIDES ================== + String? _triMgdlValue; + String? _triMmolValue; + String? _triOriginalValue; + String _triOriginalUnit = 'mg/dL'; + bool _triIsSwapped = false; + String _triActiveUnit = 'mg/dL'; + + String? get triMgdlValue => _triMgdlValue; + + String? get triMmolValue => _triMmolValue; + + String get triActiveUnit => _triActiveUnit; + + // Generic helpers + + void calculateBMI({required String heightText, required String weightText, required String heightUnit, required String weightUnit}) { + if (heightText.trim().isEmpty || weightText.trim().isEmpty) { + bmiResult = null; + bmiCategory = null; + notifyListeners(); + return; + } + + try { + double height = double.parse(heightText.trim()); + double weight = double.parse(weightText.trim()); + + double heightInMeters = _convertHeightToMeters(height, heightUnit); + double weightInKg = _convertWeightToKg(weight, weightUnit); + + if (heightInMeters <= 0 || weightInKg <= 0) { + bmiResult = null; + bmiCategory = null; + notifyListeners(); + return; + } + + double bmi = weightInKg / (heightInMeters * heightInMeters); + String category = _getBMICategory(bmi); + + bmiResult = bmi; + bmiCategory = category; + notifyListeners(); + } catch (e) { + bmiResult = null; + bmiCategory = null; + notifyListeners(); + } + } + + double _convertHeightToMeters(double height, String unit) { + switch (unit) { + case 'cm': + return height / 100; + case 'm': + return height; + case 'ft': + return height * 0.3048; + case 'in': + return height * 0.0254; + default: + return height / 100; + } + } + + double _convertWeightToKg(double weight, String unit) { + switch (unit) { + case 'kg': + return weight; + case 'lb': + return weight * 0.453592; + default: + return weight; + } + } + + String _getBMICategory(double bmi) { + if (bmi < 18.5) { + return 'Underweight'; + } else if (bmi >= 18.5 && bmi < 25) { + return 'Normal'; + } else if (bmi >= 25 && bmi < 30) { + return 'Overweight'; + } else { + return 'Obese'; + } + } + + // BMR / Calories (shared logic) + void calculateBMRAndCalories( + {required String heightText, + required String weightText, + required String ageText, + required String heightUnit, + required String weightUnit, + required String gender, + required String activityLevel, + bool forCaloriesOnly = false}) { + if (heightText.trim().isEmpty || weightText.trim().isEmpty || ageText.trim().isEmpty) { + bmrResult = null; + caloriesResult = null; + bmrRange = null; + calorieRange = null; + notifyListeners(); + return; + } + + try { + double height = double.parse(heightText.trim()); + double weight = double.parse(weightText.trim()); + int age = int.parse(ageText.trim()); + + if (age < 11 || age > 120) { + bmrResult = null; + caloriesResult = null; + bmrRange = null; + calorieRange = null; + notifyListeners(); + return; + } + + double heightInCm = _convertHeightToCm(height, heightUnit); + double weightInKg = _convertWeightToKg(weight, weightUnit); + + if (heightInCm <= 0 || weightInKg <= 0) { + bmrResult = null; + caloriesResult = null; + bmrRange = null; + calorieRange = null; + notifyListeners(); + return; + } + + double bmr = _calculateBMR(heightInCm, weightInKg, age, gender); + double activityMultiplier = _getActivityMultiplier(activityLevel); + double calories = bmr * activityMultiplier; + + bmrResult = bmr; + caloriesResult = calories; + + // ranges + if (bmr < 1200) { + bmrRange = 'Low'; + } else if (bmr < 1600) { + bmrRange = 'Normal'; + } else if (bmr < 2000) { + bmrRange = 'High'; + } else { + bmrRange = 'Very High'; + } + + if (calories < 1800) { + calorieRange = 'Low'; + } else if (calories < 2500) { + calorieRange = 'Normal'; + } else if (calories < 3200) { + calorieRange = 'High'; + } else { + calorieRange = 'High'; + } + + notifyListeners(); + } catch (e) { + bmrResult = null; + caloriesResult = null; + bmrRange = null; + calorieRange = null; + notifyListeners(); + } + } + + double _convertHeightToCm(double height, String unit) { + switch (unit) { + case 'cm': + return height; + case 'm': + return height * 100; + case 'ft': + return height * 30.48; + case 'in': + return height * 2.54; + default: + return height; + } + } + + double _calculateBMR(double heightCm, double weightKg, int age, String gender) { + if (gender == "Male") { + return 88.362 + (13.397 * weightKg) + (4.799 * heightCm) - (5.677 * age); + } else { + return 447.593 + (9.247 * weightKg) + (3.098 * heightCm) - (4.330 * age); + } + } + + double _getActivityMultiplier(String activityLevel) { + switch (activityLevel) { + case "Almost Inactive (no exercise)": + return 1.2; + case "Lightly active": + return 1.375; + case "Lightly active (1-3) days per week": + return 1.55; + case "Super active (very hard exercise)": + return 1.725; + default: + return 1.375; + } + } + + // IBW + void calculateIBW({required String heightText, required String weightText, required String heightUnit, required String weightUnit, required String bodyFrameSize}) { + if (heightText.trim().isEmpty || weightText.trim().isEmpty) { + ibwResult = null; + weightDifference = null; + weightStatus = null; + notifyListeners(); + return; + } + + try { + double height = double.parse(heightText.trim()); + double weight = double.parse(weightText.trim()); + + double heightInCm = _convertHeightToCm(height, heightUnit); + double weightInKg = _convertWeightToKg(weight, weightUnit); + + if (heightInCm <= 0 || weightInKg <= 0) { + ibwResult = null; + weightDifference = null; + weightStatus = null; + notifyListeners(); + return; + } + + double ibw = _calculateIBWValue(heightInCm); + double adjusted = _applyFrameSizeAdjustment(ibw, bodyFrameSize); + double difference = weightInKg - adjusted; + String status = _getWeightStatus(difference); + + ibwResult = adjusted; + weightDifference = difference; + weightStatus = status; + notifyListeners(); + } catch (e) { + ibwResult = null; + weightDifference = null; + weightStatus = null; + notifyListeners(); + } + } + + double _calculateIBWValue(double heightCm) { + double baseHeight = 152.4; + double baseWeight = 50.0; + double heightMultiplier = 2.3; + + if (heightCm <= baseHeight) { + return baseWeight - ((baseHeight - heightCm) * 0.5); + } + + return baseWeight + ((heightCm - baseHeight) * heightMultiplier / 2.54); + } + + double _applyFrameSizeAdjustment(double ibw, String selectedBodyFrameSize) { + switch (selectedBodyFrameSize) { + case "Small (fingers overlaps)": + return ibw * 0.9; + case "Medium (fingers touch)": + return ibw; + case "Large (fingers don't touch)": + return ibw * 1.1; + default: + return ibw; + } + } + + String _getWeightStatus(double difference) { + if (difference.abs() < 2) { + return 'Normal'; + } else if (difference > 0) { + return 'Overweight'; + } else { + return 'Underweight'; + } + } + + // Body Fat + void calculateBodyFat( + {required String heightText, + required String neckText, + required String waistText, + required String hipText, + required String heightUnit, + required String neckUnit, + required String waistUnit, + required String hipUnit, + required String gender}) { + if (heightText.trim().isEmpty || neckText.trim().isEmpty || waistText.trim().isEmpty) { + bodyFatResult = null; + bodyFatCategory = null; + notifyListeners(); + return; + } + + if (gender == "Female" && hipText.trim().isEmpty) { + bodyFatResult = null; + bodyFatCategory = null; + notifyListeners(); + return; + } + + try { + double height = double.parse(heightText.trim()); + double neck = double.parse(neckText.trim()); + double waist = double.parse(waistText.trim()); + double hip = gender == "Female" ? double.parse(hipText.trim()) : 0; + + double heightInCm = _convertHeightToCm(height, heightUnit); + double neckInCm = _convertLengthToCm(neck, neckUnit); + double waistInCm = _convertLengthToCm(waist, waistUnit); + double hipInCm = gender == "Female" ? _convertLengthToCm(hip, hipUnit) : 0; + + if (heightInCm <= 0 || neckInCm <= 0 || waistInCm <= 0) { + bodyFatResult = null; + bodyFatCategory = null; + notifyListeners(); + return; + } + + double bodyFat = _calculateBodyFatPercentage(heightInCm, neckInCm, waistInCm, hipInCm, gender == "Male"); + String category = _getBodyFatCategory(bodyFat, gender == "Male"); + + bodyFatResult = bodyFat; + bodyFatCategory = category; + notifyListeners(); + } catch (e) { + bodyFatResult = null; + bodyFatCategory = null; + notifyListeners(); + } + } + + double _convertLengthToCm(double length, String unit) { + switch (unit) { + case 'cm': + return length; + case 'm': + return length * 100; + case 'ft': + return length * 30.48; + case 'in': + return length * 2.54; + default: + return length; + } + } + + double _calculateBodyFatPercentage(double heightCm, double neckCm, double waistCm, double hipCm, bool isMale) { + if (isMale) { + double waistMinusNeck = waistCm - neckCm; + if (waistMinusNeck <= 0) return 0; + double log10WaistNeck = _log10(waistMinusNeck); + double log10Height = _log10(heightCm); + double bodyDensity = 1.0324 - (0.19077 * log10WaistNeck) + (0.15456 * log10Height); + double bodyFat = (495 / bodyDensity) - 450; + return bodyFat.clamp(0, 100); + } else { + double waistHipMinusNeck = waistCm + hipCm - neckCm; + if (waistHipMinusNeck <= 0) return 0; + double log10WaistHipNeck = _log10(waistHipMinusNeck); + double log10Height = _log10(heightCm); + double bodyDensity = 1.29579 - (0.35004 * log10WaistHipNeck) + (0.22100 * log10Height); + double bodyFat = (495 / bodyDensity) - 450; + return bodyFat.clamp(0, 100); + } + } + + double _log10(double x) { + return (x <= 0) ? 0 : (log(x) / log(10)); + } + + String _getBodyFatCategory(double bodyFat, bool isMale) { + if (isMale) { + if (bodyFat < 6) return 'Essential Fat'; + if (bodyFat < 14) return 'Athletes'; + if (bodyFat < 18) return 'Fitness'; + if (bodyFat < 25) return 'Average'; + return 'Obese'; + } else { + if (bodyFat < 14) return 'Essential Fat'; + if (bodyFat < 21) return 'Athletes'; + if (bodyFat < 25) return 'Fitness'; + if (bodyFat < 32) return 'Average'; + return 'Obese'; + } + } + + // Crabs / Macros + void calculateMacros({required String caloriesText, required String selectedDietType}) { + if (caloriesText.trim().isEmpty) { + carbsCalories = null; + proteinCalories = null; + fatCalories = null; + carbsGrams = null; + proteinGrams = null; + fatGrams = null; + dietType = null; + notifyListeners(); + return; + } + + try { + double totalCalories = double.parse(caloriesText.trim()); + if (totalCalories <= 0) { + carbsCalories = null; + proteinCalories = null; + fatCalories = null; + carbsGrams = null; + proteinGrams = null; + fatGrams = null; + dietType = null; + notifyListeners(); + return; + } + + Map macroPercentages = _getMacroPercentages(selectedDietType); + double carbsPercent = macroPercentages['carbs']!; + double proteinPercent = macroPercentages['protein']!; + double fatPercent = macroPercentages['fat']!; + + double cCalories = totalCalories * (carbsPercent / 100); + double pCalories = totalCalories * (proteinPercent / 100); + double fCalories = totalCalories * (fatPercent / 100); + + double cGrams = cCalories / 4; + double pGrams = pCalories / 4; + double fGrams = fCalories / 9; + + carbsCalories = cCalories; + proteinCalories = pCalories; + fatCalories = fCalories; + carbsGrams = cGrams; + proteinGrams = pGrams; + fatGrams = fGrams; + dietType = selectedDietType; + notifyListeners(); + } catch (e) { + carbsCalories = null; + proteinCalories = null; + fatCalories = null; + carbsGrams = null; + proteinGrams = null; + fatGrams = null; + dietType = null; + notifyListeners(); + } + } + + Map _getMacroPercentages(String dietType) { + switch (dietType) { + case "Very Low Crabs": + return {'carbs': 5, 'protein': 30, 'fat': 65}; + case "Low Crabs": + return {'carbs': 20, 'protein': 35, 'fat': 45}; + case "Moderate Crabs": + return {'carbs': 40, 'protein': 30, 'fat': 30}; + case "USDA Guidelines ": + return {'carbs': 55, 'protein': 15, 'fat': 30}; + case "Zone Diet": + return {'carbs': 40, 'protein': 30, 'fat': 30}; + default: + return {'carbs': 40, 'protein': 30, 'fat': 30}; + } + } + + // Ovulation + DateTime? _parseCustomDate(String dateString) { + try { + List parts = dateString.split(' '); + if (parts.length >= 3) { + int day = int.parse(parts[0]); + String month = parts[1].replaceAll(',', ''); + int year = int.parse(parts[2]); + + Map months = { + 'January': 1, + 'February': 2, + 'March': 3, + 'April': 4, + 'May': 5, + 'June': 6, + 'July': 7, + 'August': 8, + 'September': 9, + 'October': 10, + 'November': 11, + 'December': 12, + 'Jan': 1, + 'Feb': 2, + 'Mar': 3, + 'Apr': 4, + 'Jun': 6, + 'Jul': 7, + 'Aug': 8, + 'Sep': 9, + 'Oct': 10, + 'Nov': 11, + 'Dec': 12, + }; + + int? monthNum = months[month]; + if (monthNum != null) { + return DateTime(year, monthNum, day); + } + } + return null; + } catch (e) { + return null; + } + } + + DateTime? _tryParseDate(String dateString) { + try { + // try ISO like + return DateTime.tryParse(dateString) ?? _parseCustomDate(dateString); + } catch (e) { + return null; + } + } + + String _formatDate(DateTime? date) { + if (date == null) return ''; + String day = date.day.toString().padLeft(2, '0'); + return '$day ${_getMonthName(date.month)}, ${date.year}'; + } + + String _getMonthName(int month) { + const List months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + return months[month - 1]; + } + + String _getDayName(int weekday) { + // DateTime.weekday returns 1 for Monday and 7 for Sunday. + const List days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; + return days[weekday - 1]; + } + + String _formatDateWithDayName(DateTime? date) { + if (date == null) return ''; + String dayName = _getDayName(date.weekday); // Gets 'Monday', 'Tuesday', etc. + return dayName; + } + + Map convertBloodSugar(double value, String fromUnit) { + if (fromUnit == 'mg/dL') { + final mmolL = value / 18.0182; + return {'mgdL': value, 'mmolL': mmolL}; + } else if (fromUnit == 'mmol/L') { + final mgdL = value * 18.0182; + return {'mgdL': mgdL, 'mmolL': value}; + } + return {'mgdL': 0, 'mmolL': 0}; + } + + String _determineCyclePhase(int daysSincePeriod, int follicularPhase, int cycleLength) { + int normalizedDay = daysSincePeriod % cycleLength; + + if (normalizedDay < follicularPhase - 1) { + return 'Follicular Phase'; + } else if (normalizedDay < follicularPhase + 2) { + return 'Ovulation'; + } else if (normalizedDay < cycleLength) { + return 'Luteal Phase'; + } else { + return 'Menstruation'; + } + } + + void calculateOvulation({required String dateText, required String cycleLengthText, required String lutealPhaseText}) { + if (dateText.trim().isEmpty || cycleLengthText.trim().isEmpty || lutealPhaseText.trim().isEmpty) { + ovulationResult = null; + notifyListeners(); + return; + } + + DateTime? parsedDate = _tryParseDate(dateText); + if (parsedDate == null) { + ovulationResult = null; + notifyListeners(); + return; + } + + try { + int cycleLength = int.parse(cycleLengthText.trim()); + int lutealPhase = int.parse(lutealPhaseText.trim()); + + if (cycleLength < 16 || cycleLength > 40 || lutealPhase < 8 || lutealPhase > 16) { + ovulationResult = null; + notifyListeners(); + return; + } + + if (cycleLength <= lutealPhase) { + ovulationResult = null; + notifyListeners(); + return; + } + + int follicularPhase = cycleLength - lutealPhase; + DateTime ovulationDate = parsedDate.add(Duration(days: follicularPhase - 1)); + DateTime fertileStart = ovulationDate.subtract(Duration(days: 5)); + DateTime fertileEnd = ovulationDate.add(Duration(days: 1)); + int daysSincePeriod = DateTime.now().difference(parsedDate).inDays; + String cyclePhase = _determineCyclePhase(daysSincePeriod, follicularPhase, cycleLength); + + ovulationResult = { + 'lastPeriodDay': _formatDateWithDayName(parsedDate), + 'ovulationDay': _formatDateWithDayName(ovulationDate), + 'lastPeriodDate': _formatDate(parsedDate), + 'ovulationDate': _formatDate(ovulationDate), + 'fertileWindowStart': _formatDate(fertileStart), + 'fertileWindowEnd': _formatDate(fertileEnd), + 'cycleLength': cycleLength, + 'lutealPhase': lutealPhase, + 'follicularPhase': follicularPhase, + 'cyclePhase': cyclePhase, + 'nextPeriodDate': _formatDate(parsedDate.add(Duration(days: cycleLength))), + }; + + notifyListeners(); + } catch (e) { + ovulationResult = null; + notifyListeners(); + } + } + + // Delivery due date + void calculateDueDate({required String isoDateString}) { + if (isoDateString.trim().isEmpty) { + deliveryResult = null; + notifyListeners(); + return; + } + + DateTime? lmp; + try { + lmp = DateTime.tryParse(isoDateString) ?? _tryParseDate(isoDateString); + } catch (_) { + lmp = null; + } + + if (lmp == null) { + deliveryResult = null; + notifyListeners(); + return; + } + + // Pregnancy constants + const int totalPregnancyDays = 280; + + // Calculate main dates + final DateTime dueDate = lmp.add(const Duration(days: totalPregnancyDays)); + + // Trimester calculations + final DateTime firstTrimesterStart = lmp; + final DateTime firstTrimesterEnd = lmp.add(const Duration(days: 83)); + + final DateTime secondTrimesterStart = firstTrimesterEnd.add(const Duration(days: 1)); + final DateTime secondTrimesterEnd = lmp.add(const Duration(days: 195)); + + final DateTime thirdTrimesterStart = secondTrimesterEnd.add(const Duration(days: 1)); + final DateTime thirdTrimesterEnd = dueDate; + + deliveryResult = { + 'lmpDate': _formatDate(lmp), + 'dueDate': _formatDate(dueDate), + // Raw DateTime (useful for logic/UI) + 'lmpDateTime': lmp, + 'dueDateTime': dueDate, + 'dueDateDay': _formatDateWithDayName(dueDate), + // Trimester info + 'firstTrimester': { + 'start': _formatDate(firstTrimesterStart), + 'end': _formatDate(firstTrimesterEnd), + 'weeks': '1–12', + 'startDateTime': firstTrimesterStart, + 'endDateTime': firstTrimesterEnd, + }, + 'secondTrimester': { + 'start': _formatDate(secondTrimesterStart), + 'end': _formatDate(secondTrimesterEnd), + 'weeks': '13–27', + 'startDateTime': secondTrimesterStart, + 'endDateTime': secondTrimesterEnd, + }, + 'thirdTrimester': { + 'start': _formatDate(thirdTrimesterStart), + 'end': _formatDate(thirdTrimesterEnd), + 'weeks': '28–40', + 'startDateTime': thirdTrimesterStart, + 'endDateTime': thirdTrimesterEnd, + }, + }; + + notifyListeners(); + } + + // Blood sugar conversions + void calculateBloodSugar({required String valueText, required String unit}) { + if (valueText.trim().isEmpty) { + bloodSugarResult = null; + notifyListeners(); + return; + } + + try { + double value = double.parse(valueText.trim()); + + if (value <= 0) { + bloodSugarResult = null; + notifyListeners(); + return; + } + + double converted; + String convertedUnit; + + if (unit == 'mg/dL' || unit == 'MG/DL' || unit.toLowerCase().contains('mg')) { + // mg/dL -> mmol/L (glucose): divide by 18.0182 + converted = value / 18.0182; + convertedUnit = 'mmol/L'; + } else { + // mmol/L -> mg/dL + converted = value * 18.0182; + convertedUnit = 'mg/dL'; + } + + // round to sensible precision + double convertedRounded = double.parse(converted.toStringAsFixed(2)); + + bloodSugarResult = { + 'input': value, + 'inputUnit': unit, + 'converted': convertedRounded, + 'convertedUnit': convertedUnit, + }; + notifyListeners(); + } catch (e) { + bloodSugarResult = null; + notifyListeners(); + } + } + + // expose map-like results for widgets to forward to parent + Map? get bmiResultMap => bmiResult == null ? null : {'bmiResult': bmiResult, 'bmiCategory': bmiCategory}; + + Map? get caloriesResultMap => caloriesResult == null ? null : {'calories': caloriesResult, 'bmr': bmrResult, 'calorieRange': calorieRange, 'bmrRange': bmrRange}; + + Map? get ibwResultMap => ibwResult == null ? null : {'ibw': ibwResult, 'difference': weightDifference, 'status': weightStatus}; + + Map? get bodyFatResultMap => bodyFatResult == null ? null : {'fatPercentage': bodyFatResult, 'fatCategory': bodyFatCategory}; + + Map? get macrosResultMap => carbsCalories == null + ? null + : { + 'totalCalories': carbsCalories! + proteinCalories! + fatCalories!, + 'carbsGrams': carbsGrams, + 'carbsCalories': carbsCalories, + 'proteinGrams': proteinGrams, + 'proteinCalories': proteinCalories, + 'fatGrams': fatGrams, + 'fatCalories': fatCalories, + 'dietType': dietType + }; + + void onBloodSugarChanged(String value, String fromUnit) { + _activeUnit = fromUnit; + + if (value.isEmpty) { + _mgdlValue = null; + _mmolValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + if (fromUnit == 'mg/dL') { + _mgdlValue = value; + _mmolValue = (parsed / 18.0182).toStringAsFixed(3); + } else { + _mmolValue = value; + _mgdlValue = (parsed * 18.0182).toStringAsFixed(3); + } + + notifyListeners(); + } + + void onBloodSugarMgdlChanged(String value) { + _mgdlValue = value; + _originalValue = value; + _originalUnit = 'mg/dL'; + _isSwapped = false; + _activeUnit = 'mg/dL'; + + if (value.isEmpty) { + _mmolValue = null; + _originalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mg/dL to mmol/L + _mmolValue = (parsed / 18.0182).toStringAsFixed(3); + notifyListeners(); + } + + void onBloodSugarMmolChanged(String value) { + _mmolValue = value; + _originalValue = value; + _originalUnit = 'mmol/L'; + _isSwapped = false; + _activeUnit = 'mmol/L'; + + if (value.isEmpty) { + _mgdlValue = null; + _originalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mmol/L to mg/dL + _mgdlValue = (parsed * 18.0182).toStringAsFixed(3); + notifyListeners(); + } + + void switchBloodSugarValues() { + // Toggle between two states using the original entered value + if (_originalValue == null || _originalValue!.isEmpty) return; + + final originalParsed = double.tryParse(_originalValue!); + if (originalParsed == null) return; + + _isSwapped = !_isSwapped; + + if (_originalUnit == 'mg/dL') { + if (_isSwapped) { + // Original was in mg/dL, now treat it as mmol/L + _mmolValue = _originalValue; // Keep original format + _mgdlValue = (originalParsed * 18.0182).toStringAsFixed(3); + } else { + // Back to original: value in mg/dL + _mgdlValue = _originalValue; // Keep original format + _mmolValue = (originalParsed / 18.0182).toStringAsFixed(3); + } + } else { + // Original was in mmol/L + if (_isSwapped) { + // Now treat it as mg/dL + _mgdlValue = _originalValue; // Keep original format + _mmolValue = (originalParsed / 18.0182).toStringAsFixed(3); + } else { + // Back to original: value in mmol/L + _mmolValue = _originalValue; // Keep original format + _mgdlValue = (originalParsed * 18.0182).toStringAsFixed(3); + } + } + + notifyListeners(); + } + + // --- NEW: Method to clear the values --- + void clearBloodSugar() { + _mgdlValue = null; + _mmolValue = null; + _originalValue = null; + _originalUnit = 'mg/dL'; + _isSwapped = false; + _activeUnit = 'mg/dL'; + notifyListeners(); + } + + void onBloodCholesterolChanged(String value, String fromUnit) { + _cholActiveUnit = fromUnit; + + if (value.isEmpty) { + _cholMgdlValue = null; + _cholMmolValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + if (fromUnit == 'mg/dL') { + _cholMgdlValue = value; + _cholMmolValue = (parsed / 38.67).toStringAsFixed(3); + } else { + _cholMmolValue = value; + _cholMgdlValue = (parsed * 38.67).toStringAsFixed(3); + } + + notifyListeners(); + } + + void onCholesterolMgdlChanged(String value) { + _cholMgdlValue = value; + _cholOriginalValue = value; + _cholOriginalUnit = 'mg/dL'; + _cholIsSwapped = false; + _cholActiveUnit = 'mg/dL'; + + if (value.isEmpty) { + _cholMmolValue = null; + _cholOriginalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mg/dL to mmol/L + _cholMmolValue = (parsed / 38.67).toStringAsFixed(3); + notifyListeners(); + } + + void onCholesterolMmolChanged(String value) { + _cholMmolValue = value; + _cholOriginalValue = value; + _cholOriginalUnit = 'mmol/L'; + _cholIsSwapped = false; + _cholActiveUnit = 'mmol/L'; + + if (value.isEmpty) { + _cholMgdlValue = null; + _cholOriginalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mmol/L to mg/dL + _cholMgdlValue = (parsed * 38.67).toStringAsFixed(3); + notifyListeners(); + } + + void switchBloodCholesterolValues() { + // Toggle between two states using the original entered value + if (_cholOriginalValue == null || _cholOriginalValue!.isEmpty) return; + + final originalParsed = double.tryParse(_cholOriginalValue!); + if (originalParsed == null) return; + + _cholIsSwapped = !_cholIsSwapped; + + if (_cholOriginalUnit == 'mg/dL') { + if (_cholIsSwapped) { + // Original was in mg/dL, now treat it as mmol/L + _cholMmolValue = _cholOriginalValue; // Keep original format + _cholMgdlValue = (originalParsed * 38.67).toStringAsFixed(3); + } else { + // Back to original: value in mg/dL + _cholMgdlValue = _cholOriginalValue; // Keep original format + _cholMmolValue = (originalParsed / 38.67).toStringAsFixed(3); + } + } else { + // Original was in mmol/L + if (_cholIsSwapped) { + // Now treat it as mg/dL + _cholMgdlValue = _cholOriginalValue; // Keep original format + _cholMmolValue = (originalParsed / 38.67).toStringAsFixed(3); + } else { + // Back to original: value in mmol/L + _cholMmolValue = _cholOriginalValue; // Keep original format + _cholMgdlValue = (originalParsed * 38.67).toStringAsFixed(3); + } + } + + notifyListeners(); + } + + void clearBloodCholesterol() { + _cholMgdlValue = null; + _cholMmolValue = null; + _cholOriginalValue = null; + _cholOriginalUnit = 'mg/dL'; + _cholIsSwapped = false; + _cholActiveUnit = 'mg/dL'; + notifyListeners(); + } + + void onTriglyceridesChanged(String value, String fromUnit) { + _triActiveUnit = fromUnit; + + if (value.isEmpty) { + _triMgdlValue = null; + _triMmolValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + if (fromUnit == 'mg/dL') { + _triMgdlValue = value; + _triMmolValue = (parsed / 88.57).toStringAsFixed(3); + } else { + _triMmolValue = value; + _triMgdlValue = (parsed * 88.57).toStringAsFixed(3); + } + + notifyListeners(); + } + + void onTriglyceridesMgdlChanged(String value) { + _triMgdlValue = value; + _triOriginalValue = value; + _triOriginalUnit = 'mg/dL'; + _triIsSwapped = false; + _triActiveUnit = 'mg/dL'; + + if (value.isEmpty) { + _triMmolValue = null; + _triOriginalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mg/dL to mmol/L + _triMmolValue = (parsed / 88.57).toStringAsFixed(3); + notifyListeners(); + } + + void onTriglyceridesMmolChanged(String value) { + _triMmolValue = value; + _triOriginalValue = value; + _triOriginalUnit = 'mmol/L'; + _triIsSwapped = false; + _triActiveUnit = 'mmol/L'; + + if (value.isEmpty) { + _triMgdlValue = null; + _triOriginalValue = null; + notifyListeners(); + return; + } + + final parsed = double.tryParse(value); + if (parsed == null) return; + + // Convert mmol/L to mg/dL + _triMgdlValue = (parsed * 88.57).toStringAsFixed(3); + notifyListeners(); + } + + void switchTriglyceridesValues() { + // Toggle between two states using the original entered value + if (_triOriginalValue == null || _triOriginalValue!.isEmpty) return; + + final originalParsed = double.tryParse(_triOriginalValue!); + if (originalParsed == null) return; + + _triIsSwapped = !_triIsSwapped; + + if (_triOriginalUnit == 'mg/dL') { + if (_triIsSwapped) { + // Original was in mg/dL, now treat it as mmol/L + _triMmolValue = _triOriginalValue; // Keep original format + _triMgdlValue = (originalParsed * 88.57).toStringAsFixed(3); + } else { + // Back to original: value in mg/dL + _triMgdlValue = _triOriginalValue; // Keep original format + _triMmolValue = (originalParsed / 88.57).toStringAsFixed(3); + } + } else { + // Original was in mmol/L + if (_triIsSwapped) { + // Now treat it as mg/dL + _triMgdlValue = _triOriginalValue; // Keep original format + _triMmolValue = (originalParsed / 88.57).toStringAsFixed(3); + } else { + // Back to original: value in mmol/L + _triMmolValue = _triOriginalValue; // Keep original format + _triMgdlValue = (originalParsed * 88.57).toStringAsFixed(3); + } + } + + notifyListeners(); + } + + void clearTriglycerides() { + _triMgdlValue = null; + _triMmolValue = null; + _triOriginalValue = null; + _triOriginalUnit = 'mg/dL'; + _triIsSwapped = false; + _triActiveUnit = 'mg/dL'; + notifyListeners(); + } +} diff --git a/lib/presentation/health_calculators_and_converts/health_calculators_page.dart b/lib/presentation/health_calculators_and_converts/health_calculators_page.dart new file mode 100644 index 0000000..faf97a1 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/health_calculators_page.dart @@ -0,0 +1,259 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/health_card.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; + +class HealthCalculatorsPage extends StatefulWidget { + HealthCalConEnum type; + + HealthCalculatorsPage({super.key, required this.type}); + + @override + State createState() => _HealthCalculatorsPageState(); +} + +class _HealthCalculatorsPageState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt.get(); + return CollapsingListView( + title: widget.type == HealthCalConEnum.calculator ? "Health Calculators".needTranslation : "Health Converters".needTranslation, + child: widget.type == HealthCalConEnum.calculator + ? Column( + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 20.r), + child: Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.general_health, height: 40.h, width: 40.w, fit: BoxFit.none), + SizedBox(width: 12.w), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + "General Health".needTranslation.toText16(weight: FontWeight.w600), + "Related To BMI, calories, body fat, etc to stay updated with your health.".needTranslation.toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + ], + ), + ), + SizedBox( + width: 12.w, + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor), + ], + ).paddingAll(16.w)) + .onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Calculator".needTranslation, + message: "", + child: showCalculatorsItems(type: HealthCalculatorEnum.general), + onOkPressed: () {}, + ); + }), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 20.r), + child: Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.women_health, height: 40.h, width: 40.w, fit: BoxFit.none), + SizedBox(width: 12.w), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + "Women's Health".needTranslation.toText16(weight: FontWeight.w600), + "Related To periods, ovulation, pregnancy, and other topics.".needTranslation.toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + ], + ), + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor), + ], + ).paddingAll(16.w)) + .onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Calculator".needTranslation, + message: "", + child: showCalculatorsItems(type: HealthCalculatorEnum.women), + onOkPressed: () {}, + ); + }), + ], + ).paddingSymmetrical(20.w, 24.h) + : Column( + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 20.r), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.bloodSugar, height: 40.h, width: 40.w, fit: BoxFit.none), + SizedBox(width: 12.w), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + "Blood Sugar".needTranslation.toText16(weight: FontWeight.w600), + "Track your glucose levels, understand trends, and get personalized insights for better health.".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: Color(0xFF8F9AA3), + ) + ], + ), + ), + SizedBox( + width: 12.w, + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor), + ], + ).paddingAll(16.w)) + .onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: HealthCalculatorDetailedPage(calculatorType: HealthCalculatorsTypeEnum.bloodSugar), + ), + ); + }), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 20.r), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.bloodCholestrol, height: 40.h, width: 40.w, fit: BoxFit.none), + SizedBox(width: 12.w), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + "Blood Cholesterol".needTranslation.toText16(weight: FontWeight.w600), + "Monitor your cholesterol levels, track your LDL, HDL, and triglycerides. Get personalized recommendations for a healthy heart." + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + ], + ), + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor), + ], + ).paddingAll(16.w)) + .onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: HealthCalculatorDetailedPage(calculatorType: HealthCalculatorsTypeEnum.bloodCholesterol), + ), + ); + }), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 20.r), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.triglycerides, height: 40.h, width: 40.w, fit: BoxFit.none), + SizedBox(width: 12.w), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + "Triglycerides Fat Blood".needTranslation.toText16(weight: FontWeight.w600), + "Manage triglycerides, a key blood fat. Understand levels, diet impacts, and heart health strategies." + .needTranslation + .toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + ], + ), + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor), + ], + ).paddingAll(16.w)) + .onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: HealthCalculatorDetailedPage(calculatorType: HealthCalculatorsTypeEnum.triglycerides), + ), + ); + }), + ], + ).paddingSymmetrical(20.w, 24.h)); + } + + Widget showCalculatorsItems({required HealthCalculatorEnum type}) { + return GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, // 4 icons per row + crossAxisSpacing: 16.w, + mainAxisSpacing: 16.w, + childAspectRatio: 0.80), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: type == HealthCalculatorEnum.general ? generalHealthServices.length : womenHealthServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return HealthCard( + icon: type == HealthCalculatorEnum.general ? generalHealthServices[index].icon : womenHealthServices[index].icon, + labelText: type == HealthCalculatorEnum.general ? generalHealthServices[index].title : womenHealthServices[index].title, + onTap: () { + Navigator.of(context).push( + CustomPageRoute( + page: HealthCalculatorDetailedPage( + calculatorType: type == HealthCalculatorEnum.general ? generalHealthServices[index].type : womenHealthServices[index].type, + clinicID: type == HealthCalculatorEnum.general ? generalHealthServices[index].clinicID : womenHealthServices[index].clinicID, + calculationID: type == HealthCalculatorEnum.general ? generalHealthServices[index].calculationID : womenHealthServices[index].calculationID, + ), + ), + ); + }, + ); + }, + ); + } + + final List generalHealthServices = [ + HealthComponentModel(title: "BMI\nCalculator".needTranslation, icon: AppAssets.bmi, type: HealthCalculatorsTypeEnum.bmi, clinicID: 108, calculationID: null), + HealthComponentModel(title: "Calories\nCalculator".needTranslation, icon: AppAssets.calories, type: HealthCalculatorsTypeEnum.calories, clinicID: null, calculationID: 2), + HealthComponentModel(title: "BMR\nCalculator".needTranslation, icon: AppAssets.bmr, type: HealthCalculatorsTypeEnum.bmr, clinicID: null, calculationID: 3), + HealthComponentModel(title: "Ideal Body\nWeight".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.idealBodyWeight, clinicID: null, calculationID: 4), + HealthComponentModel(title: "Body Fat\nCalculator".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.bodyFat, clinicID: null, calculationID: 5), + HealthComponentModel(title: "Carbs\nProtein & Fat".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.crabsProteinFat, clinicID: null, calculationID: 11), + ]; + + final List womenHealthServices = [ + HealthComponentModel(title: "Ovulation\nPeriod".needTranslation, icon: AppAssets.locate_me, type: HealthCalculatorsTypeEnum.ovulation, clinicID: null, calculationID: 6 ), + HealthComponentModel(title: "Delivery\nDue Date".needTranslation, icon: AppAssets.activeCheck, type: HealthCalculatorsTypeEnum.deliveryDueDate, clinicID: null, calculationID: 6), + ]; +} + +class HealthComponentModel { + String title; + String? subTitle; + String icon; + Color? iconColor; + Color? bgColor; + Color? textColor; + HealthCalculatorsTypeEnum type; + int? clinicID; + int? calculationID; + + HealthComponentModel({required this.title, this.subTitle, required this.icon, this.iconColor, this.bgColor, this.textColor, required this.type, this.clinicID, this.calculationID}); +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/bf.dart b/lib/presentation/health_calculators_and_converts/widgets/bf.dart new file mode 100644 index 0000000..3a88eb3 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/bf.dart @@ -0,0 +1,641 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class BodyFatWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + BodyFatWidget({super.key, required this.onChange}); + + @override + _BodyFatWidgetState createState() => _BodyFatWidgetState(); +} + +class _BodyFatWidgetState extends State { + final TextEditingController _heightController = TextEditingController(); + final TextEditingController _neckController = TextEditingController(); + final TextEditingController _waistController = TextEditingController(); + final TextEditingController _hipController = TextEditingController(); + final List _heightUnits = ['cm', 'm', 'ft', 'in']; + String selectedHeightUnit = 'cm'; + String selectedNeckUnit = 'in'; + String selectedWaistUnit = 'in'; + String selectedHipUnit = 'in'; + String selectedGender = "Male"; + + @override + void initState() { + super.initState(); + _heightController.addListener(_onInputChanged); + _neckController.addListener(_onInputChanged); + _waistController.addListener(_onInputChanged); + _hipController.addListener(_onInputChanged); + } + + @override + void dispose() { + _heightController.removeListener(_onInputChanged); + _neckController.removeListener(_onInputChanged); + _waistController.removeListener(_onInputChanged); + _hipController.removeListener(_onInputChanged); + _heightController.dispose(); + _neckController.dispose(); + _waistController.dispose(); + _hipController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateBodyFat( + heightText: _heightController.text, + neckText: _neckController.text, + waistText: _waistController.text, + hipText: _hipController.text, + heightUnit: selectedHeightUnit, + neckUnit: selectedNeckUnit, + waistUnit: selectedWaistUnit, + hipUnit: selectedHipUnit, + gender: selectedGender, + ); + if (widget.onChange != null) widget.onChange!(provider.bodyFatResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.gender, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Select Gender".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedGender.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _genders = ["Male", "Female"]; + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Gender".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _genders.length, + itemBuilder: (context, index) { + final unit = _genders[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedGender, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedGender = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedGender = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.height, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Height".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _heightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '175', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHeightUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Neck".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _neckController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '7', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedNeckUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedNeckUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedNeckUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedNeckUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Waist".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _waistController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '30', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedWaistUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedWaistUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedWaistUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedWaistUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Hip".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _hipController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '0', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHipUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHipUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHipUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Estimate the total body fat based on the size.".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/blood_cholesterol.dart b/lib/presentation/health_calculators_and_converts/widgets/blood_cholesterol.dart new file mode 100644 index 0000000..e3bc7ff --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/blood_cholesterol.dart @@ -0,0 +1,178 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class BloodCholesterolWidget extends StatefulWidget { + final Function(dynamic result)? onChange; + + const BloodCholesterolWidget({super.key, this.onChange}); + + @override + State createState() => _BloodCholesterolWidgetState(); +} + +class _BloodCholesterolWidgetState extends State { + final TextEditingController _mgdlController = TextEditingController(); + final TextEditingController _mmolController = TextEditingController(); + final FocusNode _mgdlFocus = FocusNode(); + final FocusNode _mmolFocus = FocusNode(); + bool _isProgrammaticChange = false; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + Provider.of( + context, + listen: false, + ).clearBloodCholesterol(); + }); + } + + @override + void dispose() { + _mgdlController.dispose(); + _mmolController.dispose(); + _mgdlFocus.dispose(); + _mmolFocus.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, provider, _) { + _isProgrammaticChange = true; + final mgdlText = provider.cholMgdlValue ?? ''; + final mmolText = provider.cholMmolValue ?? ''; + + // Only update if focus is not on this field (to avoid cursor jumping) + if (!_mgdlFocus.hasFocus && _mgdlController.text != mgdlText) { + _mgdlController.text = mgdlText; + _mgdlController.selection = TextSelection.fromPosition( + TextPosition(offset: _mgdlController.text.length), + ); + } + + if (!_mmolFocus.hasFocus && _mmolController.text != mmolText) { + _mmolController.text = mmolText; + _mmolController.selection = TextSelection.fromPosition( + TextPosition(offset: _mmolController.text.length), + ); + } + + _isProgrammaticChange = false; + + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + _buildInputField( + label: "MG/DL", + hint: "120", + controller: _mgdlController, + focusNode: _mgdlFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onCholesterolMgdlChanged(value); + }, + ).paddingOnly(top: 16.h), + Row( + children: [ + const Expanded( + flex: 3, + child: Divider(height: 1, color: Color(0xFFEEEEEE)), + ), + SizedBox(width: 8.w), + Utils.buildSvgWithAssets( + icon: AppAssets.switchBtn, + width: 40.h, + height: 40.h, + ).onPress(() { + // Unfocus both fields before switching + _mgdlFocus.unfocus(); + _mmolFocus.unfocus(); + provider.switchBloodCholesterolValues(); + }), + ], + ), + _buildInputField( + label: "MMOL/L", + hint: "3.1", + controller: _mmolController, + focusNode: _mmolFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onCholesterolMmolChanged(value); + }, + ).paddingOnly(bottom: 16.h), + const Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Convert blood cholesterol values between mg/dL and mmol/L. ".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }, + ); + } + + /// Reusable Input Field + Widget _buildInputField({ + required String label, + required String hint, + required TextEditingController controller, + required FocusNode focusNode, + required ValueChanged onChanged, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + label.toText12( + fontWeight: FontWeight.w500, + color: AppColors.inputLabelTextColor, + ), + SizedBox( + height: 40.h, + child: TextField( + controller: controller, + focusNode: focusNode, + keyboardType: const TextInputType.numberWithOptions(decimal: true), + maxLines: 1, + onChanged: onChanged, + cursorHeight: 35.h, + textAlignVertical: TextAlignVertical.center, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: hint, + hintStyle: const TextStyle(color: Colors.grey), + ), + style: TextStyle( + fontSize: 32.f, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.h, + ), + ), + ), + ], + ); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart b/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart new file mode 100644 index 0000000..cf7cc61 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart @@ -0,0 +1,189 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class BloodSugarWidget extends StatefulWidget { + final Function(dynamic result)? onChange; + + const BloodSugarWidget({super.key, this.onChange}); + + @override + State createState() => _BloodSugarWidgetState(); +} + +class _BloodSugarWidgetState extends State { + final TextEditingController _mgdlController = TextEditingController(); + final TextEditingController _mmolController = TextEditingController(); + final FocusNode _mgdlFocus = FocusNode(); + final FocusNode _mmolFocus = FocusNode(); + bool _isProgrammaticChange = false; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + Provider.of( + context, + listen: false, + ).clearBloodSugar(); + }); + } + + @override + void dispose() { + _mgdlController.dispose(); + _mmolController.dispose(); + _mgdlFocus.dispose(); + _mmolFocus.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, provider, _) { + _isProgrammaticChange = true; + final mgdlText = provider.mgdlValue ?? ''; + final mmolText = provider.mmolValue ?? ''; + + // Only update if focus is not on this field (to avoid cursor jumping) + if (!_mgdlFocus.hasFocus && _mgdlController.text != mgdlText) { + _mgdlController.text = mgdlText; + _mgdlController.selection = TextSelection.fromPosition( + TextPosition(offset: _mgdlController.text.length), + ); + } + + if (!_mmolFocus.hasFocus && _mmolController.text != mmolText) { + _mmolController.text = mmolText; + _mmolController.selection = TextSelection.fromPosition( + TextPosition(offset: _mmolController.text.length), + ); + } + + _isProgrammaticChange = false; + + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + children: [ + _buildInputField( + label: "MG/DL", + hint: "120", + controller: _mgdlController, + focusNode: _mgdlFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onBloodSugarMgdlChanged(value); + }, + ).paddingOnly(top: 16.h), + Row( + children: [ + const Expanded( + flex: 3, + child: Divider(height: 1, color: Color(0xFFEEEEEE)), + ), + SizedBox(width: 8.w), + Utils.buildSvgWithAssets( + icon: AppAssets.switchBtn, + width: 40.h, + height: 40.h, + ).onPress(() { + // Unfocus both fields before switching + _mgdlFocus.unfocus(); + _mmolFocus.unfocus(); + provider.switchBloodSugarValues(); + }), + ], + ), + _buildInputField( + label: "MMOL/L", + hint: "6.7", + controller: _mmolController, + focusNode: _mmolFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onBloodSugarMmolChanged(value); + }, + ).paddingOnly(bottom: 16.h), + const Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.globe, + width: 18.w, + height: 18.w, + ), + SizedBox(width: 12.w), + Expanded( + child: "Convert blood glucose values between mg/dL and mmol/L. (1 mmol/L ≈ 18.0182 mg/dL)".toText12( + fontWeight: FontWeight.w500, + color: AppColors.inputLabelTextColor, + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }, + ); + } + + /// Reusable Input Field + Widget _buildInputField({ + required String label, + required String hint, + required TextEditingController controller, + required FocusNode focusNode, + required ValueChanged onChanged, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + label.toText12( + fontWeight: FontWeight.w500, + color: AppColors.inputLabelTextColor, + ), + SizedBox( + height: 40.h, + child: TextField( + controller: controller, + focusNode: focusNode, + keyboardType: const TextInputType.numberWithOptions(decimal: true), + maxLines: 1, + onChanged: onChanged, + cursorHeight: 35.h, + textAlignVertical: TextAlignVertical.center, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: hint, + hintStyle: const TextStyle(color: Colors.grey), + ), + style: TextStyle( + fontSize: 32.f, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.h, + ), + ), + ), + ], + ); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/bmi.dart b/lib/presentation/health_calculators_and_converts/widgets/bmi.dart new file mode 100644 index 0000000..49b77c0 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/bmi.dart @@ -0,0 +1,309 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class BMIWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + BMIWidget({super.key, required this.onChange}); + + @override + _BMIWidgetState createState() => _BMIWidgetState(); +} + +class _BMIWidgetState extends State { + final TextEditingController _heightController = TextEditingController(); + final TextEditingController _weightController = TextEditingController(); + final List _heightUnits = ['cm', 'm', 'ft', 'in']; + final List _weightUnits = ['kg', 'lb']; + String selectedHeightUnit = 'cm'; + String selectedWeightUnit = 'kg'; + + @override + void initState() { + super.initState(); + _heightController.addListener(_onInputChanged); + _weightController.addListener(_onInputChanged); + } + + @override + void dispose() { + _heightController.removeListener(_onInputChanged); + _weightController.removeListener(_onInputChanged); + _heightController.dispose(); + _weightController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateBMI(heightText: _heightController.text, weightText: _weightController.text, heightUnit: selectedHeightUnit, weightUnit: selectedWeightUnit); + // notify parent + if (widget.onChange != null) widget.onChange!(provider.bmiResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.height, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Height".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _heightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '175', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHeightUnit.toUpperCase().toText12(fontWeight: FontWeight.w600, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHeightUnit = value; + _onInputChanged(); + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHeightUnit = unit; + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Weight".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _weightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '75', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedWeightUnit.toUpperCase().toText12(fontWeight: FontWeight.w600, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _weightUnits.length, + itemBuilder: (context, index) { + final unit = _weightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedWeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedWeightUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedWeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculate the BMI value and weight status to identify the healthy weight. NOt appropriate for children and women who are pregnant or breastfeeding." + .toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/bmr.dart b/lib/presentation/health_calculators_and_converts/widgets/bmr.dart new file mode 100644 index 0000000..5f429ff --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/bmr.dart @@ -0,0 +1,522 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class BMRWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + BMRWidget({super.key, required this.onChange}); + + @override + _BMRWidgetState createState() => _BMRWidgetState(); +} + +class _BMRWidgetState extends State { + final TextEditingController _heightController = TextEditingController(); + final TextEditingController _weightController = TextEditingController(); + final TextEditingController _ageController = TextEditingController(); + final List _heightUnits = ['cm', 'm', 'ft', 'in']; + final List _weightUnits = ['kg', 'lb']; + String selectedHeightUnit = 'cm'; + String selectedWeightUnit = 'kg'; + String selectedActivityLevel = 'Lightly active'; + String selectedGender = "Male"; + + @override + void initState() { + super.initState(); + _heightController.addListener(_onInputChanged); + _weightController.addListener(_onInputChanged); + _ageController.addListener(_onInputChanged); + } + + @override + void dispose() { + _heightController.removeListener(_onInputChanged); + _weightController.removeListener(_onInputChanged); + _ageController.removeListener(_onInputChanged); + _heightController.dispose(); + _weightController.dispose(); + _ageController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateBMRAndCalories( + heightText: _heightController.text, + weightText: _weightController.text, + ageText: _ageController.text, + heightUnit: selectedHeightUnit, + weightUnit: selectedWeightUnit, + gender: selectedGender, + activityLevel: selectedActivityLevel, + ); + if (widget.onChange != null) widget.onChange!(provider.caloriesResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + AppState appState = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column(children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.gender, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Select Gender".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedGender.toCamelCase.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _genders = ["Male", "Female"]; + + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Gender".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _genders.length, + itemBuilder: (context, index) { + final unit = _genders[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedGender, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + print(value); + setState(() { + selectedGender = value; + }); + _onInputChanged(); + Navigator.of(context).pop(); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedGender = unit; + }); + _onInputChanged(); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.age, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Age (11-120) yrs".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _ageController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '20', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.height, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Height".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _heightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '175', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHeightUnit = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Weight".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _weightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '75', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedWeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _weightUnits.length, + itemBuilder: (context, index) { + final unit = _weightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedWeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedWeightUnit = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedWeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.activity, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Activity Level".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedActivityLevel.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _activity = ["Almost Inactive (no exercise)", "Lightly active", "Lightly active (1-3) days per week", "Super active (very hard exercise)"]; + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Activity Level".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _activity.length, + itemBuilder: (context, index) { + final unit = _activity[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedActivityLevel, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedActivityLevel = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedActivityLevel = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculates daily calorie intake based on server factors, like height, weight, age, gender and daily physical activity." + .toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ])); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/calories.dart b/lib/presentation/health_calculators_and_converts/widgets/calories.dart new file mode 100644 index 0000000..fbe15a6 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/calories.dart @@ -0,0 +1,523 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class CaloriesWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + CaloriesWidget({super.key, required this.onChange}); + + @override + _CaloriesWidgetState createState() => _CaloriesWidgetState(); +} + +class _CaloriesWidgetState extends State { + final TextEditingController _heightController = TextEditingController(); + final TextEditingController _weightController = TextEditingController(); + final TextEditingController _ageController = TextEditingController(); + final List _heightUnits = ['cm', 'm', 'ft', 'in']; + final List _weightUnits = ['kg', 'lb']; + String selectedHeightUnit = 'cm'; + String selectedWeightUnit = 'kg'; + String selectedActivityLevel = 'Lightly active'; + String selectedGender = "Male"; + + @override + void initState() { + super.initState(); + _heightController.addListener(_onInputChanged); + _weightController.addListener(_onInputChanged); + _ageController.addListener(_onInputChanged); + } + + @override + void dispose() { + _heightController.removeListener(_onInputChanged); + _weightController.removeListener(_onInputChanged); + _ageController.removeListener(_onInputChanged); + _heightController.dispose(); + _weightController.dispose(); + _ageController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateBMRAndCalories( + heightText: _heightController.text, + weightText: _weightController.text, + ageText: _ageController.text, + heightUnit: selectedHeightUnit, + weightUnit: selectedWeightUnit, + gender: selectedGender, + activityLevel: selectedActivityLevel, + ); + if (widget.onChange != null) widget.onChange!(provider.caloriesResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + AppState appState = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.gender, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Select Gender".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedGender.toCamelCase.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _genders = ["Male", "Female"]; + + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Gender".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _genders.length, + itemBuilder: (context, index) { + final unit = _genders[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedGender, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedGender = value; + }); + _onInputChanged(); + Navigator.of(context).pop(); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedGender = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.age, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Age (11-120) yrs".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _ageController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '20', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.height, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Height".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _heightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '175', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHeightUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Weight".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _weightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '75', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedWeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _weightUnits.length, + itemBuilder: (context, index) { + final unit = _weightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedWeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedWeightUnit = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedWeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.activity, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Activity Level".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedActivityLevel.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _activity = ["Almost Inactive (no exercise)", "Lightly active", "Lightly active (1-3) days per week", "Super active (very hard exercise)"]; + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Activity Level".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _activity.length, + itemBuilder: (context, index) { + final unit = _activity[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedActivityLevel, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedActivityLevel = value; + }); + _onInputChanged(); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedActivityLevel = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculates daily calorie intake based on server factors, like height, weight, age, gender and daily physical activity." + .toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/crabs.dart b/lib/presentation/health_calculators_and_converts/widgets/crabs.dart new file mode 100644 index 0000000..5fe1215 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/crabs.dart @@ -0,0 +1,198 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class CrabsWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + CrabsWidget({super.key, required this.onChange}); + + @override + _CrabsWidgetState createState() => _CrabsWidgetState(); +} + +class _CrabsWidgetState extends State { + final TextEditingController _caloriesController = TextEditingController(); + String selectedDietType = 'Very Low Crabs'; + Function(String)? onUnitSelected; + + @override + void initState() { + super.initState(); + _caloriesController.addListener(_onInputChanged); + } + + @override + void dispose() { + _caloriesController.removeListener(_onInputChanged); + _caloriesController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateMacros(caloriesText: _caloriesController.text, selectedDietType: selectedDietType); + if (widget.onChange != null) widget.onChange!(provider.macrosResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.age, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Calories Per Day".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _caloriesController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '2000', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.ask_doctor_icon).onPress(() { + Navigator.pop(context); + Navigator.of(context).push(CustomPageRoute(page: HealthCalculatorDetailedPage(calculatorType: HealthCalculatorsTypeEnum.calories))); + }), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.activity, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Diet Type".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedDietType.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _activity = ["Very Low Crabs", "Low Crabs", "Moderate Crabs", "USDA Guidelines ", "Zone Diet"]; + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Diet Type".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _activity.length, + itemBuilder: (context, index) { + final unit = _activity[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedDietType, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedDietType = value; + _onInputChanged(); + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedDietType = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculate carbohydrate based protein and fat ration in calories and grams according to a pre set ratio." + .toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart b/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart new file mode 100644 index 0000000..15c0a0c --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class DeliveryDueDWidget extends StatefulWidget { + final Function(dynamic result)? onChange; + + DeliveryDueDWidget({super.key, required this.onChange}); + + @override + _DeliveryDueDWidgetState createState() => _DeliveryDueDWidgetState(); +} + +class _DeliveryDueDWidgetState extends State { + final TextEditingController _date = TextEditingController(); + String selectedDate = ''; + Function(String)? onUnitSelected; + + @override + Widget build(BuildContext context) { + final provider = Provider.of(context); + + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 0.h, bottom: 0.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + TextInputWidget( + labelText: "Last Period Date", + hintText: "11 July, 1994".needTranslation, + controller: _date, + focusNode: FocusNode(), + isEnable: true, + prefix: null, + isAllowRadius: true, + isBorderAllowed: false, + isAllowLeadingIcon: true, + padding: EdgeInsets.symmetric(vertical: 8.h), + leadingIcon: AppAssets.birthday_cake, + selectionType: SelectionTypeEnum.calendar, + isHideSwitcher: true, + onCalendarTypeChanged: (val) {}, + onChange: (val) { + if (val == null) return; + + setState(() { + selectedDate = Utils.formatDateToDisplay(val); + _date.text = selectedDate; + }); + provider.calculateDueDate(isoDateString: val); + + if (widget.onChange != null) { + widget.onChange!(provider.deliveryResult); + } + }, + ).withVerticalPadding(4.h), + ], + ), + ); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/health_card.dart b/lib/presentation/health_calculators_and_converts/widgets/health_card.dart new file mode 100644 index 0000000..d54d037 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/health_card.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class HealthCard extends StatelessWidget { + const HealthCard({ + super.key, + required this.icon, + required this.labelText, + this.onTap, + }); + + final String icon; + final String labelText; + final VoidCallback? onTap; + + @override + Widget build(BuildContext context) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.r, + hasShadow: false, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets( + icon: icon, + width: 40.w, + height: 40.h, + fit: BoxFit.cover, + ).toShimmer2(isShow: false, radius: 12.r), + SizedBox(height: 14.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Flexible( + child: labelText.toText12( + fontWeight: FontWeight.w600, + maxLine: 2, + )), + ], + ), + ], + ).paddingAll(16.w).onPress(() { + onTap!(); + }), + ); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/ibw.dart b/lib/presentation/health_calculators_and_converts/widgets/ibw.dart new file mode 100644 index 0000000..5f67511 --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/ibw.dart @@ -0,0 +1,393 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class IdealBodyWeightWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + IdealBodyWeightWidget({super.key, required this.onChange}); + + @override + _IdealBodyWeightWidgetState createState() => _IdealBodyWeightWidgetState(); +} + +class _IdealBodyWeightWidgetState extends State { + final TextEditingController _heightController = TextEditingController(); + final TextEditingController _weightController = TextEditingController(); + final List _heightUnits = ['cm', 'm', 'ft', 'in']; + final List _weightUnits = ['kg', 'lb']; + String selectedHeightUnit = 'cm'; + String selectedWeightUnit = 'kg'; + String selectedBodyFrameSize = 'Medium (fingers touch)'; + Function(String)? onUnitSelected; + + @override + void initState() { + super.initState(); + _heightController.addListener(_onInputChanged); + _weightController.addListener(_onInputChanged); + } + + @override + void dispose() { + _heightController.removeListener(_onInputChanged); + _weightController.removeListener(_onInputChanged); + _heightController.dispose(); + _weightController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + provider.calculateIBW( + heightText: _heightController.text, + weightText: _weightController.text, + heightUnit: selectedHeightUnit, + weightUnit: selectedWeightUnit, + bodyFrameSize: selectedBodyFrameSize, + ); + if (widget.onChange != null) widget.onChange!(provider.ibwResultMap); + } + + @override + Widget build(BuildContext context) { + DialogService dialogService = getIt(); + + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.height, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Height".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _heightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '175', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _heightUnits.length, + itemBuilder: (context, index) { + final unit = _heightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedHeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedHeightUnit = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedHeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.weight, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Weight".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _weightController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '75', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black87, + height: 1.0, + ), + ), + ) + ], + ), + ), + Container( + width: 1.w, + height: 30.w, + color: Color(0xFFEAEAEB), + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedWeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(() { + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Unit".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _weightUnits.length, + itemBuilder: (context, index) { + final unit = _weightUnits[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedWeightUnit, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedWeightUnit = value; + }); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toUpperCase().toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedWeightUnit = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.activity, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Body Frame Size".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + selectedBodyFrameSize.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ).paddingSymmetrical(0.w, 16.w).onPress(() { + List _activity = ["Small (fingers overlaps)", "Medium (fingers touch)", "Large (fingers don't touch)"]; + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: "Select Body Frame Size".needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: _activity.length, + itemBuilder: (context, index) { + final unit = _activity[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 70, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: unit, + groupValue: selectedBodyFrameSize, + activeColor: AppColors.errorColor, + onChanged: (String? value) { + if (value == null) return; + setState(() { + selectedBodyFrameSize = value; + }); + Navigator.pop(context); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + unit.toCamelCase.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, + ], + ).onPress(() { + setState(() { + selectedBodyFrameSize = unit; + _onInputChanged(); + }); + Navigator.pop(context); + }), + ), + ], + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: Color(0xFFEEEEEE)); + }, + ), + ), + onOkPressed: () {}, + ); + }), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculates the ideal body weight based on height, weight and body size.".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart b/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart new file mode 100644 index 0000000..de209cb --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart @@ -0,0 +1,175 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class OvulationWidget extends StatefulWidget { + Function(dynamic result)? onChange; + + OvulationWidget({super.key, required this.onChange}); + + @override + _OvulationWidgetState createState() => _OvulationWidgetState(); +} + +class _OvulationWidgetState extends State { + final TextEditingController _ageController = TextEditingController(); + final TextEditingController _cycleLengthController = TextEditingController(); + final TextEditingController _lutealPhaseLengthController = TextEditingController(); + Function(String)? onUnitSelected; + String selectedDate = ''; + + @override + void initState() { + super.initState(); + _ageController.addListener(_onInputChanged); + _cycleLengthController.addListener(_onInputChanged); + _lutealPhaseLengthController.addListener(_onInputChanged); + } + + @override + void dispose() { + _ageController.removeListener(_onInputChanged); + _cycleLengthController.removeListener(_onInputChanged); + _lutealPhaseLengthController.removeListener(_onInputChanged); + _ageController.dispose(); + _cycleLengthController.dispose(); + _lutealPhaseLengthController.dispose(); + super.dispose(); + } + + void _onInputChanged() { + final provider = Provider.of(context, listen: false); + final dateText = selectedDate.isEmpty ? _ageController.text.trim() : selectedDate; + provider.calculateOvulation(dateText: dateText, cycleLengthText: _cycleLengthController.text, lutealPhaseText: _lutealPhaseLengthController.text); + if (widget.onChange != null) widget.onChange!(provider.ovulationResult); + } + + @override + Widget build(BuildContext context) { + return Consumer(builder: (context, provider, _) { + return Container( + margin: EdgeInsets.zero, + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + TextInputWidget( + labelText: "Date", + hintText: "11 July, 1994".needTranslation, + controller: _ageController, + isEnable: true, + prefix: null, + isAllowRadius: true, + isBorderAllowed: false, + isAllowLeadingIcon: true, + padding: EdgeInsets.symmetric(vertical: 8.h), + leadingIcon: AppAssets.birthday_cake, + selectionType: SelectionTypeEnum.calendar, + isHideSwitcher: true, + onCalendarTypeChanged: (val) {}, + onChange: (val) { + if (val == null) return; + setState(() { + _ageController.text = selectedDate = Utils.formatDateToDisplay(val); + }); + _onInputChanged(); + }, + ).withVerticalPadding(8), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.age, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Average Cycle Length (Usually 28 days)".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _cycleLengthController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '28', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Divider(height: 1, color: Color(0xFFEEEEEE)), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.age, width: 40.w, height: 40.w), + SizedBox(width: 12.w), + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Average Luteal Phase Length(Usually 14 days)".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: TextField( + controller: _lutealPhaseLengthController, + keyboardType: TextInputType.number, + maxLines: 1, + cursorHeight: 14, + textAlignVertical: TextAlignVertical.center, + decoration: const InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: '14', + hintStyle: TextStyle(color: Colors.grey), + ), + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0), + ), + ) + ], + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w), + SizedBox(width: 12.w), + Expanded( + child: "Calculate ovulation and fertile window based on last period, cycle length and luteal phase.".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/health_calculators_and_converts/widgets/triglycerides.dart b/lib/presentation/health_calculators_and_converts/widgets/triglycerides.dart new file mode 100644 index 0000000..1c8c99e --- /dev/null +++ b/lib/presentation/health_calculators_and_converts/widgets/triglycerides.dart @@ -0,0 +1,192 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; + +class TriglyceridesWidget extends StatefulWidget { + final Function(dynamic result)? onChange; + + const TriglyceridesWidget({super.key, this.onChange}); + + @override + State createState() => _TriglyceridesWidgetState(); +} + +class _TriglyceridesWidgetState extends State { + final TextEditingController _mgdlController = TextEditingController(); + final TextEditingController _mmolController = TextEditingController(); + final FocusNode _mgdlFocus = FocusNode(); + final FocusNode _mmolFocus = FocusNode(); + bool _isProgrammaticChange = false; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + Provider.of( + context, + listen: false, + ).clearTriglycerides(); + }); + } + + @override + void dispose() { + _mgdlController.dispose(); + _mmolController.dispose(); + _mgdlFocus.dispose(); + _mmolFocus.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, provider, _) { + _isProgrammaticChange = true; + + final mgdlText = provider.triMgdlValue ?? ''; + final mmolText = provider.triMmolValue ?? ''; + + // Only update if focus is not on this field (to avoid cursor jumping) + if (!_mgdlFocus.hasFocus && _mgdlController.text != mgdlText) { + _mgdlController.text = mgdlText; + _mgdlController.selection = TextSelection.fromPosition( + TextPosition(offset: _mgdlController.text.length), + ); + } + + if (!_mmolFocus.hasFocus && _mmolController.text != mmolText) { + _mmolController.text = mmolText; + _mmolController.selection = TextSelection.fromPosition( + TextPosition(offset: _mmolController.text.length), + ); + } + + _isProgrammaticChange = false; + + return Container( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + children: [ + _buildInputField( + label: "MG/DL", + hint: "150", + controller: _mgdlController, + focusNode: _mgdlFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onTriglyceridesMgdlChanged(value); + }, + ).paddingOnly(top: 16.h), + + Row( + children: [ + const Expanded( + flex: 3, + child: Divider(height: 1, color: Color(0xFFEEEEEE)), + ), + SizedBox(width: 8.w), + Utils.buildSvgWithAssets( + icon: AppAssets.switchBtn, + width: 40.h, + height: 40.h, + ).onPress(() { + // Unfocus both fields before switching + _mgdlFocus.unfocus(); + _mmolFocus.unfocus(); + provider.switchTriglyceridesValues(); + }), + ], + ), + + _buildInputField( + label: "MMOL/L", + hint: "1.7", + controller: _mmolController, + focusNode: _mmolFocus, + onChanged: (value) { + if (_isProgrammaticChange) return; + provider.onTriglyceridesMmolChanged(value); + }, + ).paddingOnly(bottom: 16.h), + + const Divider(height: 1, color: Color(0xFFEEEEEE)), + + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.globe, + width: 18.w, + height: 18.w, + ), + SizedBox(width: 12.w), + Expanded( + child: + "Convert triglyceride values between mg/dL and mmol/L." + .toText12( + fontWeight: FontWeight.w500, + color: AppColors.inputLabelTextColor, + ), + ), + ], + ).paddingSymmetrical(0.w, 16.w), + ], + ), + ); + }, + ); + } + + Widget _buildInputField({ + required String label, + required String hint, + required TextEditingController controller, + required FocusNode focusNode, + required ValueChanged onChanged, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + label.toText12( + fontWeight: FontWeight.w500, + color: AppColors.inputLabelTextColor, + ), + SizedBox( + height: 40.h, + child: TextField( + controller: controller, + focusNode: focusNode, + keyboardType: + const TextInputType.numberWithOptions(decimal: true), + onChanged: onChanged, + cursorHeight: 35.h, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: hint, + hintStyle: const TextStyle(color: Colors.grey), + ), + style: TextStyle( + fontSize: 32.f, + fontWeight: FontWeight.bold, + color: Colors.black87, + ), + ), + ), + ], + ); + } +} diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart index ab70265..1380ad9 100644 --- a/lib/presentation/hmg_services/services_page.dart +++ b/lib/presentation/hmg_services/services_page.dart @@ -1,22 +1,27 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/blood_donation/blood_donation_page.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/contact_us.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/hmg_services/services_view.dart'; +import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart'; +import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; @@ -73,30 +78,59 @@ class ServicesPage extends StatelessWidget { true, route: AppRoutes.eReferralPage, ), - HmgServicesComponentModel(3, "Blood Donation".needTranslation, "".needTranslation, AppAssets.blood_donation_icon, bgColor: AppColors.bloodDonationCardColor, true, route: null, onTap: () async { + HmgServicesComponentModel( + 3, + "Blood Donation".needTranslation, + "".needTranslation, + AppAssets.blood_donation_icon, + bgColor: AppColors.bloodDonationCardColor, + true, + route: null, onTap: () async { LoaderBottomSheet.showLoader(loadingText: "Fetching Data..."); await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async { - await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) { - LoaderBottomSheet.hideLoader(); - Navigator.of(GetIt.instance().navigatorKey.currentContext!).push( - CustomPageRoute( - page: BloodDonationPage(), - ), - ); - }); + // await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + Navigator.of(GetIt.instance().navigatorKey.currentContext!).push( + CustomPageRoute( + page: BloodDonationPage(), + ), + ); + // }, onError: (err) { + // LoaderBottomSheet.hideLoader(); + // }); }, onError: (err) { LoaderBottomSheet.hideLoader(); }); }), - HmgServicesComponentModel( - 3, - "Home Health Care".needTranslation, - "".needTranslation, - AppAssets.homeBottom, - bgColor: AppColors.primaryRedColor, - true, - route: AppRoutes.homeHealthCarePage, - ), + // HmgServicesComponentModel( + // 11, + // "Covid 19 Test".needTranslation, + // "".needTranslation, + // AppAssets.covid19icon, + // bgColor: AppColors.covid29Color, + // true, + // route: AppRoutes.covid19Test, + // ), + + // HmgServicesComponentModel( + // 11, + // "Vital Sign".needTranslation, + // "".needTranslation, + // AppAssets.covid19icon, + // bgColor: AppColors.covid29Color, + // true, + // route: AppRoutes.vitalSign, + // ) + + // HmgServicesComponentModel( + // 3, + // "Home Health Care".needTranslation, + // "".needTranslation, + // AppAssets.homeBottom, + // bgColor: AppColors.primaryRedColor, + // true, + // route: AppRoutes.homeHealthCarePage, + // ), // HmgServicesComponentModel( // 11, // "Virtual Tour".needTranslation, @@ -113,6 +147,66 @@ class ServicesPage extends StatelessWidget { // ) ]; + late final List hmgHealthToolServices = [ + HmgServicesComponentModel( + 11, + "Daily Water Monitor".needTranslation, + "".needTranslation, + AppAssets.daily_water_monitor_icon, + bgColor: AppColors.whiteColor, + true, + route: null, // Set to null since we handle navigation in onTap + onTap: () async { + LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation); + final waterMonitorVM = getIt.get(); + final context = getIt.get().navigatorKey.currentContext!; + await waterMonitorVM.fetchUserDetailsForMonitoring( + onSuccess: (userDetail) { + LoaderBottomSheet.hideLoader(); + if (userDetail == null) { + waterMonitorVM.populateFromAuthenticatedUser(); + context.navigateWithName(AppRoutes.waterMonitorSettingsScreen); + } else { + context.navigateWithName(AppRoutes.waterConsumptionScreen); + } + }, + onError: (error) { + LoaderBottomSheet.hideLoader(); + context.navigateWithName(AppRoutes.waterConsumptionScreen); + }, + ); + }, + ), + HmgServicesComponentModel( + 11, + "Health\nCalculators".needTranslation, + "".needTranslation, + AppAssets.health_calculators_services_icon, + bgColor: AppColors.whiteColor, + true, + route: AppRoutes.healthCalculatorsPage, + ), + HmgServicesComponentModel( + 5, + "Health\nConverters".needTranslation, + "".needTranslation, + AppAssets.health_converters_icon, + bgColor: AppColors.whiteColor, + true, + route: AppRoutes.healthConvertersPage, + ), + HmgServicesComponentModel( + 11, + "Smart\nWatches".needTranslation, + "".needTranslation, + AppAssets.smartwatch_icon, + bgColor: AppColors.whiteColor, + true, + route: AppRoutes.smartWatches, + // route: AppRoutes.huaweiHealthExample, + ), + ]; + @override Widget build(BuildContext context) { bloodDonationViewModel = Provider.of(context); @@ -122,308 +216,359 @@ class ServicesPage extends StatelessWidget { body: CollapsingListView( title: "Explore Services".needTranslation, isLeading: false, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 24.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 16.h), - "Medical & Care Services".needTranslation.toText18(isBold: true), - SizedBox(height: 16.h), - GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, // 4 icons per row - crossAxisSpacing: 12.w, - mainAxisSpacing: 18.h, - childAspectRatio: 0.8, - ), - physics: NeverScrollableScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + "Medical & Care Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + SizedBox(height: 16.h), + GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: (isFoldable || isTablet) ? 6 : 4, // 4 icons per row + crossAxisSpacing: 12.w, + mainAxisSpacing: 18.h, + childAspectRatio: 0.8, + ), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServiceGridViewItem(hmgServices[index], index, false, isHealthToolIcon: false); + }, + ).paddingSymmetrical(24.w, 0), + SizedBox(height: 24.h), + "HMG Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + SizedBox(height: 16.h), + SizedBox( + height: 350.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: LandingPageData.getServiceCardsList.length, shrinkWrap: true, - itemCount: hmgServices.length, - padding: EdgeInsets.zero, - itemBuilder: (BuildContext context, int index) { - return ServiceGridViewItem(hmgServices[index], index, false); + padding: EdgeInsets.symmetric(horizontal: 24.w), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: LargeServiceCard( + serviceCardData: LandingPageData.getServiceCardsList[index], + image: LandingPageData.getServiceCardsList[index].icon, + title: LandingPageData.getServiceCardsList[index].title, + subtitle: LandingPageData.getServiceCardsList[index].subtitle, + icon: LandingPageData.getServiceCardsList[index].largeCardIcon, + ), + ), + ), + ); }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 16.w), ), - SizedBox(height: 24.h), - "Personal Services".needTranslation.toText18(isBold: true), - SizedBox(height: 16.h), - Row( - children: [ - Expanded( - child: Container( - height: 170.h, - padding: EdgeInsets.all(16.w), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.r, - hasShadow: false, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - spacing: 8.w, - crossAxisAlignment: CrossAxisAlignment.center, + ), + SizedBox(height: 24.h), + "Personal Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: Container( + height: 170.h, + padding: EdgeInsets.all(16.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.r, + hasShadow: false, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + spacing: 8.w, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 30.w, height: 30.h), + "Habib Wallet".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, + Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), + ], + ), + Spacer(), + Consumer(builder: (context, habibWalletVM, child) { + return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) + .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); + }), + Spacer(), + CustomButton( + height: 40.h, + icon: AppAssets.recharge_icon, + iconSize: 16.w, + iconColor: AppColors.infoColor, + textColor: AppColors.infoColor, + text: "Recharge".needTranslation, + borderWidth: 0.w, + fontWeight: FontWeight.w500, + borderColor: Colors.transparent, + backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08), + padding: EdgeInsets.all(8.w), + fontSize: 12.f, + onPressed: () { + Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage())); + }, + ), + ], + ).onPress(() { + Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage())); + }), + ), + ), + SizedBox(width: 16.w), + Expanded( + child: Container( + height: 170.h, + padding: EdgeInsets.all(16.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.r, + hasShadow: false, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + spacing: 8.w, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.services_medical_file_icon, width: 30.w, height: 30.h), + "Medical Files".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, + Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), + ], + ), + Spacer(), + Wrap( + spacing: -8.h, + // runSpacing: 0.h, + children: [ + Utils.buildImgWithAssets( + icon: AppAssets.babyGirlImg, + height: 28.h, + width: 28.w, + border: 1, + fit: BoxFit.contain, + borderRadius: 50.r, + ), + Utils.buildImgWithAssets( + icon: AppAssets.femaleImg, + height: 28.h, + width: 28.w, + border: 1, + borderRadius: 50.r, + fit: BoxFit.contain, + ), + Utils.buildImgWithAssets( + icon: AppAssets.maleImg, + height: 28.h, + width: 28.w, + border: 1, + borderRadius: 50.r, + fit: BoxFit.contain, + ), + ], + ), + Spacer(), + CustomButton( + height: 40.h, + icon: AppAssets.add_icon, + iconSize: 16.w, + iconColor: AppColors.primaryRedColor, + textColor: AppColors.primaryRedColor, + text: "Add Member".needTranslation, + borderWidth: 0.w, + fontWeight: FontWeight.w500, + borderColor: Colors.transparent, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.08), + padding: EdgeInsets.all(8.w), + fontSize: 12.f, + onPressed: () { + DialogService dialogService = getIt.get(); + medicalFileViewModel.clearAuthValues(); + dialogService.showAddFamilyFileSheet( + label: "Add Family Member".needTranslation, + message: "Please fill the below field to add a new family member to your profile".needTranslation, + onVerificationPress: () { + medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); + }); + }, + ), + ], + ).onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: MedicalFilePage(), + ), + ); + }), + ), + ), + ], + ).paddingSymmetrical(24.w, 0), + SizedBox(height: 24.h), + "Health Tools".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + SizedBox(height: 16.h), + GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: (isFoldable || isTablet) ? 6 : 4, // 4 icons per row + crossAxisSpacing: 12.w, + mainAxisSpacing: 18.h, + childAspectRatio: 0.8, + ), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgHealthToolServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServiceGridViewItem( + hmgHealthToolServices[index], + index, + false, + isHealthToolIcon: true, + ); + }, + ).paddingSymmetrical(24.w, 0), + SizedBox(height: 24.h), + "Support Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + SizedBox(height: 16.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( children: [ - Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 30.w, height: 30.h), - "Habib Wallet".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, - Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), + Utils.buildSvgWithAssets( + icon: AppAssets.virtual_tour_icon, + width: 32.w, + height: 32.h, + fit: BoxFit.contain, + ), + SizedBox(width: 8.w), + "Virtual Tour".needTranslation.toText12(fontWeight: FontWeight.w500) ], ), - Spacer(), - Consumer(builder: (context, habibWalletVM, child) { - return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) - .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); - }), - Spacer(), - CustomButton( - height: 40.h, - icon: AppAssets.recharge_icon, - iconSize: 16.w, - iconColor: AppColors.infoColor, - textColor: AppColors.infoColor, - text: "Recharge".needTranslation, - borderWidth: 0.w, - fontWeight: FontWeight.w500, - borderColor: Colors.transparent, - backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08), - padding: EdgeInsets.all(8.w), - fontSize: 12.f, - onPressed: () { - Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage())); - }, - ), - ], + ), ).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage())); + Utils.openWebView( + url: 'https://hmgwebservices.com/vt_mobile/html/index.html', + ); }), ), - ), - SizedBox(width: 16.w), - Expanded( - child: Container( - height: 170.h, - padding: EdgeInsets.all(16.w), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.r, - hasShadow: false, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - spacing: 8.w, - crossAxisAlignment: CrossAxisAlignment.center, + SizedBox(width: 16.w), + Expanded( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( children: [ - Utils.buildSvgWithAssets(icon: AppAssets.services_medical_file_icon, width: 30.w, height: 30.h), - "Medical Files".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, - Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), + Utils.buildSvgWithAssets( + icon: AppAssets.car_parking_icon, + width: 32.w, + height: 32.h, + fit: BoxFit.contain, + ), + SizedBox(width: 8.w), + "Car Parking".needTranslation.toText12(fontWeight: FontWeight.w500) ], ), - Spacer(), - Wrap( - spacing: -8.h, - // runSpacing: 0.h, + ), + ), + ), + ], + ), + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( children: [ - Utils.buildImgWithAssets( - icon: AppAssets.babyGirlImg, - height: 28.h, - width: 28.w, - border: 1, - fit: BoxFit.contain, - borderRadius: 50.r, - ), - Utils.buildImgWithAssets( - icon: AppAssets.femaleImg, - height: 28.h, - width: 28.w, - border: 1, - borderRadius: 50.r, - fit: BoxFit.contain, - ), - Utils.buildImgWithAssets( - icon: AppAssets.male_img, - height: 28.h, - width: 28.w, - border: 1, - borderRadius: 50.r, + Utils.buildSvgWithAssets( + icon: AppAssets.latest_news_icon, + width: 32.w, + height: 32.h, fit: BoxFit.contain, ), + SizedBox(width: 8.w), + "Latest News".needTranslation.toText12(fontWeight: FontWeight.w500) ], ), - Spacer(), - CustomButton( - height: 40.h, - icon: AppAssets.add_icon, - iconSize: 16.w, - iconColor: AppColors.primaryRedColor, - textColor: AppColors.primaryRedColor, - text: "Add Member".needTranslation, - borderWidth: 0.w, - fontWeight: FontWeight.w500, - borderColor: Colors.transparent, - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.08), - padding: EdgeInsets.all(8.w), - fontSize: 12.f, - onPressed: () { - DialogService dialogService = getIt.get(); - medicalFileViewModel.clearAuthValues(); - dialogService.showAddFamilyFileSheet( - label: "Add Family Member".needTranslation, - message: "Please fill the below field to add a new family member to your profile".needTranslation, - onVerificationPress: () { - medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); - }); - }, - ), - ], + ), ).onPress(() { - Navigator.of(context).push( - CustomPageRoute( - page: MedicalFilePage(), - ), + Utils.openWebView( + url: 'https://x.com/HMG', ); }), ), - ), - ], - ), - SizedBox(height: 24.h), - "Support Services".needTranslation.toText18(isBold: true), - SizedBox(height: 16.h), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.virtual_tour_icon, - width: 32.w, - height: 32.h, - fit: BoxFit.contain, - ), - SizedBox(width: 8.w), - "Virtual Tour".needTranslation.toText12(fontWeight: FontWeight.w500) - ], - ), - ), - ).onPress(() { - Utils.openWebView( - url: 'https://hmgwebservices.com/vt_mobile/html/index.html', - ); - }), - ), - SizedBox(width: 16.w), - Expanded( - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.car_parking_icon, - width: 32.w, - height: 32.h, - fit: BoxFit.contain, - ), - SizedBox(width: 8.w), - "Car Parking".needTranslation.toText12(fontWeight: FontWeight.w500) - ], - ), - ), + SizedBox(width: 16.w), + Expanded( + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: false, ), - ), - ], - ), - SizedBox(height: 16.h), - Row( - children: [ - Expanded( - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.latest_news_icon, - width: 32.w, - height: 32.h, - fit: BoxFit.contain, - ), - SizedBox(width: 8.w), - "Latest News".needTranslation.toText12(fontWeight: FontWeight.w500) - ], - ), - ), - ).onPress(() { - Utils.openWebView( - url: 'https://x.com/HMG', - ); - }), - ), - SizedBox(width: 16.w), - Expanded( - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 12.h, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.hmg_contact_icon, - width: 32.w, - height: 32.h, - fit: BoxFit.contain, - ), - SizedBox(width: 8.w), - "HMG Contact".needTranslation.toText12(fontWeight: FontWeight.w500) - ], - ), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.hmg_contact_icon, + width: 32.w, + height: 32.h, + fit: BoxFit.contain, + ), + SizedBox(width: 8.w), + "HMG Contact".needTranslation.toText12(fontWeight: FontWeight.w500) + ], ), - ).onPress(() { - showCommonBottomSheetWithoutHeight( - context, - title: LocaleKeys.contactUs.tr(), - child: ContactUs(), - callBackFunc: () {}, - isFullScreen: false, - ); - }), - ) - ], - ) - ], - ), - SizedBox(height: 24.h), - ], - ), + ), + ).onPress(() { + showCommonBottomSheetWithoutHeight( + context, + title: LocaleKeys.contactUs.tr(), + child: ContactUs(), + callBackFunc: () {}, + isFullScreen: false, + ); + }), + ) + ], + ) + ], + ).paddingSymmetrical(24.w, 0), + SizedBox(height: 24.h), + ], ), ), ); diff --git a/lib/presentation/hmg_services/services_view.dart b/lib/presentation/hmg_services/services_view.dart index b24b0b4..3f0c44e 100644 --- a/lib/presentation/hmg_services/services_view.dart +++ b/lib/presentation/hmg_services/services_view.dart @@ -13,8 +13,10 @@ class ServiceGridViewItem extends StatelessWidget { final int index; final bool isHomePage; final bool isLocked; + final bool isHealthToolIcon; final Function? onTap; - const ServiceGridViewItem(this.hmgServiceComponentModel, this.index, this.isHomePage, {super.key, this.isLocked = false, this.onTap}); + + const ServiceGridViewItem(this.hmgServiceComponentModel, this.index, this.isHomePage, {super.key, this.isLocked = false, this.onTap, this.isHealthToolIcon = false}); @override Widget build(BuildContext context) { @@ -42,7 +44,7 @@ class ServiceGridViewItem extends StatelessWidget { padding: EdgeInsets.all(12.h), child: Utils.buildSvgWithAssets( icon: hmgServiceComponentModel.icon, - iconColor: AppColors.whiteColor, + iconColor: isHealthToolIcon ? null : AppColors.whiteColor, fit: BoxFit.contain, ), ), diff --git a/lib/presentation/home/data/landing_page_data.dart b/lib/presentation/home/data/landing_page_data.dart index 3d74cfd..c693479 100644 --- a/lib/presentation/home/data/landing_page_data.dart +++ b/lib/presentation/home/data/landing_page_data.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/presentation/home/data/service_card_data.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -36,7 +35,7 @@ class LandingPageData { isBold: false, ), ServiceCardData( - serviceName: "health_calculators", + serviceName: "health_calculators_and_converts", icon: AppAssets.health_calculators_icon, title: "Health", subtitle: "Calculators", @@ -90,7 +89,7 @@ class LandingPageData { ), ServiceCardData( serviceName: "radiology_results", - icon: AppAssets.home_lab_result_icon, + icon: AppAssets.my_radiology_icon, title: "Radiology", subtitle: "Results", backgroundColor: AppColors.whiteColor, @@ -120,7 +119,7 @@ class LandingPageData { ), ServiceCardData( serviceName: "my_doctors", - icon: AppAssets.insurance_update_icon, + icon: AppAssets.my_doctors_icon, title: "My", subtitle: "Doctors", backgroundColor: AppColors.whiteColor, @@ -130,7 +129,7 @@ class LandingPageData { ), ServiceCardData( serviceName: "sick_leaves", - icon: AppAssets.insurance_update_icon, + icon: AppAssets.my_sick_leave_icon, title: "Sick", subtitle: "Leaves", backgroundColor: AppColors.whiteColor, @@ -142,44 +141,42 @@ class LandingPageData { static List getServiceCardsList = [ ServiceCardData( - icon: AppAssets.livecare_service, + serviceName: "livecare", + icon: AppAssets.small_livecare_icon, title: "LiveCare", subtitle: "Explore our app, View our services and offers", - largeCardIcon: AppAssets.livecare_icon, - backgroundColor: Colors.transparent, - iconColor: Colors.transparent, - textColor: Colors.transparent, - isBold: true, - ), - ServiceCardData( - icon: AppAssets.lab_result_icon, - title: "Dermatology", - subtitle: "Explore our app, View our services and offers", - largeCardIcon: AppAssets.livecare_icon, - backgroundColor: AppColors.whiteColor, - iconColor: AppColors.blackColor, - textColor: AppColors.blackColor, + largeCardIcon: AppAssets.liveCareService, + backgroundColor: AppColors.successColor, + iconColor: AppColors.whiteColor, isBold: false, ), - ServiceCardData( - icon: AppAssets.my_prescription_icon, + // ServiceCardData( + // icon: AppAssets.homeBottom, + // title: "Dermatology", + // subtitle: "Explore our app, View our services and offers", + // largeCardIcon: AppAssets.homeBottom, + // backgroundColor: AppColors.primaryRedColor, + // isBold: false, + // ), + ServiceCardData( + serviceName: "home_health_care", + icon: AppAssets.homeBottom, title: "Home Health Care", subtitle: "Explore our app, View our services and offers", - largeCardIcon: AppAssets.livecare_icon, - backgroundColor: AppColors.whiteColor, - iconColor: AppColors.blackColor, - textColor: AppColors.blackColor, + largeCardIcon: AppAssets.homeHealthCareService, + backgroundColor: AppColors.primaryRedColor, + iconColor: AppColors.whiteColor, isBold: false, ), ServiceCardData( - icon: AppAssets.insurance_update_icon, + serviceName: "pharmacy", + icon: AppAssets.pharmacy_icon, //359846 title: "Pharmacy", subtitle: "Explore our app, View our services and offers", - largeCardIcon: AppAssets.livecare_icon, - backgroundColor: AppColors.whiteColor, - iconColor: AppColors.blackColor, - textColor: AppColors.blackColor, - isBold: false, + largeCardIcon: AppAssets.pharmacyService, + backgroundColor: AppColors.pharmacyBGColor, + iconColor: null, + isBold: true, ), ]; } diff --git a/lib/presentation/home/data/service_card_data.dart b/lib/presentation/home/data/service_card_data.dart index 49e7e3d..3bc22d7 100644 --- a/lib/presentation/home/data/service_card_data.dart +++ b/lib/presentation/home/data/service_card_data.dart @@ -7,7 +7,7 @@ class ServiceCardData { final String icon; final String title; final String subtitle; - final Color iconColor; + final Color? iconColor; final Color textColor; final Color backgroundColor; final bool isBold; @@ -22,6 +22,6 @@ class ServiceCardData { this.backgroundColor = AppColors.whiteColor, this.iconColor = AppColors.blackColor, this.textColor = AppColors.blackColor, - this.isBold = false, + this.isBold = false }); } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 88b9274..1496ded 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -21,10 +21,12 @@ import 'package:hmg_patient_app_new/features/emergency_services/emergency_servic import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_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/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/appointments/appointment_queue_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/presentation/authentication/quick_login.dart'; @@ -40,8 +42,7 @@ import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart'; -import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/call_screen.dart'; -import 'package:hmg_patient_app_new/routes/app_routes.dart'; +import 'package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_doctor.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -68,7 +69,7 @@ class _LandingPageState extends State { late MyAppointmentsViewModel myAppointmentsViewModel; late PrescriptionsViewModel prescriptionsViewModel; final CacheService cacheService = GetIt.instance(); - + late AppointmentRatingViewModel appointmentRatingViewModel; late InsuranceViewModel insuranceViewModel; late ImmediateLiveCareViewModel immediateLiveCareViewModel; late BookAppointmentsViewModel bookAppointmentsViewModel; @@ -80,6 +81,7 @@ class _LandingPageState extends State { void initState() { authVM = context.read(); habibWalletVM = context.read(); + appointmentRatingViewModel = context.read(); // myAppointmentsViewModel = context.read(); // prescriptionsViewModel = context.read(); // insuranceViewModel = context.read(); @@ -103,6 +105,24 @@ class _LandingPageState extends State { prescriptionsViewModel.initPrescriptionsViewModel(); insuranceViewModel.initInsuranceProvider(); emergencyServicesViewModel.checkPatientERAdvanceBalance(); + myAppointmentsViewModel.getPatientAppointmentQueueDetails(); + if(!appState.isRatedVisible) { + appointmentRatingViewModel.getLastRatingAppointment(onSuccess: (response) { + if (appointmentRatingViewModel.appointmentRatedList.isNotEmpty) { + appointmentRatingViewModel.getAppointmentDetails(appointmentRatingViewModel.appointmentRatedList.last.appointmentNo!, appointmentRatingViewModel.appointmentRatedList.last.projectID!, + onSuccess: ((response) { + + appointmentRatingViewModel.setClinicOrDoctor(false); + appointmentRatingViewModel.setTitle("Rate Doctor".needTranslation); + appointmentRatingViewModel.setSubTitle("How was your last visit with doctor?".needTranslation); + openLastRating(); + appState.setRatedVisible(true); + + })); + + } + }); + } } }); super.initState(); @@ -136,7 +156,7 @@ class _LandingPageState extends State { Navigator.of(context).push(springPageRoute(ProfileSettings())); }, name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'), - imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, + imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, ).expanded : CustomButton( text: LocaleKeys.loginOrRegister.tr(context: context), @@ -290,16 +310,16 @@ class _LandingPageState extends State { Utils.buildSvgWithAssets(icon: AppAssets.waiting_icon, width: 24.h, height: 24.h), ], ), - SizedBox(height: 10.h), - "Hala ${appState!.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), SizedBox(height: 8.h), + "Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), + SizedBox(height: 2.h), "Thank you for your patience, here is your queue number." .needTranslation .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 8.h), - "IMD W-A-5".needTranslation.toText28(isBold: true), - SizedBox(height: 12.h), - Row( + myAppointmentsVM.currentPatientQueueDetails.queueNo!.toText28(isBold: true), + SizedBox(height: 6.h), + myAppointmentsVM.patientQueueDetailsList.isNotEmpty ? Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -307,24 +327,24 @@ class _LandingPageState extends State { Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - "IMD W-A-2".needTranslation.toText12(isBold: true), + myAppointmentsVM.patientQueueDetailsList.first.queueNo!.toText12(isBold: true), SizedBox(width: 8.w), AppCustomChipWidget( - deleteIcon: AppAssets.call_for_vitals, - labelText: "Call for vital signs".needTranslation, - iconColor: AppColors.primaryRedColor, - textColor: AppColors.primaryRedColor, + deleteIcon: myAppointmentsVM.patientQueueDetailsList.first.callType == 1 ? AppAssets.call_for_vitals : AppAssets.call_for_doctor, + labelText: myAppointmentsVM.patientQueueDetailsList.first.callType == 1 ? "Call for vital signs".needTranslation : "Call for Doctor".needTranslation, + iconColor: myAppointmentsVM.patientQueueDetailsList.first.callType == 1 ? AppColors.primaryRedColor : AppColors.successColor, + textColor: myAppointmentsVM.patientQueueDetailsList.first.callType == 1 ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 14.w, - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1), + backgroundColor: myAppointmentsVM.patientQueueDetailsList.first.callType == 1 ? AppColors.primaryRedColor.withValues(alpha: 0.1) : AppColors.successColor.withValues(alpha: 0.1), labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h), ), ], ), ], - ), - SizedBox(height: 8.h), + ) : SizedBox(height: 12.h), + SizedBox(height: 5.h), CustomButton( - text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus), + text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""), onPressed: () {}, backgroundColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus), borderColor: Utils.getCardButtonColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.01), @@ -340,7 +360,13 @@ class _LandingPageState extends State { ], ), ), - ) + ).onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: AppointmentQueuePage(), + ), + ); + }) : (immediateLiveCareVM.patientHasPendingLiveCareRequest && index == 0) ? Column( children: [ @@ -383,15 +409,15 @@ class _LandingPageState extends State { SizedBox(height: 10.h), "Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), SizedBox(height: 8.h), - "Your turn is after ${immediateLiveCareVM.patientLiveCareHistoryList[0].patCount} patients.".toText14(isBold: true), - SizedBox(height: 8.h), - Column( + "Your turn is after ${immediateLiveCareVM.patientLiveCareHistoryList[0].patCount} patients.".needTranslation.toText14(isBold: true), + SizedBox(height: 8.h), + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Expected waiting time: ".toText12(isBold: true), - SizedBox(height: 8.h), - ValueListenableBuilder( - valueListenable: immediateLiveCareVM.durationNotifier, + "Expected waiting time: ".needTranslation.toText12(isBold: true), + SizedBox(height: 7.h), + ValueListenableBuilder( + valueListenable: immediateLiveCareVM.durationNotifier, builder: (context, duration, child) { return Column( mainAxisAlignment: MainAxisAlignment.center, @@ -401,9 +427,8 @@ class _LandingPageState extends State { ); }, ), - SizedBox(height: 12.h), - ], - ), + ], + ), // CustomButton( // text: "View Details".needTranslation, // onPressed: () async { @@ -446,21 +471,19 @@ class _LandingPageState extends State { ) : Container( width: double.infinity, - decoration: RoundedRectangleBorder() - .toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), child: Padding( padding: EdgeInsets.all(12.h), child: Column( children: [ Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), SizedBox(height: 12.h), - "You do not have any upcoming appointment. Please book an appointment" - .needTranslation - .toText12(isCenter: true), + "You do not have any upcoming appointment. Please book an appointment".needTranslation.toText12(isCenter: true), SizedBox(height: 12.h), CustomButton( text: LocaleKeys.bookAppo.tr(context: context), onPressed: () { + getIt.get().onTabChanged(0); Navigator.of(context).push(CustomPageRoute(page: BookAppointmentPage())); }, backgroundColor: Color(0xffFEE9EA), @@ -471,7 +494,7 @@ class _LandingPageState extends State { padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0), icon: AppAssets.add_icon, iconColor: AppColors.primaryRedColor, - height: 46.h, + height: 40.h, ), ], ), @@ -577,7 +600,7 @@ class _LandingPageState extends State { icon: LandingPageData.getLoggedInServiceCardsList[index].icon, title: LandingPageData.getLoggedInServiceCardsList[index].title, subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle, - iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor, + iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor!, textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor, backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor, isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold, @@ -618,7 +641,7 @@ class _LandingPageState extends State { icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, title: LandingPageData.getNotLoggedInServiceCardsList[index].title, subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, - iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor, + iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor!, textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor, backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor, isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold, @@ -663,6 +686,7 @@ class _LandingPageState extends State { horizontalOffset: 100.0, child: FadeInAnimation( child: LargeServiceCard( + serviceCardData: LandingPageData.getServiceCardsList[index], image: LandingPageData.getServiceCardsList[index].icon, title: LandingPageData.getServiceCardsList[index].title, subtitle: LandingPageData.getServiceCardsList[index].subtitle, @@ -672,7 +696,7 @@ class _LandingPageState extends State { ), ); }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.w), + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 16.w), ), ), appState.isAuthenticated ? HabibWalletCard() : SizedBox(), @@ -714,4 +738,31 @@ class _LandingPageState extends State { }, ); } + + openLastRating() { + showCommonBottomSheetWithoutHeight( + context, + titleWidget: Selector( + selector: (_, vm) => vm.title, + builder: (context, title, child) { + final displayTitle = title ?? ''; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + displayTitle.toText20(weight: FontWeight.w600), + (context.select((vm) => vm.subTitle) ?? '').toText12(), + ], + ); + }, + ), + isCloseButtonVisible: true, + child: StatefulBuilder( + builder: (context, setState) { + + return RateAppointmentDoctor(); + }, + ), + isFullScreen: false, + ); + } } diff --git a/lib/presentation/home/navigation_screen.dart b/lib/presentation/home/navigation_screen.dart index f8447d2..6ec8c3a 100644 --- a/lib/presentation/home/navigation_screen.dart +++ b/lib/presentation/home/navigation_screen.dart @@ -1,12 +1,14 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; -import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart'; import 'package:hmg_patient_app_new/presentation/hmg_services/services_page.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/todo_section/todo_page.dart'; +import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/widgets/bottom_navigation/bottom_navigation.dart'; class LandingNavigation extends StatefulWidget { @@ -18,12 +20,11 @@ class LandingNavigation extends StatefulWidget { class _LandingNavigationState extends State { int _currentIndex = 0; - late AppState appState; final PageController _pageController = PageController(); @override Widget build(BuildContext context) { - appState = getIt.get(); + AppState appState = getIt.get(); return Scaffold( body: PageView( controller: _pageController, @@ -31,7 +32,7 @@ class _LandingNavigationState extends State { children: [ const LandingPage(), appState.isAuthenticated ? MedicalFilePage() : /* need add feedback page */ FeedbackPage(), - BookAppointmentPage(), + SizedBox(), const ToDoPage(), ServicesPage(), ], @@ -40,6 +41,11 @@ class _LandingNavigationState extends State { currentIndex: _currentIndex, onTap: (index) { setState(() => _currentIndex = index); + if (_currentIndex == 2) { + getIt.get().onTabChanged(0); + context.navigateWithName(AppRoutes.bookAppointmentPage); + return; + } _pageController.animateToPage(index, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); }, ), diff --git a/lib/presentation/home/widgets/habib_wallet_card.dart b/lib/presentation/home/widgets/habib_wallet_card.dart index 6ea4507..b2649f9 100644 --- a/lib/presentation/home/widgets/habib_wallet_card.dart +++ b/lib/presentation/home/widgets/habib_wallet_card.dart @@ -9,7 +9,6 @@ import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page. import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; class HabibWalletCard extends StatelessWidget { diff --git a/lib/presentation/home/widgets/large_service_card.dart b/lib/presentation/home/widgets/large_service_card.dart index 3989523..5274d5b 100644 --- a/lib/presentation/home/widgets/large_service_card.dart +++ b/lib/presentation/home/widgets/large_service_card.dart @@ -1,16 +1,25 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; +import 'package:hmg_patient_app_new/presentation/home/data/service_card_data.dart'; +import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_procedures_page.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../../core/utils/utils.dart'; import '../../../theme/colors.dart'; class LargeServiceCard extends StatelessWidget { + final ServiceCardData serviceCardData; final String image; final String icon; final String title; @@ -18,6 +27,7 @@ class LargeServiceCard extends StatelessWidget { const LargeServiceCard({ super.key, + required this.serviceCardData, this.image = "", this.icon = "", this.title = "", @@ -27,37 +37,112 @@ class LargeServiceCard extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - width: 150.w, - padding: EdgeInsets.symmetric(horizontal: 3.w), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.transparent, borderRadius: 16.r), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + height: 350.h, + width: 230.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.transparent, borderRadius: 24.r), + child: Stack( children: [ - Image.asset(AppAssets.livecare_service, width: 220.w, fit: BoxFit.contain), - SizedBox(height: 10.h), - Row( - children: [ - Utils.buildSvgWithAssets(icon: icon, width: 24.w, height: 24.h), - Flexible(child: title.toText14(color: AppColors.blackColor, isBold: true, textOverflow: TextOverflow.clip, maxlines: 1)), - ], + ClipRRect( + borderRadius: BorderRadius.circular(24.r), + child: Image.asset( + serviceCardData.largeCardIcon, + fit: BoxFit.cover, + ), ), - subtitle.toText11(color: AppColors.blackColor), - SizedBox(height: 10.h), - CustomButton( - text: LocaleKeys.bookNow.tr(context: context), - onPressed: () {}, - backgroundColor: AppColors.borderOnlyColor, - borderColor: AppColors.borderOnlyColor, - textColor: AppColors.whiteColor, - fontSize: 14.f, - fontWeight: FontWeight.bold, - borderRadius: 12.r, - padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), - height: 40.h, + Positioned( + bottom: 0.0, // Positions the child 0 logical pixels from the bottom + left: 0.0, + right: 0.0, + child: Container( + height: 180.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + customBorder: BorderRadius.only( + bottomLeft: Radius.circular(24.r), + bottomRight: Radius.circular(24.r), + ), + ), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 48.h, + width: 48.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: serviceCardData.backgroundColor, + borderRadius: 12.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(12.h), + child: Utils.buildSvgWithAssets( + icon: serviceCardData.icon, + iconColor: serviceCardData.iconColor, + fit: BoxFit.contain, + ), + ), + ), + SizedBox(width: 12.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + serviceCardData.title.toText14(isBold: true, color: AppColors.textColor), + SizedBox(width: 6.h), + serviceCardData.subtitle.toText14(weight: FontWeight.w500, color: AppColors.textColorLight), + ], + ), + ), + ], + ).paddingSymmetrical(16.w, 20.h), + CustomButton( + text: serviceCardData.isBold ? "Visit Pharmacy Online".needTranslation : LocaleKeys.bookNow.tr(context: context), + onPressed: () { + handleOnTap(); + }, + backgroundColor: serviceCardData.isBold ? AppColors.successLightColor.withValues(alpha: 0.2) : AppColors.bgRedLightColor, + borderColor: serviceCardData.isBold ? AppColors.successLightColor.withValues(alpha: 0.01) : AppColors.bgRedLightColor, + textColor: serviceCardData.isBold ? AppColors.successColor : AppColors.primaryRedColor, + fontSize: 14.f, + fontWeight: FontWeight.w500, + borderRadius: 10.r, + height: 40.h, + ).paddingSymmetrical(16.w, 0.h), + ], + ), + ), ), ], ), ); } + + void handleOnTap() { + switch (serviceCardData.serviceName) { + case "livecare": + { + getIt.get().onTabChanged(1); + Navigator.of(getIt.get().navigatorKey.currentContext!).push( + CustomPageRoute( + page: BookAppointmentPage(), + ), + ); + } + case "home_health_care": + { + Navigator.of(getIt().navigatorKey.currentContext!).push( + CustomPageRoute( + page: HhcProceduresPage(), + ), + ); + } + case "pharmacy": + { + Uri uri = Uri.parse(PHARMACY_REDIRECT_URL); + launchUrl(uri, mode: LaunchMode.externalApplication); + } + } + } } diff --git a/lib/presentation/home/widgets/small_service_card.dart b/lib/presentation/home/widgets/small_service_card.dart index f54f442..76ed3f7 100644 --- a/lib/presentation/home/widgets/small_service_card.dart +++ b/lib/presentation/home/widgets/small_service_card.dart @@ -10,7 +10,6 @@ import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/patient_sickleaves_list_page.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescriptions_list_page.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; import '../../../core/utils/utils.dart'; diff --git a/lib/presentation/home/widgets/welcome_widget.dart b/lib/presentation/home/widgets/welcome_widget.dart index f710ab2..8ef0697 100644 --- a/lib/presentation/home/widgets/welcome_widget.dart +++ b/lib/presentation/home/widgets/welcome_widget.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/home_health_care/hhc_order_detail_page.dart b/lib/presentation/home_health_care/hhc_order_detail_page.dart index 21b0def..92c93d1 100644 --- a/lib/presentation/home_health_care/hhc_order_detail_page.dart +++ b/lib/presentation/home_health_care/hhc_order_detail_page.dart @@ -10,10 +10,8 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; -import 'package:hmg_patient_app_new/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:provider/provider.dart'; @@ -75,7 +73,6 @@ class _HhcOrderDetailPageState extends State { Widget _buildOrderCard(GetCMCAllOrdersResponseModel order, {bool isLoading = false}) { final statusColor = _getStatusColor(order.statusId); - final canCancel = order.statusId == 1 || order.statusId == 2; return AnimatedContainer( duration: Duration(milliseconds: 300), @@ -150,27 +147,27 @@ class _HhcOrderDetailPageState extends State { ], ), - // Cancel Button - if (canCancel || isLoading) ...[ - SizedBox(height: 16.h), - Row( - children: [ - Expanded( - child: CustomButton( - text: "Cancel Order".needTranslation, - onPressed: isLoading ? () {} : () => HhcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - textColor: AppColors.whiteColor, - fontSize: 14.f, - fontWeight: FontWeight.w600, - borderRadius: 10.r, - height: 44.h, - ).toShimmer2(isShow: isLoading), - ), - ], - ), - ] + // // Cancel Button + // if (canCancel || isLoading) ...[ + // SizedBox(height: 16.h), + // Row( + // children: [ + // Expanded( + // child: CustomButton( + // text: "Cancel Order".needTranslation, + // onPressed: isLoading ? () {} : () => HhcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), + // backgroundColor: AppColors.primaryRedColor, + // borderColor: AppColors.primaryRedColor, + // textColor: AppColors.whiteColor, + // fontSize: 14.f, + // fontWeight: FontWeight.w600, + // borderRadius: 10.r, + // height: 44.h, + // ).toShimmer2(isShow: isLoading), + // ), + // ], + // ), + // ] ], ), ), @@ -219,6 +216,7 @@ class _HhcOrderDetailPageState extends State { } return ListView.separated( + padding: EdgeInsets.only(top: 24.h), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: viewModel.hhcOrdersList.length, diff --git a/lib/presentation/home_health_care/hhc_procedures_page.dart b/lib/presentation/home_health_care/hhc_procedures_page.dart index 0cf57ce..be97a88 100644 --- a/lib/presentation/home_health_care/hhc_procedures_page.dart +++ b/lib/presentation/home_health_care/hhc_procedures_page.dart @@ -14,9 +14,12 @@ import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_order_detail_page.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_selection_review_page.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'package:shimmer/shimmer.dart'; @@ -60,26 +63,16 @@ class _HhcProceduresPageState extends State { } Widget _buildPendingOrderCard(GetCMCAllOrdersResponseModel order) { - int status = order.statusId ?? 0; - String statusDisp = order.statusText ?? ""; - Color statusColor; + final canCancel = order.statusId == 1 || order.statusId == 2; + final isArabic = getIt.get().isArabic(); - if (status == 1) { - // pending - statusColor = AppColors.statusPendingColor; - } else if (status == 2) { - // processing - statusColor = AppColors.statusProcessingColor; - } else if (status == 3) { - // completed - statusColor = AppColors.statusCompletedColor; - } else { - // cancel / rejected - statusColor = AppColors.statusRejectedColor; + List selectedServices = []; + if (order.orderselectedservice != null) { + if (order.orderselectedservice is List) { + selectedServices = order.orderselectedservice as List; + } } - final canCancel = order.statusId == 1 || order.statusId == 2; - return Container( width: double.infinity, margin: EdgeInsets.all(16.w), @@ -98,16 +91,12 @@ class _HhcProceduresPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), - decoration: BoxDecoration( - color: statusColor.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(8.r), - ), - child: statusDisp.toText12( - color: statusColor, - fontWeight: FontWeight.w600, - ), + Row( + children: [ + "Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500), + SizedBox(width: 4.w), + "${order.iD ?? '-'}".toText16(isBold: true), + ], ), SizedBox(width: 8.w), if (order.created != null) @@ -117,19 +106,88 @@ class _HhcProceduresPageState extends State { ), ], ), + SizedBox(height: 8.h), - SizedBox(height: 16.h), + // Services List + if (selectedServices.isNotEmpty) ...[ + SizedBox(height: 16.h), + Container( + padding: EdgeInsets.all(12.w), + decoration: BoxDecoration( + color: AppColors.bgScaffoldColor, + borderRadius: BorderRadius.circular(12.r), + border: Border.all( + color: AppColors.greyColor.withAlpha(51), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.medical_services_outlined, + size: 18.h, + color: AppColors.primaryRedColor, + ), + SizedBox(width: 6.w), + "Requested Services".needTranslation.toText14( + weight: FontWeight.w600, + color: AppColors.blackColor, + ), + ], + ), + SizedBox(height: 8.h), + ...selectedServices.asMap().entries.map((entry) { + int index = entry.key; + var service = entry.value; + String serviceName = ''; - // Request ID - Row( - children: [ - "Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500), - SizedBox(width: 4.w), - "${order.iD ?? '-'}".toText16(isBold: true), - ], - ), + if (service is Map) { + if (isArabic) { + serviceName = service['SelectedServiceNameAR']?.toString() ?? + service['selectedServiceNameAR']?.toString() ?? + service['SelectedServiceName']?.toString() ?? + service['selectedServiceName']?.toString() ?? + ''; + } else { + serviceName = service['SelectedServiceName']?.toString() ?? service['selectedServiceName']?.toString() ?? ''; + } + } + + return Padding( + padding: EdgeInsets.only(top: index > 0 ? 6.h : 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 6.h), + width: 6.w, + height: 6.w, + decoration: BoxDecoration( + color: AppColors.primaryRedColor, + shape: BoxShape.circle, + ), + ), + SizedBox(width: 8.w), + Expanded( + child: serviceName.toText14( + color: AppColors.blackColor, + weight: FontWeight.w500, + maxlines: 3, + ), + ), + ], + ), + ); + }), + ], + ), + ), + ], - SizedBox(height: 12.h), + SizedBox(height: 8.h), // Info message Container( @@ -185,157 +243,174 @@ class _HhcProceduresPageState extends State { ); } - Widget _buildServiceSelectionList(List services) { - if (services.isEmpty) { - return Center( - child: Padding( - padding: EdgeInsets.all(24.h), - child: Text( - 'No services available'.needTranslation, - style: TextStyle( - fontSize: 16.h, - color: AppColors.greyTextColor, - ), - ), - ), - ); - } - - return Consumer( - builder: (context, viewModel, child) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 8.h), - if (viewModel.selectedHhcServices.isNotEmpty) ...[ - SizedBox(height: 16.h), - Container( - margin: EdgeInsets.symmetric(horizontal: 16.w), - padding: EdgeInsets.all(16.w), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.primaryRedColor.withValues(alpha: 0.1), - borderRadius: 16.r, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "Selected Services".needTranslation.toText12( - color: AppColors.textColorLight, - fontWeight: FontWeight.w600, - ), - "${viewModel.selectedHhcServices.length} service(s) selected".toText14( - isBold: true, - weight: FontWeight.bold, - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - "Total Amount".needTranslation.toText12( - color: AppColors.textColorLight, - fontWeight: FontWeight.w600, - ), - Utils.getPaymentAmountWithSymbol( - viewModel.getHhcSelectedServicesTotal().toStringAsFixed(2).toText16( - isBold: true, - weight: FontWeight.bold, - color: AppColors.primaryRedColor, - ), - AppColors.primaryRedColor, - 14, - isSaudiCurrency: true, - ), - ], - ), - ], + _buildServicesListBottomsSheet(List services) { + showCommonBottomSheetWithoutHeight( + hasBottomPadding: false, + padding: EdgeInsets.only(top: 24.h), + context, + title: 'Select Services'.needTranslation, + isCloseButtonVisible: true, + isDismissible: true, + callBackFunc: () {}, + child: services.isEmpty + ? Center( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Text( + 'No services available'.needTranslation, + style: TextStyle( + fontSize: 16.h, + color: AppColors.greyTextColor, + ), ), ), - ], + ) + : Consumer( + builder: (context, hmgServicesViewModel, child) { + final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); + final hasSelectedServices = pendingOrder == null && hmgServicesViewModel.selectedHhcServices.isNotEmpty; - SizedBox(height: 16.h), - Text( - 'Select Services'.needTranslation, - style: TextStyle( - fontSize: 20.h, - fontWeight: FontWeight.w700, - color: AppColors.blackColor, - letterSpacing: -0.8, - ), - ).paddingOnly(left: 16.w, right: 16.w), - SizedBox(height: 12.h), - ListView.builder( - padding: EdgeInsets.symmetric(horizontal: 16.w), - itemCount: services.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - final service = services[index]; - final isSelected = viewModel.isHhcServiceSelected(service); - final isArabic = getIt.get().isArabic(); - final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); + return Stack( + children: [ + // Services List + ConstrainedBox( + constraints: BoxConstraints(maxHeight: SizeUtils.height * 0.7), + child: ListView.separated( + separatorBuilder: (context, index) => Divider(color: AppColors.dividerColor).paddingSymmetrical(16.w, 0), + padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: hasSelectedServices ? 160.h : 8.h), + shrinkWrap: true, + itemCount: services.length, + itemBuilder: (context, index) { + final service = services[index]; + final isSelected = hmgServicesViewModel.isHhcServiceSelected(service); + final isArabic = getIt.get().isArabic(); + final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); - return AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - margin: EdgeInsets.only(bottom: 12.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 16.r, - hasShadow: true, - ), - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () => viewModel.toggleHhcServiceSelection(service), - borderRadius: BorderRadius.circular(16.r), - child: Container( - padding: EdgeInsets.all(16.w), - child: Row( - children: [ - Checkbox( - value: isSelected, - onChanged: (v) => viewModel.toggleHhcServiceSelection(service), - activeColor: AppColors.primaryRedColor, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - visualDensity: VisualDensity.compact, + return AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + child: InkWell( + onTap: () => hmgServicesViewModel.toggleHhcServiceSelection(service), + borderRadius: BorderRadius.circular(16.r), + child: Container( + padding: EdgeInsets.all(8.w), + child: Row( + children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + width: 24.w, + height: 24.w, + decoration: BoxDecoration( + color: isSelected ? AppColors.primaryRedColor : Colors.transparent, + borderRadius: BorderRadius.circular(5.r), + border: Border.all( + color: isSelected ? AppColors.primaryRedColor : AppColors.borderGrayColor, + width: 1.w, + ), + ), + child: isSelected ? Icon(Icons.check, size: 18.f, color: AppColors.whiteColor) : null, + ), + SizedBox(width: 12.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + serviceName.toText16( + weight: FontWeight.w500, + color: AppColors.blackColor, + maxlines: 2, + ), + ], + ), + ), + ], + ), + ), ), - SizedBox(width: 12.w), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ); + }, + ), + ), + + if (hasSelectedServices) + Positioned( + left: 0, + right: 0, + bottom: 0, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 24.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - serviceName.toText16( - weight: FontWeight.w400, - color: AppColors.blackColor, - maxlines: 2, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Selected Services".needTranslation.toText12( + color: AppColors.textColorLight, + fontWeight: FontWeight.w600, + ), + "${hmgServicesViewModel.selectedHhcServices.length} service(s) selected".toText14( + isBold: true, + weight: FontWeight.bold, + ), + ], ), ], ), - ), - ], + SizedBox(height: 16.h), + CustomButton( + borderWidth: 0, + text: "Next".needTranslation, + onPressed: () { + Navigator.pop(context); + _proceedWithSelectedService(); + }, + textColor: AppColors.whiteColor, + borderRadius: 12.r, + borderColor: Colors.transparent, + ), + ], + ), ), ), - ), - ), + ], ); }, ), - // Summary Section - ], - ); - }, ); } - void _proceedWithSelectedService() { + void _proceedWithSelectedService() async { + final navigationServices = getIt.get(); + final appState = getIt.get(); final hmgServicesViewModel = context.read(); if (hmgServicesViewModel.selectedHhcServices.isNotEmpty) { hmgServicesViewModel.setSelectedServiceForHhcOrder(hmgServicesViewModel.selectedHhcServices.first); - Navigator.of(context).pushReplacement( + + bool result = await navigationServices.push( + CustomPageRoute( + page: MapUtilityScreen( + confirmButtonString: "Submit Request ".needTranslation, + titleString: "Select Location", + subTitleString: "Please select the location".needTranslation, + isGmsAvailable: appState.isGMSAvailable, + ), + direction: AxisDirection.down), + ); + + if (!result) { + return; + } + + Navigator.of(context).push( CustomPageRoute( page: HhcSelectionReviewPage(selectedServices: hmgServicesViewModel.selectedHhcServices), direction: AxisDirection.left, @@ -369,45 +444,64 @@ class _HhcProceduresPageState extends State { @override Widget build(BuildContext context) { - return CollapsingListView( - title: "Home Health Care".needTranslation, - history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)), - bottomChild: Consumer( - builder: (context, hmgServicesViewModel, child) { - if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) return SizedBox.shrink(); - final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); - if (pendingOrder == null && hmgServicesViewModel.selectedHhcServices.isNotEmpty) { - return SafeArea( - top: false, - child: Padding( - padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h), - child: CustomButton( - borderWidth: 0, - text: "Next".needTranslation, - onPressed: _proceedWithSelectedService, - textColor: AppColors.whiteColor, - borderRadius: 12.r, - borderColor: Colors.transparent, - padding: EdgeInsets.symmetric(vertical: 14.h), + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "Home Health Care".needTranslation, + history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)), + bottomChild: Consumer( + builder: (BuildContext context, HmgServicesViewModel hmgServicesViewModel, Widget? child) { + if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) { + return SizedBox.shrink(); + } + final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); + if (pendingOrder == null) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, ), - ), - ); - } - return SizedBox.shrink(); - }, - ), - child: Consumer( - builder: (context, hmgServicesViewModel, child) { - if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) { - return _buildLoadingShimmer(); - } - final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); - if (pendingOrder != null) { - return _buildPendingOrderCard(pendingOrder); - } else { - return _buildServiceSelectionList(hmgServicesViewModel.hhcServicesList); - } - }, + child: Padding( + padding: EdgeInsets.all(24.w), + child: CustomButton( + borderWidth: 0, + text: "Create new request".needTranslation, + onPressed: () => _buildServicesListBottomsSheet(hmgServicesViewModel.hhcServicesList), + textColor: AppColors.whiteColor, + borderRadius: 12.r, + borderColor: Colors.transparent, + padding: EdgeInsets.symmetric(vertical: 14.h), + ), + ), + ); + } + + return SizedBox.shrink(); + }, + ), + child: Consumer( + builder: (context, hmgServicesViewModel, child) { + if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) { + return _buildLoadingShimmer(); + } + final pendingOrder = _getPendingOrder(hmgServicesViewModel.hhcOrdersList); + if (pendingOrder != null) { + return _buildPendingOrderCard(pendingOrder); + } else { + return Column( + children: [ + Center( + child: Utils.getNoDataWidget( + context, + noDataText: "You have no pending requests.".needTranslation, + ), + ), + ], + ); + } + }, + ), ), ); } diff --git a/lib/presentation/home_health_care/hhc_selection_review_page.dart b/lib/presentation/home_health_care/hhc_selection_review_page.dart index 7baeec0..37410e2 100644 --- a/lib/presentation/home_health_care/hhc_selection_review_page.dart +++ b/lib/presentation/home_health_care/hhc_selection_review_page.dart @@ -10,13 +10,15 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; +import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -57,6 +59,8 @@ class _HhcSelectionReviewPageState extends State { children: [ _buildSelectedServicesCard(isArabic), SizedBox(height: 16.h), + _buildLocationMap(), + SizedBox(height: 16.h), ], ), ), @@ -65,84 +69,82 @@ class _HhcSelectionReviewPageState extends State { Widget _buildSelectedServicesCard(bool isArabic) { return Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 16.r, - ), + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), padding: EdgeInsets.all(16.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ "Selected Services".needTranslation.toText14( weight: FontWeight.w600, - color: AppColors.greyTextColor, + color: AppColors.textColor, letterSpacing: -0.4, ), SizedBox(height: 12.h), - ...widget.selectedServices.map((service) { - final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); - final price = service.priceTotal ?? 0.0; - return Padding( - padding: EdgeInsets.only(bottom: 4.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: serviceName.toText14( - weight: FontWeight.w600, - color: AppColors.blackColor, - letterSpacing: -0.5, - maxlines: 2, - ), - ), - ], - ), - ); - }), + Wrap( + spacing: 8.w, + runSpacing: 12.w, + children: widget.selectedServices.map((service) { + final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); + return AppCustomChipWidget(labelText: serviceName.needTranslation); + }).toList(), + ), ], ), ); } + Widget _buildLocationMap() { + final locationViewModel = getIt.get(); + final geocodeResponse = locationViewModel.geocodeResponse; + final mapCapturedLocation = locationViewModel.mapCapturedLocation; + + // Check if we have location data + if (mapCapturedLocation == null || (mapCapturedLocation.lat == 0.0 && mapCapturedLocation.lng == 0.0)) { + return SizedBox.shrink(); + } + + final double lat = mapCapturedLocation?.lat ?? 0.0; + final double lng = mapCapturedLocation?.lng ?? 0.0; + + if (lat == 0.0 || lng == 0.0) return SizedBox.shrink(); + + // Get address from geocode response + String address = "Selected Location".needTranslation; + if (geocodeResponse != null && geocodeResponse.results.isNotEmpty) { + address = geocodeResponse.results.first.formattedAddress; + } + + return LocationMapWidget( + latitude: lat, + longitude: lng, + address: address, + onDirectionsTap: () => _launchDirectionsToLocation(lat, lng, address), + ); + } + Widget _buildBottomButton() { - return SafeArea( - top: false, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), - decoration: BoxDecoration( - color: AppColors.whiteColor, - boxShadow: [ - BoxShadow( - color: Color.fromARGB(13, 0, 0, 0), - blurRadius: 8, - offset: Offset(0, -2), - ), - ], - ), - child: CustomButton( - text: "Confirm".needTranslation, - onPressed: _handleConfirm, - textColor: AppColors.whiteColor, - backgroundColor: AppColors.successColor, - borderRadius: 12.r, - borderColor: Colors.transparent, - borderWidth: 0, - padding: EdgeInsets.symmetric(vertical: 14.h), - ), + return Container( + padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 24.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: CustomButton( + borderWidth: 0, + text: "Confirm".needTranslation, + onPressed: () => _handleConfirm(), + textColor: AppColors.whiteColor, + borderRadius: 12.r, + borderColor: Colors.transparent, ), ); } - void _launchDirections(HospitalsModel selectedHospital) { - final double lat = double.parse(selectedHospital.latitude ?? "0.0"); - final double lng = double.parse(selectedHospital.longitude ?? "0.0"); - + void _launchDirectionsToLocation(double lat, double lng, String locationName) { if (lat != 0.0 && lng != 0.0) { - MapsLauncher.launchCoordinates( - lat, - lng, - selectedHospital.name ?? "Hospital", - ); + MapsLauncher.launchCoordinates(lat, lng, locationName); } } diff --git a/lib/presentation/insurance/insurance_approval_details_page.dart b/lib/presentation/insurance/insurance_approval_details_page.dart index 150b15c..415d66f 100644 --- a/lib/presentation/insurance/insurance_approval_details_page.dart +++ b/lib/presentation/insurance/insurance_approval_details_page.dart @@ -146,7 +146,7 @@ class InsuranceApprovalDetailsPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ "${LocaleKeys.usageStatus.tr(context: context)}: ".toText14(isBold: true), - insuranceApprovalResponseModel.apporvalDetails!.isInvoicedDesc!.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + (insuranceApprovalResponseModel.apporvalDetails!.isInvoicedDesc ?? "").toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), ], ), ], diff --git a/lib/presentation/insurance/insurance_home_page.dart b/lib/presentation/insurance/insurance_home_page.dart index cdd9a2e..b005e42 100644 --- a/lib/presentation/insurance/insurance_home_page.dart +++ b/lib/presentation/insurance/insurance_home_page.dart @@ -15,12 +15,10 @@ import 'package:hmg_patient_app_new/presentation/insurance/widgets/insurance_upd import 'package:hmg_patient_app_new/presentation/insurance/widgets/patient_insurance_card.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; -import 'package:hmg_patient_app_new/widgets/shimmer/common_shimmer_widget.dart'; import 'package:provider/provider.dart'; import 'widgets/insurance_history.dart'; @@ -74,7 +72,7 @@ class _InsuranceHomePageState extends State { padding: EdgeInsets.only(top: 24.h), child: PatientInsuranceCard( insuranceCardDetailsModel: insuranceVM.patientInsuranceList.first, - isInsuranceExpired: DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo))), + isInsuranceExpired: DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo))).paddingSymmetrical(24.w, 0.h), ) : Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.12), diff --git a/lib/presentation/insurance/widgets/insurance_approval_card.dart b/lib/presentation/insurance/widgets/insurance_approval_card.dart index bea2e56..ee31538 100644 --- a/lib/presentation/insurance/widgets/insurance_approval_card.dart +++ b/lib/presentation/insurance/widgets/insurance_approval_card.dart @@ -8,11 +8,8 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_approval_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/utils/appointment_type.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; class InsuranceApprovalCard extends StatelessWidget { diff --git a/lib/presentation/insurance/widgets/insurance_history.dart b/lib/presentation/insurance/widgets/insurance_history.dart index 3e6ee86..341e234 100644 --- a/lib/presentation/insurance/widgets/insurance_history.dart +++ b/lib/presentation/insurance/widgets/insurance_history.dart @@ -12,7 +12,6 @@ import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:hmg_patient_app_new/widgets/shimmer/common_shimmer_widget.dart'; import 'package:provider/provider.dart'; class InsuranceHistory extends StatelessWidget { diff --git a/lib/presentation/insurance/widgets/insurance_update_details_card.dart b/lib/presentation/insurance/widgets/insurance_update_details_card.dart index 753a36c..c3bbcd7 100644 --- a/lib/presentation/insurance/widgets/insurance_update_details_card.dart +++ b/lib/presentation/insurance/widgets/insurance_update_details_card.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; -import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -12,7 +11,6 @@ import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:hmg_patient_app_new/widgets/shimmer/common_shimmer_widget.dart'; import 'package:provider/provider.dart'; class PatientInsuranceCardUpdateCard extends StatelessWidget { diff --git a/lib/presentation/insurance/widgets/patient_insurance_card.dart b/lib/presentation/insurance/widgets/patient_insurance_card.dart index 3d774d3..fde5811 100644 --- a/lib/presentation/insurance/widgets/patient_insurance_card.dart +++ b/lib/presentation/insurance/widgets/patient_insurance_card.dart @@ -48,8 +48,9 @@ class PatientInsuranceCard extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true), - "Policy: ${insuranceCardDetailsModel.insurancePolicyNo}".toText12(isBold: true, color: AppColors.lightGrayColor), + SizedBox( + width: MediaQuery.of(context).size.width * 0.45, child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true)), + "Policy: ${insuranceCardDetailsModel.insurancePolicyNo}".needTranslation.toText12(isBold: true, color: AppColors.lightGrayColor), ], ), AppCustomChipWidget( diff --git a/lib/presentation/lab/alphabeticScroll.dart b/lib/presentation/lab/alphabeticScroll.dart index e610d71..29ded69 100644 --- a/lib/presentation/lab/alphabeticScroll.dart +++ b/lib/presentation/lab/alphabeticScroll.dart @@ -5,7 +5,6 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart' import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; -import 'package:hmg_patient_app_new/core/utils/debouncer.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; @@ -121,9 +120,7 @@ class _AlphabetScrollPageState extends State { @override Widget build(BuildContext context) { - return - - SizedBox( + return SizedBox( width: MediaQuery.sizeOf(context).width, child: Row( crossAxisAlignment: CrossAxisAlignment.start, // Add this diff --git a/lib/presentation/lab/lab_order_by_test.dart b/lib/presentation/lab/lab_order_by_test.dart index bd56df6..837f482 100644 --- a/lib/presentation/lab/lab_order_by_test.dart +++ b/lib/presentation/lab/lab_order_by_test.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; -import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; @@ -12,7 +11,6 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; class LabOrderByTest extends StatelessWidget { final VoidCallback onTap; diff --git a/lib/presentation/lab/lab_orders_page.dart b/lib/presentation/lab/lab_orders_page.dart index a868d59..90651f1 100644 --- a/lib/presentation/lab/lab_orders_page.dart +++ b/lib/presentation/lab/lab_orders_page.dart @@ -1 +1 @@ -import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_order_by_test.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import '../../widgets/appbar/collapsing_list_view.dart'; import 'alphabeticScroll.dart'; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingToolbar( title: LocaleKeys.labResults.tr(), search: () async { final lavVM = Provider.of(context, listen: false); if (lavVM.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: lavVM.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; lavVM.filterLabReports(value); } } }, child: SingleChildScrollView( padding: EdgeInsets.all(24.h), physics: NeverScrollableScrollPhysics(), child: Consumer( builder: (context, model, child) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, "By Visit".needTranslation), CustomTabBarModel(null, "By Test".needTranslation), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? CustomChipWidget( chipText: selectedFilterText!, chipType: ChipTypeEnum.alert, isSelected: true, ) : SizedBox(), activeIndex == 0 ? ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: model.isLabOrdersLoading ? 5 : model.patientLabOrders.isNotEmpty ? model.patientLabOrders.length : 1, itemBuilder: (context, index) { final isExpanded = expandedIndex == index; return model.isLabOrdersLoading ? LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ) : model.patientLabOrders.isNotEmpty ? AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: LabResultItemView( onTap: () { model.currentlySelectedPatientOrder = model.patientLabOrders[ index]; labProvider.getPatientLabResultByHospital(model.patientLabOrders[ index]); labProvider .getPatientSpecialResult( model.patientLabOrders[ index]); Navigator.push( context, CustomPageRoute( page: LabResultByClinic(labOrder: model.patientLabOrders[index]), )); }, labOrder: model.patientLabOrders[index], index: index, isExpanded: isExpanded), ), ), ) : Utils.getNoDataWidget(context, noDataText: "You don't have any lab results yet.".needTranslation); }, ) // : ListView.builder( // shrinkWrap: true, // physics: NeverScrollableScrollPhysics(), // padding: EdgeInsets.zero, // itemCount: model.isLabOrdersLoading // ? 5 // : model.uniqueTests.toList().isNotEmpty // ? model.uniqueTests.toList().length // : 1, // itemBuilder: (context, index) { // final isExpanded = expandedIndex == index; // return model.isLabOrdersLoading // ? LabResultItemView( // onTap: () {}, // labOrder: null, // index: index, // isLoading: true, // ) // : model.uniqueTests.toList().isNotEmpty // ? AnimationConfiguration.staggeredList( // position: index, // duration: const Duration(milliseconds: 500), // child: SlideAnimation( // verticalOffset: 100.0, // child: FadeInAnimation( // child: LabOrderByTest( // appState: _appState, // onTap: () { // if (model.uniqueTests.toList()[index].model != null) { // rangeViewModel.flush(); // model.getPatientLabResult(model.uniqueTests.toList()[index].model!, model.uniqueTests.toList()[index].description!, // (_appState.isArabic() ? model.uniqueTests.toList()[index].testDescriptionAr! : model.uniqueTests.toList()[index].testDescriptionEn!)); // } // }, // tests: model.uniqueTests.toList()[index], // index: index, // isExpanded: isExpanded)), // ), // ) // : Utils.getNoDataWidget(context, noDataText: "You don't have any lab results yet.".needTranslation); // }, // ) : (model.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) :AlphabeticScroll( alpahbetsAvailable: model.indexedCharacterForUniqueTest, details: model.uniqueTestsList, labViewModel: model, rangeViewModel: rangeViewModel, appState: _appState, ) ], ); }, ), ), )); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file +import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'alphabeticScroll.dart'; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return CollapsingToolbar( title: LocaleKeys.labResults.tr(), search: () async { final lavVM = Provider.of(context, listen: false); if (lavVM.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: lavVM.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; lavVM.filterLabReports(value); } } }, child: Consumer( builder: (context, model, child) { return SingleChildScrollView( physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.all(24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, "By Visit".needTranslation), CustomTabBarModel(null, "By Test".needTranslation), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), ), ], ), if (activeIndex == 0) Padding( padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( children: [ CustomButton( text: LocaleKeys.byClinic.tr(context: context), onPressed: () { model.setIsSortByClinic(true); }, backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), SizedBox(width: 8.h), CustomButton( text: LocaleKeys.byHospital.tr(context: context), onPressed: () { model.setIsSortByClinic(false); }, backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ], ), ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? CustomChipWidget( chipText: selectedFilterText!, chipType: ChipTypeEnum.alert, isSelected: true, ) : SizedBox(), activeIndex == 0 ? // By Visit - show grouped view when available model.isLabOrdersLoading ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: 5, itemBuilder: (context, index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ), ) : (model.patientLabOrdersViewList.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: model.patientLabOrdersViewList.length, itemBuilder: (context, index) { final group = model.patientLabOrdersViewList[index]; final isExpanded = expandedIndex == index; return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder() .toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget(labelText: "${group.length} ${'results'.needTranslation}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), SizedBox(height: 8.h), Text( model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'), style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis, ), ], ), ), AnimatedSwitcher( duration: Duration(milliseconds: 500), switchInCurve: Curves.easeIn, switchOutCurve: Curves.easeOut, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0.0, child: child, ), ); }, child: isExpanded ? Container( key: ValueKey(index), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ...group.map((order) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ Image.network( order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 24.w, height: 24.h, fit: BoxFit.cover, ).circle(100), SizedBox(width: 8.h), Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ AppCustomChipWidget( labelText: ("Order No: ".needTranslation + order.orderNo!), ), AppCustomChipWidget( labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), ), AppCustomChipWidget( labelText: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), ), ], ), // Row( // children: [ // CustomButton( // text: ("Order No: ".needTranslation + order.orderNo!), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // SizedBox(width: 8.h), // CustomButton( // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), // SizedBox(height: 8.h), // Row( // children: [ // CustomButton( // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), SizedBox(height: 12.h), Row( children: [ Expanded(flex: 2, child: SizedBox()), // Expanded( // flex: 1, // child: Container( // height: 40.h, // width: 40.w, // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // color: AppColors.textColor, // borderRadius: 12, // ), // child: Padding( // padding: EdgeInsets.all(12.h), // child: Transform.flip( // flipX: _appState.isArabic(), // child: Utils.buildSvgWithAssets( // icon: AppAssets.forward_arrow_icon_small, // iconColor: AppColors.whiteColor, // fit: BoxFit.contain, // ), // ), // ), // ).onPress(() { // model.currentlySelectedPatientOrder = order; // labProvider.getPatientLabResultByHospital(order); // labProvider.getPatientSpecialResult(order); // Navigator.of(context).push( // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // ); // }), // ) Expanded( flex:2, child: CustomButton( icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, text: "View Results".needTranslation, onPressed: () { model.currentlySelectedPatientOrder = order; labProvider.getPatientLabResultByHospital(order); labProvider.getPatientSpecialResult(order); Navigator.of(context).push( CustomPageRoute(page: LabResultByClinic(labOrder: order)), ); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ) ], ), SizedBox(height: 12.h), Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), SizedBox(height: 12.h), ], ); }).toList(), ], ), ) : SizedBox.shrink(), ), ], ), ), ), ), )); }, ) : Utils.getNoDataWidget(context, noDataText: "You don't have any lab results yet.".needTranslation)) : // By Test or other tabs keep existing behavior (model.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) : AlphabeticScroll( alpahbetsAvailable: model.indexedCharacterForUniqueTest, details: model.uniqueTestsList, labViewModel: model, rangeViewModel: rangeViewModel, appState: _appState, ) ], ) ); }, ), ); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file diff --git a/lib/presentation/lab/lab_result_item_view.dart b/lib/presentation/lab/lab_result_item_view.dart index 9269c6d..db80918 100644 --- a/lib/presentation/lab/lab_result_item_view.dart +++ b/lib/presentation/lab/lab_result_item_view.dart @@ -9,7 +9,6 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; class LabResultItemView extends StatelessWidget { diff --git a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart index a603ecb..ad4a032 100644 --- a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart +++ b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension; import 'package:flutter/material.dart'; -import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; diff --git a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart index bc1d6b1..c6841b3 100644 --- a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart +++ b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart @@ -2,19 +2,14 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; -import 'package:hmg_patient_app_new/core/enums.dart'; -import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart' show LabViewModel; import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart'; -import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; -import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:provider/provider.dart'; class LabOrderResultItem extends StatelessWidget { diff --git a/lib/presentation/lab/lab_results/lab_result_list_item.dart b/lib/presentation/lab/lab_results/lab_result_list_item.dart index f90df7b..6ccf750 100644 --- a/lib/presentation/lab/lab_results/lab_result_list_item.dart +++ b/lib/presentation/lab/lab_results/lab_result_list_item.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart' ; -import 'package:flutter/src/widgets/framework.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/presentation/lab/search_lab_report.dart b/lib/presentation/lab/search_lab_report.dart index f1fd389..bf27b91 100644 --- a/lib/presentation/lab/search_lab_report.dart +++ b/lib/presentation/lab/search_lab_report.dart @@ -8,7 +8,6 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; -import 'package:sizer/sizer.dart'; class SearchLabResultsContent extends StatefulWidget { final List labSuggestionsList; diff --git a/lib/presentation/medical_file/eye_measurement_details_page.dart b/lib/presentation/medical_file/eye_measurement_details_page.dart index e69766a..0662cb1 100644 --- a/lib/presentation/medical_file/eye_measurement_details_page.dart +++ b/lib/presentation/medical_file/eye_measurement_details_page.dart @@ -7,7 +7,6 @@ import 'package:hmg_patient_app_new/features/book_appointments/book_appointments 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/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/main.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index 5cfbcb9..c9603b5 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -27,6 +27,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/allergies/allergies_list_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_doctors_page.dart'; +import 'package:hmg_patient_app_new/presentation/appointments/widgets/ask_doctor_request_type_select.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_profile_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; @@ -54,7 +55,6 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; -import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/expandable_list_widget.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; @@ -130,10 +130,9 @@ class _MedicalFilePageState extends State { fit: BoxFit.contain, ), Utils.buildImgWithAssets( - icon: AppAssets.male_img, - height: 28.h, - width: 28.w, - border: 1, + icon: AppAssets.maleImg, + height: 32.h, + border: 1.5, borderRadius: 50.r, fit: BoxFit.contain, ), @@ -176,13 +175,16 @@ class _MedicalFilePageState extends State { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.w, height: 56.h), + Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h), SizedBox(width: 8.w), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" - .toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), + SizedBox( + width: MediaQuery.of(context).size.width * 0.6, + child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" + .toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 2), + ), SizedBox(height: 4.h), Wrap( direction: Axis.horizontal, @@ -192,20 +194,21 @@ class _MedicalFilePageState extends State { AppCustomChipWidget( icon: AppAssets.file_icon, labelText: "${LocaleKeys.fileno.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}", - labelPadding: EdgeInsetsDirectional.only(end: 6.w), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), onChipTap: () { navigationService.pushPage( page: FamilyMedicalScreen( profiles: medicalFileViewModel.patientFamilyFiles, onSelect: (FamilyFileResponseModelLists p1) {}, - )); + ), + ); }, ), AppCustomChipWidget( icon: AppAssets.checkmark_icon, labelText: LocaleKeys.verified.tr(context: context), iconColor: AppColors.successColor, - labelPadding: EdgeInsetsDirectional.only(end: 6.w), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), ), ], ), @@ -227,9 +230,9 @@ class _MedicalFilePageState extends State { ), AppCustomChipWidget( icon: AppAssets.blood_icon, - labelText: "Blood: ${appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup.isEmpty}", + labelText: "Blood: ${appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup}", iconColor: AppColors.primaryRedColor, - labelPadding: EdgeInsetsDirectional.only(end: 4.w), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), padding: EdgeInsets.zero, ), Consumer(builder: (context, insuranceVM, child) { @@ -240,7 +243,7 @@ class _MedicalFilePageState extends State { textColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 12.w, backgroundColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.successColor.withOpacity(0.1), - labelPadding: EdgeInsetsDirectional.only(end: 8.w), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), ); }), ], @@ -299,9 +302,8 @@ class _MedicalFilePageState extends State { title: "Tracker & Others".toText18(weight: FontWeight.w600), expandedBackgroundColor: Colors.transparent, children: [ - Text("Blood Report"), - SizedBox(height: 8), - Text("X-Ray Report"), + SizedBox(height: 10.h), + getSelectedTabData(3), ], ), ], @@ -443,7 +445,7 @@ class _MedicalFilePageState extends State { ? Container( padding: EdgeInsets.all(12.w), width: MediaQuery.of(context).size.width, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r, hasShadow: true), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r, hasShadow: false), child: Column( children: [ Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), @@ -453,6 +455,7 @@ class _MedicalFilePageState extends State { CustomButton( text: LocaleKeys.bookAppo.tr(context: context), onPressed: () { + getIt.get().onTabChanged(0); Navigator.of(context).push( CustomPageRoute( page: BookAppointmentPage(), @@ -493,8 +496,36 @@ class _MedicalFilePageState extends State { onRescheduleTap: () { openDoctorScheduleCalendar(myAppointmentsVM.patientAppointmentsHistoryList[index]); }, - onAskDoctorTap: () {}, - )), + onAskDoctorTap: () async { + LoaderBottomSheet.showLoader(loadingText: "Checking doctor availability...".needTranslation); + await myAppointmentsViewModel.isDoctorAvailable( + projectID: myAppointmentsVM.patientAppointmentsHistoryList[index].projectID, + doctorId: myAppointmentsVM.patientAppointmentsHistoryList[index].doctorID, + clinicId: myAppointmentsVM.patientAppointmentsHistoryList[index].clinicID, + onSuccess: (value) async { + if (value) { + await myAppointmentsViewModel.getAskDoctorRequestTypes(onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + title: LocaleKeys.askDoctor.tr(context: context), + child: AskDoctorRequestTypeSelect( + askDoctorRequestTypeList: myAppointmentsViewModel.askDoctorRequestTypeList, + myAppointmentsViewModel: myAppointmentsViewModel, + patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList[index], + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + } else { + print("Doctor is not available"); + } + }); + }, + ), + ), ), ), ); @@ -811,7 +842,7 @@ class _MedicalFilePageState extends State { GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, - crossAxisSpacing: 16.h, + crossAxisSpacing: 10.h, mainAxisSpacing: 16.w, mainAxisExtent: 115.h, ), @@ -928,7 +959,7 @@ class _MedicalFilePageState extends State { GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, - crossAxisSpacing: 16.h, + crossAxisSpacing: 10.h, mainAxisSpacing: 16.w, mainAxisExtent: 120.h, ), @@ -940,7 +971,7 @@ class _MedicalFilePageState extends State { label: "Update Insurance".needTranslation, textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.eye_result_icon, + svgIcon: AppAssets.update_insurance_icon, isLargeText: true, iconSize: 36.w, ).onPress(() { @@ -950,7 +981,7 @@ class _MedicalFilePageState extends State { label: "${LocaleKeys.insurance.tr(context: context)} ${LocaleKeys.approvals.tr(context: context)}", textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.eye_result_icon, + svgIcon: AppAssets.insurance_approval_icon, isLargeText: true, iconSize: 36.w, ).onPress(() { @@ -964,7 +995,7 @@ class _MedicalFilePageState extends State { label: "My Invoices List".needTranslation, textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.eye_result_icon, + svgIcon: AppAssets.invoices_list_icon, isLargeText: true, iconSize: 36.w, ), @@ -972,7 +1003,7 @@ class _MedicalFilePageState extends State { label: "Ancillary Orders List".needTranslation, textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.eye_result_icon, + svgIcon: AppAssets.ancillary_orders_list_icon, isLargeText: true, iconSize: 36.w, ), @@ -1015,7 +1046,7 @@ class _MedicalFilePageState extends State { GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, - crossAxisSpacing: 16.h, + crossAxisSpacing: 10.h, mainAxisSpacing: 16.w, mainAxisExtent: 110.h, ), @@ -1027,7 +1058,7 @@ class _MedicalFilePageState extends State { label: LocaleKeys.monthlyReports.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.eye_result_icon, + svgIcon: AppAssets.monthly_reports_icon, isLargeText: true, iconSize: 36.h, ), @@ -1035,7 +1066,7 @@ class _MedicalFilePageState extends State { label: "Medical Reports".needTranslation, textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.allergy_info_icon, + svgIcon: AppAssets.medical_reports_icon, isLargeText: true, iconSize: 36.h, ).onPress(() { @@ -1051,7 +1082,7 @@ class _MedicalFilePageState extends State { label: "Sick Leave Report".needTranslation, textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.vaccine_info_icon, + svgIcon: AppAssets.sick_leave_report_icon, isLargeText: true, iconSize: 36.h, ).onPress(() { @@ -1067,7 +1098,92 @@ class _MedicalFilePageState extends State { ], ); case 3: - return Container(); + // Trackers Tab Data + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Health Trackers".needTranslation.toText16(weight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(height: 16.h), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10.h, + mainAxisSpacing: 16.w, + mainAxisExtent: 115.h, + ), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + shrinkWrap: true, + children: [ + MedicalFileCard( + label: "Blood Sugar".needTranslation, + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.blood_sugar_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() {}), + MedicalFileCard( + label: "Blood Pressure".needTranslation, + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.lab_result_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() {}), + MedicalFileCard( + label: "Weight Tracker".needTranslation, + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.weight_tracker_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() {}), + ], + ).paddingSymmetrical(0.w, 0.0), + SizedBox(height: 16.h), + Row( + children: [ + "Others".needTranslation.toText16(weight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(height: 16.h), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10.h, + mainAxisSpacing: 16.w, + mainAxisExtent: 115.h, + ), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + shrinkWrap: true, + children: [ + MedicalFileCard( + label: "Ask Your Doctor".needTranslation, + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.ask_doctor_medical_file_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() {}), + MedicalFileCard( + label: "Internet Pairing".needTranslation, + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.internet_pairing_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() {}), + ], + ).paddingSymmetrical(0.w, 0.0), + SizedBox(height: 24.h), + ], + ); default: return Container(); } diff --git a/lib/presentation/medical_file/patient_sickleaves_list_page.dart b/lib/presentation/medical_file/patient_sickleaves_list_page.dart index a28f518..ef5aaeb 100644 --- a/lib/presentation/medical_file/patient_sickleaves_list_page.dart +++ b/lib/presentation/medical_file/patient_sickleaves_list_page.dart @@ -3,6 +3,10 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -12,6 +16,9 @@ import 'package:hmg_patient_app_new/features/medical_file/models/patient_sicklea import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; import 'widgets/patient_sick_leave_card.dart'; @@ -24,6 +31,7 @@ class PatientSickleavesListPage extends StatefulWidget { } class _PatientSickleavesListPageState extends State { + int? expandedIndex; late MedicalFileViewModel medicalFileViewModel; @override @@ -37,51 +45,257 @@ class _PatientSickleavesListPageState extends State { @override Widget build(BuildContext context) { + AppState appState = getIt.get(); medicalFileViewModel = Provider.of(context, listen: false); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( title: "${LocaleKeys.sick.tr(context: context)} ${LocaleKeys.sickSubtitle.tr(context: context)}", child: SingleChildScrollView( - child: Consumer(builder: (context, medicalFileVM, child) { + child: Consumer(builder: (context, model, child) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ListView.separated( - scrollDirection: Axis.vertical, - itemCount: medicalFileVM.isPatientSickLeaveListLoading - ? 3 - : medicalFileVM.patientSickLeaveList.isNotEmpty - ? medicalFileVM.patientSickLeaveList.length + SizedBox(height: 16.h), + // Clinic & Hospital Sort + Row( + children: [ + CustomButton( + text: LocaleKeys.byClinic.tr(context: context), + onPressed: () { + model.setIsSickLeavesSortByClinic(true); + }, + backgroundColor: model.isSickLeavesSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + textColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.byHospital.tr(context: context), + onPressed: () { + model.setIsSickLeavesSortByClinic(false); + }, + backgroundColor: model.isSickLeavesSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + borderColor: model.isSickLeavesSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + textColor: model.isSickLeavesSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 20.h), + // Expandable list + ListView.builder( + itemCount: model.isPatientSickLeaveListLoading + ? 4 + : model.patientSickLeaveList.isNotEmpty + ? model.patientSickLeavesViewList.length : 1, - shrinkWrap: true, physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.only(left: 0, right: 8), itemBuilder: (context, index) { - return medicalFileVM.isPatientSickLeaveListLoading + final isExpanded = expandedIndex == index; + return model.isPatientSickLeaveListLoading ? PatientSickLeaveCard( patientSickLeavesResponseModel: PatientSickLeavesResponseModel(), isLoading: true, - ).paddingSymmetrical(24.h, 0.0) - : medicalFileVM.patientSickLeaveList.isNotEmpty + ).paddingSymmetrical(0.h, 12.h) + : model.patientSickLeaveList.isNotEmpty ? AnimationConfiguration.staggeredList( position: index, - duration: const Duration(milliseconds: 1000), + duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( - child: PatientSickLeaveCard( - patientSickLeavesResponseModel: medicalFileVM.patientSickLeaveList.first, - isLoading: false, - isSickLeaveListPage: true, - ).paddingSymmetrical(24.h, 0.0), + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + margin: EdgeInsets.symmetric(vertical: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), + child: InkWell( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${model.patientSickLeavesViewList[index].sickLeavesList!.length} ${LocaleKeys.sickSubtitle.tr(context: context)} Available", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + ], + ), + SizedBox(height: 8.h), + model.patientSickLeavesViewList[index].filterName!.toText16(isBold: true) + ], + ), + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeIn, + switchOutCurve: Curves.easeOut, + transitionBuilder: (Widget child, Animation animation) { + return FadeTransition( + opacity: animation, + child: SizeTransition( + sizeFactor: animation, + axisAlignment: 0.0, + child: child, + ), + ); + }, + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...model.patientSickLeavesViewList[index].sickLeavesList!.map((sickLeave) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + sickLeave.doctorImageURL!, + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: sickLeave.doctorName!.toText14(weight: FontWeight.w500)), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + CustomButton( + text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(sickLeave.appointmentDate), false), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: model.isSickLeavesSortByClinic ? sickLeave.projectName! : sickLeave.clinicName!, + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: "${sickLeave.sickLeaveDays} Days", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Expanded( + flex: 6, + child: CustomButton( + text: "Download Report".needTranslation, + onPressed: () async { + LoaderBottomSheet.showLoader(); + await medicalFileViewModel.getPatientSickLeavePDF(sickLeave, appState.getAuthenticatedUser()!).then((val) async { + LoaderBottomSheet.hideLoader(); + if (medicalFileViewModel.patientSickLeavePDFBase64.isNotEmpty) { + String path = await Utils.createFileFromString(medicalFileViewModel.patientSickLeavePDFBase64, "pdf"); + try { + OpenFilex.open(path); + } catch (ex) { + debugPrint("Error opening file: $ex"); + } + } + }); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 14, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + icon: AppAssets.download, + iconColor: AppColors.primaryRedColor, + iconSize: 14.h, + ), + ), + ], + ), + SizedBox(height: 12.h), + Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + SizedBox(height: 12.h), + ], + ); + }), + ], + ), + ) + : SizedBox.shrink(), + ), + ], + ), + ), + ), ), ), ) : Utils.getNoDataWidget(context, noDataText: "You don't have any sick leaves yet.".needTranslation); }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h), - ), - SizedBox(height: 60.h), + ).paddingSymmetrical(24.h, 0.h), ], ); }), diff --git a/lib/presentation/medical_file/widgets/lab_rad_card.dart b/lib/presentation/medical_file/widgets/lab_rad_card.dart index eef73eb..f31c90b 100644 --- a/lib/presentation/medical_file/widgets/lab_rad_card.dart +++ b/lib/presentation/medical_file/widgets/lab_rad_card.dart @@ -28,59 +28,24 @@ class LabRadCard extends StatelessWidget { AppState appState = getIt.get(); return Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 18.r, hasShadow: false), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Utils.buildSvgWithAssets( - icon: icon, - width: 40.w, - height: 40.h, - fit: BoxFit.cover, - ).toShimmer2(isShow: false, radius: 12.r), - SizedBox(width: 8.w), - Flexible( - child: labelText.toText12(isBold: true, maxLine: 2), - ), - Transform.flip( - flipX: appState.isArabic(), - child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon_small, width: 10.w, height: 10.h, fit: BoxFit.contain, iconColor: AppColors.textColor), - ), - ], + Utils.buildSvgWithAssets( + icon: icon, + width: 40.w, + height: 40.h, + fit: BoxFit.cover, + ).toShimmer2(isShow: false, radius: 12.r), + SizedBox(width: 8.w), + Flexible( + child: labelText.toText12(isBold: true, maxLine: 2), + ), + SizedBox(width: 12.w), + Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon_small, width: 10.w, height: 10.h, fit: BoxFit.contain, iconColor: AppColors.textColor), ), - // SizedBox(height: 16.h), - // labOrderTests.isNotEmpty - // ? ListView.separated( - // scrollDirection: Axis.vertical, - // padding: EdgeInsets.zero, - // physics: NeverScrollableScrollPhysics(), - // shrinkWrap: true, - // itemBuilder: (cxt, index) { - // return labOrderTests[index] - // .toText12(isBold: true, maxLine: 1) - // .toShimmer2(isShow: false, radius: 6.r, height: 24.h, width: 120.w) - // .toShimmer2(isShow: isLoading); - // }, - // separatorBuilder: (cxt, index) => SizedBox(height: 8.h), - // itemCount: 3, - // ) - // : "You don't have any records yet".needTranslation.toText13( - // color: AppColors.greyTextColor, isCenter: true), - // SizedBox(height: 16.h), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // SizedBox.shrink(), - // Transform.flip( - // flipX: appState.isArabic(), - // child: Utils.buildSvgWithAssets( - // icon: AppAssets.forward_arrow_icon_small, width: 15.w, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor) - // .toShimmer2(isShow: false, radius: 12.r), - // ), - // ], - // ) ], ).paddingAll(12.w), ); diff --git a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart index 1b09dd5..fbe79bb 100644 --- a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart @@ -173,7 +173,7 @@ class MedicalFileAppointmentCard extends StatelessWidget { backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, - fontSize: 14, + fontSize: 14.f, fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.symmetric(horizontal: 10.w), diff --git a/lib/presentation/medical_file/widgets/medical_file_card.dart b/lib/presentation/medical_file/widgets/medical_file_card.dart index 6343e2a..77968c5 100644 --- a/lib/presentation/medical_file/widgets/medical_file_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_card.dart @@ -28,7 +28,7 @@ class MedicalFileCard extends StatelessWidget { return Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: backgroundColor, - borderRadius: 12.r, + borderRadius: 20.r, hasShadow: false ), padding: EdgeInsets.all(12.w), diff --git a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart index a818ae5..6f9b8b5 100644 --- a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart +++ b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart @@ -18,7 +18,6 @@ import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; diff --git a/lib/presentation/medical_report/medical_reports_page.dart b/lib/presentation/medical_report/medical_reports_page.dart index 71abcb7..f6d7576 100644 --- a/lib/presentation/medical_report/medical_reports_page.dart +++ b/lib/presentation/medical_report/medical_reports_page.dart @@ -2,6 +2,9 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -10,14 +13,14 @@ import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_mode import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/medical_report/medical_report_request_page.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/presentation/medical_report/widgets/patient_medical_report_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; -import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; class MedicalReportsPage extends StatefulWidget { @@ -28,10 +31,12 @@ class MedicalReportsPage extends StatefulWidget { } class _MedicalReportsPageState extends State { + int? expandedIndex; late MedicalFileViewModel medicalFileViewModel; @override Widget build(BuildContext context) { + AppState appState = getIt.get(); medicalFileViewModel = Provider.of(context, listen: false); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, @@ -45,15 +50,53 @@ class _MedicalReportsPageState extends State { return Column( children: [ SizedBox(height: 16.h), + // Status filter tabs + // Row( + // children: [ + // CustomButton( + // text: LocaleKeys.byClinic.tr(context: context), + // onPressed: () { + // medicalFileVM.setIsMedicalReportsSortByClinic(true); + // }, + // backgroundColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + // borderColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + // textColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // SizedBox(width: 8.h), + // CustomButton( + // text: LocaleKeys.byHospital.tr(context: context), + // onPressed: () { + // medicalFileVM.setIsMedicalReportsSortByClinic(false); + // }, + // backgroundColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + // borderColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + // textColor: medicalFileVM.isMedicalReportsSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // ], + // ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 8.h), Row( children: [ CustomButton( text: "Requested".needTranslation, onPressed: () { + setState(() { + expandedIndex = null; + }); medicalFileViewModel.onMedicalReportTabChange(0); }, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: medicalFileVM.selectedMedicalReportsTabIndex == 0 ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, @@ -65,10 +108,13 @@ class _MedicalReportsPageState extends State { CustomButton( text: LocaleKeys.ready.tr(context: context), onPressed: () { + setState(() { + expandedIndex = null; + }); medicalFileViewModel.onMedicalReportTabChange(1); }, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: medicalFileVM.selectedMedicalReportsTabIndex == 1 ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, @@ -80,10 +126,13 @@ class _MedicalReportsPageState extends State { CustomButton( text: LocaleKeys.cancelled.tr(context: context), onPressed: () { + setState(() { + expandedIndex = null; + }); medicalFileViewModel.onMedicalReportTabChange(2); }, backgroundColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + borderColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: medicalFileVM.selectedMedicalReportsTabIndex == 2 ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, @@ -93,34 +142,27 @@ class _MedicalReportsPageState extends State { ), ], ).paddingSymmetrical(24.h, 0.h), - // CustomTabBar( - // activeTextColor: Color(0xffED1C2B), - // activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), - // tabs: [ - // CustomTabBarModel(null, "Requested".needTranslation), - // CustomTabBarModel(null, "Ready".needTranslation), - // CustomTabBarModel(null, "Cancelled".needTranslation), - // ], - // onTabChange: (index) { - // medicalFileViewModel.onMedicalReportTabChange(index); - // }, - // ).paddingSymmetrical(24.h, 0.h), - ListView.separated( - padding: EdgeInsets.only(top: 24.h), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + SizedBox(height: 12.h), + // Clinic & Hospital Sort + + // Expandable list + ListView.builder( itemCount: medicalFileViewModel.isPatientMedicalReportsListLoading - ? 3 + ? 4 : medicalFileViewModel.patientMedicalReportList.isNotEmpty - ? medicalFileViewModel.patientMedicalReportList.length + ? medicalFileViewModel.patientMedicalReportsViewList.length : 1, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.only(left: 0, right: 8), itemBuilder: (context, index) { + final isExpanded = expandedIndex == index; return medicalFileViewModel.isPatientMedicalReportsListLoading ? PatientMedicalReportCard( patientMedicalReportResponseModel: PatientMedicalReportResponseModel(), medicalFileViewModel: medicalFileVM, isLoading: true, - ).paddingSymmetrical(24.h, 0.h) + ).paddingSymmetrical(0.h, 8.h) : medicalFileViewModel.patientMedicalReportList.isNotEmpty ? AnimationConfiguration.staggeredList( position: index, @@ -131,20 +173,185 @@ class _MedicalReportsPageState extends State { child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), - child: PatientMedicalReportCard( - patientMedicalReportResponseModel: medicalFileVM.patientMedicalReportList[index], - medicalFileViewModel: medicalFileVM, - isLoading: false, + margin: EdgeInsets.symmetric(vertical: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), + child: InkWell( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${medicalFileVM.patientMedicalReportsViewList[index].medicalReportsList!.length} Reports Available", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + ], + ), + SizedBox(height: 8.h), + medicalFileVM.patientMedicalReportsViewList[index].filterName!.toText16(isBold: true) + ], + ), + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeIn, + switchOutCurve: Curves.easeOut, + transitionBuilder: (Widget child, Animation animation) { + return FadeTransition( + opacity: animation, + child: SizeTransition( + sizeFactor: animation, + axisAlignment: 0.0, + child: child, + ), + ); + }, + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...medicalFileVM.patientMedicalReportsViewList[index].medicalReportsList!.map((report) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + report.doctorImageURL!, + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: report.doctorName!.toText14(weight: FontWeight.w500)), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + CustomButton( + text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(report.appointmentDate), false), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: medicalFileVM.isMedicalReportsSortByClinic ? report.projectName! : report.clinicDescription!, + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: report.statusDesc!, + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + if (medicalFileVM.selectedMedicalReportsTabIndex == 1) + Expanded( + flex: 6, + child: CustomButton( + text: "Download Report".needTranslation, + onPressed: () async { + LoaderBottomSheet.showLoader(); + await medicalFileViewModel.getPatientMedicalReportPDF(report, appState.getAuthenticatedUser()!).then((val) async { + LoaderBottomSheet.hideLoader(); + if (medicalFileViewModel.patientMedicalReportPDFBase64.isNotEmpty) { + String path = await Utils.createFileFromString(medicalFileViewModel.patientMedicalReportPDFBase64, "pdf"); + try { + OpenFilex.open(path); + } catch (ex) { + debugPrint("Error opening file: $ex"); + } + } + }); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 14, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + icon: AppAssets.download, + iconColor: AppColors.primaryRedColor, + iconSize: 14.h, + ), + ), + ], + ), + SizedBox(height: 12.h), + Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + SizedBox(height: 12.h), + ], + ); + }), + ], + ), + ) + : SizedBox.shrink(), + ), + ], + ), ), - ).paddingSymmetrical(24.h, 0.h), + ), ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any medical reports yet.".needTranslation).paddingSymmetrical(24.h, 24.h); + : Utils.getNoDataWidget(context, noDataText: "You don't have any medical reports yet.".needTranslation) + .paddingSymmetrical(24.h, 24.h); }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), - ), + ).paddingSymmetrical(24.h, 0.h), SizedBox(height: 24.h), ], ); @@ -188,11 +395,10 @@ class _MedicalReportsPageState extends State { backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, textColor: AppColors.whiteColor, - fontSize: 16, + fontSize: 16.f, fontWeight: FontWeight.w500, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 45.h, + borderRadius: 12.r, + height: 46.h, icon: AppAssets.requests, iconColor: AppColors.whiteColor, iconSize: 20.h, @@ -218,7 +424,9 @@ class _MedicalReportsPageState extends State { LoaderBottomSheet.showLoader(); await medicalFileViewModel.insertRequestForMedicalReport(onSuccess: (val) { LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight(context, child: Utils.getSuccessWidget(loadingText: "Your medical report request has been successfully submitted.".needTranslation), callBackFunc: () { + showCommonBottomSheetWithoutHeight(context, + child: Utils.getSuccessWidget(loadingText: "Your medical report request has been successfully submitted.".needTranslation), + callBackFunc: () { medicalFileViewModel.setIsPatientMedicalReportsLoading(true); medicalFileViewModel.onMedicalReportTabChange(0); medicalFileViewModel.getPatientMedicalReportList(); diff --git a/lib/presentation/medical_report/widgets/patient_medical_report_card.dart b/lib/presentation/medical_report/widgets/patient_medical_report_card.dart index 1762886..413858d 100644 --- a/lib/presentation/medical_report/widgets/patient_medical_report_card.dart +++ b/lib/presentation/medical_report/widgets/patient_medical_report_card.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; @@ -10,7 +9,6 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; diff --git a/lib/presentation/my_family/my_family.dart b/lib/presentation/my_family/my_family.dart index 781624a..07f1a4f 100644 --- a/lib/presentation/my_family/my_family.dart +++ b/lib/presentation/my_family/my_family.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -7,10 +6,8 @@ import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; -import 'package:hmg_patient_app_new/core/utils/validation_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; @@ -19,10 +16,7 @@ import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; -import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; -import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dart'; -import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:provider/provider.dart'; class FamilyMedicalScreen extends StatefulWidget { diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 4db5470..3621cc3 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -173,9 +173,9 @@ class _FamilyCardsState extends State { children: [ Utils.buildImgWithAssets( icon: profile.gender == null - ? AppAssets.dummy_user + ? AppAssets.dummyUser : profile.gender == 1 - ? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.male_img) + ? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.maleImg) : (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg), width: 72.h, height: 70.h, diff --git a/lib/presentation/onboarding/splash_animation_screen.dart b/lib/presentation/onboarding/splash_animation_screen.dart index 7acd078..105922b 100644 --- a/lib/presentation/onboarding/splash_animation_screen.dart +++ b/lib/presentation/onboarding/splash_animation_screen.dart @@ -1,10 +1,8 @@ -import 'dart:async'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; diff --git a/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart b/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart index 9f2b2a2..e2ce865 100644 --- a/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart +++ b/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart @@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; -import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; diff --git a/lib/presentation/prescriptions/prescription_detail_page.dart b/lib/presentation/prescriptions/prescription_detail_page.dart index a38ff92..a6c6965 100644 --- a/lib/presentation/prescriptions/prescription_detail_page.dart +++ b/lib/presentation/prescriptions/prescription_detail_page.dart @@ -219,7 +219,15 @@ class _PrescriptionDetailPageState extends State { text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? LocaleKeys.resendOrder.tr(context: context) : LocaleKeys.prescriptionDeliveryError.tr(context: context), - onPressed: () {}, + onPressed: () async { + if (widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported!) { + LoaderBottomSheet.showLoader(loadingText: "Fetching prescription details...".needTranslation); + await prescriptionsViewModel.getPrescriptionDetails(widget.prescriptionsResponseModel, onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + prescriptionsViewModel.initiatePrescriptionDelivery(); + }); + } + }, backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color, borderColor: AppColors.successColor.withOpacity(0.01), textColor: diff --git a/lib/presentation/prescriptions/prescriptions_list_page.dart b/lib/presentation/prescriptions/prescriptions_list_page.dart index 3d631ce..2cf2fcc 100644 --- a/lib/presentation/prescriptions/prescriptions_list_page.dart +++ b/lib/presentation/prescriptions/prescriptions_list_page.dart @@ -6,7 +6,6 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; -import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; @@ -21,10 +20,7 @@ import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_deta import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; -import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:hmg_patient_app_new/widgets/shimmer/common_shimmer_widget.dart'; -import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; class PrescriptionsListPage extends StatefulWidget { @@ -130,125 +126,125 @@ class _PrescriptionsListPageState extends State { child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - margin: EdgeInsets.symmetric(vertical: 8.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), - child: InkWell( - onTap: () { - setState(() { - expandedIndex = isExpanded ? null : index; - }); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + margin: EdgeInsets.symmetric(vertical: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), + child: InkWell( + onTap: () { + setState(() { + expandedIndex = isExpanded ? null : index; + }); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - CustomButton( - text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available", - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 8, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 30.h, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + ], ), - Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + SizedBox(height: 8.h), + model.patientPrescriptionOrdersViewList[index].filterName!.toText16(isBold: true) ], ), - SizedBox(height: 8.h), - model.patientPrescriptionOrdersViewList[index].filterName!.toText16(isBold: true) - ], - ), - ), - AnimatedSwitcher( - duration: Duration(milliseconds: 500), - switchInCurve: Curves.easeIn, - switchOutCurve: Curves.easeOut, - transitionBuilder: (Widget child, Animation animation) { - return FadeTransition( - opacity: animation, - child: SizeTransition( - sizeFactor: animation, - axisAlignment: 0.0, - child: child, - ), - ); - }, - child: isExpanded - ? Container( - key: ValueKey(index), - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.network( - prescription.doctorImageURL!, - width: 24.h, - height: 24.h, - fit: BoxFit.fill, - ).circle(100), - SizedBox(width: 8.h), - Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), - ], - ), - SizedBox(height: 8.h), - Row( + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeIn, + switchOutCurve: Curves.easeOut, + transitionBuilder: (Widget child, Animation animation) { + return FadeTransition( + opacity: animation, + child: SizeTransition( + sizeFactor: animation, + axisAlignment: 0.0, + child: child, + ), + ); + }, + child: isExpanded + ? Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - CustomButton( - text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 8, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 24.h, + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + prescription.doctorImageURL!, + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), + ], ), - SizedBox(width: 8.h), - CustomButton( - text: model.isSortByClinic ? prescription.name! : prescription.clinicDescription!, - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 8, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 24.h, + SizedBox(height: 8.h), + Row( + children: [ + CustomButton( + text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: model.isSortByClinic ? prescription.name! : prescription.clinicDescription!, + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + ], ), - ], - ), - SizedBox(height: 8.h), - Row( - children: [ - Expanded( - flex: 6, - child: CustomButton( - text: prescription.isHomeMedicineDeliverySupported! - ? LocaleKeys.resendOrder.tr(context: context) - : LocaleKeys.prescriptionDeliveryError.tr(context: context), + SizedBox(height: 8.h), + Row( + children: [ + Expanded( + flex: 6, + child: CustomButton( + text: prescription.isHomeMedicineDeliverySupported! + ? LocaleKeys.resendOrder.tr(context: context) + : LocaleKeys.prescriptionDeliveryError.tr(context: context), onPressed: () async { if (prescription.isHomeMedicineDeliverySupported!) { LoaderBottomSheet.showLoader(loadingText: "Fetching prescription details...".needTranslation); @@ -269,62 +265,62 @@ class _PrescriptionsListPageState extends State { padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, icon: AppAssets.prescription_refill_icon, - iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), - iconSize: 14.h, - ), - ), - SizedBox(width: 8.h), - Expanded( - flex: 1, - child: Container( + iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + iconSize: 14.h, + ), + ), + SizedBox(width: 8.h), + Expanded( + flex: 1, + child: Container( height: 40.h, width: 40.w, decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.textColor, + color: AppColors.textColor, borderRadius: 12, ), - child: Padding( + child: Padding( padding: EdgeInsets.all(12.h), child: Transform.flip( - flipX: appState.isArabic(), - child: Utils.buildSvgWithAssets( - icon: AppAssets.forward_arrow_icon_small, - iconColor: AppColors.whiteColor, + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.whiteColor, fit: BoxFit.contain, + ), + ), ), - ), - ), - ).onPress(() { - model.setPrescriptionsDetailsLoading(); - Navigator.of(context).push( - CustomPageRoute( + ).onPress(() { + model.setPrescriptionsDetailsLoading(); + Navigator.of(context).push( + CustomPageRoute( page: PrescriptionDetailPage( prescriptionsResponseModel: prescription, isFromAppointments: false, ), ), ); - }), + }), + ), + ], ), + SizedBox(height: 12.h), + Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + SizedBox(height: 12.h), ], - ), - SizedBox(height: 12.h), - Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), - SizedBox(height: 12.h), - ], - ); - }).toList(), - ], - ), - ) - : SizedBox.shrink(), + ); + }).toList(), + ], + ), + ) + : SizedBox.shrink(), + ), + ], ), - ], + ), ), ), ), - ), - ), ) : Utils.getNoDataWidget(context, noDataText: "You don't have any prescriptions yet.".needTranslation); }, diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index ee7465d..9e4c808 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -29,18 +29,14 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; -import '../../core/dependencies.dart' show getIt; - class ProfileSettings extends StatefulWidget { - ProfileSettings({Key? key}) : super(key: key); + const ProfileSettings({super.key}); @override - _ProfileSettingsState createState() { - return _ProfileSettingsState(); - } + ProfileSettingsState createState() => ProfileSettingsState(); } -class _ProfileSettingsState extends State { +class ProfileSettingsState extends State { @override void initState() { super.initState(); @@ -184,7 +180,10 @@ class _ProfileSettingsState extends State { ), ], ), - "Quick Actions".needTranslation.toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), + "Quick Actions" + .needTranslation + .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), padding: EdgeInsets.only(top: 4.h, bottom: 4.h), @@ -192,9 +191,12 @@ class _ProfileSettingsState extends State { child: Column( children: [ actionItem(AppAssets.language_change, "Language".needTranslation, () { - showCommonBottomSheetWithoutHeight(context, title: "Application Language".needTranslation, child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); + showCommonBottomSheetWithoutHeight(context, + title: "Application Language".needTranslation, child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); }, trailingLabel: Utils.appState.isArabic() ? "العربية".needTranslation : "English".needTranslation), 1.divider, + actionItem(AppAssets.accessibility, "Symptoms Checker".needTranslation, () {}), + 1.divider, actionItem(AppAssets.accessibility, "Accessibility".needTranslation, () {}), 1.divider, actionItem(AppAssets.bell, "Notifications Settings".needTranslation, () {}), @@ -203,7 +205,10 @@ class _ProfileSettingsState extends State { ], ), ), - "Personal Information".needTranslation.toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), + "Personal Information" + .needTranslation + .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), padding: EdgeInsets.only(top: 4.h, bottom: 4.h), @@ -220,7 +225,10 @@ class _ProfileSettingsState extends State { ], ), ), - "Help & Support".needTranslation.toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), + "Help & Support" + .needTranslation + .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h), padding: EdgeInsets.only(top: 4.h, bottom: 4.h), @@ -261,12 +269,13 @@ class _ProfileSettingsState extends State { children: [ Utils.buildSvgWithAssets(icon: icon, iconColor: AppColors.greyTextColor), label.toText14(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded, - if (trailingLabel.isNotEmpty) trailingLabel.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1), + if (trailingLabel.isNotEmpty) + trailingLabel.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1), switchValue != null ? Switch( value: switchValue, onChanged: (value) {}, - activeColor: AppColors.successColor, + activeThumbColor: AppColors.successColor, activeTrackColor: AppColors.successColor.withValues(alpha: .15), ) : Transform.scale( @@ -295,8 +304,8 @@ class FamilyCardWidget extends StatelessWidget { Widget build(BuildContext context) { AppState appState = getIt.get(); final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); - final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; - final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); + // final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; + // final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); return Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, @@ -312,7 +321,7 @@ class FamilyCardWidget extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(profile.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.w, height: 56.h), + Image.asset(profile.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, diff --git a/lib/presentation/profile_settings/widgets/family_card_widget.dart b/lib/presentation/profile_settings/widgets/family_card_widget.dart new file mode 100644 index 0000000..eaee4c0 --- /dev/null +++ b/lib/presentation/profile_settings/widgets/family_card_widget.dart @@ -0,0 +1,207 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:provider/provider.dart'; + +class FamilyCardWidget extends StatelessWidget { + final Function() onAddFamilyMemberPress; + final Function(FamilyFileResponseModelLists member) onFamilySwitchPress; + final FamilyFileResponseModelLists profile; + + const FamilyCardWidget({ + super.key, + required this.onAddFamilyMemberPress, + required this.profile, + required this.onFamilySwitchPress(FamilyFileResponseModelLists member), + }); + + @override + Widget build(BuildContext context) { + AppState appState = getIt.get(); + final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); + final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; + final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.h, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset(profile.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + "${profile.patientName}".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), + AppCustomChipWidget( + icon: AppAssets.file_icon, + labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${profile.responseId}", + iconSize: 12.w, + ), + ], + ).expanded, + Icon(Icons.qr_code, size: 56.h) + ], + ), + SizedBox(height: 4.h), + SizedBox( + child: Wrap( + alignment: WrapAlignment.start, + spacing: 4.w, + runSpacing: 4.h, + children: [ + AppCustomChipWidget( + labelText: "${profile.age} Years Old".needTranslation, + ), + isActive && appState.getAuthenticatedUser()!.bloodGroup != null + ? AppCustomChipWidget( + icon: AppAssets.blood_icon, + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 8.w), + labelText: "Blood: ${appState.getAuthenticatedUser()!.bloodGroup ?? ""}", + iconColor: AppColors.primaryRedColor) + : SizedBox(), + Selector( + selector: (context, insuranceVM) => ( + isEmpty: insuranceVM.patientInsuranceList.isEmpty, + patientID: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.patientID : null, + isLoading: insuranceVM.isInsuranceLoading, + cardValidTo: insuranceVM.patientInsuranceList.isNotEmpty ? insuranceVM.patientInsuranceList.first.cardValidTo : null + ), + builder: (context, data, child) { + if (data.isEmpty) { + return const SizedBox(); + } else if (profile.responseId != data.patientID) { + return SizedBox(); + } + + final isLoading = data.isLoading; + final isExpired = !isLoading && DateTime.now().isAfter(DateUtil.convertStringToDate(data.cardValidTo)); + + final String icon; + final String labelText; + final Color iconColor; + final Color backgroundColor; + + if (isLoading) { + icon = AppAssets.cancel_circle_icon; + labelText = "Insurance".needTranslation; + iconColor = AppColors.primaryRedColor; + backgroundColor = AppColors.primaryRedColor; + } else if (isExpired) { + icon = AppAssets.cancel_circle_icon; + labelText = "Insurance Expired".needTranslation; + iconColor = AppColors.primaryRedColor; + backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15); + } else { + icon = AppAssets.insurance_active_icon; + labelText = "Insurance Active".needTranslation; + iconColor = AppColors.successColor; + backgroundColor = AppColors.successColor.withValues(alpha: 0.15); + } + + return AppCustomChipWidget( + icon: icon, + labelText: labelText, + iconColor: iconColor, + iconSize: 12.w, + backgroundColor: backgroundColor, + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 8.w), + // padding: EdgeInsets.zero, + ).toShimmer2(isShow: isLoading); + }, + ) + ], + ), + ), + ], + ).paddingOnly(top: 16.h, right: 16.w, left: 16.w, bottom: 12.h), + 1.divider, + _buildActionButton(appState), + ], + ), + ); + } + + Widget _buildActionButton(AppState appState) { + final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; + final int? currentUserId = appState.getAuthenticatedUser()?.patientId; + final int? superUserId = appState.getSuperUserID; + + if (isParentUser) { + return _buildParentUserButton(currentUserId); + } else { + return _buildNonParentUserButton(superUserId); + } + } + + Widget _buildParentUserButton(int? currentUserId) { + final canSwitch = profile.responseId != currentUserId; + + return CustomButton( + icon: canSwitch ? AppAssets.switch_user : AppAssets.add_family, + text: canSwitch ? "Switch Family File".needTranslation : "Add a new family member".needTranslation, + onPressed: canSwitch ? () => onFamilySwitchPress(profile) : onAddFamilyMemberPress, + backgroundColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, + borderColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, + textColor: canSwitch ? AppColors.primaryRedColor : AppColors.whiteColor, + iconColor: canSwitch ? AppColors.primaryRedColor : AppColors.whiteColor, + height: isFoldable ? 50.h : 40.h, + fontSize: 14.f, + ).paddingOnly(top: 12.h, right: 16.w, left: 16.w, bottom: 16.h); + } + + Widget _buildNonParentUserButton(int? superUserId) { + final canSwitchBack = superUserId != null && superUserId == profile.responseId; + + return CustomButton( + icon: AppAssets.switch_user, + text: canSwitchBack ? "Switch Back To Family File".needTranslation : "Switch".needTranslation, + backgroundColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, + borderColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, + textColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor, + iconColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor, + onPressed: canSwitchBack ? () => onFamilySwitchPress(profile) : () {}, + height: isFoldable ? 50.h : 40.h, + fontSize: 14.f, + ).paddingOnly(top: 12.h, right: 16.w, left: 16.w, bottom: 16.h); + } + +// //TODO: Add family file switch logic here +// isRootUser +// ? CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, height: 40.h, fontSize: 14, onPressed: () {}) +// .paddingOnly(top: 12, right: 16, left: 16, bottom: 16) +// : CustomButton( +// icon: AppAssets.add_family, +// backgroundColor: AppColors.secondaryLightRedColor, +// borderColor: AppColors.secondaryLightRedColor, +// textColor: AppColors.primaryRedColor, +// iconColor: AppColors.primaryRedColor, +// text: "Switch to this medical file".needTranslation, +// height: 40.h, +// fontSize: 14, +// onPressed: () {}) +// .paddingOnly(top: 12, right: 16, left: 16, bottom: 16), +// +} diff --git a/lib/presentation/radiology/radiology_orders_page.dart b/lib/presentation/radiology/radiology_orders_page.dart index cb925ef..c0eb782 100644 --- a/lib/presentation/radiology/radiology_orders_page.dart +++ b/lib/presentation/radiology/radiology_orders_page.dart @@ -3,13 +3,13 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; +import 'package:hmg_patient_app_new/features/radiology/models/resp_models/patient_radiology_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/radiology/radiology_result_page.dart'; @@ -22,6 +22,7 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import '../../features/radiology/radiology_view_model.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; class RadiologyOrdersPage extends StatefulWidget { const RadiologyOrdersPage({super.key}); @@ -34,226 +35,401 @@ class _RadiologyOrdersPageState extends State { late RadiologyViewModel radiologyViewModel; String selectedFilterText = ''; int? expandedIndex; + // Scroll controller to ensure expanded group is visible + late ScrollController _scrollController; + final Map _groupKeys = {}; @override void initState() { + _scrollController = ScrollController(); scheduleMicrotask(() { radiologyViewModel.initRadiologyViewModel(); }); super.initState(); } + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { radiologyViewModel = Provider.of(context); return Scaffold( - backgroundColor: AppColors.bgScaffoldColor, - body: CollapsingListView( - title: LocaleKeys.radiology.tr(context: context), - search: () async { - final lavVM = Provider.of(context, listen: false); - if (lavVM.isLabOrdersLoading) { - return; - } else { - String? value = await Navigator.of(context).push( - CustomPageRoute( - page: SearchRadiologyContent(radiologySuggestionsList: radiologyViewModel.radiologySuggestions), - fullScreenDialog: true, - direction: AxisDirection.down, - ), - ); - if (value != null) { - selectedFilterText = value; - radiologyViewModel.filterRadiologyReports(value); + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: LocaleKeys.radiology.tr(context: context), + search: () async { + final lavVM = Provider.of(context, listen: false); + if (lavVM.isLabOrdersLoading) { + return; + } else { + String? value = await Navigator.of(context).push( + CustomPageRoute( + page: SearchRadiologyContent(radiologySuggestionsList: radiologyViewModel.radiologySuggestions), + fullScreenDialog: true, + direction: AxisDirection.down, + ), + ); + if (value != null) { + selectedFilterText = value; + radiologyViewModel.filterRadiologyReports(value); + } } - } - }, - child: SingleChildScrollView( - child: Consumer( - builder: (context, model, child) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 24.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - selectedFilterText!.isNotEmpty - ? AppCustomChipWidget( - padding: EdgeInsets.symmetric(horizontal: 5.h), - labelText: selectedFilterText!, - deleteIcon: 'assets/images/svg/cross_circle.svg', - backgroundColor: AppColors.alertColor, - textColor: AppColors.whiteColor, - deleteIconColor: AppColors.whiteColor, - deleteIconHasColor: true, - onDeleteTap: () { - setState(() { - selectedFilterText = ''; - model.filterRadiologyReports(''); - }); + }, + child: SingleChildScrollView( + controller: _scrollController, + physics: NeverScrollableScrollPhysics(), + child: Consumer( + builder: (context, model, child) { + // Build grouping lists if we have data and none constructed yet + if (!model.isRadiologyOrdersLoading && model.patientRadiologyOrders.isNotEmpty && model.patientRadiologyOrdersViewList.isEmpty) { + final clinicMap = >{}; + final hospitalMap = >{}; + for (var order in model.patientRadiologyOrders) { + final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); + clinicMap.putIfAbsent(clinicKey, () => []).add(order); + final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); + hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); + } + model.patientRadiologyOrdersByClinic = clinicMap.values.toList(); + model.patientRadiologyOrdersByHospital = hospitalMap.values.toList(); + model.patientRadiologyOrdersViewList = model.isSortByClinic ? model.patientRadiologyOrdersByClinic : model.patientRadiologyOrdersByHospital; + } + + return Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Clinic / Hospital toggle + SizedBox(height: 16.h), + Row( + children: [ + CustomButton( + text: LocaleKeys.byClinic.tr(context: context), + onPressed: () { + model.setIsSortByClinic(true); + }, + backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.byHospital.tr(context: context), + onPressed: () { + model.setIsSortByClinic(false); }, - // chipType: ChipTypeEnum.alert, - // isSelected: true, - ) - : SizedBox(), - ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: model.isRadiologyOrdersLoading - ? 5 - : model.patientRadiologyOrders.isNotEmpty - ? model.patientRadiologyOrders.length - : 1, - itemBuilder: (context, index) { - final isExpanded = expandedIndex == index; - return model.isRadiologyOrdersLoading - ? LabResultItemView( - onTap: () {}, - labOrder: null, - index: index, - isLoading: true, - ) - : model.patientRadiologyOrders.isNotEmpty - ? AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 500), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - margin: EdgeInsets.symmetric(vertical: 8.h), - decoration: RoundedRectangleBorder() - .toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), - child: InkWell( - onTap: () { - setState(() { - expandedIndex = isExpanded ? null : index; + backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ), + + SizedBox(height: 8.h), + selectedFilterText.isNotEmpty + ? AppCustomChipWidget( + padding: EdgeInsets.symmetric(horizontal: 5.h), + labelText: selectedFilterText, + deleteIcon: 'assets/images/svg/cross_circle.svg', + backgroundColor: AppColors.alertColor, + textColor: AppColors.whiteColor, + deleteIconColor: AppColors.whiteColor, + deleteIconHasColor: true, + onDeleteTap: () { + setState(() { + selectedFilterText = ''; + model.filterRadiologyReports(''); + }); + }, + // chipType: ChipTypeEnum.alert, + // isSelected: true, + ) + : SizedBox(), + + // Grouped view when available + Builder(builder: (ctx) { + if (model.isRadiologyOrdersLoading) { + return ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: 5, + itemBuilder: (context, index) => LabResultItemView( + onTap: () {}, + labOrder: null, + index: index, + isLoading: true, + ), + ); + } + + if (model.patientRadiologyOrdersViewList.isEmpty) { + return Utils.getNoDataWidget(ctx, noDataText: "You don't have any radiology results yet.".needTranslation); + } + + return ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: model.patientRadiologyOrdersViewList.length, + itemBuilder: (context, index) { + final group = model.patientRadiologyOrdersViewList[index]; + final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'); + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 400), + child: SlideAnimation( + verticalOffset: 50.0, + child: FadeInAnimation( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Group header container with key so we can scroll to it + GestureDetector( + onTap: () { + setState(() { + expandedIndex = expandedIndex == index ? null : index; + }); + WidgetsBinding.instance.addPostFrameCallback((_) { + final key = _groupKeys.putIfAbsent(index, () => GlobalKey()); + if (key.currentContext != null && expandedIndex == index) { + // Delay scrolling to wait for expansion animation + Future.delayed(Duration(milliseconds: 450), () { + if (key.currentContext != null) { + Scrollable.ensureVisible( + key.currentContext!, + duration: Duration(milliseconds: 350), + curve: Curves.easeInOut, + alignment: 0.0, + ); + } }); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppCustomChipWidget( - labelText: LocaleKeys.resultsAvailable.tr(context: context), - backgroundColor: AppColors.successColor.withOpacity(0.15), - textColor: AppColors.successColor, - ).toShimmer2(isShow: model.isRadiologyOrdersLoading, width: 100), - SizedBox(height: 8.h), - Row( - children: [ - Image.network( - model.isRadiologyOrdersLoading - ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" - : model.patientRadiologyOrders[index].doctorImageURL!, - width: 24.h, - height: 24.h, - fit: BoxFit.fill, - ).circle(100).toShimmer2(isShow: model.isRadiologyOrdersLoading), - SizedBox(width: 4.h), - (model.isRadiologyOrdersLoading - ? "Dr John Smith" - : model.patientRadiologyOrders[index].doctorName!) - .toText16(isBold: true) - .toShimmer2(isShow: model.isRadiologyOrdersLoading) - ], + } + }); + }, + child: Container( + key: _groupKeys.putIfAbsent(index, () => GlobalKey()), + margin: EdgeInsets.only(bottom: 8.h), + padding: EdgeInsets.all(12.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.h), + boxShadow: [ + BoxShadow( + color: AppColors.blackColor.withValues(alpha: 0.03), + blurRadius: 6, + offset: Offset(0, 2), + ) + ], + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomButton( + text: "${group.length} ${'results'.needTranslation}", + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 30.h, + ), + Icon(expandedIndex == index ? Icons.expand_less : Icons.expand_more), + ], + ), + SizedBox(height: 8.h), + Text( + displayName, + style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ], + ), + ), + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 400), + child: expandedIndex == index + ? Container( + key: ValueKey(index), + padding: EdgeInsets.only(top: 12.h), + child: Column( + children: group.map((order) { + return Container( + margin: EdgeInsets.only(bottom: 12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 12.h, + hasShadow: true, ), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 3.h, - runSpacing: 4.h, - children: [ - AppCustomChipWidget( - icon: AppAssets.doctor_calendar_icon, - labelText: model.isRadiologyOrdersLoading - ? "01 Jan 2025" - : DateUtil.formatDateToDate(model.patientRadiologyOrders[index].orderDate!, false), - ).toShimmer2(isShow: model.isRadiologyOrdersLoading), - AppCustomChipWidget( - labelText: model.isRadiologyOrdersLoading - ? "01 Jan 2025" - : model.patientRadiologyOrders[index].clinicDescription!, - ).toShimmer2(isShow: model.isRadiologyOrdersLoading), + child: Padding( + padding: EdgeInsets.all(14.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.network( + order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + width: 24.h, + height: 24.h, + fit: BoxFit.cover, + ).circle(100), + SizedBox(width: 8.h), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, - // AppCustomChipWidget(labelText: "").toShimmer2(isShow: model.isRadiologyOrdersLoading, width: 16.h), - // AppCustomChipWidget(labelText: "").toShimmer2(isShow: model.isRadiologyOrdersLoading, width: 16.h), - ], - ), - ], - ), - ), - model.isRadiologyOrdersLoading - ? SizedBox.shrink() - : AnimatedCrossFade( - firstChild: SizedBox.shrink(), - secondChild: Padding( - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 8.h), - child: '● ${model.patientRadiologyOrders[index].description}' - .toText14(weight: FontWeight.w500), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox(), - CustomButton( - icon: AppAssets.view_report_icon, - iconColor: AppColors.primaryRedColor, - iconSize: 16.h, - text: LocaleKeys.viewReport.tr(context: context), - onPressed: () { - Navigator.of(context).push( - CustomPageRoute( - page: RadiologyResultPage( - patientRadiologyResponseModel: model.patientRadiologyOrders[index]), - ), - ); - }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 14, - fontWeight: FontWeight.bold, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, + children: [ + (order.doctorName ?? "").toString().toText14(weight: FontWeight.w500), + SizedBox(height: 6.h), + + + ], ), - ], - ), - ], - ), + ), + ], + ), + SizedBox(height: 8.h), + Row(children: [ + CustomButton( + text: order.description!, + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ) + + ] + ), + SizedBox(height: 6.h), + + Row( + children: [ + CustomButton( + text: DateUtil.formatDateToDate(order.orderDate ?? order.appointmentDate ?? "", false), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), + onPressed: () {}, + backgroundColor: AppColors.greyColor, + borderColor: AppColors.greyColor, + textColor: AppColors.blackColor, + fontSize: 10, + fontWeight: FontWeight.w500, + borderRadius: 8, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 24.h, + ), + ], + ), + SizedBox(height: 8.h), + Row( + children: [ + Expanded( + flex: 6, + child: SizedBox(), + ), + SizedBox(width: 8.h), + Expanded( + flex: 1, + child: Container( + height: 40.h, + width: 40.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.textColor, + borderRadius: 12, + ), + child: Padding( + padding: EdgeInsets.all(12.h), + child: Transform.flip( + flipX: false, + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.whiteColor, + fit: BoxFit.contain, + ), + ), + ), + ).onPress(() { + model.navigationService.push( + CustomPageRoute( + page: RadiologyResultPage(patientRadiologyResponseModel: order), + ), + ); + }), + ), + ], + ), + ], ), - crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: Duration(milliseconds: 300), ), - ], - ), - ), - ), + ); + }).toList(), + ), + ) + : SizedBox.shrink(), ), - ), - ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any radiology results yet.".needTranslation); - }, - ), - ], - ), - ); - }, + ], + ), + ), + ), + ); + }, + ); + }), + ], + ), + ); + }, + ), ), ), - ), - ); + ); } Color getLabOrderStatusColor(num status) { diff --git a/lib/presentation/radiology/radiology_result_page.dart b/lib/presentation/radiology/radiology_result_page.dart index df34164..1fc2d9f 100644 --- a/lib/presentation/radiology/radiology_result_page.dart +++ b/lib/presentation/radiology/radiology_result_page.dart @@ -10,7 +10,6 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/radiology/models/resp_models/patient_radiology_response_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; diff --git a/lib/presentation/radiology/search_radiology.dart b/lib/presentation/radiology/search_radiology.dart index 98f5c90..8d63a59 100644 --- a/lib/presentation/radiology/search_radiology.dart +++ b/lib/presentation/radiology/search_radiology.dart @@ -8,7 +8,6 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; -import 'package:sizer/sizer.dart'; class SearchRadiologyContent extends StatefulWidget { final List radiologySuggestionsList; diff --git a/lib/presentation/rate_appointment/rate_appointment_clinic.dart b/lib/presentation/rate_appointment/rate_appointment_clinic.dart new file mode 100644 index 0000000..5fb1fa3 --- /dev/null +++ b/lib/presentation/rate_appointment/rate_appointment_clinic.dart @@ -0,0 +1,211 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/rate_appointment/widget/doctor_row.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:provider/provider.dart'; + +class RateAppointmentClinic extends StatefulWidget { + + late final String? doctorNote; + late final int? doctorRate; + + RateAppointmentClinic({this.doctorRate, this.doctorNote}); + + @override + _RateAppointmentClinicState createState() => _RateAppointmentClinicState(); +} + +class _RateAppointmentClinicState extends State { + final formKey = GlobalKey(); + String note = ""; + int rating = 5; + AppointmentRatingViewModel? appointmentRatingViewModel; + MyAppointmentsViewModel? myAppointmentsViewModel; + + @override + Widget build(BuildContext context) { + myAppointmentsViewModel = Provider.of(context, listen: false); + appointmentRatingViewModel = Provider.of(context, listen: false); + + // Make the sheet a fixed height and keep content scrollable while pinning buttons to bottom + final sheetHeight = ResponsiveExtension.screenHeight * 0.60; + + return SizedBox( + height: sheetHeight, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Scrollable content + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 0.0, left: 0, right: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Doctor row + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: BuildDoctorRow( + isForClinic: true, + appointmentDetails: appointmentRatingViewModel!.appointmentDetails, + ), + ), + SizedBox(height: 16), + + // Rate clinic box + SizedBox( + width: double.infinity, + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + "Rate Clinic".needTranslation.toText16(isBold: true), + + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => rating == (index + 1) + ? Container( + margin: EdgeInsets.only(left: 3.0, right: 3.0), + child: IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/svg/rate_${index + 1}.svg', colorFilter: getColors(rating)), + ), + ) + : IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/svg/rate_${index + 1}.svg'), + ), + ), + ], + ), + ], + ), + ), + ), + ), + + SizedBox(height: 12), + + // Extra content area (keeps any other widgets that were previously below) + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // Placeholder for in-content widgets if needed in future + ], + ), + ), + + // Add bottom spacing so last content isn't obscured by the fixed buttons + SizedBox(height: 12), + ], + ), + ), + + ), + + // Bottom action buttons pinned to bottom of the sheet + SafeArea( + top: false, + child: Padding( + padding: const EdgeInsets.symmetric( vertical: 12.0), + child: Row( + children: [ + Expanded( + child: CustomButton( + text: "Back".needTranslation, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Color(0xffED1C2B), + onPressed: () { + appointmentRatingViewModel!.setTitle("Rate Doctor".needTranslation); + appointmentRatingViewModel!.setSubTitle("How was your last visit with doctor?".needTranslation); + appointmentRatingViewModel!.setClinicOrDoctor(false); + setState(() { + + }); + }, + ), + ), + SizedBox(width: 10), + Expanded( + child: CustomButton( + text: "Submit".needTranslation, + onPressed: () { + + submitRating(); + + }, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + ColorFilter getColors(int rating){ + + switch(rating){ + case 5: + return ColorFilter.mode(AppColors.bgGreenColor, BlendMode.srcIn); + case 4: + return ColorFilter.mode(Colors.greenAccent, BlendMode.srcIn); + case 3: + return ColorFilter.mode(AppColors.warningLightColor, BlendMode.srcIn); + case 2: + return ColorFilter.mode(Colors.orange, BlendMode.srcIn); + case 1: + return ColorFilter.mode(AppColors.primaryRedColor, BlendMode.srcIn); + + default: + return ColorFilter.mode(AppColors.greyColor, BlendMode.srcIn); + } + } + + submitRating() async{ + LoaderBottomSheet.showLoader(); + await appointmentRatingViewModel!.submitDoctorRating(docRate: widget.doctorRate!, docNote: widget.doctorNote!); + await appointmentRatingViewModel!.submitClinicRating(clinicRate: rating, clinicNote: note); + LoaderBottomSheet.hideLoader(); + Navigator.pop(context); + } + +} diff --git a/lib/presentation/rate_appointment/rate_appointment_doctor.dart b/lib/presentation/rate_appointment/rate_appointment_doctor.dart new file mode 100644 index 0000000..ac79744 --- /dev/null +++ b/lib/presentation/rate_appointment/rate_appointment_doctor.dart @@ -0,0 +1,221 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_clinic.dart'; +import 'package:hmg_patient_app_new/presentation/rate_appointment/widget/doctor_row.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +class RateAppointmentDoctor extends StatefulWidget { + + bool isFromRegistration; + + RateAppointmentDoctor({Key? key, this.isFromRegistration = false}) : super(key: key); + + @override + _RateAppointmentDoctorState createState() => _RateAppointmentDoctorState(); +} + +class _RateAppointmentDoctorState extends State { + final formKey = GlobalKey(); + String note = ""; + int rating = 5; + + // ProjectViewModel? projectViewModel; + AppointmentRatingViewModel? appointmentRatingViewModel; + MyAppointmentsViewModel? myAppointmentsViewModel; + + @override + void initState() { + + super.initState(); + } + + + @override + Widget build(BuildContext context) { + + myAppointmentsViewModel = Provider.of(context, listen: false); + appointmentRatingViewModel = Provider.of(context, listen: false); + + final sheetHeight = ResponsiveExtension.screenHeight * 0.60; + + return Selector( + selector: (_, vm) => vm.isRateClinic, + builder: (context, isRateClinic, child) => isRateClinic + ? RateAppointmentClinic(doctorNote: note, doctorRate: rating,) + : SizedBox( + height: sheetHeight, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Scrollable main content + Expanded( + + child: Padding( + padding: const EdgeInsets.only(top: 0.0, left: 0, right: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Doctor row + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: BuildDoctorRow( + isForClinic: false, + appointmentDetails: appointmentRatingViewModel!.appointmentDetails, + )), + + SizedBox(height: 16), + + // Rating box + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + "Please rate the doctor".needTranslation.toText16(isBold: true), + + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => AnimatedSwitcher( + duration: Duration(milliseconds: 1000), + switchInCurve: Curves.elasticOut, + switchOutCurve: Curves.elasticIn, + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(child: child, scale: animation); + }, + child: Container( + key: ValueKey(rating), + child: IconButton( + iconSize: 45.0, + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + color: rating >= (index + 1) + ? Color.fromRGBO(255, 186, 0, 1.0) + : Colors.grey[400], + icon: Icon(rating >= (index + 1) ? Icons.star : Icons.star)), + ), + ), + ) + ], + ), + ], + ), + ), + ), + + SizedBox(height: 12), + + // Note text field + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Padding( + padding: EdgeInsets.all(16.0), + child: TextField( + + maxLines: 4, + decoration: InputDecoration.collapsed( + hintText: "Notes".needTranslation, + hintStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16)), + onChanged: (value) { + setState(() { + note = value; + }); + }, + ))), + + + ], + ), + ), + + ), + + // Bottom action buttons pinned to bottom + SafeArea( + top: false, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12.0), + child: Row( + children: [ + Expanded( + child: CustomButton( + text: "Later".needTranslation, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Color(0xffED1C2B), + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox(width: 10), + Expanded( + child: CustomButton( + text: "Next".needTranslation, + onPressed: () { + // Set up clinic rating and show clinic rating view + appointmentRatingViewModel!.setTitle("Rate Clinic".needTranslation); + appointmentRatingViewModel!.setSubTitle("How was your appointment?".needTranslation); + appointmentRatingViewModel!.setClinicOrDoctor(true); + + setState(() {}); + }, + ), + ), + ], + ), + ), + ), + ], + ), + )); + + // DoctorList getDoctorObject(AppointmentRateViewModel model) { + // DoctorList doctor = new DoctorList(); + // + // doctor.name = model.appointmentDetails.doctorName; + // doctor.doctorImageURL = model.appointmentDetails.doctorImageURL; + // doctor.clinicName = model.appointmentDetails.clinicName; + // doctor.projectName = model.appointmentDetails.projectName; + // doctor.date = model.appointmentDetails.appointmentDate; + // doctor.actualDoctorRate = 5; + // + // return doctor; + // } + } + + +} diff --git a/lib/presentation/rate_appointment/widget/doctor_row.dart b/lib/presentation/rate_appointment/widget/doctor_row.dart new file mode 100644 index 0000000..725ac7c --- /dev/null +++ b/lib/presentation/rate_appointment/widget/doctor_row.dart @@ -0,0 +1,94 @@ + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/appointment_details_resp_model.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; + +class BuildDoctorRow extends StatelessWidget { + bool isForClinic = false; + AppointmentDetails? appointmentDetails; + + BuildDoctorRow({super.key, required this.isForClinic, this.appointmentDetails}); + + @override + Widget build(BuildContext context) { + + return Padding(padding: EdgeInsets.all(16),child:Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.network( + isForClinic ? 'https://hmgwebservices.com/Images/Hospitals/${appointmentDetails!.projectID}.jpg' : appointmentDetails!.doctorImageURL , + width: 63.h, + height: 63.h, + fit: BoxFit.cover, + ).circle(100), + SizedBox(width: 16.h), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (isForClinic ? appointmentDetails!.projectName : appointmentDetails!.doctorName)!.toString() + .toText16(isBold: true, maxlines: 1), + + SizedBox(height: 8.h), + + + isForClinic ? Wrap( + direction: Axis.horizontal, + spacing: 3.h, + runSpacing: 4.h, + children: [ + AppCustomChipWidget( + + labelText: + appointmentDetails!.clinicName.toString(), + + ), + AppCustomChipWidget( + icon: AppAssets.ic_date_filter, + labelText: + DateUtil.formatDateToDate(DateUtil.convertStringToDate(appointmentDetails!.appointmentDate), false), + + ), + + AppCustomChipWidget( + icon: AppAssets.appointment_time_icon, + labelText: + appointmentDetails!.startTime.substring(0, appointmentDetails!.startTime.length - 3), + + ), + + ] + ) : Wrap( + direction: Axis.horizontal, + spacing: 3.h, + runSpacing: 4.h, + children: [ + AppCustomChipWidget( + + labelText: + appointmentDetails!.projectName.toString(), + + + ), + AppCustomChipWidget( + + labelText: + appointmentDetails!.clinicName.toString(), + + ) + + ] + ) + ], + ), + ), + ], + )); + } + +} \ No newline at end of file diff --git a/lib/presentation/smartwatches/health_dashboard/health_dashboard.dart b/lib/presentation/smartwatches/health_dashboard/health_dashboard.dart new file mode 100644 index 0000000..7c537ba --- /dev/null +++ b/lib/presentation/smartwatches/health_dashboard/health_dashboard.dart @@ -0,0 +1,419 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/widgets/health_metric.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/widgets/health_metric_card.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; +import 'package:provider/provider.dart'; +import 'package:health/health.dart'; + +class HealthDashboard extends StatefulWidget { + const HealthDashboard({Key? key}) : super(key: key); + + @override + _HealthDashboardState createState() => _HealthDashboardState(); +} + +class _HealthDashboardState extends State with SingleTickerProviderStateMixin { + late TabController _tabController; + final dateFormat = DateFormat('MMM dd, yyyy'); + final timeFormat = DateFormat('hh:mm a'); + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + Future.microtask( + () async { + await Health().configure(); + context.read().fetchHealthData(); + }, + ); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Consumer( + builder: (context, healthProvider, child) { + return SingleChildScrollView( + child: Column( + children: [ + SizedBox(height: 96.h), + CustomTabBar( + activeTextColor: Color(0xffED1C2B), + activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), + tabs: [ + CustomTabBarModel(null, "Overview".needTranslation), + CustomTabBarModel(null, "Details".needTranslation), + ], + onTabChange: (index) { + healthProvider.onTabChanged(index); + }, + ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 24.h), + getSelectedTabData(healthProvider.selectedTabIndex, healthProvider).paddingSymmetrical(24.w, 0), + ], + ), + ); + }, + ), + floatingActionButton: FloatingActionButton( + onPressed: () => context.read().fetchHealthData(), + tooltip: 'Refresh health data', + child: Icon(Icons.refresh), + ), + ); + } + + Widget getSelectedTabData(int index, HealthProvider healthProvider) { + switch (index) { + case 0: + return _buildOverviewTab(healthProvider); + case 1: + return _buildDetailsTab(healthProvider); + default: + SizedBox.shrink(); + } + return Container(); + } + + Widget _buildOverviewTab(HealthProvider healthProvider) { + if (healthProvider.isLoading) { + return _buildLoadingState(); + } + + if (healthProvider.error != null) { + return _buildErrorState(healthProvider.error!); + } + return CustomScrollView( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + slivers: [ + SliverToBoxAdapter( + child: _buildTimeRangeSelector(healthProvider), + ), + SliverPadding( + padding: EdgeInsets.symmetric(vertical: 12.w), + sliver: SliverGrid( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisSpacing: 16, + crossAxisSpacing: 16, + childAspectRatio: 0.62, + ), + delegate: SliverChildBuilderDelegate( + (context, index) { + final metric = HealthMetrics.metrics[index]; + return HealthMetricCard( + metric: metric, + data: healthProvider.healthData[metric.type] ?? [], + onTap: () => _showMetricDetails(context, metric, healthProvider), + ); + }, + childCount: HealthMetrics.metrics.length, + ), + ), + ), + ], + ); + } + + Widget _buildDetailsTab(HealthProvider healthProvider) { + return ListView.builder( + padding: const EdgeInsets.all(16), + itemCount: HealthMetrics.metrics.length, + shrinkWrap: true, + itemBuilder: (context, index) { + final metric = HealthMetrics.metrics[index]; + final data = healthProvider.healthData[metric.type] ?? []; + + return Card( + color: AppColors.whiteColor, + margin: EdgeInsets.only(bottom: 16), + child: ExpansionTile( + leading: Icon( + metric.icon, + color: metric.color, + size: 32.h, + ), + // title: Text(metric.name), + title: (getIt.get().isArabic() ? metric.nameAr : metric.nameEn).toText14(isBold: true), + subtitle: Text( + data.isEmpty ? LocaleKeys.noDataAvailable.tr(context: context) : '${_getValueAsDouble(data.last.value, metric.type).toStringAsFixed(1)} ${metric.unit}', + ), + children: [ + Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + metric.description.toText13(), + SizedBox(height: 16.h), + if (data.isNotEmpty) ...[ + Text( + 'History', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + SizedBox(height: 8), + ...data.reversed + .take(5) + .map((point) => Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + dateFormat.format(point.dateFrom), + style: TextStyle(color: Colors.grey[600]), + ), + Text( + '${_getValueAsDouble(point.value, metric.type).toStringAsFixed(1)} ${metric.unit}', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ], + ), + )) + .toList(), + ], + ], + ), + ), + ], + ), + ); + }, + ); + } + + Widget _buildTimeRangeSelector(HealthProvider provider) { + return Container( + height: 40, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + for (final range in ['1D', '7D', '1M', '3M', '1Y']) + Padding( + padding: const EdgeInsets.only(right: 8), + child: ChoiceChip( + label: Text(range), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + checkmarkColor: AppColors.primaryRedColor, + selected: provider.selectedTimeRange == range, + selectedColor: AppColors.secondaryLightRedColor, + onSelected: (selected) { + if (selected) { + provider.updateTimeRange(range); + } + }, + ), + ), + ], + ), + ); + } + + Widget _buildLoadingState() { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + SizedBox(height: 16), + Text('Loading health data...'), + ], + ), + ); + } + + Widget _buildErrorState(String error) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.error_outline, + size: 48, + color: Colors.red, + ), + SizedBox(height: 16), + Text( + 'Error loading health data', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 8), + Text( + error, + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey[600]), + ), + SizedBox(height: 24), + ElevatedButton( + onPressed: () => context.read().fetchHealthData(), + child: Text('Try Again'), + ), + ], + ), + ); + } + + void _showMetricDetails( + BuildContext context, + HealthMetricInfo metric, + HealthProvider provider, + ) { + final data = provider.healthData[metric.type] ?? []; + + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (context) => DraggableScrollableSheet( + initialChildSize: 0.7, + minChildSize: 0.5, + maxChildSize: 0.95, + expand: false, + builder: (context, scrollController) => Container( + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + width: 40, + height: 4, + margin: EdgeInsets.only(bottom: 16), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(2), + ), + ), + ), + Row( + children: [ + Icon(metric.icon, color: metric.color, size: 30), + SizedBox(width: 16), + (getIt.get().isArabic() ? metric.nameAr : metric.nameEn).toText24(isBold: true), + // Text( + // metric.name, + // style: TextStyle( + // fontSize: 24, + // fontWeight: FontWeight.bold, + // ), + // ), + ], + ), + SizedBox(height: 16), + Text( + metric.description, + style: TextStyle( + color: Colors.grey[600], + fontSize: 16, + ), + ), + SizedBox(height: 24), + Text( + 'Healthy Range', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 8), + '${metric.minHealthyValue} - ${metric.maxHealthyValue} ${metric.unit}'.toText16(isBold: true, color: AppColors.primaryRedColor), + // Text( + // '${metric.minHealthyValue} - ${metric.maxHealthyValue} ${metric.unit}', + // style: TextStyle( + // color: mainPurple, + // fontSize: 16, + // ), + // ), + SizedBox(height: 24), + if (data.isNotEmpty) ...[ + Text( + 'History', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 16), + Expanded( + child: ListView.builder( + controller: scrollController, + itemCount: data.length, + itemBuilder: (context, index) { + final point = data[data.length - 1 - index]; + final value = _getValueAsDouble(point.value, metric.type); + return Card( + child: ListTile( + title: Text( + '${value.toStringAsFixed(1)} ${metric.unit}', + style: TextStyle(fontWeight: FontWeight.bold), + ), + subtitle: Text( + // dateFormat.format(point.dateFrom), + Utils.getMonthDayYearDateFormatted(point.dateFrom) + // dateFormat.format(point.dateFrom), + ), + trailing: Icon( + value >= metric.minHealthyValue && value <= metric.maxHealthyValue ? Icons.check_circle : Icons.warning, + color: value >= metric.minHealthyValue && value <= metric.maxHealthyValue ? AppColors.textColor : Colors.orange, + ), + ), + ); + }, + ), + ), + ] else + Center( + child: Text( + 'No data available', + style: TextStyle(color: Colors.grey[600]), + ), + ), + ], + ), + ), + ), + ); + } + + // Add this helper method to the _HealthDashboardState class + double _getValueAsDouble(HealthValue value, HealthDataType type) { + if (value is NumericHealthValue) { + // if(type == HealthDataType.BLOOD_OXYGEN) { + // return (value.numericValue.toDouble() * 100); + // } else { + return value.numericValue.toDouble(); + // } + } + return 0.0; + } +} diff --git a/lib/presentation/smartwatches/huawei_health_example.dart b/lib/presentation/smartwatches/huawei_health_example.dart new file mode 100644 index 0000000..4163d8b --- /dev/null +++ b/lib/presentation/smartwatches/huawei_health_example.dart @@ -0,0 +1,1563 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:huawei_health/huawei_health.dart'; + +const String packageName = 'com.ejada.hmg'; + +class HuaweiHealthExample extends StatefulWidget { + const HuaweiHealthExample({Key? key}) : super(key: key); + + @override + State createState() => _HuaweiHealthExampleState(); +} + +class _HuaweiHealthExampleState extends State { + /// Styles + static const TextStyle cardTitleTextStyle = TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + ); + static const EdgeInsets componentPadding = EdgeInsets.all(8.0); + + /// Text Controllers for showing the logs of different modules + final TextEditingController _activityTextController = TextEditingController(); + final TextEditingController _dataTextController = TextEditingController(); + final TextEditingController _settingTextController = TextEditingController(); + final TextEditingController _autoRecorderTextController = TextEditingController(); + final TextEditingController _consentTextController = TextEditingController(); + final TextEditingController _healthTextController = TextEditingController(); + + /// Data controller reference to initialize at startup. + late DataController _dataController; + + String? accessToken = ''; + + @override + void initState() { + super.initState(); + if (!mounted) return; + // Initialize Event Callbacks + AutoRecorderController.autoRecorderStream.listen(_onAutoRecorderEvent); + // Initialize a DataController + initDataController(); + } + + /// Prints the specified text on both the console and the specified text controller. + void log( + String methodName, + TextEditingController controller, + LogOptions logOption, { + String? result = '', + String? error = '', + }) { + String log = ''; + switch (logOption) { + case LogOptions.call: + log = '$methodName called'; + break; + case LogOptions.success: + log = '$methodName [Success: $result] '; + break; + case LogOptions.error: + log = '$methodName [Error: $error] [Error Description: ${HiHealthStatusCodes.getStatusCodeMessage(error ?? '')}]'; + break; + case LogOptions.custom: + log = methodName; // Custom text + break; + } + debugPrint(log); + setState(() { + controller.text = '$log\n${controller.text}'; + }); + } + + /// Authorizes Huawei Health Kit for the user, with defined scopes. + void signIn() async { + // List of scopes to ask for authorization. + // + // Note: These scopes should also be authorized on the Huawei Developer Console. + final List scopes = [ + Scope.HEALTHKIT_ACTIVITY_READ, + Scope.HEALTHKIT_ACTIVITY_WRITE, + Scope.HEALTHKIT_BLOODGLUCOSE_READ, + Scope.HEALTHKIT_BLOODGLUCOSE_WRITE, + Scope.HEALTHKIT_CALORIES_READ, + Scope.HEALTHKIT_CALORIES_WRITE, + Scope.HEALTHKIT_DISTANCE_READ, + Scope.HEALTHKIT_DISTANCE_WRITE, + Scope.HEALTHKIT_HEARTRATE_READ, + Scope.HEALTHKIT_HEARTRATE_WRITE, + Scope.HEALTHKIT_HEIGHTWEIGHT_READ, + Scope.HEALTHKIT_HEIGHTWEIGHT_WRITE, + Scope.HEALTHKIT_LOCATION_READ, + Scope.HEALTHKIT_LOCATION_WRITE, + Scope.HEALTHKIT_PULMONARY_READ, + Scope.HEALTHKIT_PULMONARY_WRITE, + Scope.HEALTHKIT_SLEEP_READ, + Scope.HEALTHKIT_SLEEP_WRITE, + Scope.HEALTHKIT_SPEED_READ, + Scope.HEALTHKIT_SPEED_WRITE, + Scope.HEALTHKIT_STEP_READ, + Scope.HEALTHKIT_STEP_WRITE, + Scope.HEALTHKIT_STRENGTH_READ, + Scope.HEALTHKIT_STRENGTH_WRITE, + Scope.HEALTHKIT_BODYFAT_READ, + Scope.HEALTHKIT_BODYFAT_WRITE, + Scope.HEALTHKIT_NUTRITION_READ, + Scope.HEALTHKIT_NUTRITION_WRITE, + Scope.HEALTHKIT_BLOODPRESSURE_READ, + Scope.HEALTHKIT_BLOODPRESSURE_WRITE, + Scope.HEALTHKIT_BODYTEMPERATURE_READ, + Scope.HEALTHKIT_BODYTEMPERATURE_WRITE, + Scope.HEALTHKIT_OXYGENSTATURATION_READ, + Scope.HEALTHKIT_OXYGENSTATURATION_WRITE, + Scope.HEALTHKIT_REPRODUCTIVE_READ, + Scope.HEALTHKIT_REPRODUCTIVE_WRITE, + Scope.HEALTHKIT_ACTIVITY_RECORD_READ, + Scope.HEALTHKIT_ACTIVITY_RECORD_WRITE, + Scope.HEALTHKIT_HEARTRATE_REALTIME, + Scope.HEALTHKIT_STEP_REALTIME, + Scope.HEALTHKIT_HEARTHEALTH_WRITE, + Scope.HEALTHKIT_HEARTHEALTH_READ, + Scope.HEALTHKIT_STRESS_WRITE, + Scope.HEALTHKIT_STRESS_READ, + Scope.HEALTHKIT_OXYGEN_SATURATION_WRITE, + Scope.HEALTHKIT_OXYGEN_SATURATION_READ, + Scope.HEALTHKIT_HISTORYDATA_OPEN_WEEK, + Scope.HEALTHKIT_HISTORYDATA_OPEN_MONTH, + Scope.HEALTHKIT_HISTORYDATA_OPEN_YEAR, + ]; + try { + AuthHuaweiId? result = await HealthAuth.signIn(scopes); + debugPrint( + 'Granted Scopes for User(${result?.displayName}): ${result?.grantedScopes?.toString()}', + ); + showSnackBar( + 'Authorization Success.', + color: Colors.green, + ); + setState(() => accessToken = result?.accessToken); + } on PlatformException catch (e) { + debugPrint('Error on authorization, Error:${e.toString()}'); + showSnackBar( + 'Error on authorization, Error:${e.toString()}, Error Description: ' + '${HiHealthStatusCodes.getStatusCodeMessage(e.message ?? '')}', + ); + } + } + + // ActivityRecordsController + // + /// Adds an ActivityRecord with an ActivitySummary, time range is 2 hours from now. + Future addActivityRecord() async { + log( + 'addActivityRecord', + _activityTextController, + LogOptions.call, + ); + DateTime startTime = DateTime.now().subtract(const Duration(hours: 2)); + DateTime endTime = DateTime.now(); + // Build an ActivityRecord object + ActivityRecord activityRecord = ActivityRecord( + startTime: startTime, + endTime: endTime, + id: 'ActivityRecordId0', + name: 'AddActivityRecord', + activityTypeId: HiHealthActivities.running, + description: 'This is a test for ActivityRecord', + activitySummary: ActivitySummary( + paceSummary: PaceSummary( + avgPace: 247.27626, + bestPace: 212.0, + britishPaceMap: { + '102802480': 365.0, + }, + britishPartTimeMap: { + '1.0': 263.0, + }, + partTimeMap: { + '1.0': 456.0, + }, + paceMap: { + '1.0': 263.0, + }, + ), + dataSummary: [ + SamplePoint( + dataType: DataType.DT_CONTINUOUS_DISTANCE_TOTAL, + startTime: startTime.add(Duration(seconds: 1)), + endTime: endTime.subtract(Duration(seconds: 1)), + fieldValueOptions: FieldFloat(Field.FIELD_DISTANCE, 400), + timeUnit: TimeUnit.MILLISECONDS, + ), + SamplePoint( + dataType: DataType.POLYMERIZE_CONTINUOUS_SPEED_STATISTICS, + fieldValueOptions: FieldFloat(Field.FIELD_AVG, 60.0), + startTime: startTime.add(Duration(seconds: 1)), + endTime: endTime.subtract(Duration(seconds: 1)), + timeUnit: TimeUnit.MILLISECONDS, + ) + ..setFieldValue(Field.FIELD_MIN, 40.0) + ..setFieldValue(Field.FIELD_MAX, 80.0), + ]), + ); + + // Build the dataCollector object + DataCollector dataCollector = DataCollector( + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + dataType: DataType.DT_INSTANTANEOUS_STEPS_RATE, + name: 'AddActivityRecord1923', + ); + + // You can use sampleSets to add more sample points to the sampling dataset. + // Build a list of sampling point objects and add it to the sampling dataSet + List samplePoints = [ + SamplePoint( + dataCollector: dataCollector, + startTime: startTime.add(Duration(seconds: 1)), + endTime: endTime.subtract(Duration(seconds: 1)), + fieldValueOptions: FieldFloat(Field.FIELD_STEP_RATE, 10.0), + timeUnit: TimeUnit.MILLISECONDS, + ), + ]; + SampleSet sampleSet = SampleSet( + dataCollector, + samplePoints, + ); + + try { + await ActivityRecordsController.addActivityRecord( + ActivityRecordInsertOptions( + activityRecord: activityRecord, + sampleSets: [ + sampleSet, + ], + ), + ); + log( + 'addActivityRecord', + _activityTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'addActivityRecord', + _activityTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Obtains saved ActivityRecords between yesterday and now, + /// with the DT_CONTINUOUS_STEPS_DELTA data type + void getActivityRecord() async { + log( + 'getActivityRecord', + _activityTextController, + LogOptions.call, + ); + // Create start time that will be used to read activity record. + DateTime startTime = DateTime.now().subtract(const Duration(days: 1)); + + // Create end time that will be used to read activity record. + DateTime endTime = DateTime.now().add(const Duration(hours: 3)); + + ActivityRecordReadOptions activityRecordReadOptions = ActivityRecordReadOptions( + activityRecordId: "ActivityRecordId0", + activityRecordName: null, + startTime: startTime, + endTime: endTime, + timeUnit: TimeUnit.MILLISECONDS, + dataType: DataType.DT_INSTANTANEOUS_STEPS_RATE, + ); + try { + List result = await ActivityRecordsController.getActivityRecord( + activityRecordReadOptions, + ); + log( + 'getActivityRecord', + _activityTextController, + LogOptions.success, + result: '[IDs: ${result.map((ActivityRecord e) => e.id).toList()}]', + ); + } on PlatformException catch (e) { + log( + 'getActivityRecord', + _activityTextController, + LogOptions.error, + result: e.message, + ); + } + } + + /// Starts the ActivityRecord with the id:`ActivityRecordRun1` + void beginActivityRecord() async { + try { + log( + 'beginActivityRecord', + _activityTextController, + LogOptions.call, + ); + // Build an ActivityRecord object + ActivityRecord activityRecord = ActivityRecord( + id: 'ActivityRecordRun0', + name: 'BeginActivityRecord', + description: 'This is ActivityRecord begin test!', + activityTypeId: HiHealthActivities.running, + startTime: DateTime.now().subtract(const Duration(hours: 1)), + ); + await ActivityRecordsController.beginActivityRecord( + activityRecord, + ); + log( + 'beginActivityRecord', + _activityTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'beginActivityRecord', + _activityTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Stops the ActivityRecord with the id:`ActivityRecordRun1` + void endActivityRecord() async { + try { + log( + 'endActivityRecord', + _activityTextController, + LogOptions.call, + ); + final List result = await ActivityRecordsController.endActivityRecord( + 'ActivityRecordRun0', + ); + // Return the list of activity records that have stopped + log( + 'endActivityRecord', + _activityTextController, + LogOptions.success, + result: result.toString(), + ); + } on PlatformException catch (e) { + log( + 'endActivityRecord', + _activityTextController, + LogOptions.error, + result: e.message, + ); + } + } + + /// Ends all the ongoing activity records. + /// + /// Result list will be null if there is no ongoing activity record. + void endAllActivityRecords() async { + try { + log( + 'endAllActivityRecords', + _activityTextController, + LogOptions.call, + ); + // Return the list of activity records that have stopped + List result = await ActivityRecordsController.endAllActivityRecords(); + log( + 'endAllActivityRecords', + _activityTextController, + LogOptions.success, + result: '[IDs: ${result.map((ActivityRecord e) => e.id).toList()}]', + ); + } on PlatformException catch (e) { + log( + 'endAllActivityRecords', + _activityTextController, + LogOptions.error, + result: e.message, + ); + } + } + + // + // + // End of ActivityRecordsController Methods + + // DataController Methods + // + // + /// Initializes a DataController instance with a list of HiHealtOptions. + void initDataController() async { + if (!mounted) return; + log( + 'init', + _dataTextController, + LogOptions.call, + ); + try { + _dataController = await DataController.init(); + log( + 'init', + _dataTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'init', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Clears all the data inserted by the app. + void clearAll() async { + log('clearAll', _dataTextController, LogOptions.call); + try { + await _dataController.clearAll(); + log('clearAll', _dataTextController, LogOptions.success); + } on PlatformException catch (e) { + log('clearAll', _dataTextController, LogOptions.error, error: e.message); + } + } + + /// Deletes DT_CONTINUOUS_STEPS_DELTA type data by the specified time range. + void delete() async { + log( + 'delete', + _dataTextController, + LogOptions.call, + ); + // Build the dataCollector object + DataCollector dataCollector = DataCollector( + dataType: DataType.DT_CONTINUOUS_STEPS_DELTA, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + dataStreamName: 'STEPS_DELTA', + ); + + // Build the time range for the deletion: start time and end time. + DeleteOptions deleteOptions = DeleteOptions( + dataCollectors: [dataCollector], + startTime: DateTime.parse('2020-10-10 08:00:00'), + endTime: DateTime.parse('2020-10-10 12:30:00'), + ); + + // Call the api with the constructed DeleteOptions instance. + try { + _dataController.delete(deleteOptions); + log( + 'delete', + _dataTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'delete', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Inserts a sampling set with the DT_CONTINUOUS_STEPS_DELTA data type at the + /// specified start and end dates. + void insert() async { + log( + 'insert', + _dataTextController, + LogOptions.call, + ); + // Build the dataCollector object + DataCollector dataCollector = DataCollector( + dataType: DataType.DT_CONTINUOUS_STEPS_DELTA, + dataStreamName: 'STEPS_DELTA', + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ); + // You can use sampleSets to add more sampling points to the sampling dataset. + SampleSet sampleSet = SampleSet( + dataCollector, + [ + SamplePoint( + dataCollector: dataCollector, + startTime: DateTime.parse('2020-10-10 12:00:00'), + endTime: DateTime.parse('2020-10-10 12:12:00'), + fieldValueOptions: FieldInt( + Field.FIELD_STEPS_DELTA, + 100, + ), + ), + ], + ); + // Call the api with the constructed sample set. + try { + _dataController.insert(sampleSet); + log( + 'insert', + _dataTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'insert', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + // Reads the user data between the specified start and end dates. + void read() async { + log( + 'read', + _dataTextController, + LogOptions.call, + ); + // Build the dataCollector object + DataCollector dataCollector = DataCollector( + dataType: DataType.DT_CONTINUOUS_STEPS_DELTA, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + dataStreamName: 'STEPS_DELTA', + ); + + // Build the time range for the query: start time and end time. + ReadOptions readOptions = ReadOptions( + dataCollectors: [ + dataCollector, + ], + startTime: DateTime.parse('2020-10-10 12:00:00'), + endTime: DateTime.parse('2020-10-10 12:12:00'), + )..groupByTime(10000); + + // Call the api with the constructed ReadOptions instance. + try { + ReadReply? readReply = await _dataController.read(readOptions); + log( + 'read', + _dataTextController, + LogOptions.success, + result: readReply.toString(), + ); + } on PlatformException catch (e) { + log( + 'read', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Reads the daily summation between the dates: `2020.10.02` to `2020.12.15` for multiple data types. + /// Note that the time format is different for this method. + void readDailySummationList() async { + log( + 'readDailySummationList', + _dataTextController, + LogOptions.call, + ); + try { + List? sampleSets = await _dataController.readDailySummationList( + [DataType.DT_CONTINUOUS_STEPS_DELTA, DataType.DT_CONTINUOUS_CALORIES_BURNT], + 20201002, + 20201003, + ); + log( + 'readDailySummationList', + _dataTextController, + LogOptions.success, + result: sampleSets.toString(), + ); + } on PlatformException catch (e) { + log( + 'readDailySummationList', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Reads the steps summation for today. + void readTodaySummation() async { + log( + 'readTodaySummation', + _dataTextController, + LogOptions.call, + ); + try { + SampleSet? sampleSet = await _dataController.readTodaySummation( + DataType.DT_CONTINUOUS_STEPS_DELTA, + ); + log( + 'readTodaySummation', + _dataTextController, + LogOptions.success, + result: sampleSet.toString(), + ); + } on PlatformException catch (e) { + log( + 'readTodaySummation', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Updates DT_CONTINUOUS_STEPS_DELTA for the specified dates. + void update() async { + log( + 'update', + _dataTextController, + LogOptions.call, + ); + + // Build the dataCollector object + DataCollector dataCollector = DataCollector( + dataType: DataType.DT_CONTINUOUS_STEPS_DELTA, + dataStreamName: 'STEPS_DELTA', + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ); + + // You can use sampleSets to add more sampling points to the sampling dataset. + SampleSet sampleSet = SampleSet( + dataCollector, + [ + SamplePoint( + dataCollector: dataCollector, + startTime: DateTime.parse('2020-12-12 09:00:00'), + endTime: DateTime.parse('2020-12-12 09:05:00'), + fieldValueOptions: FieldInt( + Field.FIELD_STEPS_DELTA, + 120, + ), + ), + ], + ); + + // Build a parameter object for the update. + // Note: (1) The start time of the modified object updateOptions can not be greater than the minimum + // value of the start time of all sample data points in the modified data sample set + // (2) The end time of the modified object updateOptions can not be less than the maximum value of the + // end time of all sample data points in the modified data sample set + UpdateOptions updateOptions = UpdateOptions( + startTime: DateTime.parse('2020-12-12 08:00:00'), + endTime: DateTime.parse('2020-12-12 09:25:00'), + sampleSet: sampleSet, + ); + try { + await _dataController.update(updateOptions); + log( + 'update', + _dataTextController, + LogOptions.success, + result: sampleSet.toString(), + ); + } on PlatformException catch (e) { + log( + 'update', + _dataTextController, + LogOptions.error, + error: e.message, + ); + } + } + + // + // + // End of DataController Methods + + // SettingController Methods + // + /// Adds a custom DataType with the FIELD_ALTITUDE. + void addDataType() async { + log( + 'addDataType', + _settingTextController, + LogOptions.call, + ); + try { + // The name of the created data type must be prefixed with the package name + // of the app. Otherwise, the creation fails. If the same data type is tried to + // be added again an exception will be thrown. + DataTypeAddOptions options = DataTypeAddOptions( + '$packageName.myCustomDataType', + [ + const Field.newIntField('myIntField'), + Field.FIELD_ALTITUDE, + ], + ); + final DataType dataTypeResult = await SettingController.addDataType( + options, + ); + log( + 'addDataType', + _settingTextController, + LogOptions.success, + result: dataTypeResult.toString(), + ); + } on PlatformException catch (e) { + log( + 'addDataType', + _settingTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Reads the inserted data type on the [addDataType] method. + void readDataType() async { + log( + 'readDataType', + _settingTextController, + LogOptions.call, + ); + try { + final DataType dataTypeResult = await SettingController.readDataType( + '$packageName.myCustomDataType', + ); + log( + 'readDataType', + _settingTextController, + LogOptions.success, + result: dataTypeResult.toString(), + ); + } on PlatformException catch (e) { + log( + 'readDataType', + _settingTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Disables the Health Kit function, cancels user authorization, and cancels + /// all data records. (The task takes effect in 24 hours.) + void disableHiHealth() async { + log( + 'disableHiHealth', + _settingTextController, + LogOptions.call, + ); + try { + await SettingController.disableHiHealth(); + log( + 'disableHiHealth', + _settingTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'disableHiHealth', + _settingTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Checks the user privacy authorization to Health Kit. Redirects the user to + /// the Authorization screen if the permissions are not given. + void checkHealthAppAuthorization() async { + log( + 'checkHealthAppAuthorization', + _settingTextController, + LogOptions.call, + ); + try { + await SettingController.checkHealthAppAuthorization(); + log( + 'checkHealthAppAuthorization', + _settingTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'checkHealthAppAuthorization', + _settingTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Checks the user privacy authorization to Health Kit. If authorized `true` + /// value would be returned. + void getHealthAppAuthorization() async { + log( + 'getHealthAppAuthorization', + _settingTextController, + LogOptions.call, + ); + try { + final bool result = await SettingController.getHealthAppAuthorization(); + log( + 'getHealthAppAuthorization', + _settingTextController, + LogOptions.success, + result: result.toString(), + ); + } on PlatformException catch (e) { + log( + 'getHealthAppAuthorization', + _settingTextController, + LogOptions.error, + error: e.message, + ); + } + } + + void requestAuth() async { + final HealthKitAuthResult res = await SettingController.requestAuthorizationIntent( + [ + Scope.HEALTHKIT_STEP_READ, + Scope.HEALTHKIT_STEP_WRITE, + Scope.HEALTHKIT_HEIGHTWEIGHT_READ, + Scope.HEALTHKIT_HEIGHTWEIGHT_WRITE, + Scope.HEALTHKIT_HEARTRATE_READ, + Scope.HEALTHKIT_HEARTRATE_WRITE, + Scope.HEALTHKIT_ACTIVITY_RECORD_READ, + Scope.HEALTHKIT_ACTIVITY_RECORD_WRITE, + Scope.HEALTHKIT_HEARTHEALTH_READ, + Scope.HEALTHKIT_HEARTHEALTH_WRITE, + ], + true, + ); + debugPrint(res.authAccount?.accessToken); + } + + // + // + // End of SettingController Methods + + // AutoRecorderController Methods + // + // + // Callback function for AutoRecorderStream event. + void _onAutoRecorderEvent(SamplePoint? res) { + log( + '[AutoRecorderEvent] obtained, SamplePoint Field Value is ${res?.fieldValues?.toString()}', + _autoRecorderTextController, + LogOptions.custom, + ); + } + + /// Starts an Android Foreground Service to count the steps of the user. + /// The steps will be emitted to the AutoRecorderStream. + void startRecord() async { + log( + 'startRecord', + _autoRecorderTextController, + LogOptions.call, + ); + try { + await AutoRecorderController.startRecord( + DataType.DT_CONTINUOUS_STEPS_TOTAL, + NotificationProperties( + title: 'HMS Flutter Health Demo', + text: 'Counting steps', + subText: 'this is a subtext', + ticker: 'this is a ticker', + showChronometer: true, + ), + ); + log( + 'startRecord', + _autoRecorderTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'startRecord', + _autoRecorderTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Ends the Foreground service and stops the step count events. + void stopRecord() async { + log( + 'endRecord', + _autoRecorderTextController, + LogOptions.call, + ); + try { + await AutoRecorderController.stopRecord( + DataType.DT_CONTINUOUS_STEPS_TOTAL, + ); + log( + 'endRecord', + _autoRecorderTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'endRecord', + _autoRecorderTextController, + LogOptions.error, + error: e.message, + ); + } + } + + // + // + // End of AutoRecorderController Methods + + // ConsentController Methods + // + /// Obtains the application id from the agconnect-services.json file. + void getAppId() async { + log( + 'getAppId', + _consentTextController, + LogOptions.call, + ); + try { + final String appId = await ConsentsController.getAppId(); + log( + 'getAppId', + _consentTextController, + LogOptions.success, + result: appId, + ); + } on PlatformException catch (e) { + log( + 'getAppId', + _consentTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Gets the granted permission scopes for the app. + void getScopes() async { + log( + 'getScopes', + _consentTextController, + LogOptions.call, + ); + try { + final String appId = await ConsentsController.getAppId(); + final ScopeLangItem scopeLangItem = await ConsentsController.getScopes( + 'en-gb', + appId, + ); + log( + 'getScopes', + _consentTextController, + LogOptions.success, + result: scopeLangItem.toString(), + ); + } on PlatformException catch (e) { + log( + 'getScopes', + _consentTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Revokes all the permissions that authorized for this app. + void revoke() async { + log( + 'revoke', + _consentTextController, + LogOptions.call, + ); + try { + final String appId = await ConsentsController.getAppId(); + await ConsentsController.revoke(appId); + log( + 'revoke', + _consentTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'revoke', + _consentTextController, + LogOptions.error, + error: e.message, + ); + } + } + + /// Revokes the distance read/write permissions for the app. + void revokeWithScopes() async { + log( + 'revokeWithScopes', + _consentTextController, + LogOptions.call, + ); + try { + // Obtain the application id. + final String appId = await ConsentsController.getAppId(); + // Call the revokeWithScopes method with desired scopes. + await ConsentsController.revokeWithScopes( + appId, + [ + Scope.HEALTHKIT_DISTANCE_WRITE, + Scope.HEALTHKIT_DISTANCE_READ, + ], + ); + log( + 'revokeWithScopes', + _consentTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'revokeWithScopes', + _consentTextController, + LogOptions.error, + error: e.message, + ); + } + } + + // + // + // End of ConsentController Methods + + // HealthController Methods + // + void addHealthRecord() async { + log( + 'addHealthRecord', + _healthTextController, + LogOptions.call, + ); + try { + final DateTime startTime = DateTime(2023, 5, 11); + final DateTime endTime = DateTime(2023, 5, 13); + + DataCollector contDataCollector = DataCollector( + dataStreamName: 'contDataCollector', + packageName: packageName, + dataType: DataType.POLYMERIZE_CONTINUOUS_HEART_RATE_STATISTICS, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ); + + DataCollector instDataCollector = DataCollector( + dataStreamName: 'instDataCollector', + packageName: packageName, + dataType: DataType.DT_INSTANTANEOUS_HEART_RATE, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ); + + List subDataDetails = [ + SampleSet(instDataCollector, [ + SamplePoint( + dataCollector: instDataCollector, + ) + ..setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS) + ..setFieldValue(Field.FIELD_BPM, 88.0) + ]) + ]; + + List subDataSummary = [ + SamplePoint( + dataCollector: contDataCollector, + ) + ..setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS) + ..setFieldValue(Field.FIELD_AVG, 90.0) + ..setFieldValue(Field.FIELD_MAX, 100.0) + ..setFieldValue(Field.FIELD_MIN, 80.0) + ..setFieldValue(Field.LAST, 85.0) + ]; + + final HealthRecord healthRecord = HealthRecord( + startTime: startTime, + endTime: endTime, + metadata: 'Data', + dataCollector: DataCollector( + dataStreamName: 'such as step count', + packageName: packageName, + dataType: HealthDataTypes.DT_HEALTH_RECORD_BRADYCARDIA, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ), + ) + ..setSubDataSummary(subDataSummary) + ..setSubDataDetails(subDataDetails) + ..setFieldValue(HealthFields.FIELD_THRESHOLD, 42.0) + ..setFieldValue(HealthFields.FIELD_MAX_HEART_RATE, 48.0) + ..setFieldValue(HealthFields.FIELD_MIN_HEART_RATE, 42.0) + ..setFieldValue(HealthFields.FIELD_AVG_HEART_RATE, 45.0); + + final String? result = await HealthRecordController.addHealthRecord( + HealthRecordInsertOptions( + healthRecord: healthRecord, + ), + ); + log( + 'addHealthRecord', + _healthTextController, + LogOptions.success, + result: result.toString(), + ); + } on PlatformException catch (e) { + log( + 'addHealthRecord', + _healthTextController, + LogOptions.error, + error: e.message, + ); + } + } + + void getHealthRecord() async { + log( + 'getHealthRecord', + _healthTextController, + LogOptions.call, + ); + try { + final DateTime startTime = DateTime(2023, 5, 11); + final DateTime endTime = DateTime(2023, 5, 13); + + HealthRecordReply result = await HealthRecordController.getHealthRecord( + HealthRecordReadOptions( + packageName: packageName, + ) + ..setSubDataTypeList( + [ + DataType.DT_INSTANTANEOUS_HEART_RATE, + ], + ) + ..setTimeInterval( + startTime, + endTime, + TimeUnit.MILLISECONDS, + ) + ..readByDataType( + HealthDataTypes.DT_HEALTH_RECORD_BRADYCARDIA, + ) + ..readHealthRecordsFromAllApps(), + ); + log( + 'getHealthRecord', + _healthTextController, + LogOptions.success, + result: result.healthRecords[0].toJson(), + ); + } on PlatformException catch (e) { + log( + 'getHealthRecord', + _healthTextController, + LogOptions.error, + error: e.message, + ); + } + } + + void updateHealthRecord() async { + log( + 'updateHealthRecord', + _healthTextController, + LogOptions.call, + ); + try { + final DateTime startTime = DateTime(2022, 10, 11); + final DateTime endTime = DateTime(2022, 10, 12); + final HealthRecord healthRecord = HealthRecord( + startTime: startTime, + endTime: endTime, + metadata: 'Data', + dataCollector: DataCollector( + dataStreamName: 'such as step count', + packageName: packageName, + dataType: HealthDataTypes.DT_HEALTH_RECORD_BRADYCARDIA, + dataGenerateType: DataGenerateType.DATA_TYPE_RAW, + ), + ) + ..setFieldValue(HealthFields.FIELD_THRESHOLD, 41.9) + ..setFieldValue(HealthFields.FIELD_MAX_HEART_RATE, 49.1) + ..setFieldValue(HealthFields.FIELD_MIN_HEART_RATE, 41.1) + ..setFieldValue(HealthFields.FIELD_AVG_HEART_RATE, 45.1); + await HealthRecordController.updateHealthRecord( + HealthRecordUpdateOptions( + healthRecord: healthRecord, + healthRecordId: '', + ), + ); + log( + 'updateHealthRecord', + _healthTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'updateHealthRecord', + _healthTextController, + LogOptions.error, + error: e.message, + ); + } + } + + void deleteHealthRecord() async { + log( + 'deleteHealthRecord', + _healthTextController, + LogOptions.call, + ); + try { + await HealthRecordController.deleteHealthRecord( + HealthRecordDeleteOptions( + startTime: DateTime.now().subtract(const Duration(days: 14)), + endTime: DateTime.now(), + )..setHealthRecordIds( + [ + '', + ], + ), + ); + log( + 'deleteHealthRecord', + _healthTextController, + LogOptions.success, + ); + } on PlatformException catch (e) { + log( + 'deleteHealthRecord', + _healthTextController, + LogOptions.error, + error: e.message, + ); + } + } + + // + // + // End of HealthController Methods + + // App's widgets. + // + // + Widget expansionCard({ + required String titleText, + required List children, + }) { + return Card( + margin: componentPadding, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + child: ExpansionTile( + title: Text( + titleText, + style: cardTitleTextStyle, + ), + children: children, + ), + ); + } + + Widget loggingArea( + TextEditingController moduleTextController, + ) { + return Column( + children: [ + Container( + margin: componentPadding, + padding: const EdgeInsets.all(8.0), + height: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all(color: Colors.black12), + ), + child: TextField( + readOnly: true, + maxLines: 15, + controller: moduleTextController, + decoration: const InputDecoration( + enabledBorder: InputBorder.none, + ), + ), + ), + TextButton( + child: const Text('Clear Log'), + onPressed: () => setState(() { + moduleTextController.text = ''; + }), + ) + ], + ); + } + + void showSnackBar( + String text, { + Color color = Colors.blue, + }) { + final SnackBar snackBar = SnackBar( + content: Text(text), + backgroundColor: color, + action: SnackBarAction( + label: 'Close', + textColor: Colors.white, + onPressed: () { + ScaffoldMessenger.of(context).removeCurrentSnackBar(); + }, + ), + ); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + title: const Text( + 'Huawei Health Kit', + style: TextStyle( + color: Colors.blue, + fontWeight: FontWeight.bold, + ), + ), + centerTitle: true, + elevation: 0.0, + actions: [ + IconButton( + onPressed: requestAuth, + icon: const Icon(Icons.ac_unit), + ), + ], + ), + body: Builder( + builder: (BuildContext context) { + return ListView( + physics: const BouncingScrollPhysics( + parent: AlwaysScrollableScrollPhysics(), + ), + children: [ + // Sign In Widgets + Card( + margin: componentPadding, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Padding( + padding: componentPadding, + child: Text( + 'Tap to SignIn button to obtain the HMS Account to complete ' + 'login and authorization, and then use other buttons ' + 'to try the related API functions.', + textAlign: TextAlign.center, + ), + ), + const Padding( + padding: componentPadding, + child: Text( + 'Note: If the login page is not displayed, change the package ' + 'name, AppID, and configure the signature file by referring ' + 'to the developer guide on the official website.', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.blue, + ), + ), + ), + Container( + padding: componentPadding, + width: double.infinity, + child: OutlinedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + Colors.blue, + ), + ), + child: const Text( + 'SignIn', + style: TextStyle( + color: Colors.white, + ), + ), + onPressed: () => signIn(), + ), + ), + ], + ), + ), + + // ActivityRecordsController + expansionCard( + titleText: 'ActivityRecords Controller', + children: [ + loggingArea(_activityTextController), + ListTile( + title: const Text('AddActivityRecord'), + onTap: () => addActivityRecord(), + ), + ListTile( + title: const Text('GetActivityRecord'), + onTap: () => getActivityRecord(), + ), + ListTile( + title: const Text('beginActivityRecord'), + onTap: () => beginActivityRecord(), + ), + ListTile( + title: const Text('endActivityRecord'), + onTap: () => endActivityRecord(), + ), + ListTile( + title: const Text('endAllActivityRecords'), + onTap: () => endAllActivityRecords(), + ), + ], + ), + // DataController Widgets + expansionCard( + titleText: 'DataController', + children: [ + loggingArea(_dataTextController), + ListTile( + title: const Text('readTodaySummation'), + onTap: () => readTodaySummation(), + ), + ListTile( + title: const Text('readDailySummationList'), + onTap: () => readDailySummationList(), + ), + ListTile( + title: const Text('insert'), + onTap: () => insert(), + ), + ListTile( + title: const Text('read'), + onTap: () => read(), + ), + ListTile( + title: const Text('update'), + onTap: () => update(), + ), + ListTile( + title: const Text('delete'), + onTap: () => delete(), + ), + ListTile( + title: const Text('clearAll'), + onTap: () => clearAll(), + ), + ], + ), + // SettingController Widgets. + expansionCard( + titleText: 'SettingController', + children: [ + loggingArea(_settingTextController), + ListTile( + title: const Text('addDataType'), + onTap: () => addDataType(), + ), + ListTile( + title: const Text('readDataType'), + onTap: () => readDataType(), + ), + ListTile( + title: const Text('disableHiHealth'), + onTap: () => disableHiHealth(), + ), + ListTile( + title: const Text('checkHealthAppAuthorization'), + onTap: () => checkHealthAppAuthorization(), + ), + ListTile( + title: const Text('getHealthAppAuthorization'), + onTap: () => getHealthAppAuthorization(), + ), + ], + ), + // AutoRecorderController Widgets + expansionCard( + titleText: 'AutoRecorderController', + children: [ + loggingArea(_autoRecorderTextController), + ListTile( + title: const Text('startRecord'), + onTap: () => startRecord(), + ), + ListTile( + title: const Text('stopRecord'), + onTap: () => stopRecord(), + ), + ], + ), + // Consent Controller Widgets + expansionCard( + titleText: 'ConsentController', + children: [ + loggingArea(_consentTextController), + ListTile( + title: const Text('getAppId'), + onTap: () => getAppId(), + ), + ListTile( + title: const Text('getScopes'), + onTap: () => getScopes(), + ), + ListTile( + title: const Text('revoke'), + onTap: () => revoke(), + ), + ListTile( + title: const Text('revokeWithScopes'), + onTap: () => revokeWithScopes(), + ), + ], + ), + + // Health Controller Widgets + expansionCard( + titleText: 'HealthController', + children: [ + loggingArea(_healthTextController), + ListTile( + title: const Text('addHealthRecord'), + onTap: () => addHealthRecord(), + ), + ListTile( + title: const Text('getHealthRecord'), + onTap: () => getHealthRecord(), + ), + ListTile( + title: const Text('updateHealthRecord'), + onTap: () => updateHealthRecord(), + ), + ListTile( + title: const Text('deleteHealthRecord'), + onTap: () => deleteHealthRecord(), + ), + ], + ), + ], + ); + }, + ), + ); + } +} + +/// Options for logging. +enum LogOptions { + call, + success, + error, + custom, +} diff --git a/lib/presentation/smartwatches/smartwatch_instructions_page.dart b/lib/presentation/smartwatches/smartwatch_instructions_page.dart new file mode 100644 index 0000000..7f17f5a --- /dev/null +++ b/lib/presentation/smartwatches/smartwatch_instructions_page.dart @@ -0,0 +1,466 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:health/health.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/health_dashboard/health_dashboard.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class SmartwatchInstructionsPage extends StatelessWidget { + const SmartwatchInstructionsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: LocaleKeys.smartWatches.tr(), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: SingleChildScrollView( + child: Platform.isIOS ? getIOSInstructionsUI(context) : getAndroidInstructionsUI(context), + ), + ), + ), + ); + } + + Widget getAndroidInstructionsUI(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Supported Smart Watches".needTranslation.toText20(isBold: true), + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_watch_ultra.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Watch Ultra", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Watch 8 Classic", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_watch_8.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Watch 8", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_watch_7_classic.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Watch 7 Classic", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_watch_7.webp", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Watch 7", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/galaxy_fit_3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Galaxy Fit3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + SizedBox(height: 12), + "Please make sure that your Samsung Watch is connected to your Phone, is actively synced & updated.".needTranslation.toText14(isBold: true), + SizedBox(height: 12), + "Before syncing data, please make sure that you have followed the instructions properly.".needTranslation.toText14(isBold: true), + SizedBox(height: 12), + InkWell( + onTap: () { + showInstructionsDialog(context); + }, + child: "View watch instructions".needTranslation.toText12(isBold: true, color: AppColors.textColor, isUnderLine: true)), + SizedBox( + height: 130.h, + ), + CustomButton( + text: LocaleKeys.confirm.tr(context: context), + onPressed: () async { + await Health().getHealthConnectSdkStatus().then((val) { + print('Health Connect SDK Status: $val'); + if (val == HealthConnectSdkStatus.sdkAvailable) { + Navigator.of(context).push( + CustomPageRoute( + page: HealthDashboard(), + ), + ); + } else { + getIt.get().showErrorBottomSheet( + message: "Seems like you do not have Health Connect App installed. Please install it from the Play Store to sync your health data.".needTranslation, + onOkPressed: () { + Navigator.pop(context); + Uri uri = Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata"); + launchUrl(uri, mode: LaunchMode.externalApplication); + }); + return; + } + }); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 10.r, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 50.h, + iconColor: AppColors.whiteColor, + iconSize: 18.h, + ), + // DefaultButton( + // LocaleKeys.confirm.tr(context: context), + // () async { + // await Health().getHealthConnectSdkStatus().then((val) { + // print('Health Connect SDK Status: $val'); + // if (val == HealthConnectSdkStatus.sdkAvailable) { + // Navigator.of(context).push( + // FadePage( + // page: HealthDashboard(), // Replace with the actual vital signs page + // // page: HealthApp(), // Replace with the actual vital signs page + // ), + // ); + // } else { + // Utils.showAppDialog(context, LocaleKeys.error.tr(context: context), LocaleKeys.healthConnectNotInstalled.tr(), () { + // Navigator.pop(context); + // Uri uri = Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata"); + // launchUrl(uri, mode: LaunchMode.externalApplication); + // }); + // return; + // } + // }); + // }, + // ) + ], + ); + } + + Widget getIOSInstructionsUI(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Supported Smart Watches".needTranslation.toText20(isBold: true), + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/apple-watch-1.jpeg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 5", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/apple-watch-2.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 6", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/apple-watch-3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 7", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/apple-watch-4.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 8", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/apple-watch-5.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 9", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/png/smartwatches/Apple-Watch-6.png", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.21, + child: Text("Apple Watch Series 10", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + SizedBox(height: 12), + "Please make sure that your Apple Watch is connected to your iPhone, is actively synced & updated.".toText14(isBold: true), + SizedBox(height: 12), + "Before syncing data, please make sure that you have followed the instructions properly.".toText14(isBold: true), + SizedBox(height: 12), + InkWell( + onTap: () { + showInstructionsDialog(context); + }, + child: "View watch instructions".toText12(isBold: true, color: AppColors.textColor, isUnderLine: true), + ), + SizedBox( + height: 130.h, + ), + CustomButton( + text: LocaleKeys.confirm.tr(context: context), + onPressed: () async { + Navigator.of(context).push( + CustomPageRoute( + page: HealthDashboard(), + ), + ); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 10.r, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 50.h, + iconColor: AppColors.whiteColor, + iconSize: 18.h, + ), + ], + ); + } + + showInstructionsDialog(BuildContext context) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 350.0, + padding: EdgeInsets.all(21), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "SmartWatch Tracker".toText18(), + IconButton( + icon: Icon( + Icons.close, + color: Color(0xff2E303A), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (Platform.isIOS + ? "Make sure that you have installed 'Health' App & 'Watch' App from Apple Store." + : "Please make sure that your Samsung Watch is connected to your Phone, is actively synced & updated.") + .needTranslation + .toText14(), + SizedBox(height: 12), + ], + ) + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) { + return SizedBox(); + //Chanbged By Aamir + }); + } +} diff --git a/lib/presentation/smartwatches/widgets/health_chart.dart b/lib/presentation/smartwatches/widgets/health_chart.dart new file mode 100644 index 0000000..fe6ae78 --- /dev/null +++ b/lib/presentation/smartwatches/widgets/health_chart.dart @@ -0,0 +1,87 @@ +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class HealthChart extends StatelessWidget { + final List spots; + final String title; + final Color gradientColor; + + const HealthChart({ + Key? key, + required this.spots, + required this.title, + required this.gradientColor, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.1), + spreadRadius: 5, + blurRadius: 7, + offset: const Offset(0, 3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 16), + Expanded( + child: LineChart( + LineChartData( + gridData: FlGridData(show: false), + titlesData: FlTitlesData(show: false), + borderData: FlBorderData(show: false), + minX: 0, + maxX: spots.length.toDouble() - 1, + minY: spots.map((e) => e.y).reduce((a, b) => a < b ? a : b), + maxY: spots.map((e) => e.y).reduce((a, b) => a > b ? a : b), + lineBarsData: [ + LineChartBarData( + spots: spots, + isCurved: true, + gradient: LinearGradient( + colors: [ + gradientColor.withOpacity(0.5), + gradientColor, + ], + ), + barWidth: 3, + isStrokeCapRound: true, + dotData: FlDotData(show: false), + belowBarData: BarAreaData( + show: true, + gradient: LinearGradient( + colors: [ + gradientColor.withOpacity(0.1), + gradientColor.withOpacity(0.2), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/smartwatches/widgets/health_metric.dart b/lib/presentation/smartwatches/widgets/health_metric.dart new file mode 100644 index 0000000..5375966 --- /dev/null +++ b/lib/presentation/smartwatches/widgets/health_metric.dart @@ -0,0 +1,95 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:health/health.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class HealthMetricInfo { + final HealthDataType type; + final String nameEn; + final String nameAr; + final String unit; + final Color color; + final IconData icon; + final String description; + final double minHealthyValue; + final double maxHealthyValue; + final String svgIcon; + + const HealthMetricInfo( + {required this.type, + required this.nameEn, + required this.nameAr, + required this.unit, + required this.color, + required this.icon, + required this.description, + required this.minHealthyValue, + required this.maxHealthyValue, + required this.svgIcon}); +} + +class HealthMetrics { + static final metrics = [ + HealthMetricInfo( + type: HealthDataType.HEART_RATE, + nameEn: "Heart Rate", + nameAr: "معدل النبض", + unit: 'BPM', + color: AppColors.primaryRedColor, + icon: Icons.favorite, + description: "Your heart rate indicates how many times your heart beats per minute".needTranslation, + minHealthyValue: 60, + maxHealthyValue: 100, + svgIcon: "assets/images/smartwatches/heartrate_icon.svg"), + HealthMetricInfo( + type: HealthDataType.BLOOD_OXYGEN, + nameEn: "Blood Oxygen", + nameAr: "أكسجين الدم", + unit: '%', + // color: Colors.blue, + color: Color(0xff3A3558), + icon: Icons.air, + description: "Blood oxygen level indicates how much oxygen your red blood cells are carrying".needTranslation, + minHealthyValue: 95, + maxHealthyValue: 100, + svgIcon: "assets/images/smartwatches/bloodoxygen_icon.svg"), + HealthMetricInfo( + type: HealthDataType.STEPS, + nameEn: "Steps", + nameAr: "خطوات", + unit: 'steps', + // color: Colors.green, + color: Color(0xff3263B8), + icon: Icons.directions_walk, + description: "Number of steps taken throughout the day".needTranslation, + minHealthyValue: 7000, + maxHealthyValue: 15000, + svgIcon: "assets/images/smartwatches/steps_icon.svg"), + HealthMetricInfo( + type: Platform.isIOS ? HealthDataType.ACTIVE_ENERGY_BURNED : HealthDataType.TOTAL_CALORIES_BURNED, + nameEn: "Active Calories", + nameAr: "السعرات الحرارية النشطة", + unit: 'kcal', + color: Color(0xffD59E95), + icon: Icons.local_fire_department, + description: "Calories burned during physical activity".needTranslation, + minHealthyValue: 300, + maxHealthyValue: 1000, + svgIcon: "assets/images/smartwatches/calories_icon.svg"), + HealthMetricInfo( + type: Platform.isIOS ? HealthDataType.DISTANCE_WALKING_RUNNING : HealthDataType.DISTANCE_DELTA, + nameEn: "Distance Covered", + nameAr: "المسافة المغطاة", + unit: 'KMs', + // color: mainPurple, + color: Color(0xff6A46F5), + icon: Icons.directions_run, + description: "Distance covered throughout the day".needTranslation, + minHealthyValue: 3, + maxHealthyValue: 10, + svgIcon: "assets/images/smartwatches/distance_icon.svg"), + // Add more metrics as needed + ]; +} diff --git a/lib/presentation/smartwatches/widgets/health_metric_card.dart b/lib/presentation/smartwatches/widgets/health_metric_card.dart new file mode 100644 index 0000000..023f41b --- /dev/null +++ b/lib/presentation/smartwatches/widgets/health_metric_card.dart @@ -0,0 +1,151 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:health/health.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/widgets/health_metric.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class HealthMetricCard extends StatelessWidget { + final HealthMetricInfo metric; + final List data; + final VoidCallback onTap; + + const HealthMetricCard({ + Key? key, + required this.metric, + required this.data, + required this.onTap, + }) : super(key: key); + + // Helper method to convert HealthValue to double + double _getValueAsDouble(HealthValue value, HealthDataType type) { + if (value is NumericHealthValue) { + return value.numericValue.toDouble(); + } + return 0.0; + } + + @override + Widget build(BuildContext context) { + final latestValue = data.isNotEmpty ? _getValueAsDouble(data.last.value, data.last.type) : 0.0; + final isHealthy = latestValue >= metric.minHealthyValue && latestValue <= metric.maxHealthyValue; + + return Card( + color: AppColors.whiteColor, + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(20), + child: Container( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + metric.svgIcon, + height: 30.h, + width: 30.h, + fit: BoxFit.contain, + // color: color, + ), + // Icon( + // metric.icon, + // color: metric.color, + // size: 30, + // ), + if (data.isNotEmpty) + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + decoration: BoxDecoration( + color: isHealthy ? Colors.green[100] : Color(0xffD7D2F3), + borderRadius: BorderRadius.circular(12), + ), + child: Text( + isHealthy ? "Healthy".needTranslation : 'Warning'.needTranslation, + style: TextStyle( + color: isHealthy ? Colors.green[700] : AppColors.blackColor, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + const SizedBox(height: 16), + (getIt.get().isArabic() ? metric.nameAr : metric.nameEn).toText18(isBold: true, maxlines: 1), + // Text( + // metric.name, + // style: const TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // ), + // ), + const SizedBox(height: 8), + Text( + data.isEmpty ? LocaleKeys.noDataAvailable.tr(context: context) : '${latestValue.toStringAsFixed(metric.type == HealthDataType.STEPS ? 0 : 1)} ${metric.unit}', + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: metric.color, + ), + ), + if (data.isNotEmpty) ...[ + const SizedBox(height: 16), + SizedBox( + height: 100, + child: LineChart( + LineChartData( + gridData: FlGridData(show: false), + titlesData: FlTitlesData(show: false), + borderData: FlBorderData(show: false), + lineBarsData: [ + LineChartBarData( + spots: _convertToSpots(data), + isCurved: true, + color: metric.color, + barWidth: 3, + isStrokeCapRound: true, + dotData: FlDotData(show: false), + belowBarData: BarAreaData( + show: true, + color: metric.color.withOpacity(0.1), + ), + ), + ], + ), + ), + ), + ], + ], + ), + ), + ), + ); + } + + List _convertToSpots(List data) { + if (data.isEmpty) return []; + + return List.generate( + data.length, + (index) => FlSpot( + index.toDouble(), + _getValueAsDouble(data[index].value, data[index].type), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/organ_selector_screen.dart b/lib/presentation/symptoms_checker/organ_selector_screen.dart new file mode 100644 index 0000000..c23b956 --- /dev/null +++ b/lib/presentation/symptoms_checker/organ_selector_screen.dart @@ -0,0 +1,332 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/interactive_body_widget.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:provider/provider.dart'; + +class OrganSelectorPage extends StatefulWidget { + const OrganSelectorPage({super.key}); + + @override + State createState() => _OrganSelectorPageState(); +} + +class _OrganSelectorPageState extends State { + late final AppState _appState; + + @override + void initState() { + super.initState(); + _appState = getIt.get(); + } + + void _onNextPressed(SymptomsCheckerViewModel viewModel) { + if (!viewModel.validateSelection()) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Please select at least one organ'.needTranslation), + backgroundColor: AppColors.errorColor, + ), + ); + return; + } + + context.navigateWithName(AppRoutes.symptomsSelectorScreen); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + appBar: _buildAppBar(), + body: Consumer( + builder: (context, viewModel, _) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildTitle(), + SizedBox(height: 8.h), + Expanded( + child: Stack( + children: [ + _buildBodyViewer(viewModel), + _buildViewToggleButtons(viewModel), + _buildBottomSheet(viewModel), + ], + ), + ), + ], + ); + }, + ), + ); + } + + PreferredSizeWidget _buildAppBar() { + return AppBar( + backgroundColor: AppColors.bgScaffoldColor, + elevation: 0, + leading: Transform.flip( + flipX: _appState.isArabic(), + child: IconButton( + icon: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + width: 32.h, + height: 32.h, + ), + padding: const EdgeInsets.only(left: 12), + onPressed: () => Navigator.pop(context), + highlightColor: Colors.transparent, + ), + ), + ); + } + + Widget _buildTitle() { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Text( + "Organ Selector".needTranslation, + style: TextStyle( + color: AppColors.textColor, + fontSize: 22.f, + fontWeight: FontWeight.w600, + ), + ), + ); + } + + Widget _buildBodyViewer(SymptomsCheckerViewModel viewModel) { + return Padding( + padding: EdgeInsets.fromLTRB(16.h, 16.h, 16.h, 60.h), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 600), + transitionBuilder: (child, animation) => _build3DFlipTransition(child, animation), + switchInCurve: Curves.easeInOut, + switchOutCurve: Curves.easeInOut, + child: InteractiveBodyWidget( + key: ValueKey(viewModel.currentView), + bodyImageAsset: viewModel.currentView == BodyView.front ? AppAssets.fullBodyFront : AppAssets.fullBodyBack, + organs: viewModel.currentOrgans, + selectedOrganIds: viewModel.selectedOrganIds, + onOrganTap: viewModel.toggleOrganSelection, + isBodyHidden: viewModel.isBodyHidden, + tooltipOrganId: viewModel.tooltipOrganId, + ), + ), + ); + } + + Widget _build3DFlipTransition(Widget child, Animation animation) { + final rotateAnimation = Tween(begin: 0.5, end: 0.0).animate( + CurvedAnimation(parent: animation, curve: Curves.easeInOut), + ); + + return AnimatedBuilder( + animation: rotateAnimation, + builder: (context, child) { + final angle = rotateAnimation.value * 3.14159; + final transform = Matrix4.identity() + ..setEntry(3, 2, 0.001) + ..rotateY(angle); + + return Transform( + transform: transform, + alignment: Alignment.center, + child: child, + ); + }, + child: child, + ); + } + + Widget _buildViewToggleButtons(SymptomsCheckerViewModel viewModel) { + return Positioned( + left: 16.w, + top: 36.h, + child: Column( + children: [ + _buildToggleButton( + icon: AppAssets.bodyIcon, + onTap: viewModel.toggleIsBodyHidden, + ), + SizedBox(height: 16.h), + _buildToggleButton( + icon: AppAssets.rotateIcon, + onTap: viewModel.toggleView, + ), + ], + ), + ); + } + + Widget _buildToggleButton({required String icon, required VoidCallback onTap}) { + return GestureDetector( + onTap: onTap, + child: Container( + width: 48.w, + height: 48.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 11.r, + ), + child: Center( + child: Utils.buildSvgWithAssets( + icon: icon, + width: 25.w, + height: 25.h, + ), + ), + ), + ); + } + + Widget _buildBottomSheet(SymptomsCheckerViewModel viewModel) { + return Positioned( + left: 0, + right: 0, + bottom: 0, + child: AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: SafeArea( + top: false, + child: Stack( + clipBehavior: Clip.none, + children: [ + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (viewModel.isBottomSheetExpanded) ...[ + SizedBox(height: 20.h), + _buildBottomSheetTitle(), + SizedBox(height: 12.h), + _buildSelectedOrgansContent(viewModel), + SizedBox(height: 16.h), + _buildNextButton(viewModel), + SizedBox(height: 16.h), + ] else + SizedBox(height: 20.h), + ], + ), + _buildExpandCollapseButton(viewModel), + ], + ), + ), + ), + ); + } + + Widget _buildBottomSheetTitle() { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Text( + 'Selected Organs'.needTranslation, + style: TextStyle( + fontSize: 16.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + ); + } + + Widget _buildSelectedOrgansContent(SymptomsCheckerViewModel viewModel) { + if (viewModel.selectedOrgans.isEmpty) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Text( + 'No organs selected yet'.needTranslation, + style: TextStyle( + color: AppColors.greyTextColor, + fontSize: 14.f, + ), + ), + ); + } + + return ConstrainedBox( + constraints: BoxConstraints(maxHeight: 150.h), + child: SingleChildScrollView( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Wrap( + spacing: 8.w, + runSpacing: 8.h, + children: viewModel.selectedOrgans.map((organ) { + return AppCustomChipWidget( + labelText: organ.description, + backgroundColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + deleteIcon: AppAssets.cancel, + deleteIconColor: AppColors.primaryRedColor, + deleteIconHasColor: false, + onDeleteTap: () { + viewModel.removeOrgan(organ.id); + }); + }).toList(), + ), + ), + ); + } + + Widget _buildNextButton(SymptomsCheckerViewModel viewModel) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: CustomButton( + text: 'Next'.needTranslation, + onPressed: () => _onNextPressed(viewModel), + isDisabled: viewModel.selectedOrgans.isEmpty, + backgroundColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + ), + ); + } + + Widget _buildExpandCollapseButton(SymptomsCheckerViewModel viewModel) { + return Positioned( + right: 24.w, + top: -24.h, + child: GestureDetector( + onTap: viewModel.toggleBottomSheet, + behavior: HitTestBehavior.opaque, + child: Container( + width: 70.w, + height: 70.h, + alignment: Alignment.center, + child: Container( + width: 48.w, + height: 48.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 11.r, + ), + child: Center( + child: AnimatedRotation( + duration: const Duration(milliseconds: 300), + turns: viewModel.isBottomSheetExpanded ? 0.25 : -0.25, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrowRight, + width: 25.w, + height: 25.h, + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/possible_conditions_screen.dart b/lib/presentation/symptoms_checker/possible_conditions_screen.dart new file mode 100644 index 0000000..2c99515 --- /dev/null +++ b/lib/presentation/symptoms_checker/possible_conditions_screen.dart @@ -0,0 +1,177 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/conditions_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/condition_card.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:provider/provider.dart'; +import 'package:shimmer/shimmer.dart'; + +class PossibleConditionsScreen extends StatelessWidget { + const PossibleConditionsScreen({super.key}); + + Widget _buildLoadingShimmer() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(16.w), + itemCount: 10, + separatorBuilder: (_, __) => SizedBox(height: 12.h), + itemBuilder: (context, index) { + return Shimmer.fromColors( + baseColor: Colors.grey[300]!, + highlightColor: Colors.grey[100]!, + child: Container( + height: 80.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.r), + ), + ), + ); + }, + ); + } + + Widget _buildPredictionsList(List conditions) { + if (conditions.isEmpty) { + return Center( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Text( + 'No Predictions available'.needTranslation, + style: TextStyle( + fontSize: 16.h, + color: AppColors.greyTextColor, + ), + ), + ), + ); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + ListView.separated( + padding: EdgeInsets.zero, + itemCount: conditions.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + separatorBuilder: (context, index) => SizedBox(height: 16.h), + itemBuilder: (context, index) { + final conditionModel = conditions[index]; + return ConditionCard( + icon: conditionModel.icon, + title: conditionModel.title, + percentage: conditionModel.percentage, + tagText: conditionModel.tagText, + clinic: conditionModel.clinic, + symptoms: conditionModel.symptoms, + description: conditionModel.description, + possibleConditionsSeverityEnum: conditionModel.possibleConditionsSeverityEnum, + onActionPressed: () { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('We are not available for a week. May you Rest In Peace :('), + backgroundColor: AppColors.primaryRedColor, + ), + ); + }, + ); + }, + ).paddingSymmetrical(24.w, 0), + SizedBox(height: 24.h), + ], + ); + } + + _buildConfirmationBottomSheet({required BuildContext context, required VoidCallback onConfirm}) { + return showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getWarningWidget( + loadingText: "Are you sure you want to restart the organ selection?".needTranslation, + isShowActionButtons: true, + onCancelTap: () => Navigator.pop(context), + onConfirmTap: () => onConfirm(), + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + + _restartOrganSelection(BuildContext context) async { + final symptomsCheckerVm = context.read(); + symptomsCheckerVm.reset(); + context.pop(); + await Future.delayed(Duration(seconds: 1)).whenComplete(() => context.pop()); + } + + _navigateToLandingPage() { + NavigationService navigationService = getIt.get(); + navigationService.replaceAllRoutesAndNavigateToLanding(); + } + + _buildTrailingSection(BuildContext context) { + return Row( + children: [ + Container( + height: 40.h, + padding: EdgeInsets.all(8.w), + child: Center( + child: Utils.buildSvgWithAssets( + icon: AppAssets.refreshIcon, + height: 20.h, + width: 20.w, + iconColor: AppColors.textColor, + ), + ), + ).onPress(() => _buildConfirmationBottomSheet(context: context, onConfirm: () => _restartOrganSelection(context))), + Container( + height: 40.h, + padding: EdgeInsets.all(8.w), + child: Center( + child: Utils.buildSvgWithAssets( + icon: AppAssets.homeBorderedIcon, + height: 20.h, + width: 20.w, + iconColor: AppColors.textColor, + ), + ), + ).onPress(() => _buildConfirmationBottomSheet(context: context, onConfirm: () => _navigateToLandingPage())), + ], + ).paddingSymmetrical(20.w, 0); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "Possible Conditions".needTranslation, + trailing: _buildTrailingSection(context), + child: Consumer( + builder: (context, symptomsCheckerViewModel, child) { + if (symptomsCheckerViewModel.isPossibleConditionsLoading || symptomsCheckerViewModel.isPossibleConditionsLoading) { + return _buildLoadingShimmer(); + } + return _buildPredictionsList(dummyConditions); + }, + ), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/risk_factors_screen.dart b/lib/presentation/symptoms_checker/risk_factors_screen.dart new file mode 100644 index 0000000..d4ff2cb --- /dev/null +++ b/lib/presentation/symptoms_checker/risk_factors_screen.dart @@ -0,0 +1,309 @@ +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +class RiskFactorsScreen extends StatefulWidget { + const RiskFactorsScreen({super.key}); + + @override + State createState() => _RiskFactorsScreenState(); +} + +class _RiskFactorsScreenState extends State { + @override + void initState() { + super.initState(); + // Fetch risk factors based on selected symptoms + WidgetsBinding.instance.addPostFrameCallback((_) { + final viewModel = context.read(); + viewModel.fetchRiskFactors(); + }); + } + + void _onRiskFactorSelected(SymptomsCheckerViewModel viewModel, String riskFactorId) { + viewModel.toggleRiskFactorSelection(riskFactorId); + } + + void _onNextPressed(SymptomsCheckerViewModel viewModel) { + if (viewModel.hasSelectedRiskFactors) { + context.navigateWithName(AppRoutes.suggestionsScreen); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Please select at least one risk before proceeding'.needTranslation), + backgroundColor: AppColors.errorColor, + ), + ); + } + } + + void _onPreviousPressed() { + context.pop(); + } + + Widget _buildRiskFactorItem(SymptomsCheckerViewModel viewModel, String riskFactorId, String optionText) { + final bool selected = viewModel.isRiskFactorSelected(riskFactorId); + + return GestureDetector( + onTap: () => _onRiskFactorSelected(viewModel, riskFactorId), + child: Container( + margin: EdgeInsets.only(bottom: 16.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + width: 24.w, + height: 24.w, + decoration: BoxDecoration( + color: selected ? AppColors.primaryRedColor : Colors.transparent, + borderRadius: BorderRadius.circular(5.r), + border: Border.all(color: selected ? AppColors.primaryRedColor : AppColors.checkBoxBorderColor, width: 1.w), + ), + child: selected ? Icon(Icons.check, size: 16.f, color: AppColors.whiteColor) : null, + ), + SizedBox(width: 12.w), + Expanded( + child: optionText.toText14( + color: riskFactorId == "not_applicable" ? AppColors.errorColor : AppColors.textColor, + weight: FontWeight.w500, + )), + ], + ), + ), + ); + } + + Widget _buildRiskFactorsList(SymptomsCheckerViewModel viewModel) { + return Container( + key: ValueKey(viewModel.riskFactorsList.length), + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w, bottom: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...viewModel.riskFactorsList.map((factor) { + return _buildRiskFactorItem(viewModel, factor.id ?? '', factor.getDisplayName()); + }), + SizedBox(height: 12.w), + Row( + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.alertSquare, + height: 24.h, + width: 24.h, + iconColor: AppColors.textColor, + ), + SizedBox(width: 12.w), + Expanded( + child: RichText( + text: TextSpan( + style: TextStyle( + height: 1.3, + fontSize: 13.f, + fontWeight: FontWeight.w500, + color: AppColors.greyInfoTextColor, + ), + children: [ + TextSpan( + text: "Above you see the most common risk factors. Although /diagnosis may return questions about risk factors, " + .needTranslation, + ), + TextSpan( + text: "read more".needTranslation, + style: TextStyle( + color: AppColors.primaryRedColor, + fontWeight: FontWeight.w500, + ), + recognizer: TapGestureRecognizer() + ..onTap = () { + // handle tap - navigate or show bottom sheet + debugPrint('Read more tapped'); + // Example: Navigator.push(context, MaterialPageRoute(builder: (_) => RiskFactorsDetailScreen())); + }, + ), + ], + ), + ), + ) + ], + ), + ], + ), + ); + } + + Widget _buildLoadingShimmer() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + // Create 2-3 shimmer cards + ...List.generate(3, (index) { + return Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: _buildShimmerCard(), + ); + }), + ], + ); + } + + Widget _buildShimmerCard() { + return Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Shimmer title + Container( + height: 40.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24.r), + ), + ).toShimmer2(isShow: true, radius: 24.r), + SizedBox(height: 16.h), + // Shimmer chips + Wrap( + runSpacing: 12.h, + spacing: 8.w, + children: List.generate(4, (index) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(24.r), + border: Border.all(color: AppColors.bottomNAVBorder, width: 1), + ), + child: Text( + 'Not Applicable Risk Factor', + style: TextStyle(fontSize: 14.f, color: AppColors.textColor), + ), + ).toShimmer2(isShow: true, radius: 24.r); + }), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Consumer( + builder: (context, viewModel, _) { + return Column( + children: [ + Expanded( + child: CollapsingListView( + title: "Risk Factors".needTranslation, + leadingCallback: () => context.pop(), + child: viewModel.isRiskFactorsLoading + ? _buildLoadingShimmer() + : viewModel.riskFactorsList.isEmpty + ? _buildEmptyState() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + _buildRiskFactorsList(viewModel), + ], + ), + ), + ), + _buildStickyBottomCard(context, viewModel), + ], + ); + }, + ), + ); + } + + Widget _buildEmptyState() { + return Center( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), + SizedBox(height: 16.h), + Text( + 'No risk factors found'.needTranslation, + style: TextStyle( + fontSize: 18.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + SizedBox(height: 8.h), + Text( + 'Based on your selected symptoms, no additional risk factors were identified.'.needTranslation, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.f, + color: AppColors.greyTextColor, + ), + ), + ], + ), + ), + ); + } + + Widget _buildStickyBottomCard(BuildContext context, SymptomsCheckerViewModel viewModel) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: CustomButton( + text: "Previous".needTranslation, + onPressed: _onPreviousPressed, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + Expanded( + child: CustomButton( + text: "Next".needTranslation, + onPressed: () => _onNextPressed(viewModel), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + SizedBox(height: 24.h), + ], + ).paddingSymmetrical(24.w, 0), + ); + } +} diff --git a/lib/presentation/symptoms_checker/suggestions_screen.dart b/lib/presentation/symptoms_checker/suggestions_screen.dart new file mode 100644 index 0000000..f2aa71e --- /dev/null +++ b/lib/presentation/symptoms_checker/suggestions_screen.dart @@ -0,0 +1,285 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +class SuggestionsScreen extends StatefulWidget { + const SuggestionsScreen({super.key}); + + @override + State createState() => _SuggestionsScreenState(); +} + +class _SuggestionsScreenState extends State { + @override + void initState() { + super.initState(); + // Initialize symptom groups based on selected organs + WidgetsBinding.instance.addPostFrameCallback((_) { + final viewModel = context.read(); + viewModel.fetchSuggestions(); + }); + } + + void _onOptionSelected(int optionIndex) {} + + void _onSuggestionSelected(SymptomsCheckerViewModel viewModel, String suggestionId) { + viewModel.toggleSuggestionsSelection(suggestionId); + } + + void _onNextPressed(SymptomsCheckerViewModel viewModel) { + if (viewModel.hasSelectedSuggestions) { + // Navigate to triage screen + context.navigateWithName(AppRoutes.triageScreen); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Please select at least one option before proceeding'.needTranslation), + backgroundColor: AppColors.errorColor, + ), + ); + } + } + + void _onPreviousPressed() { + context.pop(); + } + + Widget _buildSuggestionItem(SymptomsCheckerViewModel viewModel, String suggestionId, String optionText) { + final bool selected = viewModel.isSuggestionsSelected(suggestionId); + + return GestureDetector( + onTap: () => _onSuggestionSelected(viewModel, suggestionId), + child: Container( + margin: EdgeInsets.only(bottom: 16.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + width: 24.w, + height: 24.w, + decoration: BoxDecoration( + color: selected ? AppColors.primaryRedColor : Colors.transparent, + borderRadius: BorderRadius.circular(5.r), + border: Border.all(color: selected ? AppColors.primaryRedColor : AppColors.checkBoxBorderColor, width: 1.w), + ), + child: selected ? Icon(Icons.check, size: 16.f, color: AppColors.whiteColor) : null, + ), + SizedBox(width: 12.w), + Expanded( + child: optionText.toText14( + color: suggestionId == "not_applicable" ? AppColors.errorColor : AppColors.textColor, + weight: FontWeight.w500, + )), + ], + ), + ), + ); + } + + Widget _buildSuggestionsList(SymptomsCheckerViewModel viewModel) { + return Container( + key: ValueKey(viewModel.suggestionsList.length), + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w, bottom: 8.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...viewModel.suggestionsList.map((factor) { + return _buildSuggestionItem(viewModel, factor.id ?? '', factor.getDisplayName()); + }), + SizedBox(height: 12.w), + Row( + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.alertSquare, + height: 24.h, + width: 24.h, + iconColor: AppColors.textColor, + ), + SizedBox(width: 12.w), + Expanded( + child: "This is a list of symptoms suggested by our AI, based on the information gathered so far during the interview".toText12( + color: AppColors.greyInfoTextColor, + ), + ) + ], + ), + ], + ), + ); + } + + Widget _buildLoadingShimmer() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + // Create 2-3 shimmer cards + ...List.generate(3, (index) { + return Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: _buildShimmerCard(), + ); + }), + ], + ); + } + + Widget _buildShimmerCard() { + return Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Shimmer title + Container( + height: 40.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24.r), + ), + ).toShimmer2(isShow: true, radius: 24.r), + SizedBox(height: 16.h), + // Shimmer chips + Wrap( + runSpacing: 12.h, + spacing: 8.w, + children: List.generate(4, (index) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(24.r), + border: Border.all(color: AppColors.bottomNAVBorder, width: 1), + ), + child: Text( + 'Not Applicable Suggestion', + style: TextStyle(fontSize: 14.f, color: AppColors.textColor), + ), + ).toShimmer2(isShow: true, radius: 24.r); + }), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Consumer( + builder: (context, viewModel, _) { + return Column( + children: [ + Expanded( + child: CollapsingListView( + title: "Suggestions".needTranslation, + leadingCallback: () => context.pop(), + child: viewModel.isSuggestionsLoading + ? _buildLoadingShimmer() + : viewModel.suggestionsList.isEmpty + ? _buildEmptyState() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + _buildSuggestionsList(viewModel), + ], + ), + ), + ), + _buildStickyBottomCard(context, viewModel), + ], + ); + }, + ), + ); + } + + Widget _buildEmptyState() { + return Center( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), + SizedBox(height: 16.h), + Text( + 'No organs selected'.needTranslation, + style: TextStyle( + fontSize: 18.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + SizedBox(height: 8.h), + Text( + 'Please go back and select organs first'.needTranslation, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.f, + color: AppColors.greyTextColor, + ), + ), + ], + ), + ), + ); + } + + Widget _buildStickyBottomCard(BuildContext context, SymptomsCheckerViewModel viewModel) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: CustomButton( + text: "Previous".needTranslation, + onPressed: _onPreviousPressed, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + Expanded( + child: CustomButton( + text: "Next".needTranslation, + onPressed: () => _onNextPressed(viewModel), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + SizedBox(height: 24.h), + ], + ).paddingSymmetrical(24.w, 0), + ); + } +} diff --git a/lib/presentation/symptoms_checker/symptoms_selector_screen.dart b/lib/presentation/symptoms_checker/symptoms_selector_screen.dart new file mode 100644 index 0000000..522c5f8 --- /dev/null +++ b/lib/presentation/symptoms_checker/symptoms_selector_screen.dart @@ -0,0 +1,312 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.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/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/custom_selectable_chip.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:provider/provider.dart'; + +class SymptomsSelectorScreen extends StatefulWidget { + const SymptomsSelectorScreen({super.key}); + + @override + State createState() => _SymptomsSelectorScreenState(); +} + +class _SymptomsSelectorScreenState extends State { + @override + void initState() { + super.initState(); + // Initialize symptom groups based on selected organs + WidgetsBinding.instance.addPostFrameCallback((_) { + final viewModel = context.read(); + viewModel.initializeSymptomGroups(); + }); + } + + void _onNextPressed(SymptomsCheckerViewModel viewModel) { + if (viewModel.hasSelectedSymptoms) { + // Navigate to triage screen + context.navigateWithName(AppRoutes.riskFactorsScreen); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Please select at least one symptom before proceeding'.needTranslation), + backgroundColor: AppColors.errorColor, + ), + ); + } + } + + void _onPreviousPressed() { + context.pop(); + } + + _buildConfirmationBottomSheet({required BuildContext context, required VoidCallback onConfirm}) { + return showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getWarningWidget( + loadingText: "Are you sure you want to restart the organ selection?".needTranslation, + isShowActionButtons: true, + onCancelTap: () => Navigator.pop(context), + onConfirmTap: () => onConfirm(), + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Consumer( + builder: (context, viewModel, _) { + return Column( + children: [ + Expanded( + child: CollapsingListView( + title: "Symptoms Selector".needTranslation, + leadingCallback: () => _buildConfirmationBottomSheet( + context: context, + onConfirm: () => { + context.pop(), + context.pop(), + }), + child: viewModel.isBodySymptomsLoading + ? _buildLoadingShimmer() + : viewModel.organSymptomsResults.isEmpty + ? _buildEmptyState() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + ...viewModel.organSymptomsResults.map((organResult) { + // Find matching organ ID from selected organs + String? organId; + String? organName; + for (var organ in viewModel.selectedOrgans) { + if (organ.name == organResult.name) { + organId = organ.id; + organName = organ.description; + break; + } + } + + if (organId != null && organResult.bodySymptoms != null) { + return Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: _buildSymptomsSelectionCard( + viewModel, + organId, + organName ?? organResult.name ?? '', + organResult.bodySymptoms!, + ), + ); + } + return SizedBox.shrink(); + }), + ], + ), + ), + ), + if (!viewModel.isBodySymptomsLoading) ...[ + _buildStickyBottomCard(context, viewModel), + ], + ], + ); + }, + ), + ); + } + + Widget _buildSymptomsSelectionCard( + SymptomsCheckerViewModel viewModel, + String organId, + String organName, + List symptoms, + ) { + return Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + 'Possible symptoms related to "$organName"', + style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), + ), + ), + ], + ), + SizedBox(height: 24.h), + Wrap( + runSpacing: 12.h, + spacing: 8.w, + children: symptoms.map((symptom) { + final symptomId = symptom.id ?? ''; + final symptomLabel = symptom.getDisplayName(false); // Pass isArabic from AppState if needed + bool isSelected = viewModel.isSymptomSelected(organId, symptomId); + return GestureDetector( + onTap: () => viewModel.toggleSymptomSelection(organId, symptomId), + child: CustomSelectableChip( + label: symptomLabel, + selected: isSelected, + activeColor: AppColors.primaryRedBorderColor, + activeTextColor: AppColors.primaryRedBorderColor, + inactiveBorderColor: AppColors.bottomNAVBorder, + inactiveTextColor: AppColors.textColor, + ), + ); + }).toList(), + ), + ], + ), + ); + } + + Widget _buildLoadingShimmer() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + // Create 2-3 shimmer cards + ...List.generate(3, (index) { + return Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: _buildShimmerCard(), + ); + }), + ], + ); + } + + Widget _buildShimmerCard() { + return Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Shimmer title + Container( + height: 40.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24.r), + ), + ).toShimmer2(isShow: true, radius: 24.r), + SizedBox(height: 16.h), + // Shimmer chips + Wrap( + runSpacing: 12.h, + spacing: 8.w, + children: List.generate(4, (index) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(24.r), + border: Border.all(color: AppColors.bottomNAVBorder, width: 1), + ), + child: Text( + 'Loading..', + style: TextStyle(fontSize: 14.f, color: AppColors.textColor), + ), + ).toShimmer2(isShow: true, radius: 24.r); + }), + ), + ], + ), + ); + } + + Widget _buildEmptyState() { + return Center( + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), + SizedBox(height: 16.h), + Text( + 'No organs selected'.needTranslation, + style: TextStyle( + fontSize: 18.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + SizedBox(height: 8.h), + Text( + 'Please go back and select organs first'.needTranslation, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.f, + color: AppColors.greyTextColor, + ), + ), + ], + ), + ), + ); + } + + Widget _buildStickyBottomCard(BuildContext context, SymptomsCheckerViewModel viewModel) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.h), + Row( + children: [ + Expanded( + child: CustomButton( + text: "Previous".needTranslation, + onPressed: _onPreviousPressed, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + Expanded( + child: CustomButton( + text: "Next".needTranslation, + onPressed: () => _onNextPressed(viewModel), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + SizedBox(height: 24.h), + ], + ).paddingSymmetrical(24.w, 0), + ); + } +} diff --git a/lib/presentation/symptoms_checker/triage_screen.dart b/lib/presentation/symptoms_checker/triage_screen.dart new file mode 100644 index 0000000..ff0482e --- /dev/null +++ b/lib/presentation/symptoms_checker/triage_screen.dart @@ -0,0 +1,286 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/data/triage_questions_data.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/triage_question_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/custom_progress_bar.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; + +class TriageScreen extends StatefulWidget { + const TriageScreen({super.key}); + + @override + State createState() => _TriageScreenState(); +} + +class _TriageScreenState extends State { + late List triageQuestions; + int currentQuestionIndex = 0; + + @override + void initState() { + super.initState(); + triageQuestions = TriageQuestionsData.getSampleTriageQuestions(); + } + + TriageQuestionModel get currentQuestion => triageQuestions[currentQuestionIndex]; + + bool get isFirstQuestion => currentQuestionIndex == 0; + + bool get isLastQuestion => currentQuestionIndex == triageQuestions.length - 1; + + void _onOptionSelected(int optionIndex) { + setState(() { + currentQuestion.selectOption(optionIndex); + }); + } + + void _onPreviousPressed() { + if (!isFirstQuestion) { + setState(() { + currentQuestionIndex--; + }); + } + } + + void _onNextPressed() { + if (currentQuestion.isAnswered) { + currentQuestion.confirmSelection(); + if (isLastQuestion) { + context.navigateWithName(AppRoutes.possibleConditionsScreen); + } else { + setState(() { + currentQuestionIndex++; + }); + } + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Please select an option before proceeding'.needTranslation), + backgroundColor: AppColors.errorColor, + ), + ); + } + } + + _buildConfirmationBottomSheet({required BuildContext context, required VoidCallback onConfirm}) { + return showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getWarningWidget( + loadingText: "Are you sure you want to restart the organ selection?".needTranslation, + isShowActionButtons: true, + onCancelTap: () => Navigator.pop(context), + onConfirmTap: () => onConfirm(), + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Column( + children: [ + Expanded( + child: CollapsingListView( + title: "Triage".needTranslation, + // onLeadingTapped: () => _buildConfirmationBottomSheet( + // context: context, + // onConfirm: () => { + // context.pop(), + // context.pop(), + // }), + + leadingCallback: () => context.pop(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + _buildQuestionCard(), + ], + ), + ), + ), + _buildStickyBottomCard(context), + ], + ), + ); + } + + Widget _buildQuestionCard() { + return AnimatedSwitcher( + duration: const Duration(milliseconds: 400), + transitionBuilder: (Widget child, Animation animation) { + final offsetAnimation = Tween( + begin: const Offset(1.0, 0.0), + end: Offset.zero, + ).animate(CurvedAnimation( + parent: animation, + curve: Curves.easeInOut, + )); + + return SlideTransition( + position: offsetAnimation, + child: FadeTransition( + opacity: animation, + child: child, + ), + ); + }, + child: Container( + key: ValueKey(currentQuestionIndex), + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 20.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + currentQuestion.question.toText16(weight: FontWeight.w500), + SizedBox(height: 24.h), + ...List.generate(currentQuestion.options.length, (index) { + bool selected = currentQuestion.selectedOptionIndex == index; + return _buildOptionItem(index, selected, currentQuestion.options[index].text); + }), + ], + ), + ), + ); + } + + Widget _buildOptionItem(int index, bool selected, String optionText) { + return GestureDetector( + onTap: () => _onOptionSelected(index), + child: Container( + margin: EdgeInsets.only(bottom: 12.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + width: 24.w, + height: 24.w, + decoration: BoxDecoration( + color: selected ? AppColors.primaryRedColor : Colors.transparent, + borderRadius: BorderRadius.circular(5.r), + border: Border.all(color: selected ? AppColors.primaryRedColor : AppColors.checkBoxBorderColor, width: 1.w), + ), + child: selected ? Icon(Icons.check, size: 16.f, color: AppColors.whiteColor) : null, + ), + SizedBox(width: 12.w), + Expanded(child: optionText.toText14(weight: FontWeight.w500)), + ], + ), + ), + ); + } + + Widget _buildStickyBottomCard(BuildContext context) { + final currentScore = TriageQuestionsData.calculateTotalScore(triageQuestions); + final suggestedCondition = TriageQuestionsData.getSuggestedCondition(currentScore); + + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RichText( + text: TextSpan( + text: "Possible symptom: ".needTranslation, + style: TextStyle( + color: AppColors.greyTextColor, + fontWeight: FontWeight.w600, + fontSize: 14.f, + ), + children: [ + TextSpan( + text: suggestedCondition, + style: TextStyle( + color: AppColors.textColor, + fontWeight: FontWeight.w600, + fontSize: 14.f, + ), + ), + ], + ), + ), + SizedBox(height: 16.h), + CustomRoundedProgressBar( + percentage: currentScore, + paddingBetween: 5.h, + color: AppColors.primaryRedColor, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.17), + height: 8.h, + titleWidget: RichText( + text: TextSpan( + text: "$currentScore% ", + style: TextStyle( + color: AppColors.primaryRedColor, + fontWeight: FontWeight.w600, + fontSize: 14.f, + ), + children: [ + TextSpan( + text: "- Symptoms checker finding score".needTranslation, + style: TextStyle( + color: AppColors.textColor, + fontWeight: FontWeight.w500, + fontSize: 13.f, + ), + ), + ], + ), + ), + ), + SizedBox(height: 12.h), + Row( + children: [ + Expanded( + child: CustomButton( + text: "Previous".needTranslation, + onPressed: isFirstQuestion ? () {} : _onPreviousPressed, + isDisabled: isFirstQuestion, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + Expanded( + child: CustomButton( + text: isLastQuestion ? "Finish".needTranslation : "Next".needTranslation, + onPressed: _onNextPressed, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + ], + ), + SizedBox(height: 24.h), + ], + ).paddingSymmetrical(24.w, 0), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection.dart b/lib/presentation/symptoms_checker/user_info_selection.dart new file mode 100644 index 0000000..91f3d36 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection.dart @@ -0,0 +1,274 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +class UserInfoSelectionScreen extends StatefulWidget { + const UserInfoSelectionScreen({super.key}); + + @override + State createState() => _UserInfoSelectionScreenState(); +} + +class _UserInfoSelectionScreenState extends State { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + _initializeUserInfo(); + }); + } + + /// Initialize user info from appState if user is logged in + void _initializeUserInfo() { + final appState = getIt.get(); + final viewModel = context.read(); + + if (appState.isAuthenticated) { + final user = appState.getAuthenticatedUser(); + + if (user == null) return; + + // Populate gender (gender is int: 1=Male, 2=Female) + if (user.gender != null) { + String genderStr = user.gender == 1 + ? "Male" + : user.gender == 2 + ? "Female" + : "Other"; + viewModel.setGender(genderStr); + } + + if (user.dateofBirth != null && user.dateofBirth!.isNotEmpty) { + try { + DateTime dob = DateTime.parse(user.dateofBirth!); + viewModel.setDateOfBirth(dob); + } catch (e) { + // If date parsing fails, ignore and let user fill manually + } + } + + // Note: AuthenticatedUser doesn't have height/weight fields + // User will need to fill these manually + } + // If not authenticated or fields are empty, user will fill them manually + } + + _buildEditInfoTile({ + required String leadingIcon, + required String title, + required String subTitle, + required VoidCallback onTap, + required String trailingIcon, + required BuildContext context, + Color? iconColor, + }) { + return InkWell( + onTap: onTap, + child: Row( + children: [ + Expanded( + child: Row( + children: [ + Container( + height: 40.h, + width: 40.h, + margin: EdgeInsets.only(right: 10.h), + padding: EdgeInsets.all(8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 12.r, color: AppColors.greyColor), + child: Utils.buildSvgWithAssets(icon: leadingIcon, iconColor: iconColor)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.toText16(weight: FontWeight.w500), + subTitle.toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500), + ], + ), + ], + ), + ), + Utils.buildSvgWithAssets(icon: trailingIcon, height: 24.h, width: 24.h), + ], + ), + ); + } + + Widget _getDivider() { + return Divider( + color: AppColors.dividerColor, + ).paddingSymmetrical(0, 16.h); + } + + @override + Widget build(BuildContext context) { + AppState appState = getIt.get(); + + String name = ""; + if (appState.isAuthenticated) { + name = "${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!} "; + } else { + name = "Guest"; + } + + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Consumer( + builder: (context, viewModel, child) { + // Check if any field is empty + bool hasEmptyFields = viewModel.selectedGender == null || + viewModel.selectedAge == null || + viewModel.selectedHeight == null || + viewModel.selectedWeight == null; + + // Get display values + String genderText = viewModel.selectedGender ?? "Not set"; + // Show age calculated from DOB, not the DOB itself + String ageText = viewModel.selectedAge != null ? "${viewModel.selectedAge} Years" : "Not set"; + String heightText = + viewModel.selectedHeight != null ? "${viewModel.selectedHeight!.round()} ${viewModel.isHeightCm ? 'cm' : 'ft'}" : "Not set"; + String weightText = + viewModel.selectedWeight != null ? "${viewModel.selectedWeight!.round()} ${viewModel.isWeightKg ? 'kg' : 'lbs'}" : "Not set"; + + return Column( + children: [ + Expanded( + child: CollapsingListView( + title: "Symptoms Checker".needTranslation, + isLeading: true, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), + child: Column( + children: [ + "Hello $name, Is your information up to date?".needTranslation.toText18( + weight: FontWeight.w600, + color: AppColors.textColor, + ), + SizedBox(height: 24.h), + _buildEditInfoTile( + context: context, + leadingIcon: AppAssets.genderIcon, + title: "Gender".needTranslation, + subTitle: genderText, + onTap: () { + viewModel.setUserInfoPage(0, isSinglePageEdit: true); + context.navigateWithName(AppRoutes.userInfoFlowManager); + }, + trailingIcon: AppAssets.edit_icon, + ), + _getDivider(), + _buildEditInfoTile( + context: context, + leadingIcon: AppAssets.calendarGrey, + title: "Age".needTranslation, + subTitle: ageText, + iconColor: AppColors.greyTextColor, + onTap: () { + viewModel.setUserInfoPage(1, isSinglePageEdit: true); + context.navigateWithName(AppRoutes.userInfoFlowManager); + }, + trailingIcon: AppAssets.edit_icon, + ), + _getDivider(), + _buildEditInfoTile( + context: context, + leadingIcon: AppAssets.rulerIcon, + title: "Height".needTranslation, + subTitle: heightText, + onTap: () { + viewModel.setUserInfoPage(2, isSinglePageEdit: true); + context.navigateWithName(AppRoutes.userInfoFlowManager); + }, + trailingIcon: AppAssets.edit_icon, + ), + _getDivider(), + _buildEditInfoTile( + context: context, + leadingIcon: AppAssets.weightScale, + title: "Weight".needTranslation, + subTitle: weightText, + onTap: () { + viewModel.setUserInfoPage(3, isSinglePageEdit: true); + context.navigateWithName(AppRoutes.userInfoFlowManager); + }, + trailingIcon: AppAssets.edit_icon, + ), + ], + ), + ), + ], + ).paddingAll(24.w), + ), + ), + ), + _buildBottomCard(context, hasEmptyFields), + ], + ); + }, + ), + ); + } + + Widget _buildBottomCard(BuildContext context, bool hasEmptyFields) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: SafeArea( + top: false, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 24.h), + Row( + children: [ + Expanded( + child: CustomButton( + text: "No, Edit all".needTranslation, + icon: AppAssets.edit_icon, + iconColor: AppColors.primaryRedColor, + onPressed: () { + context.read().setUserInfoPage(0, isSinglePageEdit: false); + context.navigateWithName(AppRoutes.userInfoFlowManager); + }, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + Expanded( + child: CustomButton( + text: "Yes, It is".needTranslation, + icon: AppAssets.tickIcon, + iconColor: hasEmptyFields ? AppColors.greyTextColor : AppColors.whiteColor, + onPressed: hasEmptyFields + ? () {} // Empty function for disabled state + : () => context.navigateWithName(AppRoutes.organSelectorPage), + backgroundColor: hasEmptyFields ? AppColors.greyLightColor : AppColors.primaryRedColor, + borderColor: hasEmptyFields ? AppColors.greyLightColor : AppColors.primaryRedColor, + textColor: hasEmptyFields ? AppColors.greyTextColor : AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + ], + ).paddingSymmetrical(24.w, 0), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart new file mode 100644 index 0000000..d73f387 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart @@ -0,0 +1,47 @@ +import 'dart:developer'; + +import 'package:flutter/cupertino.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +/// Age selection page content +class AgeSelectionPage extends StatelessWidget { + final int? selectedAge; + final Function(int) onAgeSelected; + + const AgeSelectionPage({ + super.key, + required this.selectedAge, + required this.onAgeSelected, + }); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Consumer( + builder: (BuildContext context, symptomsViewModel, Widget? child) { + return Column( + children: [ + "What is your Date of Birth?".needTranslation.toText18(weight: FontWeight.w600, color: AppColors.textColor).paddingAll(24.w), + SizedBox(height: 30.h), + ThreeColumnDatePicker( + enableHaptic: true, + enableSound: true, + initialDate: symptomsViewModel.dateOfBirth ?? DateTime(2000, 1, 1), + onDateChanged: (date) { + symptomsViewModel.setDateOfBirth(date); + log('DOB saved: $date, Age: ${symptomsViewModel.selectedAge}'); + }, + ) + ], + ); + }, + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart new file mode 100644 index 0000000..85cb6e2 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +/// Gender selection page content +class GenderSelectionPage extends StatelessWidget { + final String? selectedGender; + final Function(String) onGenderSelected; + + GenderSelectionPage({ + super.key, + required this.selectedGender, + required this.onGenderSelected, + }); + + _buildGenderOption(String iconPng, String label, bool isSelected) { + return Container( + height: 160.h, + width: 160.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, borderRadius: 24.r, side: isSelected ? BorderSide(color: AppColors.primaryRedColor, width: 2.5) : null), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Utils.buildImgWithAssets(icon: iconPng, height: 80.h, width: 80.h, fit: BoxFit.contain), + SizedBox(height: 8.h), + label.toText16( + weight: FontWeight.w500, + ) + ], + ), + ); + } + + final genders = ["Male", "Female"]; + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: EdgeInsets.all(24.w), + child: Consumer( + builder: (BuildContext context, symptomsViewModel, Widget? child) { + return Column( + children: [ + "What is your gender?".needTranslation.toText18(weight: FontWeight.w600, color: AppColors.textColor), + SizedBox(height: 70.h), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () => onGenderSelected(genders[0]), + child: _buildGenderOption(AppAssets.maleIcon, "Male".needTranslation, symptomsViewModel.selectedGender == genders[0]), + ), + ), + SizedBox(width: 16.w), + Expanded( + child: InkWell( + onTap: () => onGenderSelected(genders[1]), + child: _buildGenderOption(AppAssets.femaleIcon, "Female".needTranslation, symptomsViewModel.selectedGender == genders[1]), + )) + ], + ), + ], + ); + }, + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart new file mode 100644 index 0000000..0744e81 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart @@ -0,0 +1,174 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/height_scale.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +/// Height selection page content +class HeightSelectionPage extends StatelessWidget { + const HeightSelectionPage({super.key}); + + Widget _unitSelector(SymptomsCheckerViewModel viewModel) { + return Container( + height: 54.h, + padding: EdgeInsets.all(4.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(10.r), + ), + child: LayoutBuilder( + builder: (context, constraints) { + final tabWidth = (constraints.maxWidth - 8.w) / 2; + return Stack( + children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + width: tabWidth, + height: constraints.maxHeight, + margin: EdgeInsets.only(left: viewModel.isHeightCm ? 0 : tabWidth + 8.w), + decoration: BoxDecoration( + color: AppColors.bottomNAVBorder, + borderRadius: BorderRadius.circular(7.r), + ), + ), + // Tab buttons + Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + if (!viewModel.isHeightCm) { + final convertedHeight = viewModel.selectedHeight! * 30.48; + viewModel.setHeight(convertedHeight, true); + } + }, + child: Container( + alignment: Alignment.center, + color: Colors.transparent, + child: Text( + 'CM', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 14.f, + color: viewModel.isHeightCm ? AppColors.textColor : AppColors.textColor.withValues(alpha: 0.6), + ), + ), + ), + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + if (viewModel.isHeightCm) { + final convertedHeight = viewModel.selectedHeight! / 30.48; + viewModel.setHeight(convertedHeight, false); + } + }, + child: Container( + alignment: Alignment.center, + color: Colors.transparent, + child: Text( + 'FT', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 14.f, + color: !viewModel.isHeightCm ? AppColors.textColor : AppColors.textColor.withValues(alpha: 0.6), + ), + ), + ), + ), + ), + ], + ), + ], + ); + }, + ), + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + // Define min/max values based on unit + final minValue = viewModel.isHeightCm ? 50.0 : 1.6; // 50cm or 1.6ft (approx. 1'7") + final maxValue = viewModel.isHeightCm ? 280.0 : 9.2; // 280cm or 9.2ft (approx. 9'2") + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + Center( + child: Text( + 'How tall are you?'.needTranslation, + style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), + ), + ), + SizedBox(height: 24.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: _unitSelector(viewModel), + ), + SizedBox(height: 20.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Spacer(flex: 1), + Expanded( + flex: 3, + child: Consumer( + builder: (context, viewModel, child) { + return Text.rich( + TextSpan( + children: [ + TextSpan( + text: + viewModel.isHeightCm ? viewModel.selectedHeight?.round().toString() : viewModel.selectedHeight?.toStringAsFixed(1), + style: TextStyle( + fontSize: 90.f, + color: AppColors.textColor, + height: 1, + ), + ), + TextSpan( + text: viewModel.isHeightCm ? 'cm' : 'ft', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 24.f, + ), + ), + ], + ), + ).paddingOnly(bottom: 100.h, left: 20.w); + }, + ), + ), + Expanded( + child: HeightScale( + enableHaptic: true, + enableSound: true, + minValue: minValue, + maxValue: maxValue, + initialHeight: viewModel.selectedHeight ?? 100, + isCm: viewModel.isHeightCm, + onHeightChanged: (newHeight) { + log("height: $newHeight"); + viewModel.setHeight(newHeight, viewModel.isHeightCm); + }, + ), + ), + ], + ), + ], + ); + }, + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart new file mode 100644 index 0000000..1d38a91 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart @@ -0,0 +1,162 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/weight_scale.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +/// Weight selection page content +class WeightSelectionPage extends StatelessWidget { + final Function(double, bool) onWeightChanged; + + const WeightSelectionPage({super.key, required this.onWeightChanged}); + + Widget _unitSelector(SymptomsCheckerViewModel viewModel) { + bool isKg = viewModel.isWeightKg; + return Container( + height: 54.h, + padding: EdgeInsets.all(4.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(10.r), + ), + child: LayoutBuilder( + builder: (context, constraints) { + final tabWidth = (constraints.maxWidth - 8.w) / 2; + return Stack( + children: [ + // Animated sliding indicator + AnimatedContainer( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + width: tabWidth, + height: constraints.maxHeight, + margin: EdgeInsets.only(left: isKg ? 0 : tabWidth + 8.w), + decoration: BoxDecoration( + color: AppColors.bottomNAVBorder, + borderRadius: BorderRadius.circular(7.r), + ), + ), + // Tab buttons + Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + if (!isKg) { + // Convert from LBS to KG (1 lb = 0.453592 kg) + final convertedWeight = viewModel.selectedWeight! / 2.20462; + Future.microtask(() => onWeightChanged(convertedWeight, true)); + } + }, + child: Container( + alignment: Alignment.center, + color: Colors.transparent, + child: Text( + 'KG', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 14.f, + color: isKg ? AppColors.textColor : AppColors.textColor.withValues(alpha: 0.6), + ), + ), + ), + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + if (isKg) { + // Convert from KG to LBS (1 kg = 2.20462 lbs) + final convertedWeight = viewModel.selectedWeight! * 2.20462; + Future.microtask(() => onWeightChanged(convertedWeight, false)); + } + }, + child: Container( + alignment: Alignment.center, + color: Colors.transparent, + child: Text( + 'LBS', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 14.f, + color: !isKg ? AppColors.textColor : AppColors.textColor.withValues(alpha: 0.6), + ), + ), + ), + ), + ), + ], + ), + ], + ); + }, + ), + ); + } + + @override + Widget build(BuildContext context) { + return Consumer(builder: (context, viewModel, child) { + bool isKg = viewModel.isWeightKg; + // Define min/max values based on unit + final minValue = isKg ? 10.0 : 22.0; // 10kg or 22lbs + final maxValue = isKg ? 200.0 : 440.0; // 200kg or 440lbs + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + Center( + child: Text( + 'What is your weight?'.needTranslation, + style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), + ), + ), + SizedBox(height: 24.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: _unitSelector(viewModel), + ), + SizedBox(height: 60.h), + // Weight display centered + Center( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + viewModel.selectedWeight!.round().toString(), + style: TextStyle(fontSize: 100.f, color: AppColors.textColor, height: 1), + ), + SizedBox(width: 8.w), + Text( + isKg ? 'kg' : 'lbs', + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 24.f), + ).paddingOnly(bottom: 10.h), + ], + ), + ), + SizedBox(height: 40.h), + // Horizontal weight picker + WeightScale( + enableHaptic: true, + enableSound: true, + minValue: minValue, + maxValue: maxValue, + initialWeight: viewModel.selectedWeight!, + isKg: isKg, + onWeightChanged: (newWeight) { + log("weight: $newWeight"); + Future.microtask(() => onWeightChanged(newWeight, isKg)); + }, + ), + ], + ); + }); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart b/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart new file mode 100644 index 0000000..523470e --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart @@ -0,0 +1,276 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +/// Manages the user info selection flow with PageView +/// Only the page content changes, header and footer remain fixed +class UserInfoFlowManager extends StatefulWidget { + const UserInfoFlowManager({super.key}); + + @override + State createState() => _UserInfoFlowManagerState(); +} + +class _UserInfoFlowManagerState extends State { + late PageController _pageController; + late SymptomsCheckerViewModel _viewModel; + + // Page titles + final List _pageTitles = [ + "Your Gender", + "Your Birth Date", + "Your Height", + "Your Weight", + ]; + + @override + void initState() { + super.initState(); + _viewModel = context.read(); + // Initialize PageController with the current page from ViewModel + _pageController = PageController(initialPage: _viewModel.userInfoCurrentPage); + } + + @override + void dispose() { + _pageController.dispose(); + super.dispose(); + } + + void _onNext() { + // If in single page edit mode, just save and go back + if (_viewModel.isSinglePageEditMode) { + context.pop(); + return; + } + + // Otherwise, continue with normal flow + if (_viewModel.userInfoCurrentPage < 3) { + _viewModel.nextUserInfoPage(); + _pageController.animateToPage( + _viewModel.userInfoCurrentPage, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + } else { + _submitUserInfo(); + } + } + + void _onPrevious() { + if (_viewModel.userInfoCurrentPage > 0) { + _viewModel.previousUserInfoPage(); + _pageController.animateToPage( + _viewModel.userInfoCurrentPage, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + } else { + context.pop(); + } + } + + void _submitUserInfo() { + final userInfo = _viewModel.getUserInfoData(); + + // Log user info + log('User Info Submitted:'); + log('Gender: ${userInfo['gender']}'); + log('Age: ${userInfo['age']}'); + log('Height: ${userInfo['height']} ${userInfo['heightUnit']}'); + log('Weight: ${userInfo['weight']} ${userInfo['weightUnit']}'); + + // TODO: Save user info to backend/storage + + // Navigate to symptoms checker or next screen + context.pop(); + } + + Widget _buildProgressBar() { + return Consumer( + builder: (BuildContext context, viewModel, child) { + return Row( + children: List.generate(4, (index) { + final isCompleted = index < viewModel.userInfoCurrentPage; + final isCurrentStep = index == viewModel.userInfoCurrentPage; + + return Expanded( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 6.w), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.r), + child: Stack( + children: [ + // Background (grey) + Container( + height: 4.h, + decoration: BoxDecoration( + color: AppColors.greyLightColor, + borderRadius: BorderRadius.circular(8.r), + ), + ), + // Animated red fill from left to right + TweenAnimationBuilder( + duration: const Duration(milliseconds: 400), + curve: Curves.easeInOut, + tween: Tween( + begin: 0.0, + end: isCompleted + ? 1.0 + : isCurrentStep + ? 1.0 + : 0.0, + ), + builder: (context, value, child) { + return FractionallySizedBox( + alignment: Alignment.centerLeft, + widthFactor: value, + child: Container( + height: 4.h, + decoration: BoxDecoration( + color: AppColors.primaryRedColor, + borderRadius: BorderRadius.circular(8.r), + boxShadow: isCurrentStep && value > 0 + ? [ + BoxShadow( + color: AppColors.primaryRedColor.withValues(alpha: 0.4), + blurRadius: 8.r, + spreadRadius: 1.r, + ), + ] + : null, + ), + ), + ); + }, + ), + ], + ), + ), + ), + ); + }), + ); + }, + ); + } + + Widget _buildStickyBottomCard() { + return Consumer(builder: (BuildContext context, viewModel, child) { + bool isLastPage = viewModel.isUserInfoLastPage; + bool isFirstPage = viewModel.isUserInfoFirstPage; + bool isSingleEdit = viewModel.isSinglePageEditMode; + + return Container( + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.vertical(top: Radius.circular(24.r)), + ), + padding: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h), + child: SafeArea( + top: false, + child: isSingleEdit + ? // Single page edit mode - show only Save button + CustomButton( + text: "Save".needTranslation, + onPressed: _onNext, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ) + : // Complete flow mode - show Previous/Next buttons + Row( + children: [ + if (!isFirstPage) ...[ + Expanded( + child: CustomButton( + text: "Previous".needTranslation, + onPressed: _onPrevious, + backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + ), + ), + SizedBox(width: 12.w), + ], + Expanded( + child: CustomButton( + text: isLastPage ? "Submit".needTranslation : "Next".needTranslation, + onPressed: _onNext, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ), + ], + ), + ), + ); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: Column( + children: [ + Expanded( + child: CollapsingListView( + physics: NeverScrollableScrollPhysics(), + title: _pageTitles[_viewModel.userInfoCurrentPage].needTranslation, + isLeading: true, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + // Only show progress bar in complete flow mode + if (!_viewModel.isSinglePageEditMode) _buildProgressBar(), + if (!_viewModel.isSinglePageEditMode) SizedBox(height: 24.h), + SizedBox( + height: 600.h, + child: PageView( + controller: _pageController, + physics: const NeverScrollableScrollPhysics(), // Disable swipe + onPageChanged: (index) { + _viewModel.setUserInfoPage(index); + }, + children: [ + GenderSelectionPage( + selectedGender: _viewModel.selectedGender, + onGenderSelected: _viewModel.setGender, + ), + AgeSelectionPage( + selectedAge: _viewModel.selectedAge, + onAgeSelected: _viewModel.setAge, + ), + HeightSelectionPage(), + WeightSelectionPage(onWeightChanged: _viewModel.setWeight), + ], + ), + ), + ], + ), + ), + ), + _buildStickyBottomCard(), + ], + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart b/lib/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart new file mode 100644 index 0000000..98051e0 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart @@ -0,0 +1,235 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class ThreeColumnDatePicker extends StatefulWidget { + final DateTime initialDate; + final ValueChanged? onDateChanged; + + // Feedback config + final bool enableHaptic; + final bool enableSound; + final Duration feedbackDebounce; + + const ThreeColumnDatePicker({ + super.key, + required this.initialDate, + this.onDateChanged, + this.enableHaptic = true, + this.enableSound = true, + this.feedbackDebounce = const Duration(milliseconds: 80), + }); + + @override + State createState() => _ThreeColumnDatePickerState(); +} + +class _ThreeColumnDatePickerState extends State { + static const int yearRange = 100; + static const double _defaultItemExtent = 48.0; // will be scaled with .h + + late final List _days; + late final List _months; + late final List _years; + + late FixedExtentScrollController _dayController; + late FixedExtentScrollController _monthController; + late FixedExtentScrollController _yearController; + + int _selectedDay = 0; + int _selectedMonth = 0; + int _selectedYearIndex = 0; + + // Debounce timer used for playing feedback only after small pause + Timer? _feedbackTimer; + + double get _itemExtent => _defaultItemExtent.h; + + @override + void initState() { + super.initState(); + + _days = List.generate(31, (i) => (i + 1).toString().padLeft(2, '0')); + _months = const ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + final currentYear = DateTime.now().year; + _years = List.generate(yearRange, (i) => currentYear - i); + + _selectedDay = (widget.initialDate.day - 1).clamp(0, _days.length - 1); + _selectedMonth = (widget.initialDate.month - 1).clamp(0, _months.length - 1); + _selectedYearIndex = _years.indexOf(widget.initialDate.year); + if (_selectedYearIndex == -1) _selectedYearIndex = 0; + + _dayController = FixedExtentScrollController(initialItem: _selectedDay); + _monthController = FixedExtentScrollController(initialItem: _selectedMonth); + _yearController = FixedExtentScrollController(initialItem: _selectedYearIndex); + } + + @override + void dispose() { + _feedbackTimer?.cancel(); + _dayController.dispose(); + _monthController.dispose(); + _yearController.dispose(); + super.dispose(); + } + + void _emitDate() { + final day = int.parse(_days[_selectedDay]); + final month = _selectedMonth + 1; + final year = _years[_selectedYearIndex]; + final date = DateTime(year, month, day); + widget.onDateChanged?.call(date); + } + + // Schedule haptic + sound feedback with debounce (prevents spamming during fling) + void _scheduleFeedback() { + if (!(widget.enableHaptic || widget.enableSound)) return; + + _feedbackTimer?.cancel(); + _feedbackTimer = Timer(widget.feedbackDebounce, () { + // Haptic + if (widget.enableHaptic) { + // selection click is lightweight and appropriate for wheel ticks + HapticFeedback.selectionClick(); + } + // Sound + if (widget.enableSound) { + // simple system click - note: may be muted by device settings + SystemSound.play(SystemSoundType.click); + } + }); + } + + Widget _wheel({ + required FixedExtentScrollController controller, + required int itemCount, + required Widget Function(int index, bool selected) itemBuilder, + required ValueChanged onSelectedItemChanged, + required int currentlySelectedIndex, + }) { + return Expanded( + child: SizedBox( + height: _itemExtent * 5, // show ~5 rows + child: ListWheelScrollView.useDelegate( + controller: controller, + itemExtent: _itemExtent, + physics: const BouncingScrollPhysics(), + diameterRatio: 2.2, + squeeze: 1.2, + perspective: 0.004, + // overAndUnderCenterOpacity: 0.6, + onSelectedItemChanged: (i) { + // update selected index, emit date and schedule feedback + onSelectedItemChanged(i); + _scheduleFeedback(); + }, + childDelegate: ListWheelChildBuilderDelegate( + builder: (context, index) { + if (index < 0 || index >= itemCount) return null; + final bool selected = index == currentlySelectedIndex; + return Center(child: itemBuilder(index, selected)); + }, + childCount: itemCount, + ), + ), + ), + ); + } + + Widget _styledText(String text, bool selected) { + return Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: selected ? 22.f : 20.f, + fontWeight: selected ? FontWeight.w600 : FontWeight.w500, + color: selected ? AppColors.textColor : AppColors.greyTextColor.withValues(alpha: 0.9), + height: 1.0, + letterSpacing: selected ? -0.02 * 30 : -0.02 * 18, + ), + ); + } + + @override + Widget build(BuildContext context) { + final pickerHeight = _itemExtent * 5; + final pointerSize = 20.w; + final pointerTop = (pickerHeight / 2) - (pointerSize / 2); + + return LayoutBuilder(builder: (context, constraints) { + return SizedBox( + height: pickerHeight, + child: Stack( + children: [ + Row( + children: [ + // Day wheel + _wheel( + controller: _dayController, + itemCount: _days.length, + currentlySelectedIndex: _selectedDay, + onSelectedItemChanged: (i) { + setState(() => _selectedDay = i); + _emitDate(); + }, + itemBuilder: (index, selected) => _styledText(_days[index], selected), + ), + + // Month wheel + _wheel( + controller: _monthController, + itemCount: _months.length, + currentlySelectedIndex: _selectedMonth, + onSelectedItemChanged: (i) { + setState(() => _selectedMonth = i); + _emitDate(); + }, + itemBuilder: (index, selected) => _styledText(_months[index], selected), + ), + + // Year wheel + _wheel( + controller: _yearController, + itemCount: _years.length, + currentlySelectedIndex: _selectedYearIndex, + onSelectedItemChanged: (i) { + setState(() => _selectedYearIndex = i); + _emitDate(); + }, + itemBuilder: (index, selected) => _styledText(_years[index].toString(), selected), + ), + ], + ), + + // subtle center overlay (optional — keeps layout consistent & highlights center row) + Positioned.fill( + child: IgnorePointer( + child: Center( + child: SizedBox( + height: _itemExtent, + ), + ), + ), + ), + + // left red triangular pointer aligned to center row + Positioned( + left: 0.w, + top: pointerTop, + child: TriangleIndicator( + pointerSize: pointerSize, + // your TriangleIndicator supports direction param; use left as in the original + // if your TriangleIndicator doesn't accept direction, remove the param + direction: TriangleDirection.left, + ), + ), + ], + ), + ); + }); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/widgets/height_scale.dart b/lib/presentation/symptoms_checker/user_info_selection/widgets/height_scale.dart new file mode 100644 index 0000000..29baf64 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/widgets/height_scale.dart @@ -0,0 +1,169 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class HeightScale extends StatefulWidget { + final double minValue; + final double maxValue; + final double initialHeight; + final bool isCm; + final ValueChanged? onHeightChanged; + + // Feedback config + final bool enableHaptic; + final bool enableSound; + final Duration feedbackDebounce; + + const HeightScale({ + super.key, + required this.minValue, + required this.maxValue, + required this.initialHeight, + required this.isCm, + this.onHeightChanged, + this.enableHaptic = true, + this.enableSound = true, + this.feedbackDebounce = const Duration(milliseconds: 80), + }); + + @override + State createState() => _HeightScaleState(); +} + +class _HeightScaleState extends State { + late FixedExtentScrollController _scrollController; + + // Debounce timer used for playing feedback only after small pause + Timer? _feedbackTimer; + + // Get increment based on unit (CM = 1.0, FT = 0.1) + double get _increment => widget.isCm ? 1.0 : 0.1; + + @override + void initState() { + super.initState(); + int initialIndex = ((widget.initialHeight - widget.minValue) / _increment).round(); + _scrollController = FixedExtentScrollController(initialItem: initialIndex); + } + + // Schedule haptic + sound feedback with debounce (prevents spamming during fling) + void _scheduleFeedback() { + if (!(widget.enableHaptic || widget.enableSound)) return; + + _feedbackTimer?.cancel(); + _feedbackTimer = Timer(widget.feedbackDebounce, () { + // Haptic + if (widget.enableHaptic) { + // selection click is lightweight and appropriate for wheel ticks + HapticFeedback.selectionClick(); + } + // Sound + if (widget.enableSound) { + // simple system click - note: may be muted by device settings + SystemSound.play(SystemSoundType.click); + } + }); + } + + @override + void dispose() { + _feedbackTimer?.cancel(); + _scrollController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final pointerSize = 20.w; + final pickerHeight = 300.h; + final pointerTop = (pickerHeight / 2) - (pointerSize / 2); + + return SizedBox( + height: pickerHeight, + child: Stack( + children: [ + // Scrollable wheel picker + ListWheelScrollView.useDelegate( + controller: _scrollController, + itemExtent: 10.h, + diameterRatio: 2.0, + squeeze: 1.2, + perspective: 0.001, + physics: const BouncingScrollPhysics(), + onSelectedItemChanged: (index) { + final selectedValue = widget.minValue + (index * _increment); + widget.onHeightChanged?.call(selectedValue); + _scheduleFeedback(); + }, + childDelegate: ListWheelChildBuilderDelegate( + childCount: ((widget.maxValue - widget.minValue) / _increment).round() + 1, + builder: (context, index) { + final height = widget.minValue + (index * _increment); + + // For CM: main mark every 10, mid mark every 5 + // For FT: main mark every 1.0 (10 ticks), mid mark every 0.5 (5 ticks) + final isMainMark = widget.isCm ? height % 10 == 0 : (height * 10).round() % 10 == 0; + final isMidMark = widget.isCm ? height % 5 == 0 : (height * 10).round() % 5 == 0; + + return SizedBox( + width: 100.w, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + // Number label for main marks + if (isMainMark) + SizedBox( + width: 30.w, + child: Text( + widget.isCm ? height.round().toString() : height.toStringAsFixed(1), + style: TextStyle( + fontSize: 11.f, + color: AppColors.greyTextColor, + fontWeight: FontWeight.w500, + height: 1, + ), + textAlign: TextAlign.right, + ), + ) + else + SizedBox(width: 30.w), + SizedBox(width: 4.w), + // Ruler mark + Container( + width: isMainMark + ? 40.w + : isMidMark + ? 30.w + : 25.w, + height: isMainMark || isMidMark ? 2.5.h : 1.5.h, + decoration: BoxDecoration( + color: isMainMark + ? AppColors.textColor + : isMidMark + ? AppColors.textColorLight + : AppColors.textColorLight.withValues(alpha: 0.5), + borderRadius: BorderRadius.circular(2.r), + ), + ), + ], + ), + ); + }, + ), + ), + // Triangle indicator pointing to selected value + Positioned( + right: 0, + top: pointerTop, + child: TriangleIndicator(pointerSize: pointerSize), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart b/lib/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart new file mode 100644 index 0000000..429279d --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart @@ -0,0 +1,85 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +enum TriangleDirection { left, right, up, down } + +class TriangleIndicator extends StatelessWidget { + final double pointerSize; + final Color? color; + final TriangleDirection direction; + + const TriangleIndicator({ + super.key, + required this.pointerSize, + this.color, + this.direction = TriangleDirection.right, + }); + + @override + Widget build(BuildContext context) { + return CustomPaint( + size: Size(pointerSize, pointerSize), + painter: _TrianglePainter( + color: color ?? AppColors.primaryRedColor, + direction: direction, + ), + ); + } +} + +class _TrianglePainter extends CustomPainter { + final Color color; + final TriangleDirection direction; + + _TrianglePainter({required this.color, required this.direction}); + + @override + void paint(Canvas canvas, Size size) { + final paint = Paint() + ..color = color + ..style = PaintingStyle.fill + ..isAntiAlias = true; + + final path = Path(); + final w = size.width; + final h = size.height; + + switch (direction) { + case TriangleDirection.right: + // apex on the right, base on the left + path.moveTo(0, h / 2); + path.lineTo(w, 0); + path.lineTo(w, h); + path.close(); + break; + case TriangleDirection.left: + // apex on the left, base on the right + path.moveTo(w, h / 2); + path.lineTo(0, 0); + path.lineTo(0, h); + path.close(); + break; + case TriangleDirection.up: + // apex on top, base on bottom + path.moveTo(w / 2, 0); + path.lineTo(0, h); + path.lineTo(w, h); + path.close(); + break; + case TriangleDirection.down: + // apex on bottom, base on top + path.moveTo(w / 2, h); + path.lineTo(0, 0); + path.lineTo(w, 0); + path.close(); + break; + } + + canvas.drawPath(path, paint); + } + + @override + bool shouldRepaint(covariant _TrianglePainter oldDelegate) { + return oldDelegate.color != color || oldDelegate.direction != direction; + } +} diff --git a/lib/presentation/symptoms_checker/user_info_selection/widgets/weight_scale.dart b/lib/presentation/symptoms_checker/user_info_selection/widgets/weight_scale.dart new file mode 100644 index 0000000..8526a52 --- /dev/null +++ b/lib/presentation/symptoms_checker/user_info_selection/widgets/weight_scale.dart @@ -0,0 +1,180 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/triangle_indicator.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class WeightScale extends StatefulWidget { + final double minValue; + final double maxValue; + final double initialWeight; + final bool isKg; + final ValueChanged? onWeightChanged; + + // Feedback config + final bool enableHaptic; + final bool enableSound; + final Duration feedbackDebounce; + + const WeightScale({ + super.key, + required this.minValue, + required this.maxValue, + required this.initialWeight, + required this.isKg, + this.onWeightChanged, + this.enableHaptic = true, + this.enableSound = true, + this.feedbackDebounce = const Duration(milliseconds: 80), + }); + + @override + State createState() => _WeightScaleState(); +} + +class _WeightScaleState extends State { + late ScrollController _scrollController; + + // Debounce timer used for playing feedback only after small pause + Timer? _feedbackTimer; + + int? _lastReportedIndex; + final double _itemWidth = 8.0; // Width per weight unit + + @override + void initState() { + super.initState(); + int initialIndex = (widget.initialWeight - widget.minValue).round(); + final initialOffset = initialIndex * _itemWidth; + _scrollController = ScrollController(initialScrollOffset: initialOffset); + _scrollController.addListener(_onScroll); + } + + void _onScroll() { + if (!_scrollController.hasClients) return; + + final offset = _scrollController.offset; + final index = (offset / _itemWidth).round(); + final maxIndex = (widget.maxValue - widget.minValue).round(); + + if (index != _lastReportedIndex && index >= 0 && index <= maxIndex) { + _lastReportedIndex = index; + final selectedValue = widget.minValue + index; + widget.onWeightChanged?.call(selectedValue); + _scheduleFeedback(); + } + } + + // Schedule haptic + sound feedback with debounce (prevents spamming during fling) + void _scheduleFeedback() { + if (!(widget.enableHaptic || widget.enableSound)) return; + + _feedbackTimer?.cancel(); + _feedbackTimer = Timer(widget.feedbackDebounce, () { + // Haptic + if (widget.enableHaptic) { + // selection click is lightweight and appropriate for wheel ticks + HapticFeedback.selectionClick(); + } + // Sound + if (widget.enableSound) { + // simple system click - note: may be muted by device settings + SystemSound.play(SystemSoundType.click); + } + }); + } + + @override + void dispose() { + _feedbackTimer?.cancel(); + _scrollController.removeListener(_onScroll); + _scrollController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final pointerSize = 20.h; + final pickerHeight = 100.h; + final itemCount = (widget.maxValue - widget.minValue).round() + 1; + + return SizedBox( + height: pickerHeight, + child: Stack( + alignment: Alignment.center, + children: [ + // Horizontal scrollable ruler with gradient fade + ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + physics: const BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: MediaQuery.of(context).size.width / 2), + itemCount: itemCount, + itemBuilder: (context, index) { + final weight = (widget.minValue + index).round(); + final isMainMark = weight % 10 == 0; + final isMidMark = weight % 5 == 0; + + return SizedBox( + width: _itemWidth, + child: Stack( + alignment: Alignment.bottomCenter, + clipBehavior: Clip.none, + children: [ + // Ruler mark (vertical line) + Positioned( + bottom: 0, + child: Container( + width: isMainMark || isMidMark ? 2.5.w : 1.5.w, + height: isMainMark + ? 40.h + : isMidMark + ? 30.h + : 25.h, + decoration: BoxDecoration( + color: isMainMark + ? AppColors.textColor + : isMidMark + ? AppColors.textColorLight + : AppColors.textColorLight.withValues(alpha: 0.5), + borderRadius: BorderRadius.circular(2.r), + ), + ), + ), + // Number label for main marks + if (isMainMark) + Positioned( + bottom: 45.h, + child: Text( + weight.toString(), + style: TextStyle( + fontSize: 11.f, + color: AppColors.greyTextColor, + fontWeight: FontWeight.w500, + height: 1, + ), + textAlign: TextAlign.center, + maxLines: 1, + overflow: TextOverflow.visible, + ), + ), + ], + ), + ); + }, + ), + // Triangle indicator pointing to selected value + Positioned( + bottom: 0, + child: TriangleIndicator( + pointerSize: pointerSize, + direction: TriangleDirection.up, + ), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/condition_card.dart b/lib/presentation/symptoms_checker/widgets/condition_card.dart new file mode 100644 index 0000000..87a8f3d --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/condition_card.dart @@ -0,0 +1,199 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/custom_progress_bar.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; + +class ConditionCard extends StatelessWidget { + final IconData icon; + final String title; + final int percentage; + final String tagText; + final String clinic; + final List symptoms; + final String description; + final String? monitorNote; + final String? appointmentLabel; + final PossibleConditionsSeverityEnum possibleConditionsSeverityEnum; + final VoidCallback? onActionPressed; + + const ConditionCard({ + super.key, + required this.icon, + required this.title, + required this.percentage, + required this.tagText, + required this.clinic, + required this.symptoms, + required this.description, + this.monitorNote, + this.appointmentLabel, + required this.possibleConditionsSeverityEnum, + this.onActionPressed, + }); + + Color getChipColorBySeverityEnum(PossibleConditionsSeverityEnum possibleConditionsSeverityEnum) { + switch (possibleConditionsSeverityEnum) { + case PossibleConditionsSeverityEnum.seekMedicalAdvice: + return AppColors.chipColorSeekMedicalAdvice; + case PossibleConditionsSeverityEnum.monitorOnly: + return AppColors.chipColorMonitor; + case PossibleConditionsSeverityEnum.emergency: + return AppColors.chipColorEmergency; + } + } + + Color getChipTextColorBySeverityEnum(PossibleConditionsSeverityEnum possibleConditionsSeverityEnum) { + switch (possibleConditionsSeverityEnum) { + case PossibleConditionsSeverityEnum.seekMedicalAdvice: + return AppColors.chipTextColorSeekMedicalAdvice; + case PossibleConditionsSeverityEnum.monitorOnly: + return AppColors.chipColorMonitor; + case PossibleConditionsSeverityEnum.emergency: + return AppColors.chipColorEmergency; + } + } + + _buildSymptomsRow() { + return Wrap( + spacing: 6.w, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + for (int i = 0; i < symptoms.length; i++) ...[ + Text(symptoms[i], style: TextStyle(color: AppColors.greyTextColor, fontWeight: FontWeight.w500, fontSize: 12.f)), + if (i != symptoms.length - 1) + Padding( + padding: EdgeInsets.symmetric(horizontal: 2.w), + child: Icon(Icons.circle, size: 7, color: AppColors.textColor), + ), + ], + ], + ); + } + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 48.w, + height: 48.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: getChipColorBySeverityEnum(possibleConditionsSeverityEnum).withValues(alpha: 0.2), + borderRadius: 12.r, + hasShadow: false, + ), + child: Icon(icon, color: getChipTextColorBySeverityEnum(possibleConditionsSeverityEnum), size: 24.f), + ), + SizedBox(width: 12.w), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + title, + style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), + overflow: TextOverflow.ellipsis, + ), + ), + AppCustomChipWidget( + labelText: tagText, + backgroundColor: getChipColorBySeverityEnum(possibleConditionsSeverityEnum).withValues(alpha: 0.2), + textColor: getChipTextColorBySeverityEnum(possibleConditionsSeverityEnum), + ), + ], + ), + CustomRoundedProgressBar( + percentage: percentage, + height: 6.h, + color: getChipColorBySeverityEnum(possibleConditionsSeverityEnum), + backgroundColor: AppColors.scaffoldBgColor, + titleWidget: Row( + children: [ + Text( + "$percentage%", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 12.f, + color: getChipColorBySeverityEnum(possibleConditionsSeverityEnum), + ), + ), + ], + ).paddingSymmetrical(0, 4.h), + ), + ], + ), + ), + ], + ).paddingAll(16.w), + Divider(color: AppColors.bottomNAVBorder, height: 1, thickness: 1), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + clinic, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 14.f, + color: AppColors.textColor, + ), + ), + _buildSymptomsRow(), + SizedBox(height: 16.h), + Text("Description".needTranslation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.f, color: AppColors.textColor)), + SizedBox(height: 2.h), + Text(description, style: TextStyle(color: AppColors.greyTextColor, fontWeight: FontWeight.w500, fontSize: 12.f)), + if (possibleConditionsSeverityEnum == PossibleConditionsSeverityEnum.emergency) + CustomButton( + text: appointmentLabel ?? "Book Appointment".needTranslation, + onPressed: () { + if (onActionPressed != null) { + onActionPressed!(); + } + }, + backgroundColor: AppColors.lightRedButtonColor, + borderColor: Colors.transparent, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 48.h, + icon: AppAssets.add_icon, + iconColor: AppColors.primaryRedColor, + iconSize: 18.h, + ).paddingOnly(top: 16.w), + if (monitorNote != null) + Container( + margin: EdgeInsets.only(top: 12.h), + child: AppCustomChipWidget( + labelText: monitorNote!, + backgroundColor: AppColors.whiteColor, + textColor: AppColors.textColor, + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.r)), + ), + ), + ], + ).paddingAll(16.w), + ], + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/custom_progress_bar.dart b/lib/presentation/symptoms_checker/widgets/custom_progress_bar.dart new file mode 100644 index 0000000..d09c244 --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/custom_progress_bar.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; + +class CustomRoundedProgressBar extends StatelessWidget { + final int percentage; + final Color color; + final Color backgroundColor; + final double? height; + final double? paddingBetween; + final Widget? titleWidget; + + const CustomRoundedProgressBar({ + super.key, + this.titleWidget, + required this.percentage, + this.paddingBetween, + required this.color, + required this.backgroundColor, + this.height, + }); + + @override + Widget build(BuildContext context) { + final h = height ?? 8.h; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (titleWidget != null) ...[ + titleWidget!, + if (paddingBetween != null) ...[ + SizedBox(height: paddingBetween), + ] + ], + LayoutBuilder( + builder: (context, constraints) { + double radius = h / 2; + return Container( + height: h, + width: constraints.maxWidth, + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(radius), + ), + child: Align( + alignment: Alignment.centerLeft, + child: FractionallySizedBox( + widthFactor: (percentage.clamp(0, 100)) / 100, + child: Container( + height: height, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.horizontal( + left: Radius.circular(radius), + right: Radius.circular(radius), + ), + ), + ), + ), + ), + ); + }, + ), + ], + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/interactive_body_widget.dart b/lib/presentation/symptoms_checker/widgets/interactive_body_widget.dart new file mode 100644 index 0000000..8957fb1 --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/interactive_body_widget.dart @@ -0,0 +1,134 @@ +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/organ_model.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/organ_dot_widget.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/organ_tooltip_widget.dart'; + +class InteractiveBodyWidget extends StatefulWidget { + final String bodyImageAsset; + final List organs; + final Set selectedOrganIds; + final bool isBodyHidden; + final Function(String organId) onOrganTap; + final String? tooltipOrganId; + + const InteractiveBodyWidget({ + super.key, + required this.bodyImageAsset, + required this.organs, + required this.selectedOrganIds, + required this.onOrganTap, + this.isBodyHidden = false, + this.tooltipOrganId, + }); + + @override + State createState() => _InteractiveBodyWidgetState(); +} + +class _InteractiveBodyWidgetState extends State { + double? _imageAspectRatio; + final TransformationController _transformationController = TransformationController(); + + @override + void initState() { + super.initState(); + _loadImageAspectRatio(); + } + + @override + void didUpdateWidget(InteractiveBodyWidget oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.bodyImageAsset != widget.bodyImageAsset) { + _loadImageAspectRatio(); + // Reset zoom when switching views + _transformationController.value = Matrix4.identity(); + } + } + + @override + void dispose() { + _transformationController.dispose(); + super.dispose(); + } + + Future _loadImageAspectRatio() async { + final ByteData data = await rootBundle.load(widget.bodyImageAsset); + final ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List()); + final ui.FrameInfo frameInfo = await codec.getNextFrame(); + final image = frameInfo.image; + + if (mounted) { + setState(() { + _imageAspectRatio = image.width / image.height; + }); + } + } + + @override + Widget build(BuildContext context) { + if (_imageAspectRatio == null) { + return const Center(child: CircularProgressIndicator()); + } + + return LayoutBuilder( + builder: (context, constraints) { + return Center( + child: InteractiveViewer( + transformationController: _transformationController, + minScale: 0.5, + maxScale: 4.0, + clipBehavior: Clip.none, + child: AspectRatio( + aspectRatio: _imageAspectRatio!, + child: LayoutBuilder( + builder: (context, imageConstraints) { + return Stack( + clipBehavior: Clip.none, + children: [ + // Body image + Positioned.fill( + child: Image.asset( + widget.bodyImageAsset, + fit: BoxFit.fill, + color: widget.isBodyHidden ? Colors.black.withValues(alpha: 0.5) : null, + ), + ), + + // Organ dots + ...widget.organs.map((organ) { + final isSelected = widget.selectedOrganIds.contains(organ.id); + final dotSize = 16.0; + + final leftPos = (organ.position.x * imageConstraints.maxWidth) - (dotSize / 2); + final topPos = (organ.position.y * imageConstraints.maxHeight) - (dotSize / 2); + + return Positioned( + left: leftPos, + top: topPos, + child: OrganDot(isSelected: isSelected, onTap: () => widget.onOrganTap(organ.id), size: dotSize), + ); + }), + + // Tooltip + if (widget.tooltipOrganId != null) + ...widget.organs.where((organ) => organ.id == widget.tooltipOrganId).map( + (organ) { + final centerX = organ.position.x * imageConstraints.maxWidth; + final centerY = organ.position.y * imageConstraints.maxHeight; + return OrganTooltipWidget(organName: organ.description, position: Offset(centerX, centerY)); + }, + ), + ], + ); + }, + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/organ_dot_widget.dart b/lib/presentation/symptoms_checker/widgets/organ_dot_widget.dart new file mode 100644 index 0000000..0783dfb --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/organ_dot_widget.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class OrganDot extends StatelessWidget { + final bool isSelected; + final VoidCallback onTap; + final double size; + + const OrganDot({super.key, required this.isSelected, required this.onTap, this.size = 50.0}); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: AnimatedContainer( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + width: size.w, + height: size.h, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isSelected ? AppColors.whiteColor : AppColors.blackColor.withValues(alpha: 0.6), + ), + child: Padding( + padding: EdgeInsets.all(isSelected ? 2.w : 3.w), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isSelected ? AppColors.primaryRedColor : AppColors.whiteColor, + ), + child: isSelected + ? Center( + child: Container( + width: size.w * 0.25, + height: size.h * 0.25, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: AppColors.whiteColor, + ), + ), + ) + : null, + ), + ), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/organ_tooltip_widget.dart b/lib/presentation/symptoms_checker/widgets/organ_tooltip_widget.dart new file mode 100644 index 0000000..6c2625b --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/organ_tooltip_widget.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class OrganTooltipWidget extends StatelessWidget { + final String organName; + final Offset position; + + const OrganTooltipWidget({super.key, required this.organName, required this.position}); + + @override + Widget build(BuildContext context) { + return Positioned( + left: position.dx, + top: position.dy, + child: FractionalTranslation( + translation: const Offset(-0.5, -1.2), // Center horizontally, position above the dot + child: Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 6.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.scaffoldBgColor, + borderRadius: 8.h, + hasShadow: true, + ), + child: Text( + organName, + style: TextStyle( + color: AppColors.textColor, + fontSize: 12.f, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ); + } +} diff --git a/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart b/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart new file mode 100644 index 0000000..c0f1be3 --- /dev/null +++ b/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart @@ -0,0 +1,133 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/symptoms_checker/models/organ_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; + +class SelectedOrgansSection extends StatefulWidget { + final List selectedOrgans; + final Function(String organId) onRemoveOrgan; + + const SelectedOrgansSection({ + super.key, + required this.selectedOrgans, + required this.onRemoveOrgan, + }); + + @override + State createState() => _SelectedOrgansSectionState(); +} + +class _SelectedOrgansSectionState extends State { + bool _isExpanded = true; + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(16.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(12.r), + boxShadow: [ + BoxShadow( + color: AppColors.blackColor.withValues(alpha: 0.05), + blurRadius: 10, + offset: const Offset(0, -2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + onTap: () { + setState(() { + _isExpanded = !_isExpanded; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Selected Organs'.needTranslation, + style: TextStyle( + fontSize: 16.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + Row( + children: [ + if (widget.selectedOrgans.isNotEmpty) + Container( + padding: EdgeInsets.symmetric( + horizontal: 8.w, + vertical: 4.h, + ), + decoration: BoxDecoration( + color: AppColors.primaryRedColor, + borderRadius: BorderRadius.circular(12.r), + ), + child: Text( + '${widget.selectedOrgans.length}', + style: TextStyle( + color: AppColors.whiteColor, + fontSize: 12.f, + fontWeight: FontWeight.w600, + ), + ), + ), + SizedBox(width: 8.w), + AnimatedRotation( + turns: _isExpanded ? 0.5 : 0.0, + duration: const Duration(milliseconds: 200), + child: Icon( + Icons.keyboard_arrow_down, + color: AppColors.textColorLight, + size: 24.h, + ), + ), + ], + ), + ], + ), + ), + if (_isExpanded) ...[ + SizedBox(height: 16.h), + if (widget.selectedOrgans.isEmpty) + Padding( + padding: EdgeInsets.symmetric(vertical: 8.h), + child: Text( + 'No organs selected yet'.needTranslation, + style: TextStyle( + color: AppColors.greyTextColor, + fontSize: 14.f, + ), + ), + ) + else + Wrap( + spacing: 8.w, + runSpacing: 8.h, + children: widget.selectedOrgans.map((organ) { + return AppCustomChipWidget( + labelText: organ.description, + backgroundColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + deleteIcon: AppAssets.cross_circle, + deleteIconColor: AppColors.primaryRedColor, + deleteIconHasColor: true, + onDeleteTap: () => widget.onRemoveOrgan(organ.id), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 8.h), + ); + }).toList(), + ), + ], + ], + ), + ); + } +} diff --git a/lib/presentation/tele_consultation/zoom/call_screen.dart b/lib/presentation/tele_consultation/zoom/call_screen.dart index 21ad42f..59b5ce4 100644 --- a/lib/presentation/tele_consultation/zoom/call_screen.dart +++ b/lib/presentation/tele_consultation/zoom/call_screen.dart @@ -16,7 +16,6 @@ import 'package:flutter_zoom_videosdk/native/zoom_videosdk_event_listener.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_live_transcription_message_info.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_share_action.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_user.dart'; -import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/utils/jwt.dart'; @@ -24,7 +23,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/video_view.dart'; -import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:image_picker/image_picker.dart'; diff --git a/lib/presentation/todo_section/ancillary_order_payment_page.dart b/lib/presentation/todo_section/ancillary_order_payment_page.dart index f9995dc..fdfcc04 100644 --- a/lib/presentation/todo_section/ancillary_order_payment_page.dart +++ b/lib/presentation/todo_section/ancillary_order_payment_page.dart @@ -148,7 +148,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ Image.asset(AppAssets.visa, width: 50.h, height: 50.h), SizedBox(width: 8.h), - Image.asset(AppAssets.Mastercard, width: 40.h, height: 40.h), + Image.asset(AppAssets.mastercard, width: 40.h, height: 40.h), ], ).toShimmer2(isShow: todoVM.isProcessingPayment), SizedBox(height: 16.h), @@ -180,7 +180,6 @@ class _AncillaryOrderPaymentPageState extends State { ), ), ), - // Payment Summary Footer todoVM.isProcessingPayment ? SizedBox.shrink() : _buildPaymentSummary() ], @@ -220,7 +219,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ "Amount before tax".needTranslation.toText14(isBold: true), Utils.getPaymentAmountWithSymbol( - amountBeforeTax.toString().toText16(isBold: true), + amountBeforeTax.toStringAsFixed(2).toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true, @@ -234,7 +233,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( - taxAmount.toString().toText14(isBold: true, color: AppColors.greyTextColor), + taxAmount.toStringAsFixed(2).toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: true, @@ -250,7 +249,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ "".needTranslation.toText14(isBold: true), Utils.getPaymentAmountWithSymbol( - widget.totalAmount.toString().toText24(isBold: true), + widget.totalAmount.toStringAsFixed(2).toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true, diff --git a/lib/presentation/todo_section/ancillary_procedures_details_page.dart b/lib/presentation/todo_section/ancillary_procedures_details_page.dart index 449d21e..b7515af 100644 --- a/lib/presentation/todo_section/ancillary_procedures_details_page.dart +++ b/lib/presentation/todo_section/ancillary_procedures_details_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:collection/collection.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -13,6 +14,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/todo_section/ancillary_order_payment_page.dart'; import 'package:hmg_patient_app_new/presentation/todo_section/widgets/ancillary_orders_list.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -20,7 +22,6 @@ import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; class AncillaryOrderDetailsList extends StatefulWidget { @@ -130,7 +131,6 @@ class _AncillaryOrderDetailsListState extends State { if (viewModel.patientAncillaryOrderProceduresList.isNotEmpty) { orderData = viewModel.patientAncillaryOrderProceduresList[0]; } - return Column( children: [ Expanded( @@ -221,7 +221,7 @@ class _AncillaryOrderDetailsListState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, + gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h, ), @@ -618,39 +618,102 @@ class _AncillaryOrderDetailsListState extends State { Widget _buildStickyPaymentButton(orderData) { final isButtonEnabled = selectedProcedures.isNotEmpty; - return Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox(height: 16.h), - _buildSummarySection(orderData), - SizedBox(height: 16.h), - CustomButton( - borderWidth: 0, - backgroundColor: AppColors.infoLightColor, - text: "Proceed to Payment".needTranslation, - onPressed: () { - // Navigate to payment page with selected procedures - Navigator.of(context).push( - CustomPageRoute( - page: AncillaryOrderPaymentPage( - appointmentNoVida: widget.appointmentNoVida, - orderNo: widget.orderNo, - projectID: widget.projectID, - selectedProcedures: selectedProcedures, - totalAmount: _getTotalAmount(), - appointmentDate: orderData.appointmentDate, - ), + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 4.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: LocaleKeys.upcomingPaymentNow.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor)), + ], + ), + SizedBox(height: 18.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 150.h, + child: Utils.getPaymentMethods(), ), - ); - }, - isDisabled: !isButtonEnabled, - textColor: AppColors.whiteColor, - borderRadius: 12.r, - borderColor: Colors.transparent, - padding: EdgeInsets.symmetric(vertical: 16.h), - ), - SizedBox(height: 22.h), - ], - ).paddingSymmetrical(24.w, 0); + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Utils.getPaymentAmountWithSymbol(_getTotalAmount().toStringAsFixed(2).toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), + ], + ), + ], + ), + SizedBox(height: 16.h), + CustomButton( + borderWidth: 0, + backgroundColor: AppColors.infoLightColor, + text: "Proceed to Payment".needTranslation, + onPressed: () { + // Navigate to payment page with selected procedures + Navigator.of(context).push( + CustomPageRoute( + page: AncillaryOrderPaymentPage( + appointmentNoVida: widget.appointmentNoVida, + orderNo: widget.orderNo, + projectID: widget.projectID, + selectedProcedures: selectedProcedures, + totalAmount: _getTotalAmount(), + appointmentDate: orderData.appointmentDate, + ), + ), + ); + }, + isDisabled: !isButtonEnabled, + textColor: AppColors.whiteColor, + borderRadius: 12.r, + borderColor: Colors.transparent, + padding: EdgeInsets.symmetric(vertical: 16.h), + ), + SizedBox(height: 22.h), + ], + ).paddingOnly(left: 16.h, top: 24.h, right: 16.h, bottom: 0.h), + ); + + // Column( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // SizedBox(height: 16.h), + // _buildSummarySection(orderData), + // SizedBox(height: 16.h), + // CustomButton( + // borderWidth: 0, + // backgroundColor: AppColors.infoLightColor, + // text: "Proceed to Payment".needTranslation, + // onPressed: () { + // // Navigate to payment page with selected procedures + // Navigator.of(context).push( + // CustomPageRoute( + // page: AncillaryOrderPaymentPage( + // appointmentNoVida: widget.appointmentNoVida, + // orderNo: widget.orderNo, + // projectID: widget.projectID, + // selectedProcedures: selectedProcedures, + // totalAmount: _getTotalAmount(), + // appointmentDate: orderData.appointmentDate, + // ), + // ), + // ); + // }, + // isDisabled: !isButtonEnabled, + // textColor: AppColors.whiteColor, + // borderRadius: 12.r, + // borderColor: Colors.transparent, + // padding: EdgeInsets.symmetric(vertical: 16.h), + // ), + // SizedBox(height: 22.h), + // ], + // ).paddingSymmetrical(24.w, 0); } } diff --git a/lib/presentation/todo_section/todo_page.dart b/lib/presentation/todo_section/todo_page.dart index 11e258f..8907fc8 100644 --- a/lib/presentation/todo_section/todo_page.dart +++ b/lib/presentation/todo_section/todo_page.dart @@ -68,6 +68,7 @@ class _ToDoPageState extends State { children: [ SizedBox(height: 16.h), "Ancillary Orders".needTranslation.toText18(isBold: true), + SizedBox(height: 24.h), Consumer( builder: (BuildContext context, TodoSectionViewModel todoSectionViewModel, Widget? child) { return todoSectionViewModel.isAncillaryOrdersLoading @@ -82,8 +83,9 @@ class _ToDoPageState extends State { orderNo: order.orderNo ?? 0, projectID: order.projectID ?? 0, projectName: order.projectName ?? "", - ))); - log("View details for order: ${order.orderNo}"); + ), + ), + ); }, ); }, diff --git a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart index 31a778f..8a3e3fa 100644 --- a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart +++ b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart @@ -35,10 +35,10 @@ class AncillaryOrdersList extends StatelessWidget { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: orders.length, + padding: EdgeInsets.zero, separatorBuilder: (BuildContext context, int index) => SizedBox(height: 12.h), itemBuilder: (context, index) { final order = orders[index]; - return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), diff --git a/lib/presentation/vital_sign/vital_sign_page.dart b/lib/presentation/vital_sign/vital_sign_page.dart new file mode 100644 index 0000000..858e801 --- /dev/null +++ b/lib/presentation/vital_sign/vital_sign_page.dart @@ -0,0 +1,308 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:provider/provider.dart'; + +class VitalSignPage extends StatefulWidget { + const VitalSignPage({super.key}); + + @override + State createState() => _VitalSignPageState(); +} + +class _VitalSignPageState extends State { + @override + void initState() { + super.initState(); + final HmgServicesViewModel hmgServicesViewModel = context.read(); + + scheduleMicrotask(() async { + LoaderBottomSheet.showLoader(loadingText: 'Loading Vital Signs...'); + await hmgServicesViewModel.getPatientVitalSign( + onSuccess: (_) { + LoaderBottomSheet.hideLoader(); + }, + onError: (_) { + LoaderBottomSheet.hideLoader(); + }, + ); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: 'Vital Signs', + child: Consumer( + builder: (context, viewModel, child) { + + // Get the latest vital sign data (first item in the list) + VitalSignResModel? latestVitalSign = viewModel.vitalSignList.isNotEmpty + ? viewModel.vitalSignList.first + : null; + + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + + // Main content with body image + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Left side - Vital Sign Cards + Expanded( + child: Column( + children: [ + // BMI Card + _buildVitalSignCard( + icon: AppAssets.activity, + iconColor: AppColors.successColor, + iconBgColor: AppColors.successColor.withValues(alpha: 0.1), + label: 'BMI', + value: latestVitalSign?.bodyMassIndex?.toString() ?? '--', + unit: '', + chipText: _getBMIStatus(latestVitalSign?.bodyMassIndex), + chipBgColor: AppColors.successColor.withValues(alpha: 0.1), + chipTextColor: AppColors.successColor, + ), + SizedBox(height: 16.h), + + // Height Card + _buildVitalSignCard( + icon: AppAssets.height, + iconColor: AppColors.infoColor, + iconBgColor: AppColors.infoColor.withValues(alpha: 0.1), + label: 'Height', + value: latestVitalSign?.heightCm?.toString() ?? '--', + unit: 'cm', + ), + SizedBox(height: 16.h), + + // Weight Card + _buildVitalSignCard( + icon: AppAssets.weight, + iconColor: AppColors.successColor, + iconBgColor: AppColors.successColor.withValues(alpha: 0.1), + label: 'Weight', + value: latestVitalSign?.weightKg?.toString() ?? '--', + unit: 'kg', + chipText: 'Normal', + chipBgColor: AppColors.successColor.withValues(alpha: 0.1), + chipTextColor: AppColors.successColor, + ), + SizedBox(height: 16.h), + + // Blood Pressure Card + _buildVitalSignCard( + icon: AppAssets.activity, + iconColor: AppColors.warningColor, + iconBgColor: AppColors.warningColor.withValues(alpha: 0.1), + label: 'Blood Pressure', + value: latestVitalSign != null && + latestVitalSign.bloodPressureHigher != null && + latestVitalSign.bloodPressureLower != null + ? '${latestVitalSign.bloodPressureHigher}/${latestVitalSign.bloodPressureLower}' + : '--', + unit: '', + ), + SizedBox(height: 16.h), + + // Temperature Card + _buildVitalSignCard( + icon: AppAssets.activity, + iconColor: AppColors.errorColor, + iconBgColor: AppColors.errorColor.withValues(alpha: 0.1), + label: 'Temperature', + value: latestVitalSign?.temperatureCelcius?.toString() ?? '--', + unit: '°C', + ), + ], + ), + ), + + SizedBox(width: 16.h), + + // Right side - Body Image and Heart Rate + Respiratory Rate + Expanded( + child: Column( + children: [ + // Body anatomy image + Container( + height: 280.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Center( + child: Image.asset( + AppAssets.fullBodyFront, + height: 260.h, + fit: BoxFit.contain, + ), + ), + ), + SizedBox(height: 16.h), + + // Heart Rate Card + _buildVitalSignCard( + icon: AppAssets.heart, + iconColor: AppColors.errorColor, + iconBgColor: AppColors.errorColor.withValues(alpha: 0.1), + label: 'Heart Rate', + value: latestVitalSign?.heartRate?.toString() ?? + latestVitalSign?.pulseBeatPerMinute?.toString() ?? '--', + unit: 'bpm', + chipText: 'Normal', + chipBgColor: AppColors.successColor.withValues(alpha: 0.1), + chipTextColor: AppColors.successColor, + ), + SizedBox(height: 16.h), + + // Respiratory rate Card + _buildVitalSignCard( + icon: AppAssets.activity, + iconColor: AppColors.successColor, + iconBgColor: AppColors.successColor.withValues(alpha: 0.1), + label: 'Respiratory rate', + value: latestVitalSign?.respirationBeatPerMinute?.toString() ?? '--', + unit: 'bpm', + chipText: 'Normal', + chipBgColor: AppColors.successColor.withValues(alpha: 0.1), + chipTextColor: AppColors.successColor, + ), + ], + ), + ), + ], + ), + ), + + SizedBox(height: 60.h), + ], + ), + ); + }, + ), + ), + ); + } + + String? _getBMIStatus(dynamic bmi) { + if (bmi == null) return null; + double bmiValue = double.tryParse(bmi.toString()) ?? 0; + if (bmiValue < 18.5) return 'Underweight'; + if (bmiValue < 25) return 'Normal'; + if (bmiValue < 30) return 'Overweight'; + return 'Obese'; + } + + Widget _buildVitalSignCard({ + required String icon, + required Color iconColor, + required Color iconBgColor, + required String label, + required String value, + required String unit, + String? chipText, + Color? chipBgColor, + Color? chipTextColor, + }) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(12.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + // Icon with background + Container( + padding: EdgeInsets.all(8.h), + decoration: BoxDecoration( + color: iconBgColor, + borderRadius: BorderRadius.circular(12.r), + ), + child: Utils.buildSvgWithAssets( + icon: icon, + width: 16.w, + height: 16.h, + iconColor: iconColor, + fit: BoxFit.contain, + ), + ), + SizedBox(width: 8.w), + Expanded( + child: label.toText10( + color: AppColors.textColorLight, + weight: FontWeight.w500, + ), + ), + // Forward arrow + Utils.buildSvgWithAssets( + icon: AppAssets.arrow_forward, + width: 16.w, + height: 16.h, + iconColor: AppColors.textColorLight, + fit: BoxFit.contain, + ), + ], + ), + SizedBox(height: 12.h), + + // Value + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + value.toText18( + isBold: true, + color: AppColors.textColor, + ), + if (unit.isNotEmpty) ...[ + SizedBox(width: 4.w), + unit.toText12( + color: AppColors.textColorLight, + ), + ], + ], + ), + + // Chip if available + if (chipText != null) ...[ + SizedBox(height: 8.h), + AppCustomChipWidget( + labelText: chipText, + backgroundColor: chipBgColor, + textColor: chipTextColor, + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + ), + ], + ], + ), + ), + ); + } +} + diff --git a/lib/presentation/water_monitor/water_consumption_screen.dart b/lib/presentation/water_monitor/water_consumption_screen.dart new file mode 100644 index 0000000..5d08bcd --- /dev/null +++ b/lib/presentation/water_monitor/water_consumption_screen.dart @@ -0,0 +1,840 @@ +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/common_models/data_points.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/hydration_tips_widget.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_intake_summary_widget.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/graph/custom_graph.dart'; +import 'package:provider/provider.dart'; +import 'package:shimmer/shimmer.dart'; + +class WaterConsumptionScreen extends StatefulWidget { + const WaterConsumptionScreen({super.key}); + + @override + State createState() => _WaterConsumptionScreenState(); +} + +class _WaterConsumptionScreenState extends State { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) async { + await _refreshData(); + }); + } + + /// Refresh data by calling initialize on the view model + Future _refreshData() async { + final vm = context.read(); + await vm.initialize(); + } + + Widget _buildLoadingShimmer({bool isForHistory = true}) { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(0.w), + itemCount: 4, + separatorBuilder: (_, __) => SizedBox(height: 12.h), + itemBuilder: (context, index) { + return Shimmer.fromColors( + baseColor: AppColors.shimmerBaseColor, + highlightColor: AppColors.shimmerHighlightColor, + child: Container( + height: isForHistory ? 60.h : 40.h, + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(10.r), + ), + ), + ); + }, + ); + } + + Widget buildHistoryListTile({required String title, required String subTitle}) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.toText14(weight: FontWeight.w500, color: AppColors.labelTextColor), + subTitle.toText18(weight: FontWeight.w600), + ], + ), + Utils.buildSvgWithAssets(icon: AppAssets.greenTickIcon) + ], + ).paddingSymmetrical(0, 8.h); + } + + Widget _buildHistoryGraphOrList() { + return Container( + margin: EdgeInsets.symmetric(horizontal: 24.w), + padding: EdgeInsets.all(16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Consumer(builder: (BuildContext context, WaterMonitorViewModel viewModel, Widget? child) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "History".needTranslation.toText16(isBold: true), + Row( + children: [ + InkWell( + onTap: () => viewModel.setGraphView(!viewModel.isGraphView), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + transitionBuilder: (Widget child, Animation animation) { + return FadeTransition( + opacity: animation, + child: ScaleTransition( + scale: animation, + child: child, + ), + ); + }, + child: Container( + key: ValueKey(viewModel.isGraphView), + child: Utils.buildSvgWithAssets( + icon: viewModel.isGraphView ? AppAssets.listIcon : AppAssets.graphIcon, + height: 24.h, + width: 24.h, + ), + ), + ), + ), + SizedBox(width: 8.w), + InkWell( + onTap: () => _showHistoryDurationBottomsheet(context, viewModel), + child: Container( + padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 6.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + backgroundColor: AppColors.greyColor, + borderRadius: 8.r, + hasShadow: true, + ), + child: Row( + children: [ + viewModel.selectedDurationFilter.toText12(fontWeight: FontWeight.w500), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + ], + ), + ), + ) + ], + ), + ], + ), + if (!viewModel.isGraphView) _buildHistoryListView(viewModel) else ...[SizedBox(height: 16.h), _buildHistoryGraph()] + ], + ); + }), + ); + } + + Widget _buildHistoryListView(WaterMonitorViewModel viewModel) { + final selectedDuration = viewModel.selectedDurationFilter; + + // Build list items based on duration + List listItems = []; + + if (selectedDuration == 'Daily') { + if (viewModel.todayProgressList.isNotEmpty) { + final todayData = viewModel.todayProgressList.first; + listItems.add( + buildHistoryListTile( + title: "Today's Progress", + subTitle: "${todayData.quantityConsumed?.toStringAsFixed(0) ?? '0'} ml / ${todayData.quantityLimit?.toStringAsFixed(0) ?? '0'} ml", + ), + ); + listItems.add(Divider(height: 1, color: AppColors.dividerColor)); + listItems.add( + buildHistoryListTile( + title: "Percentage Completed", + subTitle: "${todayData.percentageConsumed?.toStringAsFixed(1) ?? '0'}%", + ), + ); + + // Add history data if available (show ALL entries) + if (viewModel.historyList.isNotEmpty) { + listItems.add(Divider(height: 1, color: AppColors.dividerColor)); + listItems.add( + Padding( + padding: EdgeInsets.symmetric(vertical: 8.h), + child: "Water Intake History".toText14( + weight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + ); + + // Show all history entries + for (var history in viewModel.historyList) { + final quantity = "${history.quantity?.toStringAsFixed(0) ?? '0'} ml"; + final time = _formatHistoryDate(history.createdDate ?? ''); + + listItems.add( + buildHistoryListTile( + title: quantity, + subTitle: time, + ), + ); + + if (history != viewModel.historyList.last) { + listItems.add(Divider(height: 1, color: AppColors.dividerColor)); + } + } + } + } else { + listItems.add( + Center( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: "No data available for today".toText14(color: AppColors.greyTextColor), + ), + ), + ); + } + } else if (selectedDuration == 'Weekly') { + if (viewModel.weekProgressList.isNotEmpty) { + // Show previous 6 days + today (total 7 days) + // API returns data in reverse order (today first), so we reverse it to show oldest to newest (top to bottom) + // This ensures today appears at the end (bottom) + final totalDays = viewModel.weekProgressList.length; + final startIndex = totalDays > 7 ? totalDays - 7 : 0; + final weekDataToShow = viewModel.weekProgressList.skip(startIndex).toList().reversed.toList(); + + for (var dayData in weekDataToShow) { + listItems.add( + buildHistoryListTile( + title: dayData.dayName ?? 'Unknown', + subTitle: "${dayData.percentageConsumed?.toStringAsFixed(1) ?? '0'}%", + ), + ); + if (dayData != weekDataToShow.last) { + listItems.add(Divider(height: 1, color: AppColors.dividerColor)); + } + } + } else { + listItems.add( + Center( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: "No data available for this week".toText14(color: AppColors.greyTextColor), + ), + ), + ); + } + } else if (selectedDuration == 'Monthly') { + if (viewModel.monthProgressList.isNotEmpty) { + // Show last 6 months + current month (total 7 months) + // Show in chronological order: oldest to newest (top to bottom) + final totalMonths = viewModel.monthProgressList.length; + final startIndex = totalMonths > 7 ? totalMonths - 7 : 0; + final monthDataToShow = viewModel.monthProgressList.skip(startIndex).toList(); + + for (var monthData in monthDataToShow) { + listItems.add( + buildHistoryListTile( + title: monthData.monthName ?? 'Unknown', + subTitle: "${monthData.percentageConsumed?.toStringAsFixed(1) ?? '0'}%", + ), + ); + if (monthData != monthDataToShow.last) { + listItems.add(Divider(height: 1, color: AppColors.dividerColor)); + } + } + } else { + listItems.add( + Center( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: "No data available for this year".toText14(color: AppColors.greyTextColor), + ), + ), + ); + } + } + + // Return scrollable list with min and max height constraints + return ConstrainedBox( + constraints: BoxConstraints(minHeight: 80.h, maxHeight: 270.h), + child: viewModel.isLoading + ? _buildLoadingShimmer().paddingOnly(top: 16.h) + : listItems.isEmpty + ? Center( + child: "No history data available".toText14(color: AppColors.greyTextColor), + ) + : ListView.separated( + padding: EdgeInsets.only(top: 16.h), + shrinkWrap: true, + itemCount: listItems.length, + separatorBuilder: (context, index) => SizedBox.shrink(), + itemBuilder: (context, index) => listItems[index], + ), + ); + } + + Widget _buildHistoryGraph() { + return Consumer( + builder: (context, viewModel, _) { + final selectedDuration = viewModel.selectedDurationFilter; + + // Build dynamic data points based on selected duration + List dataPoints = []; + + if (selectedDuration == 'Daily') { + // For daily, show last 7 history entries with at least 5 minutes difference + if (viewModel.historyList.isNotEmpty) { + // Filter entries with at least 5 minutes difference + List filteredPoints = []; + DateTime? lastTime; + + for (var historyItem in viewModel.historyList) { + final currentTime = _parseHistoryDate(historyItem.createdDate ?? ''); + + // Add if first entry OR if more than 5 minutes difference from last added entry + if (lastTime == null || currentTime.difference(lastTime).inMinutes.abs() >= 5) { + final quantity = historyItem.quantity?.toDouble() ?? 0.0; + final time = _formatHistoryDate(historyItem.createdDate ?? ''); + + filteredPoints.add( + DataPoint( + value: quantity, + actualValue: quantity.toStringAsFixed(0), + label: time, + displayTime: time, + unitOfMeasurement: 'ml', + time: currentTime, + ), + ); + lastTime = currentTime; + } + } + + // Take only last 7 filtered entries + final totalFiltered = filteredPoints.length; + final startIndex = totalFiltered > 7 ? totalFiltered - 7 : 0; + dataPoints = filteredPoints.skip(startIndex).toList(); + } else if (viewModel.todayProgressList.isNotEmpty) { + // Fallback: show today's percentage if no history + final todayData = viewModel.todayProgressList.first; + final percentage = todayData.percentageConsumed?.toDouble() ?? 0.0; + dataPoints.add( + DataPoint( + value: percentage, + actualValue: percentage.toStringAsFixed(1), + label: 'Today', + displayTime: 'Today', + unitOfMeasurement: '%', + time: DateTime.now(), + ), + ); + } + } else if (selectedDuration == 'Weekly') { + // For weekly, show previous 6 days + today (total 7 days) + // API returns data in reverse order (today first), so we reverse it to show oldest to newest (left to right) + // This ensures today appears at the end (right side) + if (viewModel.weekProgressList.isNotEmpty) { + final totalDays = viewModel.weekProgressList.length; + final startIndex = totalDays > 7 ? totalDays - 7 : 0; + final weekDataToShow = viewModel.weekProgressList.skip(startIndex).toList().reversed.toList(); + + for (var dayData in weekDataToShow) { + final percentage = dayData.percentageConsumed?.toDouble() ?? 0.0; + final dayName = dayData.dayName ?? 'Day ${dayData.dayNumber}'; + dataPoints.add( + DataPoint( + value: percentage, + actualValue: percentage.toStringAsFixed(1), + label: DateUtil.getShortWeekDayName(dayName), + displayTime: dayName, + unitOfMeasurement: '%', + time: DateTime.now(), + ), + ); + } + } + } else if (selectedDuration == 'Monthly') { + // For monthly, show last 6 months + current month (total 7 months) + // Show in chronological order: oldest to newest (left to right) + if (viewModel.monthProgressList.isNotEmpty) { + final totalMonths = viewModel.monthProgressList.length; + final startIndex = totalMonths > 7 ? totalMonths - 7 : 0; + final monthDataToShow = viewModel.monthProgressList.skip(startIndex).toList(); + + for (var monthData in monthDataToShow) { + final percentage = monthData.percentageConsumed?.toDouble() ?? 0.0; + final monthName = monthData.monthName ?? 'Month ${monthData.monthNumber}'; + dataPoints.add( + DataPoint( + value: percentage, + actualValue: percentage.toStringAsFixed(1), + label: DateUtil.getShortMonthName(monthName), + displayTime: monthName, + unitOfMeasurement: '%', + time: DateTime.now(), + ), + ); + } + } + } + + // If no data, show empty state + if (dataPoints.isEmpty) { + return Container( + padding: EdgeInsets.symmetric(vertical: 80.h), + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.graphIcon, + iconColor: AppColors.greyTextColor.withValues(alpha: 0.5), + height: 32.w, + width: 32.w, + ), + SizedBox(height: 12.h), + "No graph data available".toText14(color: AppColors.greyTextColor), + ], + ), + ), + ); + } + + // Show loading shimmer while fetching data + if (viewModel.isLoading) { + return Container( + padding: EdgeInsets.symmetric(vertical: 40.h), + child: _buildLoadingShimmer(), + ); + } + + // Configure graph based on selected duration + double maxY; + double minY; + double horizontalInterval; + double leftLabelInterval; + + if (selectedDuration == 'Daily') { + // For daily (quantity in ml), use max available cup size + // Get the biggest cup from available cups + final maxCupSize = viewModel.cups.isEmpty ? 500.0 : viewModel.cups.map((cup) => cup.capacityMl.toDouble()).reduce((a, b) => a > b ? a : b); + + maxY = maxCupSize; + minY = 0; + // Divide into 4 intervals (5 labels: 0, 1/4, 1/2, 3/4, max) + horizontalInterval = maxY / 4; + leftLabelInterval = maxY / 4; + } else { + // For weekly/monthly (percentage), use 0-100% + maxY = 100.0; + minY = 0; + horizontalInterval = 25; + leftLabelInterval = 25; + } + + return CustomGraph( + bottomLabelReservedSize: 30, + dataPoints: dataPoints, + makeGraphBasedOnActualValue: true, + leftLabelReservedSize: 50.h, + showGridLines: true, + maxY: maxY, + minY: minY, + showLinePoints: true, + maxX: dataPoints.length > 1 ? dataPoints.length.toDouble() - 0.75 : 1.0, + horizontalInterval: horizontalInterval, + leftLabelInterval: leftLabelInterval, + showShadow: true, + getDrawingHorizontalLine: (value) { + // Draw dashed lines at intervals + if (selectedDuration == 'Daily') { + // For daily, draw lines every 50 or 100 ml + if (value % horizontalInterval == 0 && value > 0) { + return FlLine( + color: AppColors.greyTextColor.withValues(alpha: 0.3), + strokeWidth: 1.5, + dashArray: [8, 4], + ); + } + } else { + // For weekly/monthly, draw lines at 25%, 50%, 75% + if (value == 25 || value == 50 || value == 75) { + return FlLine( + color: AppColors.successColor.withValues(alpha: 0.3), + strokeWidth: 1.5, + dashArray: [8, 4], + ); + } + } + return FlLine(color: AppColors.transparent, strokeWidth: 0); + }, + leftLabelFormatter: (value) { + if (selectedDuration == 'Daily') { + // Show exactly 5 labels: 0, 1/4, 1/2, 3/4, max + // Check if value matches one of the 5 positions + final interval = maxY / 4; + final positions = [0.0, interval, interval * 2, interval * 3, maxY]; + + for (var position in positions) { + if ((value - position).abs() < 1) { + return '${value.toInt()}ml'.toText10(weight: FontWeight.w600); + } + } + } else { + // Show percentage labels + if (value == 0) return '0%'.toText10(weight: FontWeight.w600); + if (value == 25) return '25%'.toText10(weight: FontWeight.w600); + if (value == 50) return '50%'.toText10(weight: FontWeight.w600); + if (value == 75) return '75%'.toText10(weight: FontWeight.w600); + if (value == 100) return '100%'.toText10(weight: FontWeight.w600); + } + return SizedBox.shrink(); + }, + graphColor: AppColors.successColor, + graphShadowColor: AppColors.successColor.withValues(alpha: 0.15), + bottomLabelFormatter: (value, data) { + if (data.isEmpty) return SizedBox.shrink(); + + // Only show labels for whole number positions (not fractional) + if ((value - value.round()).abs() > 0.01) { + return SizedBox.shrink(); + } + + int index = value.round(); + if (index < 0 || index >= data.length) return SizedBox.shrink(); + + // For daily, show all 7 time labels (last 7 entries) + if (selectedDuration == 'Daily' && index < 7) { + return Padding( + padding: EdgeInsets.only(top: 10.h), + child: data[index].label.toText8( + fontWeight: FontWeight.w600, + color: AppColors.labelTextColor, + ), + ); + } + + // For weekly, show all 7 days (today + last 6 days) + if (selectedDuration == 'Weekly' && index < 7) { + return Padding( + padding: EdgeInsets.only(top: 10.h), + child: data[index].label.toText10( + weight: FontWeight.w600, + color: AppColors.labelTextColor, + ), + ); + } + + // For monthly, show all 7 months (current month + last 6 months) + if (selectedDuration == 'Monthly' && index < 7) { + return Padding( + padding: EdgeInsets.only(top: 10.h), + child: data[index].label.toText10(weight: FontWeight.w600, color: AppColors.labelTextColor), + ); + } + + return SizedBox.shrink(); + }, + scrollDirection: selectedDuration == 'Monthly' ? Axis.horizontal : Axis.vertical, + height: 250.h, + spotColor: AppColors.successColor, + ); + }, + ); + } + + // Reusable method to build selection row widget + Widget _buildSelectionRow({ + required String value, + required String groupValue, + required VoidCallback onTap, + bool useUpperCase = false, + }) { + return SizedBox( + height: 70.h, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: value, + groupValue: groupValue, + activeColor: AppColors.errorColor, + onChanged: (_) => onTap(), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + (useUpperCase ? value.toUpperCase() : value.toCamelCase) + .toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1) + .expanded, + ], + ).onPress(onTap), + ); + } + + void _showSelectionBottomSheet({ + required BuildContext context, + required String title, + required List items, + required String selectedValue, + required Function(String) onSelected, + bool useUpperCase = false, + }) { + final dialogService = getIt.get(); + + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: title.needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: items.length, + itemBuilder: (context, index) { + final item = items[index]; + return _buildSelectionRow( + value: item, + groupValue: selectedValue, + useUpperCase: useUpperCase, + onTap: () { + onSelected(item); + Navigator.pop(context); + }, + ); + }, + separatorBuilder: (_, __) => Divider(height: 1, color: AppColors.dividerColor), + ), + ), + onOkPressed: () {}, + ); + } + + void _showHistoryDurationBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Duration".needTranslation, + items: viewModel.durationFilters, + selectedValue: viewModel.selectedDurationFilter, + onSelected: viewModel.setFilterDuration, + ); + } + + /// Handle reminder button tap (Set or Cancel) + Future _handleReminderButtonTap(WaterMonitorViewModel viewModel) async { + if (viewModel.isWaterReminderEnabled) { + // Cancel reminders + _showCancelReminderConfirmation(viewModel); + } else { + // Set reminders + await _setReminders(viewModel); + } + } + + /// Show confirmation bottom sheet before cancelling reminders + void _showCancelReminderConfirmation(WaterMonitorViewModel viewModel) { + showCommonBottomSheetWithoutHeight( + title: 'Notice'.needTranslation, + context, + child: Utils.getWarningWidget( + loadingText: "Are you sure you want to cancel all water reminders?".needTranslation, + isShowActionButtons: true, + onCancelTap: () { + Navigator.pop(context); + }, + onConfirmTap: () async { + Navigator.pop(context); + await _cancelReminders(viewModel); + }, + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + isDismissible: true, + ); + } + + /// Set water reminders + Future _setReminders(WaterMonitorViewModel viewModel) async { + // Schedule reminders + final success = await viewModel.scheduleWaterReminders(); + + if (success) { + final times = await viewModel.getScheduledReminderTimes(); + _showReminderScheduledDialog(times); + } + } + + /// Cancel water reminders + Future _cancelReminders(WaterMonitorViewModel viewModel) async { + final success = await viewModel.cancelWaterReminders(); + } + + /// Show bottom sheet with scheduled reminder times + void _showReminderScheduledDialog(List times) { + showCommonBottomSheetWithoutHeight( + title: 'Reminders Set!'.needTranslation, + context, + isCloseButtonVisible: false, + isDismissible: false, + child: Padding( + padding: EdgeInsets.only(top: 16.w, left: 16.w, right: 16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Utils.getSuccessWidget(loadingText: 'Daily water reminders scheduled at:'.needTranslation), + SizedBox(height: 16.h), + Wrap( + spacing: 8.w, + runSpacing: 8.h, + children: times + .map( + (time) => AppCustomChipWidget( + icon: AppAssets.bell, + iconColor: AppColors.quickLoginColor, + richText: _formatTime(time).toText14(), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.h), + ), + ) + .toList(), + ), + + SizedBox(height: 24.h), + + // OK button + Row( + children: [ + Expanded( + child: CustomButton( + height: 56.h, + text: 'OK'.needTranslation, + onPressed: () => Navigator.of(context).pop(), + textColor: AppColors.whiteColor, + ), + ), + ], + ), + ], + ), + ), + callBackFunc: () {}, + ); + } + + /// Format DateTime to readable time string + String _formatTime(DateTime time) { + final hour = time.hour; + final minute = time.minute; + final hour12 = hour > 12 ? hour - 12 : (hour == 0 ? 12 : hour); + final period = hour >= 12 ? 'PM' : 'AM'; + return '${hour12.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')} $period'; + } + + /// Format history date from /Date(milliseconds+0300)/ format + String _formatHistoryDate(String dateString) { + try { + // Parse the /Date(milliseconds+0300)/ format + final regex = RegExp(r'\/Date\((\d+)'); + final match = regex.firstMatch(dateString); + if (match != null) { + final milliseconds = int.tryParse(match.group(1)!); + if (milliseconds != null) { + final dateTime = DateTime.fromMillisecondsSinceEpoch(milliseconds); + return _formatTime(dateTime); + } + } + } catch (e) { + return dateString; + } + return dateString; + } + + /// Parse history date from /Date(milliseconds+0300)/ format to DateTime + DateTime _parseHistoryDate(String dateString) { + try { + final regex = RegExp(r'\/Date\((\d+)'); + final match = regex.firstMatch(dateString); + if (match != null) { + final milliseconds = int.tryParse(match.group(1)!); + if (milliseconds != null) { + return DateTime.fromMillisecondsSinceEpoch(milliseconds); + } + } + } catch (e) { + // Return current time as fallback + } + return DateTime.now(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "Water Consumption".needTranslation, + bottomChild: Consumer( + builder: (context, viewModel, child) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(24.w), + child: CustomButton( + text: viewModel.isWaterReminderEnabled ? "Cancel Reminders".needTranslation : "Set Reminder".needTranslation, + textColor: viewModel.isWaterReminderEnabled ? AppColors.errorColor : AppColors.successColor, + backgroundColor: viewModel.isWaterReminderEnabled ? AppColors.errorColor.withValues(alpha: 0.1) : AppColors.successLightBgColor, + onPressed: () => _handleReminderButtonTap(viewModel), + icon: viewModel.isWaterReminderEnabled ? null : AppAssets.bell, + iconColor: viewModel.isWaterReminderEnabled ? AppColors.errorColor : AppColors.successColor, + borderRadius: 12.r, + borderColor: AppColors.transparent, + padding: EdgeInsets.symmetric(vertical: 14.h), + ), + ), + ); + }, + ), + child: RefreshIndicator( + onRefresh: _refreshData, + color: AppColors.blueColor, + backgroundColor: AppColors.whiteColor, + child: Column( + children: [ + SizedBox(height: 16.h), + const WaterIntakeSummaryWidget(), + SizedBox(height: 16.h), + _buildHistoryGraphOrList(), + SizedBox(height: 16.h), + const HydrationTipsWidget(), + SizedBox(height: 16.h), + ], + ), + ), + ), + ); + } +} diff --git a/lib/presentation/water_monitor/water_monitor_settings_screen.dart b/lib/presentation/water_monitor/water_monitor_settings_screen.dart new file mode 100644 index 0000000..1b783ca --- /dev/null +++ b/lib/presentation/water_monitor/water_monitor_settings_screen.dart @@ -0,0 +1,355 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +class WaterMonitorSettingsScreen extends StatefulWidget { + const WaterMonitorSettingsScreen({super.key}); + + @override + State createState() => _WaterMonitorSettingsScreenState(); +} + +class _WaterMonitorSettingsScreenState extends State { + // No need to call initialize() here since it's already called in water_consumption_screen + // The ViewModel is shared via Provider, so data is already loaded + + // Reusable method to build selection row widget + Widget _buildSelectionRow({ + required String value, + required String groupValue, + required VoidCallback onTap, + bool useUpperCase = false, + }) { + return SizedBox( + height: 70.h, + child: Row( + spacing: 8.h, + children: [ + Radio( + value: value, + groupValue: groupValue, + activeColor: AppColors.errorColor, + onChanged: (_) => onTap(), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + (useUpperCase ? value.toUpperCase() : value.toCamelCase) + .toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1) + .expanded, + ], + ).onPress(onTap), + ); + } + + // Reusable method to show selection bottom sheet + void _showSelectionBottomSheet({ + required BuildContext context, + required String title, + required List items, + required String selectedValue, + required Function(String) onSelected, + bool useUpperCase = false, + }) { + final dialogService = getIt.get(); + + dialogService.showFamilyBottomSheetWithoutHWithChild( + label: title.needTranslation, + message: "", + child: Container( + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20.r)), + child: ListView.separated( + shrinkWrap: true, + itemCount: items.length, + itemBuilder: (context, index) { + final item = items[index]; + return _buildSelectionRow( + value: item, + groupValue: selectedValue, + useUpperCase: useUpperCase, + onTap: () { + onSelected(item); + Navigator.pop(context); + }, + ); + }, + separatorBuilder: (_, __) => Divider(height: 1, color: AppColors.dividerColor), + ), + ), + onOkPressed: () {}, + ); + } + + void _showGenderSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Gender".needTranslation, + items: viewModel.genderOptions, + selectedValue: viewModel.selectedGender, + onSelected: viewModel.setGender, + ); + } + + void _showHeightUnitSelectionBottomSheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Unit".needTranslation, + items: viewModel.heightUnits, + selectedValue: viewModel.selectedHeightUnit, + onSelected: viewModel.setHeightUnit, + useUpperCase: true, + ); + } + + void _showWeightUnitSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Unit".needTranslation, + items: viewModel.weightUnits, + selectedValue: viewModel.selectedWeightUnit, + onSelected: viewModel.setWeightUnit, + useUpperCase: true, + ); + } + + void _showActivityLevelSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Activity Level".needTranslation, + items: viewModel.activityLevels, + selectedValue: viewModel.selectedActivityLevel, + onSelected: viewModel.setActivityLevel, + ); + } + + void _showNumberOfRemindersSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { + _showSelectionBottomSheet( + context: context, + title: "Select Number of Reminders".needTranslation, + items: viewModel.reminderOptions, + selectedValue: viewModel.selectedNumberOfReminders, + onSelected: viewModel.setNumberOfReminders, + ); + } + + // Reusable method to build text field + Widget _buildTextField(TextEditingController controller, String hintText, {TextInputType keyboardType = TextInputType.name}) { + return TextField( + controller: controller, + keyboardType: keyboardType, + maxLines: 1, + cursorHeight: 14.h, + textAlignVertical: TextAlignVertical.center, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isCollapsed: true, + hintText: hintText, + hintStyle: const TextStyle(color: Colors.grey), + ), + style: TextStyle( + fontSize: 14.f, + fontWeight: FontWeight.w500, + color: AppColors.textColor, + ), + ); + } + + // Reusable method to build settings row + Widget _buildSettingsRow({ + required String icon, + required String label, + String? value, + Widget? inputField, + String? unit, + VoidCallback? onUnitTap, + VoidCallback? onRowTap, + bool showDivider = true, + }) { + return Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 40.w, + width: 40.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.greyColor, + borderRadius: 10.r, + hasShadow: false, + ), + child: Center(child: Utils.buildSvgWithAssets(icon: icon, height: 22.w, width: 22.w)), + ), + SizedBox(width: 12.w), + Expanded( + flex: unit != null ? 3 : 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + label.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + if (inputField != null) + Container( + height: 20.w, + alignment: Alignment.centerLeft, + child: inputField, + ) + else if (value != null) + value.toCamelCase.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + ), + if (unit != null) ...[ + Container( + width: 1.w, + height: 30.w, + color: AppColors.dividerColor, + ).paddingOnly(right: 10.w), + Expanded( + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + unit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), + ], + ), + SizedBox(width: 12.w), + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down) + ], + ).onPress(onUnitTap ?? () {}), + ), + ] else if (onRowTap != null) ...[ + Utils.buildSvgWithAssets(icon: AppAssets.arrow_down), + SizedBox(width: 4.w), + ], + ], + ).paddingSymmetrical(0.w, 16.w).onPress(onRowTap ?? () {}), + if (showDivider) Divider(height: 1, color: AppColors.dividerColor), + ], + ); + } + + @override + Widget build(BuildContext context) { + final viewModel = context.watch(); + + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "H20 Settings".needTranslation, + bottomChild: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(24.w), + child: CustomButton( + text: "Save".needTranslation, + onPressed: () async { + final success = await viewModel.saveSettings(); + if (!success && viewModel.validationError != null) { + _showSnackBar(context, viewModel.validationError!); + } else if (success) { + _showSnackBar(context, "Settings saved successfully"); + } + }, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(vertical: 14.h), + ), + ), + ), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), + padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Column( + children: [ + _buildSettingsRow( + icon: AppAssets.profileIcon, + label: "Your Name".needTranslation, + inputField: _buildTextField(viewModel.nameController, 'Guest'), + ), + _buildSettingsRow( + icon: AppAssets.genderIcon, + label: "Select Gender".needTranslation, + value: viewModel.selectedGender, + onRowTap: () => _showGenderSelectionBottomsheet(context, viewModel), + ), + _buildSettingsRow( + icon: AppAssets.calendarGrey, + label: "Age (11-120) yrs".needTranslation, + inputField: _buildTextField( + viewModel.ageController, + '20', + keyboardType: TextInputType.number, + ), + ), + _buildSettingsRow( + icon: AppAssets.heightIcon, + label: "Height".needTranslation, + inputField: _buildTextField( + viewModel.heightController, + '175', + keyboardType: TextInputType.number, + ), + unit: viewModel.selectedHeightUnit, + onUnitTap: () => _showHeightUnitSelectionBottomSheet(context, viewModel), + ), + _buildSettingsRow( + icon: AppAssets.weightScaleIcon, + label: "Weight".needTranslation, + inputField: _buildTextField( + viewModel.weightController, + '75', + keyboardType: TextInputType.number, + ), + unit: viewModel.selectedWeightUnit, + onUnitTap: () => _showWeightUnitSelectionBottomsheet(context, viewModel), + ), + _buildSettingsRow( + icon: AppAssets.dumbellIcon, + label: "Activity Level".needTranslation, + value: viewModel.selectedActivityLevel, + onRowTap: () => _showActivityLevelSelectionBottomsheet(context, viewModel), + ), + _buildSettingsRow( + icon: AppAssets.notificationIconGrey, + label: "Number of reminders in a day".needTranslation, + value: viewModel.selectedNumberOfReminders, + onRowTap: () => _showNumberOfRemindersSelectionBottomsheet(context, viewModel), + showDivider: false, + ), + ], + ), + ), + ), + ); + } + + // Show snackbar for validation errors and success messages + void _showSnackBar(BuildContext context, String message) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + backgroundColor: message.contains('successfully') ? Colors.green : AppColors.errorColor, + ), + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/bottle_shape_clipper.dart b/lib/presentation/water_monitor/widgets/bottle_shape_clipper.dart new file mode 100644 index 0000000..b4b7ba0 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/bottle_shape_clipper.dart @@ -0,0 +1,25 @@ +// Add this class at the bottom of your file (outside the main class) +import 'package:flutter/material.dart'; + +class BottleShapeClipper extends CustomClipper { + @override + Path getClip(Size size) { + final path = Path(); + + // Create rounded rectangle matching the bottle body shape + // The bottle has rounded corners with radius ~30-40 based on SVG + final borderRadius = size.width * 0.25; // 25% of width for rounded corners + + path.addRRect( + RRect.fromRectAndRadius( + Rect.fromLTWH(0, 0, size.width, size.height), + Radius.circular(borderRadius), + ), + ); + + return path; + } + + @override + bool shouldReclip(covariant CustomClipper oldClipper) => false; +} diff --git a/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart b/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart new file mode 100644 index 0000000..4ffa30d --- /dev/null +++ b/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart @@ -0,0 +1,325 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/models/water_cup_model.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:provider/provider.dart'; +import 'package:uuid/uuid.dart'; + +/// Bottom sheet to switch between existing cups or add new custom cup +void showSwitchCupBottomSheet(BuildContext context) { + return showCommonBottomSheetWithoutHeight( + context, + titleWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Switch Cups".toText20(weight: FontWeight.w600), + "Select your preferred cup size".toText16(weight: FontWeight.w500, color: AppColors.greyTextColor), + ], + ), + child: SwitchCupBottomSheet(), + callBackFunc: () {}, + ); +} + +class SwitchCupBottomSheet extends StatelessWidget { + const SwitchCupBottomSheet({super.key}); + + @override + Widget build(BuildContext context) { + final viewModel = context.watch(); + final selectedId = viewModel.selectedCup?.id; + + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 16.w, + childAspectRatio: 0.85, + ), + itemCount: viewModel.cups.length + 1, + itemBuilder: (context, index) { + if (index == viewModel.cups.length) { + return _buildAddCupItem(context); + } + + final cup = viewModel.cups[index]; + final isSelected = selectedId == cup.id; + + return _buildCupItem( + cup: cup, + isSelected: isSelected, + onTap: () { + viewModel.selectCup(cup.id); + context.pop(); + }, + ); + }, + ), + ], + ); + } + + Widget _buildCupItem({required WaterCupModel cup, required bool isSelected, required VoidCallback onTap}) { + return GestureDetector( + onTap: onTap, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Stack( + clipBehavior: Clip.none, + children: [ + Container( + width: 60.w, + height: 60.w, + decoration: BoxDecoration( + color: isSelected ? AppColors.primaryRedColor.withOpacity(0.08) : Colors.transparent, + borderRadius: BorderRadius.circular(12.r), + border: Border.all( + color: isSelected ? AppColors.primaryRedColor : AppColors.bgScaffoldColor, + width: 1, + ), + ), + child: Center( + child: Utils.buildSvgWithAssets( + icon: cup.iconPath, + height: 30.h, + width: 42.w, + iconColor: isSelected ? AppColors.primaryRedColor : null, + ), + ), + ), + // Red badge for custom cups (delete) + if (!cup.isDefault) + Positioned( + top: -6.h, + right: -6.w, + child: Builder(builder: (ctx) { + return InkWell( + onTap: () { + // call viewmodel remove + final vm = ctx.read(); + vm.removeCup(cup.id); + }, + child: Container( + color: AppColors.whiteColor, + child: Utils.buildSvgWithAssets(icon: AppAssets.minimizeIcon, height: 20.w, width: 20.w), + ), + ); + }), + ), + ], + ), + SizedBox(height: 2.h), + '${cup.capacityMl}ml'.toText10(weight: FontWeight.w500), + ], + ), + ); + } + + Widget _buildAddCupItem(BuildContext context) { + return GestureDetector( + onTap: () { + showCustomizeCupBottomSheet(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 60.w, + height: 60.w, + child: Center(child: Utils.buildSvgWithAssets(icon: AppAssets.cupAdd, height: 30.h, width: 42.w)), + ), + SizedBox(height: 4.h), + 'Add'.needTranslation.toText10(weight: FontWeight.w500), + ], + ), + ); + } +} + +/// Bottom sheet to customize cup capacity with slider +void showCustomizeCupBottomSheet(BuildContext context, {WaterCupModel? cupToEdit}) { + return showCommonBottomSheetWithoutHeight( + context, + titleWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Customize your drink cup".needTranslation.toText20(weight: FontWeight.w600), + ], + ), + child: CustomizeCupBottomSheet(cupToEdit: cupToEdit), + callBackFunc: () {}, + ); +} + +class CustomizeCupBottomSheet extends StatefulWidget { + final WaterCupModel? cupToEdit; + + const CustomizeCupBottomSheet({super.key, this.cupToEdit}); + + @override + State createState() => _CustomizeCupBottomSheetState(); +} + +class _CustomizeCupBottomSheetState extends State { + static const int minCapacity = 50; + static const int maxCapacity = 500; + + late double _currentCapacity; + + @override + void initState() { + super.initState(); + _currentCapacity = (widget.cupToEdit?.capacityMl ?? 150).toDouble(); + } + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Cup icon with fill level visualization + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 60.w, + height: 80.h, + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + // Cup image with dynamic fill + SizedBox( + width: 60.w, + height: 80.h, + child: Center( + child: Utils.buildSvgWithAssets( + icon: AppAssets.cupEmpty, + width: 60.w, + height: 80.h, + fit: BoxFit.contain, + ), + ), + ), + ClipRect( + child: Align( + alignment: Alignment.bottomCenter, + heightFactor: (_currentCapacity / maxCapacity).clamp(0.0, 1.0), + child: Utils.buildSvgWithAssets( + icon: AppAssets.cupFilled, + width: 60.w, + height: 80.h, + fit: BoxFit.contain, + )), + ), + ], + ), + ), + + SizedBox(width: 12.w), + + // Slider and labels + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Current value + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + '${_currentCapacity.round()}'.toText32(isBold: true), + SizedBox(width: 4.w), + Padding( + padding: EdgeInsets.only(bottom: 4.h), + child: Text( + 'ml', + style: TextStyle( + fontSize: 16.f, + fontWeight: FontWeight.w500, + color: AppColors.greyTextColor, + height: 1.0, + ), + ), + ), + ], + ).paddingOnly(left: 12.w), + + SizedBox(height: 16.h), + + // Slider + SliderTheme( + data: SliderTheme.of(context).copyWith( + activeTrackColor: AppColors.primaryRedColor, + inactiveTrackColor: AppColors.primaryRedColor.withOpacity(0.2), + thumbColor: AppColors.primaryRedColor, + overlayColor: AppColors.primaryRedColor.withOpacity(0.2), + trackHeight: 4.h, + thumbShape: RoundSliderThumbShape(enabledThumbRadius: 10.w), + ), + child: Slider( + value: _currentCapacity, + min: minCapacity.toDouble(), + max: maxCapacity.toDouble(), + divisions: (maxCapacity - minCapacity) ~/ 10, + onChanged: (value) => setState(() => _currentCapacity = value), + ), + ), + + Align( + alignment: Alignment.centerRight, + child: 'Max: $maxCapacity ml'.toText14( + color: AppColors.greyTextColor, + ), + ), + ], + ), + ), + ], + ), + + SizedBox(height: 24.h), + CustomButton( + text: 'Select'.needTranslation, + onPressed: () { + final newCup = WaterCupModel( + id: widget.cupToEdit?.id ?? Uuid().v4(), + name: '${_currentCapacity.round()}ml', + capacityMl: _currentCapacity.round(), + iconPath: AppAssets.cupEmpty, + isDefault: false, + ); + + final viewModel = context.read(); + if (widget.cupToEdit != null) { + viewModel.updateCup(newCup); + } else { + viewModel.addCup(newCup); + } + viewModel.selectCup(newCup.id); + + Navigator.pop(context); + Navigator.pop(context); + }, + backgroundColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + ), + ], + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart b/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart new file mode 100644 index 0000000..df55886 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class HydrationTipsWidget extends StatelessWidget { + const HydrationTipsWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 24.w), + padding: EdgeInsets.all(16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Utils.buildSvgWithAssets( + icon: AppAssets.bulb_icon, + width: 24.w, + height: 24.h, + ), + SizedBox(width: 8.w), + "Tips to stay hydrated".needTranslation.toText16(isBold: true), + ], + ), + SizedBox(height: 8.h), + " • ${"Drink before you feel thirsty"}".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: AppColors.textColorLight, + ), + SizedBox(height: 4.h), + " • ${"Keep a refillable bottle next to you"}".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: AppColors.textColorLight, + ), + SizedBox(height: 4.h), + " • ${"Track your daily intake to stay motivated"}".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: AppColors.textColorLight, + ), + SizedBox(height: 4.h), + " • ${"Choose sparkling water instead of soda"}".needTranslation.toText12( + fontWeight: FontWeight.w500, + color: AppColors.textColorLight, + ), + SizedBox(height: 8.h), + ], + ), + ); + } +} + diff --git a/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart b/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart new file mode 100644 index 0000000..6546f77 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart @@ -0,0 +1,159 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +class WaterActionButtonsWidget extends StatelessWidget { + const WaterActionButtonsWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Consumer(builder: (context, vm, _) { + final cupAmount = vm.selectedCupCapacityMl; + final isGoalAchieved = vm.progressPercent >= 100 || vm.nextDrinkTime.toLowerCase().contains('goal achieved'); + + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () async { + if (cupAmount > 0) { + await vm.undoUserActivity(); + } + }, + child: Utils.buildSvgWithAssets( + icon: AppAssets.minimizeIcon, + height: 20.h, + width: 20.h, + iconColor: AppColors.textColor, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.blueColor, + borderRadius: 99.r, + hasShadow: true, + ), + child: (cupAmount > 0 ? "+ $cupAmount ml" : "+ 0ml").toText12( + fontWeight: FontWeight.w600, + color: AppColors.whiteColor, + ), + ), + Opacity( + opacity: isGoalAchieved ? 0.4 : 1.0, + child: InkWell( + onTap: isGoalAchieved + ? null + : () async { + if (cupAmount > 0) { + await vm.insertUserActivity(quantityIntake: cupAmount); + } + }, + child: Utils.buildSvgWithAssets( + icon: AppAssets.addIconDark, + height: 20.h, + width: 20.h, + ), + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _buildActionButton( + context: context, + onTap: () => showSwitchCupBottomSheet(context), + overlayWidget: AppAssets.refreshIcon, + title: "Switch Cup".needTranslation, + icon: Utils.buildSvgWithAssets(icon: AppAssets.glassIcon, height: 24.w, width: 24.w), + ), + _buildActionButton( + context: context, + onTap: () async {}, + title: "Plain Water".needTranslation, + icon: Utils.buildSvgWithAssets(icon: AppAssets.glassIcon, height: 24.w, width: 24.w), + ), + _buildActionButton( + context: context, + onTap: () => context.navigateWithName(AppRoutes.waterMonitorSettingsScreen), + title: "Settings".needTranslation, + icon: Icon( + Icons.settings, + color: AppColors.blueColor, + size: 24.w, + ), + ), + ], + ), + ], + ); + }); + } + + Widget _buildActionButton({ + required BuildContext context, + String? overlayWidget, + required String title, + required Widget icon, + required VoidCallback onTap, + }) { + return InkWell( + onTap: onTap, + child: Column( + children: [ + Stack( + children: [ + Container( + height: 46.w, + width: 46.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.blueColor.withValues(alpha: 0.14), + borderRadius: 12.r, + hasShadow: true, + ), + child: Center(child: icon), + ), + if (overlayWidget != null) ...[ + Positioned( + top: 0, + right: 0, + child: Container( + padding: EdgeInsets.all(2.w), + height: 16.w, + width: 16.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.blueColor, + borderRadius: 100.r, + hasShadow: true, + ), + child: Center( + child: Utils.buildSvgWithAssets( + icon: AppAssets.refreshIcon, + iconColor: AppColors.whiteColor, + ), + ), + ), + ), + ] + ], + ), + SizedBox(height: 4.h), + title.toText10(), + ], + ), + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/water_bottle_widget.dart b/lib/presentation/water_monitor/widgets/water_bottle_widget.dart new file mode 100644 index 0000000..b681e32 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/water_bottle_widget.dart @@ -0,0 +1,112 @@ +import 'dart:math' as math; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/bottle_shape_clipper.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_consumption_progress_widget.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; + +class WaterBottleWidget extends StatelessWidget { + const WaterBottleWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, vm, _) { + final progressPercent = (vm.progress * 100).clamp(0.0, 100.0); + + // SVG aspect ratio + const svgAspectRatio = 315.0 / 143.0; // ~2.2 + + // Responsive bottle sizing with device-specific constraints + double bottleWidth; + if (isTablet) { + bottleWidth = math.min(SizeUtils.width * 0.15, 180.0); + } else if (isFoldable) { + bottleWidth = math.min(100.w, 160.0); + } else { + bottleWidth = math.min(120.w, 140.0); + } + + final bottleHeight = bottleWidth * svgAspectRatio; + + // Fillable area percentages + final fillableHeightPercent = 0.7; + const fillableWidthPercent = 0.8; + + final fillableHeight = bottleHeight * fillableHeightPercent; + final fillableWidth = bottleWidth * fillableWidthPercent; + + // Device-specific positioning offsets + final double leftOffset = isTablet ? 4.w : 8.w; + final double bottomOffset = isTablet ? -65.h : -78.h; + + return SizedBox( + height: bottleHeight, + width: bottleWidth, + child: Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + // Bottle SVG outline + Center( + child: Utils.buildSvgWithAssets( + icon: AppAssets.waterBottle, + height: bottleHeight, + width: bottleWidth, + fit: BoxFit.contain, + ), + ), + + // Wave and bubbles clipped to bottle shape + Positioned.fill( + left: leftOffset, + bottom: bottomOffset, + child: Center( + child: SizedBox( + width: fillableWidth, + height: fillableHeight, + child: ClipPath( + clipper: BottleShapeClipper(), + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + // Animated wave + Positioned( + child: WaterConsumptionProgressWidget( + progress: progressPercent, + size: math.min(fillableWidth, fillableHeight), + containerWidth: fillableWidth, + containerHeight: fillableHeight, + waveDuration: const Duration(milliseconds: 3000), + waveColor: AppColors.blueColor, + ), + ), + + // Bubbles (only show if progress > 10%) + if (progressPercent > 10) + Positioned( + bottom: fillableHeight * 0.12, + child: Utils.buildSvgWithAssets( + icon: AppAssets.waterBottleOuterBubbles, + height: isTablet ? math.min(45.0, fillableHeight * 0.2) : math.min(55.0, fillableHeight * 0.22), + width: fillableWidth * 0.65, + ), + ), + ], + ), + ), + ), + ), + ), + ], + ), + ); + }, + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/water_consumption_progress_widget.dart b/lib/presentation/water_monitor/widgets/water_consumption_progress_widget.dart new file mode 100644 index 0000000..08350a1 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/water_consumption_progress_widget.dart @@ -0,0 +1,78 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_splash_progress_widget.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class WaterConsumptionProgressWidget extends StatefulWidget { + /// progress: 0.0 - 100.0 + final double progress; + final double size; + final Color? waveColor; + final double? containerWidth; + final double? containerHeight; + final Duration? waveDuration; + + const WaterConsumptionProgressWidget({super.key, required this.progress, this.size = 100, this.waveColor, this.containerWidth, this.containerHeight, this.waveDuration}); + + @override + State createState() => _WaterConsumptionProgressWidgetState(); +} + +class _WaterConsumptionProgressWidgetState extends State with SingleTickerProviderStateMixin { + late AnimationController _progressController; + late Animation _progressAnimation; + double _lastTarget = 0.0; + + @override + void initState() { + super.initState(); + _lastTarget = widget.progress; + _progressController = AnimationController(vsync: this, duration: const Duration(milliseconds: 1200)); + _progressAnimation = Tween(begin: 0, end: widget.progress).animate(CurvedAnimation(parent: _progressController, curve: Curves.easeInOut)); + _progressController.forward(); + } + + @override + void didUpdateWidget(covariant WaterConsumptionProgressWidget oldWidget) { + super.didUpdateWidget(oldWidget); + if ((widget.progress - _lastTarget).abs() > 0.01) { + // animate from current value to new target + final begin = _progressAnimation.value; + _progressAnimation = + Tween(begin: begin, end: widget.progress).animate(CurvedAnimation(parent: _progressController, curve: Curves.easeInOut)); + _progressController + ..reset() + ..forward(); + _lastTarget = widget.progress; + } + } + + @override + void dispose() { + _progressController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + // default to app blue color if none provided + final blue = widget.waveColor ?? AppColors.blueColor; + return AnimatedBuilder( + animation: _progressAnimation, + builder: (context, child) { + return WaterWaveProgress( + progress: _progressAnimation.value, + size: widget.size, + showPercentage: false, + useCircleClip: false, + waveColor: blue, + containerWidth: widget.containerWidth, + containerHeight: widget.containerHeight, + waveDuration: widget.waveDuration, + backgroundColor: Colors.transparent, + progressColor: Colors.transparent, + textColor: Colors.transparent, + ); + }, + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart b/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart new file mode 100644 index 0000000..137f6a3 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_action_buttons_widget.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_bottle_widget.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:provider/provider.dart'; +import 'package:shimmer/shimmer.dart'; + +class WaterIntakeSummaryWidget extends StatelessWidget { + const WaterIntakeSummaryWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + AppColors.blueGradientColorOne, + AppColors.blueGradientColorTwo, + ], + ), + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: isTablet ? 2 : 3, + child: Consumer(builder: (context, vm, _) { + if (vm.isLoading) { + return _buildLoadingShimmer(); + } + + final goalMl = vm.dailyGoalMl; + final consumed = vm.totalConsumedMl; + final remaining = (goalMl - consumed) > 0 ? (goalMl - consumed) : 0; + final completedPercent = "${(vm.progress * 100).clamp(0.0, 100.0).toStringAsFixed(0)}%"; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Don't show label if goal is achieved + if (!vm.nextDrinkTime.toLowerCase().contains('goal achieved')) + // Show "Tomorrow" if nextDrinkTime contains "tomorrow", otherwise "Next Drink Time" + (vm.nextDrinkTime.toLowerCase().contains('tomorrow') ? "Tomorrow" : "Next Drink Time") + .needTranslation + .toText18(weight: FontWeight.w600, color: AppColors.textColor), + + // Extract only time if "tomorrow" is present, otherwise show as is + (vm.nextDrinkTime.toLowerCase().contains('tomorrow') + ? vm.nextDrinkTime.replaceAll(RegExp(r'tomorrow', caseSensitive: false), '').trim() + : vm.nextDrinkTime) + .toText32(weight: FontWeight.w600, color: AppColors.blueColor), + + SizedBox(height: 12.h), + _buildStatusColumn(title: "Your Goal".needTranslation, subTitle: "${goalMl}ml"), + SizedBox(height: 8.h), + _buildStatusColumn(title: "Remaining".needTranslation, subTitle: "${remaining}ml"), + SizedBox(height: 8.h), + _buildStatusColumn(title: "Completed".needTranslation, subTitle: completedPercent, subTitleColor: AppColors.successColor), + SizedBox(height: 8.h), + _buildStatusColumn( + title: "Hydration Status".needTranslation, + subTitle: vm.hydrationStatus, + subTitleColor: vm.hydrationStatusColor, + ), + ], + ); + }), + ), + SizedBox(width: isTablet ? 32 : 16.w), + Expanded( + flex: isTablet ? 1 : 2, + child: const WaterBottleWidget(), + ), + ], + ), + const WaterActionButtonsWidget(), + ], + ), + ); + } + + Widget _buildStatusColumn({required String title, required String subTitle, Color? subTitleColor}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "$title: ".toText16(weight: FontWeight.w500, color: AppColors.textColor), + subTitle.toText12( + fontWeight: FontWeight.w600, + color: subTitleColor ?? AppColors.greyTextColor, + ), + ], + ); + } + + Widget _buildLoadingShimmer() { + return ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(0.w), + itemCount: 4, + separatorBuilder: (_, __) => SizedBox(height: 12.h), + itemBuilder: (context, index) { + return Shimmer.fromColors( + baseColor: AppColors.shimmerBaseColor, + highlightColor: AppColors.shimmerHighlightColor, + child: Container( + height: 40.h, + decoration: BoxDecoration( + color: AppColors.whiteColor, + borderRadius: BorderRadius.circular(10.r), + ), + ), + ); + }, + ); + } +} diff --git a/lib/presentation/water_monitor/widgets/water_splash_progress_widget.dart b/lib/presentation/water_monitor/widgets/water_splash_progress_widget.dart new file mode 100644 index 0000000..da5eb06 --- /dev/null +++ b/lib/presentation/water_monitor/widgets/water_splash_progress_widget.dart @@ -0,0 +1,351 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +/// Spherical water wave progress bar with animated ripple effect +/// Based on https://github.com/meeziest/spherical_water_wavy_progress_bar +/// +/// Usage: +/// WaterWaveProgress( +/// progress: 75.0, +/// size: 200.w, +/// showPercentage: true, +/// ) +class WaterWaveProgress extends StatefulWidget { + final double progress; // 0.0 to 100.0 + final double size; + final bool showPercentage; + final bool useCircleClip; + final Color? waveColor; + final Color? backgroundColor; + final Color? progressColor; + final Color? textColor; + final Duration? waveDuration; + + // When drawing inside a non-square clip (like bottle area), provide the actual available + // width and height so the painter can compute vertical fill correctly. + final double? containerWidth; + final double? containerHeight; + + const WaterWaveProgress({ + super.key, + required this.progress, + this.size = 200, + this.showPercentage = true, + this.useCircleClip = true, + this.waveColor, + this.backgroundColor, + this.progressColor, + this.textColor, + this.waveDuration, + this.containerWidth, + this.containerHeight, + }); + + @override + State createState() => _WaterWaveProgressState(); +} + +class _WaterWaveProgressState extends State with SingleTickerProviderStateMixin { + late AnimationController _waveController; + + @override + void initState() { + super.initState(); + _waveController = AnimationController( + vsync: this, + duration: widget.waveDuration ?? const Duration(milliseconds: 2000), + )..repeat(); + } + + @override + void dispose() { + _waveController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final radius = widget.size / 2; + + // When container dimensions are provided (non-square bottle area), use them so + // the CustomPaint canvas matches the available clip rect. Otherwise fall back + // to the square size value. + final paintWidth = widget.containerWidth ?? widget.size; + final paintHeight = widget.containerHeight ?? widget.size; + + return SizedBox( + width: paintWidth, + height: paintHeight, + child: CustomPaint( + painter: _WavePainter( + progress: widget.progress, + waveAnimation: _waveController, + // For circle-based painters we still provide circleRadius; when using + // rectangular painting the circleRadius is unused. + circleRadius: radius, + waveColor: widget.waveColor ?? AppColors.primaryRedColor, + backgroundColor: widget.backgroundColor ?? AppColors.bgScaffoldColor, + useCircleClip: widget.useCircleClip, + containerWidth: widget.containerWidth, + containerHeight: widget.containerHeight, + ), + // Only draw the circular progress/percentage when explicitly requested. + foregroundPainter: widget.showPercentage + ? _ProgressPainter( + progress: widget.progress, + circleRadius: radius, + progressColor: widget.progressColor ?? AppColors.primaryRedColor, + textColor: widget.textColor ?? AppColors.textColor, + showPercentage: widget.showPercentage, + ) + : null, + ), + ); + } +} + +/// Paints the animated water waves inside a circular clip +class _WavePainter extends CustomPainter { + final double progress; + final Animation waveAnimation; + final double circleRadius; + final Color waveColor; + final Color backgroundColor; + final bool useCircleClip; + final double? containerWidth; + final double? containerHeight; + + _WavePainter({ + required this.progress, + required this.waveAnimation, + required this.circleRadius, + required this.waveColor, + required this.backgroundColor, + this.useCircleClip = true, + this.containerWidth, + this.containerHeight, + }) : super(repaint: waveAnimation); + + @override + void paint(Canvas canvas, Size size) { + final center = Offset(size.width / 2, size.height / 2); + canvas.translate(center.dx, center.dy); + + if (useCircleClip) { + // Clip to circle + canvas.clipPath( + Path() + ..addOval( + Rect.fromCircle( + center: Offset.zero, + radius: circleRadius, + ), + ), + ); + + // Fill background circle if specified + if (backgroundColor != Colors.transparent) { + canvas.drawCircle( + Offset.zero, + circleRadius, + Paint()..color = backgroundColor, + ); + } + + // Draw two sine waves clipped to circle for spherical style + _drawSineWave(canvas, waveColor.withAlpha((0.5 * 255).round()), shift: 0); + _drawSineWave(canvas, waveColor, shift: circleRadius / 2, mirror: true); + } else { + // No circular clipping: draw waves over the full rectangular area. Use provided container + // dimensions if available; otherwise fall back to square bounds derived from circleRadius. + final w = containerWidth ?? (circleRadius * 2); + final h = containerHeight ?? (circleRadius * 2); + + // use local transforms to center at origin and compute waves relative to the provided rect + canvas.save(); + canvas.translate(-w / 2, -h / 2); // move origin to top-left of the rect + + _drawSineWaveRect(canvas, waveColor.withAlpha((0.5 * 255).round()), width: w, height: h, shift: 0); + _drawSineWaveRect(canvas, waveColor, width: w, height: h, shift: w / 4, mirror: true); + + canvas.restore(); + } + } + + void _drawSineWaveRect(Canvas canvas, Color color, {required double width, required double height, double shift = 0.0, bool mirror = false}) { + if (mirror) { + canvas.save(); + canvas.translate(width, 0); + canvas.scale(-1, 1); + } + + final amplitude = height * 0.04; // smaller amplitude for rectangular waves + final angularVelocity = pi / (width / 2); + final delta = Curves.easeInOut.transform(progress / 100); + + final offsetX = 2 * width * waveAnimation.value + shift; + final offsetY = height * (1.0 - delta); + + final path = Path(); + for (double x = 0; x <= width; x += 1) { + final y = amplitude * sin(angularVelocity * (x + offsetX)); + if (x == 0) { + path.moveTo(x, y + offsetY); + } else { + path.lineTo(x, y + offsetY); + } + } + + path.lineTo(width, height); + path.lineTo(0, height); + path.close(); + + final wavePaint = Paint() + ..color = color + ..style = PaintingStyle.fill + ..isAntiAlias = true; + + canvas.drawPath(path, wavePaint); + + if (mirror) canvas.restore(); + } + + void _drawSineWave(Canvas canvas, Color color, {double shift = 0.0, bool mirror = false}) { + if (mirror) { + canvas.save(); + canvas.transform(Matrix4.rotationY(pi).storage); + } + + // original circular/spherical style: compute bounds based on circleRadius + final startX = -circleRadius; + final endX = circleRadius; + final startY = circleRadius; + final endY = -circleRadius; + + final amplitude = circleRadius * 0.15; + final angularVelocity = pi / circleRadius; + final delta = Curves.easeInOut.transform(progress / 100); + + final offsetX = 2 * circleRadius * waveAnimation.value + shift; + final offsetY = startY + (endY - startY - amplitude) * delta; + + final wavePaint = Paint() + ..color = color + ..style = PaintingStyle.fill + ..isAntiAlias = true; + + final path = Path(); + + for (double x = startX; x <= endX; x++) { + // Sine wave function: y = A * sin(ωx + φ) + final y = amplitude * sin(angularVelocity * (x + offsetX)); + if (x == startX) { + path.moveTo(x, y + offsetY); + } else { + path.lineTo(x, y + offsetY); + } + } + + path.lineTo(endX, startY); + path.lineTo(startX, startY); + path.close(); + + canvas.drawPath(path, wavePaint); + + if (mirror) canvas.restore(); + } + + @override + bool shouldRepaint(covariant _WavePainter oldDelegate) => oldDelegate.progress != progress; +} + +/// Paints the circular progress arc and percentage text +class _ProgressPainter extends CustomPainter { + final double progress; + final double circleRadius; + final Color progressColor; + final Color textColor; + final bool showPercentage; + + _ProgressPainter({ + required this.progress, + required this.circleRadius, + required this.progressColor, + required this.textColor, + required this.showPercentage, + }); + + @override + void paint(Canvas canvas, Size size) { + final center = Offset(size.width / 2, size.height / 2); + canvas.translate(center.dx, center.dy); + + _drawCircleProgress(canvas); + if (showPercentage) { + _drawProgressText(canvas); + } + } + + void _drawCircleProgress(Canvas canvas) { + final strokeWidth = circleRadius * 0.077; + + // Background circle with shadow + final bgPaint = Paint() + ..color = progressColor.withAlpha((0.2 * 255).round()) + ..strokeWidth = strokeWidth + ..style = PaintingStyle.stroke + ..isAntiAlias = true; + + final shadowPaint = Paint() + ..color = Colors.black.withAlpha((0.1 * 255).round()) + ..strokeWidth = strokeWidth + ..style = PaintingStyle.stroke + ..maskFilter = const MaskFilter.blur(BlurStyle.outer, 10); + + canvas.drawCircle(Offset.zero, circleRadius, bgPaint); + canvas.drawCircle(Offset.zero, circleRadius, shadowPaint); + + // Progress arc + final progressPaint = Paint() + ..color = progressColor + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke + ..isAntiAlias = true; + + canvas.drawArc( + Rect.fromCircle(center: Offset.zero, radius: circleRadius), + -0.5 * pi, + 2 * pi * (progress / 100), + false, + progressPaint, + ); + } + + void _drawProgressText(Canvas canvas) { + final textSpan = TextSpan( + text: "${progress.toInt()}%", + style: TextStyle( + color: textColor, + fontSize: circleRadius * 0.35, + fontWeight: FontWeight.w700, + height: 1.0, + ), + ); + + final textPainter = TextPainter( + text: textSpan, + textDirection: TextDirection.ltr, + )..layout(); + + textPainter.paint( + canvas, + Offset(-textPainter.width / 2, -textPainter.height / 2), + ); + } + + @override + bool shouldRepaint(covariant _ProgressPainter oldDelegate) => oldDelegate.progress != progress; +} diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index d09a6c0..78045b5 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -1,16 +1,34 @@ import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/register.dart'; import 'package:hmg_patient_app_new/presentation/authentication/register_step2.dart'; import 'package:hmg_patient_app_new/presentation/blood_donation/blood_donation_page.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/comprehensive_checkup_page.dart'; import 'package:hmg_patient_app_new/presentation/e_referral/new_e_referral.dart'; +import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculators_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_procedures_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/huawei_health_example.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/smartwatch_instructions_page.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/organ_selector_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/possible_conditions_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/risk_factors_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/suggestions_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/symptoms_selector_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/triage_screen.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection.dart'; +import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart'; import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/call_screen.dart'; +import 'package:hmg_patient_app_new/presentation/vital_sign/vital_sign_page.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/water_consumption_screen.dart'; +import 'package:hmg_patient_app_new/presentation/water_monitor/water_monitor_settings_screen.dart'; import 'package:hmg_patient_app_new/splashPage.dart'; +import '../presentation/covid19test/covid19_landing_page.dart'; + class AppRoutes { static const String initialRoute = '/initialRoute'; static const String loginScreen = '/loginScreen'; @@ -20,9 +38,33 @@ class AppRoutes { static const String medicalFilePage = '/medicalFilePage'; static const String eReferralPage = '/erReferralPage'; static const String comprehensiveCheckupPage = '/comprehensiveCheckupPage'; + static const String healthCalculatorsPage = '/healthCalculatorsPage'; + static const String healthConvertersPage = '/healthConvertersPage'; static const String homeHealthCarePage = '/homeHealthCarePage'; static const String zoomCallPage = '/zoomCallPage'; static const String bloodDonationPage = '/bloodDonationPage'; + static const String smartWatches = '/smartWatches'; + static const String huaweiHealthExample = '/huaweiHealthExample'; + static const String covid19Test = '/covid19Test'; + static const String vitalSign = '/vitalSign'; + //appointments + static const String bookAppointmentPage = '/bookAppointmentPage'; + + // Water Monitor + static const String waterConsumptionScreen = '/waterConsumptionScreen'; + static const String waterMonitorSettingsScreen = '/waterMonitorSettingsScreen'; + + // Symptoms Checker + static const String organSelectorPage = '/organSelectorPage'; + static const String symptomsSelectorScreen = '/symptomsCheckerScreen'; + static const String suggestionsScreen = '/suggestionsScreen'; + static const String riskFactorsScreen = '/riskFactorsScreen'; + static const String possibleConditionsScreen = '/possibleConditionsScreen'; + static const String triageScreen = '/triageProgressScreen'; + + //UserInfoSelection + static const String userInfoSelection = '/userInfoSelection'; + static const String userInfoFlowManager = '/userInfoFlowManager'; static Map get routes => { initialRoute: (context) => SplashPage(), @@ -31,10 +73,28 @@ class AppRoutes { register: (context) => RegisterNew(), registerStepTwo: (context) => RegisterNewStep2(), medicalFilePage: (context) => MedicalFilePage(), + zoomCallPage: (context) => CallScreen(), eReferralPage: (context) => NewReferralPage(), comprehensiveCheckupPage: (context) => ComprehensiveCheckupPage(), homeHealthCarePage: (context) => HhcProceduresPage(), - zoomCallPage: (context) => CallScreen(), - bloodDonationPage: (context) => BloodDonationPage() + organSelectorPage: (context) => OrganSelectorPage(), + symptomsSelectorScreen: (context) => SymptomsSelectorScreen(), + riskFactorsScreen: (context) => RiskFactorsScreen(), + suggestionsScreen: (context) => SuggestionsScreen(), + possibleConditionsScreen: (context) => PossibleConditionsScreen(), + triageScreen: (context) => TriageScreen(), + bloodDonationPage: (context) => BloodDonationPage(), + bookAppointmentPage: (context) => BookAppointmentPage(), + userInfoSelection: (context) => UserInfoSelectionScreen(), + userInfoFlowManager: (context) => UserInfoFlowManager(), + smartWatches: (context) => SmartwatchInstructionsPage(), + huaweiHealthExample: (context) => HuaweiHealthExample(), + covid19Test: (context) => Covid19LandingPage(), + // + waterConsumptionScreen: (context) => WaterConsumptionScreen(), + waterMonitorSettingsScreen: (context) => WaterMonitorSettingsScreen(), + healthCalculatorsPage: (context) => HealthCalculatorsPage(type: HealthCalConEnum.calculator), + healthConvertersPage: (context) => HealthCalculatorsPage(type: HealthCalConEnum.converter), + vitalSign: (context) => VitalSignPage() }; } diff --git a/lib/services/analytics/analytics_service.dart b/lib/services/analytics/analytics_service.dart index 3411157..c8f2e48 100644 --- a/lib/services/analytics/analytics_service.dart +++ b/lib/services/analytics/analytics_service.dart @@ -1,8 +1,5 @@ import 'package:firebase_analytics/firebase_analytics.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:geolocator/geolocator.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/services/analytics/flows/advance_payments.dart'; @@ -15,7 +12,6 @@ import 'package:hmg_patient_app_new/services/analytics/flows/live_care.dart'; import 'package:hmg_patient_app_new/services/analytics/flows/login_registration.dart'; import 'package:hmg_patient_app_new/services/analytics/flows/offers_promotions.dart'; import 'package:hmg_patient_app_new/services/analytics/flows/todo_list.dart'; -import 'package:http/http.dart' as AnalyticEvents; typedef GALogger = Function(String name, {Map parameters}); diff --git a/lib/services/analytics/flows/advance_payments.dart b/lib/services/analytics/flows/advance_payments.dart index 9c8baa1..133e241 100644 --- a/lib/services/analytics/flows/advance_payments.dart +++ b/lib/services/analytics/flows/advance_payments.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; class AdvancePayments{ diff --git a/lib/services/analytics/flows/appointments.dart b/lib/services/analytics/flows/appointments.dart index 57c45e6..d9991a6 100644 --- a/lib/services/analytics/flows/appointments.dart +++ b/lib/services/analytics/flows/appointments.dart @@ -1,8 +1,5 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; -import 'package:intl/intl.dart'; class Appointment { final GALogger logger; diff --git a/lib/services/analytics/flows/live_care.dart b/lib/services/analytics/flows/live_care.dart index 5e7f330..c5fac58 100644 --- a/lib/services/analytics/flows/live_care.dart +++ b/lib/services/analytics/flows/live_care.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; class LiveCare{ diff --git a/lib/services/analytics/flows/login_registration.dart b/lib/services/analytics/flows/login_registration.dart index 9488324..611cc47 100644 --- a/lib/services/analytics/flows/login_registration.dart +++ b/lib/services/analytics/flows/login_registration.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; class LoginRegistration{ diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart new file mode 100644 index 0000000..fd154c6 --- /dev/null +++ b/lib/services/notification_service.dart @@ -0,0 +1,373 @@ +import 'dart:typed_data'; + +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:hmg_patient_app_new/services/logger_service.dart'; +import 'package:timezone/data/latest_all.dart' as tz; +import 'package:timezone/timezone.dart' as tz show TZDateTime, local, setLocalLocation, getLocation; + +/// Abstract class defining the notification service interface +abstract class NotificationService { + /// Initialize the notification service + Future initialize({Function(String payload)? onNotificationClick}); + + /// Request notification permissions (mainly for iOS) + Future requestPermissions(); + + /// Show an immediate notification + Future showNotification({ + required String title, + required String body, + String? payload, + }); + + /// Schedule a notification at a specific date and time + Future scheduleNotification({ + required int id, + required String title, + required String body, + required DateTime scheduledDate, + String? payload, + }); + + /// Schedule daily notifications at specific times + Future scheduleDailyNotifications({ + required List times, + required String title, + required String body, + String? payload, + }); + + /// Schedule water reminder notifications + Future scheduleWaterReminders({ + required List reminderTimes, + required String title, + required String body, + }); + + /// Cancel a specific notification by id + Future cancelNotification(int id); + + /// Cancel all scheduled notifications + Future cancelAllNotifications(); + + /// Get list of pending notifications + Future> getPendingNotifications(); +} + +/// Implementation of NotificationService following the project architecture +class NotificationServiceImp implements NotificationService { + final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; + final LoggerService loggerService; + + NotificationServiceImp({required this.flutterLocalNotificationsPlugin, required this.loggerService}); + + // Channel IDs for different notification types + static const String _waterReminderChannelId = 'water_reminder_channel'; + static const String _waterReminderChannelName = 'Water Reminders'; + static const String _waterReminderChannelDescription = 'Daily water intake reminders'; + + static const String _generalChannelId = 'hmg_general_channel'; + static const String _generalChannelName = 'HMG Notifications'; + static const String _generalChannelDescription = 'General notifications from HMG'; + + Function(String payload)? _onNotificationClick; + + @override + Future initialize({Function(String payload)? onNotificationClick}) async { + try { + // Initialize timezone database + tz.initializeTimeZones(); + + // Set local timezone (you can also use a specific timezone if needed) + // For example: tz.setLocalLocation(tz.getLocation('Asia/Riyadh')); + final locationName = DateTime.now().timeZoneName; + try { + tz.setLocalLocation(tz.getLocation(locationName)); + } catch (e) { + // Fallback to UTC if specific timezone not found + loggerService.logInfo('Could not set timezone $locationName, using UTC'); + tz.setLocalLocation(tz.getLocation('UTC')); + } + + _onNotificationClick = onNotificationClick; + + const androidSettings = AndroidInitializationSettings('app_icon'); + const iosSettings = DarwinInitializationSettings( + requestAlertPermission: true, + requestBadgePermission: true, + requestSoundPermission: true, + ); + + const initializationSettings = InitializationSettings( + android: androidSettings, + iOS: iosSettings, + ); + + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: _handleNotificationResponse, + ); + + loggerService.logInfo('NotificationService initialized successfully'); + } catch (ex) { + loggerService.logError('Failed to initialize NotificationService: $ex'); + } + } + + /// Handle notification tap + void _handleNotificationResponse(NotificationResponse response) { + try { + if (response.payload != null && _onNotificationClick != null) { + _onNotificationClick!(response.payload!); + } + loggerService.logInfo('Notification tapped: ${response.payload}'); + } catch (ex) { + loggerService.logError('Error handling notification response: $ex'); + } + } + + @override + Future requestPermissions() async { + try { + // Request permissions for iOS + final result = + await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.requestPermissions( + alert: true, + badge: true, + sound: true, + ); + + // For Android 13+, permissions are requested at runtime + final androidResult = await flutterLocalNotificationsPlugin + .resolvePlatformSpecificImplementation() + ?.requestNotificationsPermission(); + + loggerService.logInfo('Notification permissions: iOS=${result ?? true}, Android=${androidResult ?? true}'); + return result ?? androidResult ?? true; + } catch (ex) { + loggerService.logError('Error requesting notification permissions: $ex'); + return false; + } + } + + @override + Future showNotification({ + required String title, + required String body, + String? payload, + }) async { + try { + final androidDetails = AndroidNotificationDetails( + _generalChannelId, + _generalChannelName, + channelDescription: _generalChannelDescription, + importance: Importance.high, + priority: Priority.high, + vibrationPattern: _getVibrationPattern(), + ); + + const iosDetails = DarwinNotificationDetails(); + + final notificationDetails = NotificationDetails( + android: androidDetails, + iOS: iosDetails, + ); + + await flutterLocalNotificationsPlugin.show( + DateTime.now().millisecondsSinceEpoch ~/ 1000, + title, + body, + notificationDetails, + payload: payload, + ); + + loggerService.logInfo('Notification shown: $title'); + } catch (ex) { + loggerService.logError('Error showing notification: $ex'); + } + } + + @override + Future scheduleNotification({ + required int id, + required String title, + required String body, + required DateTime scheduledDate, + String? payload, + }) async { + try { + final androidDetails = AndroidNotificationDetails( + _generalChannelId, + _generalChannelName, + channelDescription: _generalChannelDescription, + importance: Importance.high, + priority: Priority.high, + vibrationPattern: _getVibrationPattern(), + ); + + const iosDetails = DarwinNotificationDetails(); + + final notificationDetails = NotificationDetails( + android: androidDetails, + iOS: iosDetails, + ); + + await flutterLocalNotificationsPlugin.zonedSchedule( + id, + title, + body, + tz.TZDateTime.from(scheduledDate, tz.local), + notificationDetails, + androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle, + payload: payload, + ); + + loggerService.logInfo('Notification scheduled for: $scheduledDate'); + } catch (ex) { + loggerService.logError('Error scheduling notification: $ex'); + } + } + + @override + Future scheduleDailyNotifications({ + required List times, + required String title, + required String body, + String? payload, + }) async { + try { + for (int i = 0; i < times.length; i++) { + final time = times[i]; + await scheduleNotification( + id: i + 1000, + // Offset ID to avoid conflicts + title: title, + body: body, + scheduledDate: time, + payload: payload, + ); + } + + loggerService.logInfo('Scheduled ${times.length} daily notifications'); + } catch (ex) { + loggerService.logError('Error scheduling daily notifications: $ex'); + } + } + + @override + Future scheduleWaterReminders({ + required List reminderTimes, + required String title, + required String body, + }) async { + try { + // Cancel existing water reminders first + await _cancelWaterReminders(); + + final androidDetails = AndroidNotificationDetails( + _waterReminderChannelId, + _waterReminderChannelName, + channelDescription: _waterReminderChannelDescription, + importance: Importance.high, + priority: Priority.high, + vibrationPattern: _getVibrationPattern(), + icon: 'app_icon', + styleInformation: const BigTextStyleInformation(''), + ); + + const iosDetails = DarwinNotificationDetails( + presentAlert: true, + presentBadge: true, + presentSound: true, + ); + + final notificationDetails = NotificationDetails( + android: androidDetails, + iOS: iosDetails, + ); + + for (int i = 0; i < reminderTimes.length; i++) { + final reminderTime = reminderTimes[i]; + final notificationId = 5000 + i; // Use 5000+ range for water reminders + + // Schedule for today if time hasn't passed, otherwise schedule for tomorrow + DateTime scheduledDate = reminderTime; + if (scheduledDate.isBefore(DateTime.now())) { + scheduledDate = scheduledDate.add(const Duration(days: 1)); + } + + await flutterLocalNotificationsPlugin.zonedSchedule( + notificationId, + title, + body, + tz.TZDateTime.from(scheduledDate, tz.local), + notificationDetails, + androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle, + matchDateTimeComponents: DateTimeComponents.time, // Repeat daily at the same time + payload: 'water_reminder_$i', + ); + } + + loggerService.logInfo('Scheduled ${reminderTimes.length} water reminders'); + } catch (ex) { + loggerService.logError('Error scheduling water reminders: $ex'); + } + } + + /// Cancel all water reminders (IDs 5000-5999) + Future _cancelWaterReminders() async { + try { + final pendingNotifications = await getPendingNotifications(); + for (final notification in pendingNotifications) { + if (notification.id >= 5000 && notification.id < 6000) { + await cancelNotification(notification.id); + } + } + loggerService.logInfo('Cancelled all water reminders'); + } catch (ex) { + loggerService.logError('Error cancelling water reminders: $ex'); + } + } + + @override + Future cancelNotification(int id) async { + try { + await flutterLocalNotificationsPlugin.cancel(id); + loggerService.logInfo('Cancelled notification with ID: $id'); + } catch (ex) { + loggerService.logError('Error cancelling notification: $ex'); + } + } + + @override + Future cancelAllNotifications() async { + try { + await flutterLocalNotificationsPlugin.cancelAll(); + loggerService.logInfo('Cancelled all notifications'); + } catch (ex) { + loggerService.logError('Error cancelling all notifications: $ex'); + } + } + + @override + Future> getPendingNotifications() async { + try { + final pending = await flutterLocalNotificationsPlugin.pendingNotificationRequests(); + loggerService.logInfo('Found ${pending.length} pending notifications'); + return pending; + } catch (ex) { + loggerService.logError('Error getting pending notifications: $ex'); + return []; + } + } + + /// Get vibration pattern for notifications + Int64List _getVibrationPattern() { + final vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 500; + vibrationPattern[2] = 500; + vibrationPattern[3] = 500; + return vibrationPattern; + } +} diff --git a/lib/splashPage.dart b/lib/splashPage.dart index b5b752b..043eefd 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,41 +1,34 @@ import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_callkit_incoming/entities/call_event.dart'; import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart'; import 'package:get_it/get_it.dart'; -import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart'; -import 'package:hmg_patient_app_new/presentation/onboarding/onboarding_screen.dart'; -import 'package:hmg_patient_app_new/presentation/onboarding/splash_animation_screen.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; - -// import 'package:hmg_patient_app_new/presentation/authantication/login.dart'; -import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; +import 'package:hmg_patient_app_new/presentation/onboarding/onboarding_screen.dart'; +import 'package:hmg_patient_app_new/presentation/onboarding/splash_animation_screen.dart'; import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/call_screen.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/services/notification_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:lottie/lottie.dart'; -import 'package:provider/provider.dart'; import 'core/cache_consts.dart'; -import 'core/utils/local_notifications.dart'; import 'core/utils/push_notification_handler.dart'; -import 'widgets/routes/custom_page_route.dart'; class SplashPage extends StatefulWidget { + const SplashPage({super.key}); + @override _SplashScreenState createState() => _SplashScreenState(); } @@ -54,9 +47,13 @@ class _SplashScreenState extends State { ); await authVm.getServicePrivilege(); Timer(Duration(seconds: 2, milliseconds: 500), () async { - bool isAppOpenedFromCall = await GetIt.instance().getBool(key: CacheConst.isAppOpenedFromCall) ?? false; + bool isAppOpenedFromCall = getIt.get().getBool(key: CacheConst.isAppOpenedFromCall) ?? false; - LocalNotification.init(onNotificationClick: (payload) {}); + // Initialize NotificationService using dependency injection + final notificationService = getIt.get(); + await notificationService.initialize(onNotificationClick: (payload) { + // Handle notification click here + }); if (isAppOpenedFromCall) { navigateToTeleConsult(); @@ -85,7 +82,8 @@ class _SplashScreenState extends State { // GetIt.instance().remove(key: CacheConst.isAppOpenedFromCall); Utils.removeFromPrefs(CacheConst.isAppOpenedFromCall); - Navigator.of(GetIt.instance().navigatorKey.currentContext!).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); + Navigator.of(GetIt.instance().navigatorKey.currentContext!) + .pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); Navigator.pushReplacementNamed( // context, GetIt.instance().navigatorKey.currentContext!, @@ -218,12 +216,12 @@ class _SplashScreenState extends State { // AppSharedPreferences().setString(APP_LANGUAGE, projectProvider.isArabic ? "ar" : "en"); // var themeNotifier = Provider.of(context, listen: false); // themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); - PushNotificationHandler().init(context); // Asyncronously + // PushNotificationHandler().init(context); // Asyncronously } @override void initState() { - authVm = context.read(); + authVm = getIt(); super.initState(); initializeStuff(); } @@ -232,6 +230,8 @@ class _SplashScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.whiteColor, - body: Lottie.asset(AppAnimations.loadingAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 80.h, height: 80.h, fit: BoxFit.fill).center); + body: Lottie.asset(AppAnimations.loadingAnimation, + repeat: true, reverse: false, frameRate: FrameRate(60), width: 80.h, height: 80.h, fit: BoxFit.fill) + .center); } } diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart index f185479..c09d537 100644 --- a/lib/theme/app_theme.dart +++ b/lib/theme/app_theme.dart @@ -10,7 +10,7 @@ class AppTheme { pageTransitionsTheme: const PageTransitionsTheme( builders: { TargetPlatform.android: ZoomPageTransitionsBuilder(), - TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder() }, ), hintColor: Colors.grey[400], diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 7bee72d..c631f5b 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -8,7 +8,9 @@ class AppColors { static const bottomSheetBgColor = Color(0xFFF8F8FA); static const lightGreyEFColor = Color(0xffeaeaff); static const greyF7Color = Color(0xffF7F7F7); + static const greyInfoTextColor = Color(0xff777777); static const lightGrayColor = Color(0xff808080); + static const greyTextColorLight = Color(0xFFA2A2A2); // New UI Colors static const whiteColor = Color(0xFFffffff); @@ -31,6 +33,9 @@ class AppColors { static const Color inputLabelTextColor = Color(0xff898A8D); static const Color greyTextColor = Color(0xFF8F9AA3); static const Color lightGrayBGColor = Color(0x142E3039); + static const Color checkBoxBorderColor = Color(0xffD2D2D2); + + static const Color pharmacyBGColor = Color(0xFF359846); static const lightGreenColor = Color(0xFF0ccedde); static const textGreenColor = Color(0xFF18C273); @@ -39,6 +44,7 @@ class AppColors { //Chips static const Color successColor = Color(0xff18C273); + static const Color successLightBgColor = Color(0xffDDF6EA); static const Color errorColor = Color(0xFFED1C2B); static const Color alertColor = Color(0xFFD48D05); static const Color infoColor = Color(0xFF0B85F7); @@ -82,8 +88,25 @@ class AppColors { static const Color infoBannerIconColor = Color(0xFFCC9B14); static const Color infoBannerTextColor = Color(0xFF856404); + // SymptomsChecker + + static const Color chipColorSeekMedicalAdvice = Color(0xFFFFAF15); + static const Color chipTextColorSeekMedicalAdvice = Color(0xFFAB7103); + static const Color chipColorMonitor = Color(0xFF18C273); + static const Color chipColorEmergency = Color(0xFFED1C2B); + // Services Page Colors static const Color eReferralCardColor = Color(0xFFFF8012); static const Color bloodDonationCardColor = Color(0xFFFF5662); static const Color bookAppointment = Color(0xFF415364); + + // Water Monitor + static const Color blueColor = Color(0xFF4EB5FF); + static const Color blueGradientColorOne = Color(0xFFF1F7FD); + static const Color blueGradientColorTwo = Color(0xFFD9EFFF); + + // Shimmer + static const Color shimmerBaseColor = Color(0xFFE0E0E0); + static const Color shimmerHighlightColor = Color(0xFFF5F5F5); + static const Color covid29Color = Color(0xff2563EB); } diff --git a/lib/widgets/appbar/collapsing_list_view.dart b/lib/widgets/appbar/collapsing_list_view.dart index cf711a0..c1ab6d4 100644 --- a/lib/widgets/appbar/collapsing_list_view.dart +++ b/lib/widgets/appbar/collapsing_list_view.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -6,6 +5,7 @@ import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -26,6 +26,7 @@ class CollapsingListView extends StatelessWidget { bool isClose; bool isLeading; VoidCallback? leadingCallback; + ScrollPhysics? physics; CollapsingListView({ super.key, @@ -41,7 +42,11 @@ class CollapsingListView extends StatelessWidget { this.requests, this.isLeading = true, this.trailing, - this.leadingCallback}); + this.leadingCallback, + this.physics, + }); + + final ScrollController _controller = ScrollController(); @override Widget build(BuildContext context) { @@ -51,15 +56,32 @@ class CollapsingListView extends StatelessWidget { body: Column( children: [ CustomScrollView( + physics: physics, + controller: _controller, slivers: [ SliverAppBar( - automaticallyImplyLeading: false, + automaticallyImplyLeading: isLeading, pinned: true, - expandedHeight: MediaQuery.of(context).size.height * 0.11.h, - stretch: true, + // toolbarHeight: isLeading ? 24.h : kToolbarHeight, + leadingWidth: isLeading ? null : double.infinity, systemOverlayStyle: SystemUiOverlayStyle(statusBarBrightness: Brightness.light), surfaceTintColor: Colors.transparent, backgroundColor: AppColors.bgScaffoldColor, + bottom: isLeading + ? ScrollAnimatedTitle( + title: title, + showBack: true, + controller: _controller, + search: search, + report: report, + logout: logout, + history: history, + instructions: instructions, + requests: requests, + bottomChild: bottomChild, + trailing: trailing, + ) + : null, leading: isLeading ? Transform.flip( flipX: appState.isArabic(), @@ -67,69 +89,28 @@ class CollapsingListView extends StatelessWidget { icon: Utils.buildSvgWithAssets(icon: isClose ? AppAssets.closeBottomNav : AppAssets.arrow_back, width: 32.h, height: 32.h), padding: EdgeInsets.only(left: 12), onPressed: () { - if(leadingCallback != null) { + if (leadingCallback != null) { leadingCallback!(); } else { - Navigator.pop(context); + context.pop(); } }, highlightColor: Colors.transparent, ), ) - : SizedBox.shrink(), - flexibleSpace: LayoutBuilder( - builder: (context, constraints) { - final double maxHeight = 100.h; - final double minHeight = kToolbarHeight; - double t = (constraints.maxHeight - minHeight) / (maxHeight - minHeight); - t = t - 1; - if (t < 0.7) t = 0.7; - t = t.clamp(0.0, 1.0); - - final double fontSize = lerpDouble(14, 18, t)!; - final double bottomPadding = lerpDouble(0, 0, t)!; - final double leftPadding = lerpDouble(150, 24, t)!; - - return Stack( - children: [ - Align( - alignment: Alignment.lerp( - Alignment.center, - Alignment.bottomLeft, - t, - )!, - child: Padding( - padding: EdgeInsets.only(left: appState.isArabic() ? 0 : leftPadding, right: appState.isArabic() ? leftPadding : 0, bottom: bottomPadding), - child: Row( - spacing: 4.h, - children: [ - Text( - title, - maxLines: 1, - style: TextStyle( - fontSize: (27 - (5 * (2 - t))).f, - fontWeight: FontWeight.lerp( - FontWeight.w300, - FontWeight.w600, - t, - )!, - color: AppColors.blackColor, - letterSpacing: -0.5), - ).expanded, - if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(logout!), - if (report != null) actionButton(context, t, title: "Feedback".needTranslation, icon: AppAssets.report_icon).onPress(report!), - if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!), - if (instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(instructions!), - if (requests != null) actionButton(context, t, title: "Requests".needTranslation, icon: AppAssets.insurance_history_icon).onPress(requests!), - if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24), - if (trailing != null) trailing!, - ], - )), - ), - ], - ); - }, - ), + : ScrollAnimatedTitle( + title: title, + showBack: false, + controller: _controller, + search: search, + report: report, + logout: logout, + history: history, + instructions: instructions, + requests: requests, + bottomChild: bottomChild, + trailing: trailing, + ), ), SliverList( delegate: SliverChildBuilderDelegate( @@ -145,13 +126,161 @@ class CollapsingListView extends StatelessWidget { ); } +// Widget actionButton(BuildContext context, double t, {required String title, required String icon}) { +// return AnimatedSize( +// duration: Duration(milliseconds: 150), +// child: Container( +// height: 40.h, +// padding: EdgeInsets.all(8.w), +// margin: EdgeInsets.only(right: 24.w), +// decoration: RoundedRectangleBorder().toSmoothCornerDecoration( +// color: AppColors.secondaryLightRedColor, +// borderRadius: 10.r, +// ), +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.center, +// mainAxisAlignment: MainAxisAlignment.center, +// mainAxisSize: MainAxisSize.min, +// spacing: 8.h, +// children: [ +// Utils.buildSvgWithAssets(icon: icon, iconColor: AppColors.primaryRedColor), +// if (t == 1) +// Text( +// title, +// style: context.dynamicTextStyle( +// color: AppColors.primaryRedColor, +// letterSpacing: -0.4, +// fontSize: (12 - (2 * (1 - t))).f, +// fontWeight: FontWeight.lerp( +// FontWeight.w300, +// FontWeight.w500, +// t, +// )!, +// ), +// ), +// ], +// ), +// ), +// ); +// } +} +// +// class ActionModel { +// bool requireT; +// +// } + +class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget { + final String title; + final bool showBack; + final ScrollController controller; + + VoidCallback? search; + VoidCallback? report; + VoidCallback? logout; + VoidCallback? history; + VoidCallback? instructions; + VoidCallback? requests; + Widget? bottomChild; + Widget? trailing; + + ScrollAnimatedTitle({ + super.key, + required this.title, + required this.controller, + required this.showBack, + this.search, + this.report, + this.logout, + this.history, + this.instructions, + this.requests, + this.bottomChild, + this.trailing, + }); + + @override + Size get preferredSize => const Size.fromHeight(50); + + @override + State createState() => _ScrollAnimatedTitleState(); +} + +class _ScrollAnimatedTitleState extends State { + static const double _maxFont = 26; + static const double _minFont = 18; + + static const double _maxHeight = 80; + static const double _minHeight = 56; + + double _fontSize = _maxFont; + + @override + void initState() { + super.initState(); + widget.controller.addListener(_onScroll); + } + + @override + void dispose() { + widget.controller.removeListener(_onScroll); + super.dispose(); + } + + double t = 0; + + void _onScroll() { + final double offset = widget.controller.offset; + + // control animation range + const double range = 120; + + final double t = (1 - (offset / range)).clamp(0.0, 1.0); + this.t = t; + setState(() { + _fontSize = _minFont + (_maxFont - _minFont) * t; + }); + } + + @override + Widget build(BuildContext context) { + final isRtl = Directionality.of(context) == TextDirection.rtl; + return Container( + height: (widget.preferredSize.height - _fontSize / 2).h, + alignment: isRtl ? (widget.showBack ? Alignment.topRight : Alignment.centerRight) : (widget.showBack ? Alignment.topLeft : Alignment.centerLeft), + padding: EdgeInsets.fromLTRB(24, 0, 24, 0), + child: Row( + spacing: 4.h, + children: [ + Text( + widget.title, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: _fontSize, + fontWeight: FontWeight.bold, + ), + ).expanded, + ...[ + if (widget.logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(widget.logout!), + if (widget.report != null) actionButton(context, t, title: "Feedback".needTranslation, icon: AppAssets.report_icon).onPress(widget.report!), + if (widget.history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.history!), + if (widget.instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(widget.instructions!), + if (widget.requests != null) actionButton(context, t, title: "Requests".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.requests!), + if (widget.search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(widget.search!), + if (widget.trailing != null) widget.trailing!, + ] + ], + ), + ); + } + Widget actionButton(BuildContext context, double t, {required String title, required String icon}) { return AnimatedSize( duration: Duration(milliseconds: 150), child: Container( - height: 40.h, + height: 36.h + (4.h * t), padding: EdgeInsets.all(8.w), - margin: EdgeInsets.only(right: 24.w), decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.secondaryLightRedColor, borderRadius: 10.r, @@ -163,7 +292,7 @@ class CollapsingListView extends StatelessWidget { spacing: 8.h, children: [ Utils.buildSvgWithAssets(icon: icon, iconColor: AppColors.primaryRedColor), - if (t == 1) + if (t >= .5) Text( title, style: context.dynamicTextStyle( @@ -171,7 +300,7 @@ class CollapsingListView extends StatelessWidget { letterSpacing: -0.4, fontSize: (12 - (2 * (1 - t))).f, fontWeight: FontWeight.lerp( - FontWeight.w300, + FontWeight.w400, FontWeight.w500, t, )!, diff --git a/lib/widgets/buttons/custom_button.dart b/lib/widgets/buttons/custom_button.dart index b823eae..08d281f 100644 --- a/lib/widgets/buttons/custom_button.dart +++ b/lib/widgets/buttons/custom_button.dart @@ -3,6 +3,7 @@ import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; class CustomButton extends StatelessWidget { final String text; @@ -64,17 +65,17 @@ class CustomButton extends StatelessWidget { width: width, padding: padding, decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: isDisabled ? backgroundColor.withValues(alpha: .5) : backgroundColor, + color: isDisabled ? AppColors.inputLabelTextColor.withValues(alpha: 0.3) : backgroundColor, borderRadius: radius, customBorder: BorderRadius.circular(radius), - side: borderSide ?? BorderSide(width: borderWidth.h, color: borderColor)), + side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? Colors.transparent : borderColor)), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ if (icon != null) Padding( - padding: text.isNotEmpty ? EdgeInsets.only(right: 6.w, left: 6.w) : EdgeInsets.zero, + padding: text.isNotEmpty ? EdgeInsets.only(right: 8.w, left: 8.w) : EdgeInsets.zero, child: Utils.buildSvgWithAssets(icon: icon!, iconColor: iconColor, isDisabled: isDisabled, width: iconS, height: iconS), ), Visibility( @@ -86,7 +87,7 @@ class CustomButton extends StatelessWidget { overflow: textOverflow, style: context.dynamicTextStyle( fontSize: fontS, - color: isDisabled ? textColor.withValues(alpha: 0.5) : textColor, + color: isDisabled ? AppColors.greyTextColor : textColor, letterSpacing: 0, fontWeight: fontWeight, ), diff --git a/lib/widgets/chip/app_custom_chip_widget.dart b/lib/widgets/chip/app_custom_chip_widget.dart index 8be16b7..8597b3e 100644 --- a/lib/widgets/chip/app_custom_chip_widget.dart +++ b/lib/widgets/chip/app_custom_chip_widget.dart @@ -72,13 +72,13 @@ class AppCustomChipWidget extends StatelessWidget { ? Image.asset(icon, width: iconS, height: iconS) : Utils.buildSvgWithAssets( icon: icon, - width: iconS, - height: iconS, - iconColor: iconHasColor ? iconColor : null, - fit: BoxFit.contain, - ) + width: iconS, + height: iconS, + iconColor: iconHasColor ? iconColor : null, + fit: BoxFit.contain, + ) : SizedBox.shrink(), - label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), + label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), padding: padding, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, labelPadding: labelPadding ?? EdgeInsetsDirectional.only(end: deleteIcon?.isNotEmpty == true ? 2.w : 8.w), @@ -104,7 +104,7 @@ class AppCustomChipWidget extends StatelessWidget { ) : Chip( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor, isCenter: true), + label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor, isCenter: true), padding: EdgeInsets.zero, backgroundColor: backgroundColor, shape: shape ?? diff --git a/lib/widgets/chip/custom_chip_widget.dart b/lib/widgets/chip/custom_chip_widget.dart index 5dee4f0..b60db57 100644 --- a/lib/widgets/chip/custom_chip_widget.dart +++ b/lib/widgets/chip/custom_chip_widget.dart @@ -67,7 +67,12 @@ class CustomChipWidget extends StatelessWidget { Utils.buildSvgWithAssets(icon: iconAsset!), SizedBox(width: 4.h), ], - chipText.toText10(isBold: true, color: isSelected ? Colors.white : textColor ?? chipType.color, maxlines: 1, weight: FontWeight.w500, letterSpacing: -0.5), + chipText.toText10( + isBold: true, + color: isSelected ? Colors.white : textColor ?? chipType.color, + maxlines: 1, + weight: FontWeight.w500, + letterSpacing: -0.5), ], ), ), diff --git a/lib/widgets/chip/custom_selectable_chip.dart b/lib/widgets/chip/custom_selectable_chip.dart new file mode 100644 index 0000000..be42bfd --- /dev/null +++ b/lib/widgets/chip/custom_selectable_chip.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +class CustomSelectableChip extends StatelessWidget { + final String label; + final bool selected; + final VoidCallback? onTap; + final Color activeColor; + final Color activeTextColor; + final Color inactiveBorderColor; + final Color inactiveTextColor; + + const CustomSelectableChip({ + super.key, + required this.label, + required this.selected, + this.onTap, + this.activeColor = const Color(0xFFD03C32), // red accent + this.activeTextColor = Colors.white, + this.inactiveBorderColor = const Color(0xFFE8E8E8), + this.inactiveTextColor = const Color(0xFF222222), + }); + + @override + Widget build(BuildContext context) { + final double radius = 8.0; + return AnimatedContainer( + duration: const Duration(milliseconds: 180), + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), + decoration: BoxDecoration( + color: selected ? activeColor.withValues(alpha: 0.12) : AppColors.whiteColor, + borderRadius: BorderRadius.circular(radius), + border: Border.all( + color: selected ? activeColor : inactiveBorderColor, + width: 1, + ), + ), + child: InkWell( + borderRadius: BorderRadius.circular(radius), + onTap: onTap, + child: Text( + label, + style: TextStyle( + fontSize: 12.f, + fontWeight: FontWeight.w500, + color: selected ? activeTextColor : inactiveTextColor, + letterSpacing: -0.02 * 18, + height: 1.0, + ), + ), + ), + ); + } +} diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 9312519..6ff5cc5 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -108,11 +108,11 @@ class ButtonSheetContent extends StatelessWidget { @override Widget build(BuildContext context) { return Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - // SizedBox( - // height: 20.h, - // ), + SizedBox( + height: 20.h, + ), // Center( // child: Container( // margin: const EdgeInsets.only(top: 18, bottom: 12), @@ -127,10 +127,9 @@ class ButtonSheetContent extends StatelessWidget { // Close button isCloseButtonVisible && isFullScreen - ? Column(children: [ - SizedBox( - height: 40.h, - ), + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ Padding( padding: EdgeInsets.symmetric( horizontal: 16, @@ -145,7 +144,7 @@ class ButtonSheetContent extends StatelessWidget { isFullScreen ? Column( children: [ - SizedBox(height: 20.h), + // SizedBox(height: 20.h), Padding(padding: EdgeInsets.symmetric(horizontal: 16.h), child: title.toText24(isBold: true)), SizedBox(height: 16.h), ], diff --git a/lib/widgets/custom_tab_bar.dart b/lib/widgets/custom_tab_bar.dart index 35aafa4..c30c070 100644 --- a/lib/widgets/custom_tab_bar.dart +++ b/lib/widgets/custom_tab_bar.dart @@ -14,7 +14,7 @@ class CustomTabBarModel { } class CustomTabBar extends StatefulWidget { - final int initialIndex = 0; + final int initialIndex; final List tabs; final Color activeTextColor; final Color activeBackgroundColor; @@ -25,6 +25,7 @@ class CustomTabBar extends StatefulWidget { const CustomTabBar({ super.key, required this.tabs, + this.initialIndex = 0, this.activeTextColor = const Color(0xff2E3039), this.inActiveTextColor = const Color(0xff898A8D), this.activeBackgroundColor = const Color(0x142E3039), @@ -41,6 +42,7 @@ class CustomTabBarState extends State { @override void initState() { + selectedIndex = widget.initialIndex; super.initState(); } diff --git a/lib/widgets/date_range_selector/date_range_calender.dart b/lib/widgets/date_range_selector/date_range_calender.dart index 8620ab5..debc069 100644 --- a/lib/widgets/date_range_selector/date_range_calender.dart +++ b/lib/widgets/date_range_selector/date_range_calender.dart @@ -14,7 +14,6 @@ import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart' show DateRangeSelectorRangeViewModel; import 'package:provider/provider.dart'; -import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_datepicker/datepicker.dart'; typedef OnRangeSelected = void Function(DateTime? start, DateTime? end); diff --git a/lib/widgets/date_range_selector/viewmodel/date_range_view_model.dart b/lib/widgets/date_range_selector/viewmodel/date_range_view_model.dart index d295987..3f67b6a 100644 --- a/lib/widgets/date_range_selector/viewmodel/date_range_view_model.dart +++ b/lib/widgets/date_range_selector/viewmodel/date_range_view_model.dart @@ -1,4 +1,3 @@ -import 'package:dartz/dartz.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/features/lab/models/Range.dart'; diff --git a/lib/widgets/datepicker_widget.dart b/lib/widgets/datepicker_widget.dart index 47c4de6..6ca9fe1 100644 --- a/lib/widgets/datepicker_widget.dart +++ b/lib/widgets/datepicker_widget.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; class DatePickerWidget extends StatelessWidget { diff --git a/lib/widgets/family_files/family_file_add_widget.dart b/lib/widgets/family_files/family_file_add_widget.dart index 8e57f91..4840ba7 100644 --- a/lib/widgets/family_files/family_file_add_widget.dart +++ b/lib/widgets/family_files/family_file_add_widget.dart @@ -1,5 +1,4 @@ import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; diff --git a/lib/widgets/graph/custom_graph.dart b/lib/widgets/graph/custom_graph.dart index b955b32..1f5d806 100644 --- a/lib/widgets/graph/custom_graph.dart +++ b/lib/widgets/graph/custom_graph.dart @@ -1,8 +1,9 @@ -import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/common_models/data_points.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; + /// A customizable line graph widget using `fl_chart`. /// /// Displays a line chart with configurable axis labels, colors, and data points. @@ -56,67 +57,71 @@ class CustomGraph extends StatelessWidget { final FontWeight? bottomLabelFontWeight; final double? leftLabelInterval; final double? leftLabelReservedSize; + final double? bottomLabelReservedSize; final bool? showGridLines; final GetDrawingGridLine? getDrawingHorizontalLine; final double? horizontalInterval; final double? minY; final bool showShadow; + final bool showLinePoints; + final double? cutOffY; final RangeAnnotations? rangeAnnotations; ///creates the left label and provide it to the chart as it will be used by other part of the application so the label will be different for every chart final Widget Function(double) leftLabelFormatter; - final Widget Function(double , List) bottomLabelFormatter; - + final Widget Function(double, List) bottomLabelFormatter; final Axis scrollDirection; final bool showBottomTitleDates; final bool isFullScreeGraph; final bool makeGraphBasedOnActualValue; - const CustomGraph({ - super.key, - required this.dataPoints, - required this.leftLabelFormatter, - this.width, - required this.scrollDirection, - required this.height, - this.maxY, - this.maxX, - this.showBottomTitleDates = true, - this.isFullScreeGraph = false, - this.spotColor = AppColors.bgGreenColor, - this.graphColor = AppColors.bgGreenColor, - this.graphShadowColor = AppColors.graphGridColor, - this.graphGridColor = AppColors.graphGridColor, - this.bottomLabelColor = AppColors.textColor, - this.bottomLabelFontWeight = FontWeight.w500, - this.bottomLabelSize, - this.leftLabelInterval, - this.leftLabelReservedSize, - this.makeGraphBasedOnActualValue = false, - required this.bottomLabelFormatter, - this.minX, - this.showGridLines = false, - this.getDrawingHorizontalLine, - this.horizontalInterval, - this.minY, - this.showShadow = false, - this.rangeAnnotations - }); + const CustomGraph( + {super.key, + required this.dataPoints, + required this.leftLabelFormatter, + this.width, + required this.scrollDirection, + required this.height, + this.maxY, + this.maxX, + this.showBottomTitleDates = true, + this.isFullScreeGraph = false, + this.spotColor = AppColors.bgGreenColor, + this.graphColor = AppColors.bgGreenColor, + this.graphShadowColor = AppColors.graphGridColor, + this.graphGridColor = AppColors.graphGridColor, + this.bottomLabelColor = AppColors.textColor, + this.bottomLabelFontWeight = FontWeight.w500, + this.bottomLabelSize, + this.leftLabelInterval, + this.leftLabelReservedSize, + this.bottomLabelReservedSize, + this.makeGraphBasedOnActualValue = false, + required this.bottomLabelFormatter, + this.minX, + this.showGridLines = false, + this.getDrawingHorizontalLine, + this.horizontalInterval, + this.minY, + this.showShadow = false, + this.showLinePoints = false, + this.cutOffY = 0, + this.rangeAnnotations}); @override Widget build(BuildContext context) { return Material( - color: Colors.white, - child: SizedBox( - width: width, - height: height, - child: LineChart( - LineChartData( - minY: minY??0, + color: Colors.white, + child: SizedBox( + width: width, + height: height, + child: LineChart( + LineChartData( + minY: minY ?? 0, maxY: maxY, maxX: maxX, - minX: minX , + minX: minX, lineTouchData: LineTouchData( getTouchLineEnd: (_, __) => 0, getTouchedSpotIndicator: (barData, indicators) { @@ -149,11 +154,8 @@ class CustomGraph extends StatelessWidget { final dataPoint = dataPoints[spot.x.toInt()]; return LineTooltipItem( - '${dataPoint.actualValue} ${dataPoint.unitOfMeasurement??""} - ${dataPoint.displayTime}', - TextStyle( - color: Colors.black, - fontSize: 12.f, - fontWeight: FontWeight.w500), + '${dataPoint.actualValue} ${dataPoint.unitOfMeasurement ?? ""} - ${dataPoint.displayTime}', + TextStyle(color: Colors.black, fontSize: 12.f, fontWeight: FontWeight.w500), ); } return null; // hides the rest @@ -165,7 +167,7 @@ class CustomGraph extends StatelessWidget { leftTitles: AxisTitles( sideTitles: SideTitles( showTitles: true, - reservedSize: leftLabelReservedSize??80, + reservedSize: leftLabelReservedSize ?? 80, interval: leftLabelInterval ?? .1, // Let fl_chart handle it getTitlesWidget: (value, _) { return leftLabelFormatter(value); @@ -176,9 +178,9 @@ class CustomGraph extends StatelessWidget { axisNameSize: 20, sideTitles: SideTitles( showTitles: showBottomTitleDates, - reservedSize: 20, + reservedSize: bottomLabelReservedSize ?? 20, getTitlesWidget: (value, _) { - return bottomLabelFormatter(value, dataPoints, ); + return bottomLabelFormatter(value, dataPoints); }, interval: 1, // ensures 1:1 mapping with spots ), @@ -195,32 +197,31 @@ class CustomGraph extends StatelessWidget { top: BorderSide.none, ), ), - lineBarsData: _buildColoredLineSegments(dataPoints), + lineBarsData: _buildColoredLineSegments(dataPoints, showLinePoints), gridData: FlGridData( - show: showGridLines??true, + show: showGridLines ?? true, drawVerticalLine: false, - horizontalInterval:horizontalInterval, + horizontalInterval: horizontalInterval, // checkToShowHorizontalLine: (value) => // value >= 0 && value <= 100, - getDrawingHorizontalLine: getDrawingHorizontalLine??(value) { - return FlLine( - color: graphGridColor, - strokeWidth: 1, - dashArray: [5, 5], - ); - }, + getDrawingHorizontalLine: getDrawingHorizontalLine ?? + (value) { + return FlLine( + color: graphGridColor, + strokeWidth: 1, + dashArray: [5, 5], + ); + }, ), - rangeAnnotations: rangeAnnotations - ), - ), + rangeAnnotations: rangeAnnotations), ), + ), ); } - - List _buildColoredLineSegments(List dataPoints) { + List _buildColoredLineSegments(List dataPoints, bool showLinePoints) { final List allSpots = dataPoints.asMap().entries.map((entry) { - double value = (makeGraphBasedOnActualValue)?double.tryParse(entry.value.actualValue)??0.0:entry.value.value; + double value = (makeGraphBasedOnActualValue) ? double.tryParse(entry.value.actualValue) ?? 0.0 : entry.value.value; return FlSpot(entry.key.toDouble(), value); }).toList(); @@ -236,11 +237,11 @@ class CustomGraph extends StatelessWidget { begin: Alignment.centerLeft, end: Alignment.centerRight, ), - dotData: FlDotData( - show: false, - ), + dotData: FlDotData(show: showLinePoints), belowBarData: BarAreaData( show: showShadow, + applyCutOffY: cutOffY != null, + cutOffY: cutOffY ?? 0, gradient: LinearGradient( colors: [ graphShadowColor, @@ -255,4 +256,4 @@ class CustomGraph extends StatelessWidget { return data; } -} \ No newline at end of file +} diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart index c1a38ab..94ed9f8 100644 --- a/lib/widgets/input_widget.dart +++ b/lib/widgets/input_widget.dart @@ -48,6 +48,7 @@ class TextInputWidget extends StatelessWidget { final int minLines; final int maxLines; final Color? hintColor; + final bool? isHideSwitcher; // final List countryList; // final Function(Country)? onCountryChange; @@ -85,6 +86,7 @@ class TextInputWidget extends StatelessWidget { this.isMultiline = false, this.minLines = 3, this.maxLines = 6, + this.isHideSwitcher, // this.countryList = const [], // this.onCountryChange, }); @@ -214,9 +216,13 @@ class TextInputWidget extends StatelessWidget { switcherIcon: Utils.buildSvgWithAssets(icon: AppAssets.language, width: 24.h, height: 24.h), language: appState.getLanguageCode()!, initialDate: DateTime.now(), + showCalendarToggle: isHideSwitcher == true ? false : true, fontFamily: appState.getLanguageCode() == "ar" ? "GESSTwo" : "Poppins", - okWidget: Padding(padding: EdgeInsets.only(right: 8.h), child: Utils.buildSvgWithAssets(icon: AppAssets.confirm, width: 24.h, height: 24.h)), - cancelWidget: Padding(padding: EdgeInsets.only(right: 8.h), child: Utils.buildSvgWithAssets(icon: AppAssets.cancel, iconColor: Colors.white, width: 24.h, height: 24.h)), + okWidget: + Padding(padding: EdgeInsets.only(right: 8.h), child: Utils.buildSvgWithAssets(icon: AppAssets.confirm, width: 24.h, height: 24.h)), + cancelWidget: Padding( + padding: EdgeInsets.only(right: 8.h), + child: Utils.buildSvgWithAssets(icon: AppAssets.cancel, iconColor: Colors.white, width: 24.h, height: 24.h)), onCalendarTypeChanged: (bool value) { isGregorian = value; }); @@ -276,7 +282,12 @@ class TextInputWidget extends StatelessWidget { decoration: InputDecoration( isDense: true, hintText: hintText, - hintStyle: TextStyle(fontSize: 14.f, height: 21 / 16, fontWeight: FontWeight.w500, color: hintColor != null ? AppColors.textColor : Color(0xff898A8D), letterSpacing: -0.75), + hintStyle: TextStyle( + fontSize: 14.f, + height: 21 / 16, + fontWeight: FontWeight.w500, + color: hintColor != null ? AppColors.textColor : Color(0xff898A8D), + letterSpacing: -0.75), prefixIconConstraints: BoxConstraints(minWidth: 30.h), prefixIcon: prefix == null ? null : "+${prefix!}".toText14(letterSpacing: -1, color: AppColors.textColor, weight: FontWeight.w500), contentPadding: EdgeInsets.zero, diff --git a/lib/widgets/loading_dialog.dart b/lib/widgets/loading_dialog.dart index 3c2440a..dc860b5 100644 --- a/lib/widgets/loading_dialog.dart +++ b/lib/widgets/loading_dialog.dart @@ -3,10 +3,7 @@ import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:lottie/lottie.dart'; class LoadingDialog extends StatefulWidget { diff --git a/lib/widgets/map/HMSMap.dart b/lib/widgets/map/HMSMap.dart index 7b9c553..96b2fac 100644 --- a/lib/widgets/map/HMSMap.dart +++ b/lib/widgets/map/HMSMap.dart @@ -1,9 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:huawei_map/huawei_map.dart' ; diff --git a/lib/widgets/map/gms_map.dart b/lib/widgets/map/gms_map.dart index 6d04692..f4c3ad5 100644 --- a/lib/widgets/map/gms_map.dart +++ b/lib/widgets/map/gms_map.dart @@ -2,9 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; diff --git a/lib/widgets/map/location_map_widget.dart b/lib/widgets/map/location_map_widget.dart new file mode 100644 index 0000000..c0eb431 --- /dev/null +++ b/lib/widgets/map/location_map_widget.dart @@ -0,0 +1,179 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:maps_launcher/maps_launcher.dart'; + +/// A reusable location map widget that displays a static map with address and directions button +/// Can be used in any review screen (HHC, CMC, etc.) +class LocationMapWidget extends StatelessWidget { + /// The latitude coordinate of the location + final double latitude; + + /// The longitude coordinate of the location + final double longitude; + + /// The formatted address or location name to display + final String address; + + /// The title to show above the map (e.g., "Service Location", "Hospital Location") + final String? title; + + /// The zoom level for the map (default: 14) + final int zoomLevel; + + /// The size of the map image (default: 350x165) + final String mapSize; + + /// Optional callback when directions button is pressed + /// If not provided, will use default MapsLauncher + final VoidCallback? onDirectionsTap; + + /// Whether to show the address container (default: true) + final bool showAddress; + + /// Custom map type (default: roadmap) + final String mapType; + final EdgeInsets? padding; + + const LocationMapWidget({ + super.key, + required this.latitude, + required this.longitude, + required this.address, + this.title, + this.zoomLevel = 14, + this.mapSize = '350x165', + this.onDirectionsTap, + this.showAddress = true, + this.mapType = 'roadmap', + this.padding, + }); + + void _defaultLaunchDirections() { + if (latitude != 0.0 && longitude != 0.0) { + MapsLauncher.launchCoordinates(latitude, longitude, address); + } + } + + @override + Widget build(BuildContext context) { + final String staticMapUrl = + "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=$zoomLevel&size=$mapSize&maptype=$mapType&markers=color:red%7C$latitude,$longitude&key=${ApiKeyConstants.googleMapsApiKey}"; + + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + padding: padding ?? EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + if (title != null) ...[ + Text( + title ?? "", + style: TextStyle( + fontSize: 16.f, + fontWeight: FontWeight.w700, + color: AppColors.blackColor, + letterSpacing: -0.5, + ), + ), + SizedBox(height: 12.h), + ], + + // Address display + if (showAddress) ...[ + Row( + children: [ + Expanded( + child: Text( + address, + style: TextStyle( + fontSize: 14.f, + fontWeight: FontWeight.w500, + color: AppColors.blackColor, + letterSpacing: -0.4, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + SizedBox(height: 16.h), + ], + + // Map display with bottom button overlay + Stack( + children: [ + ClipRRect( + clipBehavior: Clip.hardEdge, + borderRadius: BorderRadius.circular(24.r), + child: Image.network( + staticMapUrl, + fit: BoxFit.contain, + loadingBuilder: (context, child, loadingProgress) { + if (loadingProgress == null) return child; + return Container( + height: 165.h, + decoration: BoxDecoration( + color: AppColors.bgScaffoldColor, + borderRadius: BorderRadius.circular(24.r), + ), + child: Center( + child: CircularProgressIndicator( + color: AppColors.primaryRedColor, + ), + ), + ); + }, + errorBuilder: (context, error, stackTrace) { + return Container( + height: 165.h, + decoration: BoxDecoration( + color: AppColors.bgScaffoldColor, + borderRadius: BorderRadius.circular(24.r), + ), + child: Center( + child: Icon( + Icons.error_outline, + size: 48.h, + color: AppColors.greyTextColor, + ), + ), + ); + }, + ), + ), + Positioned( + bottom: 0, + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.785, + child: CustomButton( + text: "Get Directions".needTranslation, + onPressed: onDirectionsTap ?? _defaultLaunchDirections, + backgroundColor: AppColors.textColor.withValues(alpha: 0.8), + borderColor: AppColors.textColor.withValues(alpha: 0.01), + textColor: AppColors.whiteColor, + fontSize: 14.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 40.h, + icon: AppAssets.directions_icon, + iconColor: AppColors.whiteColor, + iconSize: 14.h, + ).paddingAll(12.h), + ), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/widgets/map/map_utility_screen.dart b/lib/widgets/map/map_utility_screen.dart index 3982180..19823da 100644 --- a/lib/widgets/map/map_utility_screen.dart +++ b/lib/widgets/map/map_utility_screen.dart @@ -1,29 +1,13 @@ -import 'dart:io'; - -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; -import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart'; -import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; -import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart'; -import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/AddressItem.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart'; -import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/appointment_bottom_sheet.dart' show AppointmentBottomSheet; import 'package:hmg_patient_app_new/presentation/emergency_services/widgets/location_input_bottom_sheet.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/CustomSwitch.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; -import 'package:hmg_patient_app_new/widgets/expandable_bottom_sheet/ExpandableBottomSheet.dart'; -import 'package:hmg_patient_app_new/widgets/expandable_bottom_sheet/model/BottomSheetType.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/map/HMSMap.dart'; import 'package:hmg_patient_app_new/widgets/map/gms_map.dart'; @@ -42,14 +26,22 @@ import '../../../widgets/common_bottom_sheet.dart'; /// it results [true] if the user clicks on the submit button /// and [false] if the user closes the screen without giving the consent to proceed for the request class MapUtilityScreen extends StatelessWidget { - final String confirmButtonString; final String titleString; final String subTitleString; final bool isGmsAvailable; final VoidCallback? onCrossClicked; + final VoidCallback? onSubmitted; - const MapUtilityScreen({super.key, required this.confirmButtonString, required this.titleString, required this.subTitleString, required this.isGmsAvailable, this.onCrossClicked}); + const MapUtilityScreen({ + super.key, + required this.confirmButtonString, + required this.titleString, + required this.subTitleString, + required this.isGmsAvailable, + this.onCrossClicked, + this.onSubmitted, + }); @override Widget build(BuildContext context) { @@ -57,15 +49,9 @@ class MapUtilityScreen extends StatelessWidget { floatingActionButton: Padding( padding: EdgeInsetsDirectional.only(end: 8.h, bottom: 68.h), child: DecoratedBox( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, borderRadius: 12.h), - child: Utils.buildSvgWithAssets( - icon: AppAssets.locate_me, width: 24.h, height: 24.h) - .paddingAll(12.h) - .onPress(() { - context - .read() - .moveToCurrentLocation(); + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Utils.buildSvgWithAssets(icon: AppAssets.locate_me, width: 24.h, height: 24.h).paddingAll(12.h).onPress(() { + context.read().moveToCurrentLocation(); }), ), ), @@ -74,38 +60,26 @@ class MapUtilityScreen extends StatelessWidget { children: [ if (isGmsAvailable) GMSMap( - currentLocation: - context.read().getGMSLocation(), - onCameraMoved: (value) => context - .read() - .handleGMSMapCameraMoved(value), - onCameraIdle: - context.read().handleOnCameraIdle, + currentLocation: context.read().getGMSLocation(), + onCameraMoved: (value) => context.read().handleGMSMapCameraMoved(value), + onCameraIdle: context.read().handleOnCameraIdle, myLocationEnabled: true, - inputController: - context.read().gmsController, + inputController: context.read().gmsController, showCenterMarker: true, ) else HMSMap( - currentLocation: - context.read().getHMSLocation(), - onCameraMoved: (value) => context - .read() - .handleHMSMapCameraMoved(value), - onCameraIdle: - context.read().handleOnCameraIdle, + currentLocation: context.read().getHMSLocation(), + onCameraMoved: (value) => context.read().handleHMSMapCameraMoved(value), + onCameraIdle: context.read().handleOnCameraIdle, myLocationEnabled: false, - inputController: - context.read().hmsController, + inputController: context.read().hmsController, showCenterMarker: true, ), Align( alignment: AlignmentDirectional.topStart, - child: Utils.buildSvgWithAssets( - icon: AppAssets.closeBottomNav, width: 32.h, height: 32.h) - .onPress(() { - onCrossClicked?.call(); + child: Utils.buildSvgWithAssets(icon: AppAssets.closeBottomNav, width: 32.h, height: 32.h).onPress(() { + onCrossClicked?.call(); // context // .read() // .flushPickupInformation(); @@ -120,8 +94,7 @@ class MapUtilityScreen extends StatelessWidget { Widget FixedBottomSheet(BuildContext context) { return GestureDetector( - onVerticalDragUpdate: (details){ - }, + onVerticalDragUpdate: (details) {}, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, @@ -150,20 +123,23 @@ class MapUtilityScreen extends StatelessWidget { spacing: 4.h, children: [ titleString.toText21( - weight: FontWeight.w600, - color: AppColors.textColor, - ), + weight: FontWeight.w600, + color: AppColors.textColor, + ), subTitleString.needTranslation.toText12( - fontWeight: FontWeight.w500, - color: AppColors.greyTextColor, - ) + fontWeight: FontWeight.w500, + color: AppColors.greyTextColor, + ) ], ), CustomButton( - text: confirmButtonString.needTranslation, - onPressed: () { - ///indicates that the screen has resulted success and should be closed - Navigator.pop(context,true); + text: confirmButtonString.needTranslation, + onPressed: () { + if (onSubmitted != null) { + onSubmitted!(); + } else { + Navigator.pop(context, true); + } }, ) ], @@ -191,8 +167,6 @@ class MapUtilityScreen extends StatelessWidget { ); } - - textPlaceInput(context) { return Consumer(builder: (_, vm, __) { return SizedBox( @@ -201,8 +175,7 @@ class MapUtilityScreen extends StatelessWidget { labelText: "Enter Pickup Location Manually".needTranslation, hintText: "Enter Pickup Location".needTranslation, controller: TextEditingController( - text: vm.geocodeResponse?.results.first.formattedAddress ?? - vm.selectedPrediction?.description, + text: vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description, ), leadingIcon: AppAssets.location_pickup, isAllowLeadingIcon: true, diff --git a/lib/widgets/shimmer/common_shimmer_widget.dart b/lib/widgets/shimmer/common_shimmer_widget.dart index d6a2906..3d935cb 100644 --- a/lib/widgets/shimmer/common_shimmer_widget.dart +++ b/lib/widgets/shimmer/common_shimmer_widget.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -11,9 +12,7 @@ class CommonShimmerWidget extends StatelessWidget { return SizedBox( child: Container( decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(10), - ), + borderRadius: BorderRadius.all(Radius.circular(10.r)), border: Border.all(color: AppColors.lightGreyEFColor, width: 1), boxShadow: [ BoxShadow( @@ -27,7 +26,11 @@ class CommonShimmerWidget extends StatelessWidget { padding: const EdgeInsets.all(12.0), child: Column( children: [ - Container(height: 100).toShimmer(), + Container( + height: 100, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(24.r)), + )).toShimmer(), 16.height, Container(height: 24).toShimmer(), 16.height, diff --git a/pubspec.yaml b/pubspec.yaml index c4fa97b..461d3ab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,6 +30,7 @@ dependencies: # firebase_core: ^3.13.1 permission_handler: ^12.0.1 flutter_local_notifications: ^19.4.1 + timezone: ^0.10.0 provider: ^6.1.5+1 get_it: ^8.2.0 just_audio: ^0.10.4 @@ -86,6 +87,7 @@ dependencies: location: ^8.0.1 gms_check: ^1.0.4 huawei_location: ^6.14.2+301 + huawei_health: ^6.16.0+300 intl: ^0.20.2 flutter_widget_from_html: ^0.17.1 huawei_map: @@ -114,6 +116,7 @@ flutter: - assets/images/svg/ - assets/images/png/ - assets/images/png/zoom/ + - assets/images/png/smartwatches/ - assets/animations/ - assets/animations/lottie/