diff --git a/android/app/build.gradle b/android/app/build.gradle index ae87782e..af0821ee 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -40,10 +40,11 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.doctor_app_flutter" minSdkVersion 18 - targetSdkVersion 29 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + multiDexEnabled true } buildTypes { @@ -72,9 +73,10 @@ dependencies { implementation 'com.opentok.android:opentok-android-sdk:2.16.5' //permissions implementation 'pub.devrel:easypermissions:0.4.0' - //retrofit implementation 'com.squareup.retrofit2:retrofit:2.6.2' implementation 'com.squareup.retrofit2:converter-gson:2.6.2' implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1' + } +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 00000000..27e5dfb1 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,46 @@ +{ + "project_info": { + "project_number": "1097451043303", + "project_id": "doctor-app-35ddc", + "storage_bucket": "doctor-app-35ddc.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1097451043303:android:f82ecce9562ecaad866542", + "android_client_info": { + "package_name": "com.example.doctor_app_flutter" + } + }, + "oauth_client": [ + { + "client_id": "1097451043303-u7bl21167fq5b7u06cqpq621psv9s3qh.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyChu44P8Dp8jtRqnoDR2mdjqKgSKQq-FPY" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "1097451043303-u7bl21167fq5b7u06cqpq621psv9s3qh.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.hmg.doctorApp" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 357c6a1a..ea0f0026 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,6 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.3.2' } } diff --git a/android/google-services.json b/android/google-services.json new file mode 100644 index 00000000..3c00f05c --- /dev/null +++ b/android/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "1008895414777", + "project_id": "doctorapp-9f172", + "storage_bucket": "doctorapp-9f172.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1008895414777:android:d00fe21d6955c21b1f6d28", + "android_client_info": { + "package_name": "com.example.doctor_app_flutter" + } + }, + "oauth_client": [ + { + "client_id": "1008895414777-3mg88j5ocs5r1au7rf4sh3f4pgsri2f2.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCNncEIj8ehVUSxV89rx0x1NaWp8t1YVkw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "1008895414777-3mg88j5ocs5r1au7rf4sh3f4pgsri2f2.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index 38c8d454..9c0729c9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,5 @@ -org.gradle.jvmargs=-Xmx1536M + android.enableR8=true android.useAndroidX=true android.enableJetifier=true +org.gradle.jvmargs=-Xmx4608m diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf index 21ce4a5d..0cf36646 100644 Binary files a/assets/fonts/DoctorApp.ttf and b/assets/fonts/DoctorApp.ttf differ diff --git a/assets/fonts/Poppins/Poppins-Bold.ttf b/assets/fonts/Poppins/Poppins-Bold.ttf new file mode 100644 index 00000000..b94d47f3 Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Bold.ttf differ diff --git a/assets/fonts/Poppins/Poppins-Medium.ttf b/assets/fonts/Poppins/Poppins-Medium.ttf new file mode 100644 index 00000000..e90e87ed Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Medium.ttf differ diff --git a/assets/fonts/Poppins/Poppins-Regular.ttf b/assets/fonts/Poppins/Poppins-Regular.ttf new file mode 100644 index 00000000..be06e7fd Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Regular.ttf differ diff --git a/assets/images/Doctor_app_logo.png b/assets/images/Doctor_app_logo.png new file mode 100644 index 00000000..2de2d460 Binary files /dev/null and b/assets/images/Doctor_app_logo.png differ diff --git a/assets/images/booked.png b/assets/images/booked.png new file mode 100644 index 00000000..e07b7d35 Binary files /dev/null and b/assets/images/booked.png differ diff --git a/assets/images/create-episod.png b/assets/images/create-episod.png new file mode 100644 index 00000000..02386fd1 Binary files /dev/null and b/assets/images/create-episod.png differ diff --git a/assets/images/edit.png b/assets/images/edit.png new file mode 100644 index 00000000..73a48877 Binary files /dev/null and b/assets/images/edit.png differ diff --git a/assets/images/female_avatar.png b/assets/images/female_avatar.png new file mode 100644 index 00000000..9ff4b8b7 Binary files /dev/null and b/assets/images/female_avatar.png differ diff --git a/assets/images/filter-512.png b/assets/images/filter-512.png new file mode 100644 index 00000000..ce2f89b8 Binary files /dev/null and b/assets/images/filter-512.png differ diff --git a/assets/images/leaves.svg b/assets/images/leaves.svg new file mode 100644 index 00000000..474585fd --- /dev/null +++ b/assets/images/leaves.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/livecare.png b/assets/images/livecare.png new file mode 100644 index 00000000..b1fd3f06 Binary files /dev/null and b/assets/images/livecare.png differ diff --git a/assets/images/login/101.png b/assets/images/login/101.png new file mode 100644 index 00000000..90c1c575 Binary files /dev/null and b/assets/images/login/101.png differ diff --git a/assets/images/login/102.png b/assets/images/login/102.png new file mode 100644 index 00000000..8502d197 Binary files /dev/null and b/assets/images/login/102.png differ diff --git a/assets/images/login/103.png b/assets/images/login/103.png new file mode 100644 index 00000000..3326814b Binary files /dev/null and b/assets/images/login/103.png differ diff --git a/assets/images/login/104.png b/assets/images/login/104.png new file mode 100644 index 00000000..ad55ff74 Binary files /dev/null and b/assets/images/login/104.png differ diff --git a/assets/images/login/fileNum.png b/assets/images/login/fileNum.png new file mode 100644 index 00000000..386299b7 Binary files /dev/null and b/assets/images/login/fileNum.png differ diff --git a/assets/images/login/forget.png b/assets/images/login/forget.png new file mode 100644 index 00000000..57aa7ccc Binary files /dev/null and b/assets/images/login/forget.png differ diff --git a/assets/images/login/id.png b/assets/images/login/id.png new file mode 100644 index 00000000..9260cf11 Binary files /dev/null and b/assets/images/login/id.png differ diff --git a/assets/images/login/more_icon.png b/assets/images/login/more_icon.png new file mode 100644 index 00000000..b696d345 Binary files /dev/null and b/assets/images/login/more_icon.png differ diff --git a/assets/images/login/nationalID.png b/assets/images/login/nationalID.png new file mode 100644 index 00000000..5779d562 Binary files /dev/null and b/assets/images/login/nationalID.png differ diff --git a/assets/images/male_avatar.png b/assets/images/male_avatar.png new file mode 100644 index 00000000..972a59ac Binary files /dev/null and b/assets/images/male_avatar.png differ diff --git a/assets/images/modilfy-episode.png b/assets/images/modilfy-episode.png new file mode 100644 index 00000000..6fdd224f Binary files /dev/null and b/assets/images/modilfy-episode.png differ diff --git a/assets/images/patient/Order_Procedures.png b/assets/images/patient/Order_Procedures.png new file mode 100644 index 00000000..a3cd8ae0 Binary files /dev/null and b/assets/images/patient/Order_Procedures.png differ diff --git a/assets/images/patient/Progress_notes.png b/assets/images/patient/Progress_notes.png new file mode 100644 index 00000000..f5aba841 Binary files /dev/null and b/assets/images/patient/Progress_notes.png differ diff --git a/assets/images/patient/admission_req.png b/assets/images/patient/admission_req.png new file mode 100644 index 00000000..b2335083 Binary files /dev/null and b/assets/images/patient/admission_req.png differ diff --git a/assets/images/patient/arrow_forward.png b/assets/images/patient/arrow_forward.png new file mode 100644 index 00000000..df393784 Binary files /dev/null and b/assets/images/patient/arrow_forward.png differ diff --git a/assets/images/patient/health_summary.png b/assets/images/patient/health_summary.png new file mode 100644 index 00000000..fe374ebc Binary files /dev/null and b/assets/images/patient/health_summary.png differ diff --git a/assets/images/patient/lab_results.png b/assets/images/patient/lab_results.png new file mode 100644 index 00000000..20e6b5ff Binary files /dev/null and b/assets/images/patient/lab_results.png differ diff --git a/assets/images/patient/order_prescription.png b/assets/images/patient/order_prescription.png new file mode 100644 index 00000000..26e7e9c4 Binary files /dev/null and b/assets/images/patient/order_prescription.png differ diff --git a/assets/images/patient/patient_sick_leave.png b/assets/images/patient/patient_sick_leave.png new file mode 100644 index 00000000..56196834 Binary files /dev/null and b/assets/images/patient/patient_sick_leave.png differ diff --git a/assets/images/patient/refer_patient.png b/assets/images/patient/refer_patient.png new file mode 100644 index 00000000..ac3aea6e Binary files /dev/null and b/assets/images/patient/refer_patient.png differ diff --git a/assets/images/patient/ucaf.png b/assets/images/patient/ucaf.png new file mode 100644 index 00000000..f7293599 Binary files /dev/null and b/assets/images/patient/ucaf.png differ diff --git a/assets/images/patient/vital_signs.png b/assets/images/patient/vital_signs.png new file mode 100644 index 00000000..76017194 Binary files /dev/null and b/assets/images/patient/vital_signs.png differ diff --git a/assets/images/patient/vital_signs/Obese_BMI-r.png b/assets/images/patient/vital_signs/Obese_BMI-r.png new file mode 100644 index 00000000..50b32822 Binary files /dev/null and b/assets/images/patient/vital_signs/Obese_BMI-r.png differ diff --git a/assets/images/patient/vital_signs/Obese_BMI.png b/assets/images/patient/vital_signs/Obese_BMI.png new file mode 100644 index 00000000..540d4bcc Binary files /dev/null and b/assets/images/patient/vital_signs/Obese_BMI.png differ diff --git a/assets/images/patient/vital_signs/blood_pressure.png b/assets/images/patient/vital_signs/blood_pressure.png new file mode 100644 index 00000000..96701875 Binary files /dev/null and b/assets/images/patient/vital_signs/blood_pressure.png differ diff --git a/assets/images/patient/vital_signs/health_BMI-r.png b/assets/images/patient/vital_signs/health_BMI-r.png new file mode 100644 index 00000000..96189d34 Binary files /dev/null and b/assets/images/patient/vital_signs/health_BMI-r.png differ diff --git a/assets/images/patient/vital_signs/health_BMI.png b/assets/images/patient/vital_signs/health_BMI.png new file mode 100644 index 00000000..c87a0424 Binary files /dev/null and b/assets/images/patient/vital_signs/health_BMI.png differ diff --git a/assets/images/patient/vital_signs/heart_rate.png b/assets/images/patient/vital_signs/heart_rate.png new file mode 100644 index 00000000..76017194 Binary files /dev/null and b/assets/images/patient/vital_signs/heart_rate.png differ diff --git a/assets/images/patient/vital_signs/height.png b/assets/images/patient/vital_signs/height.png new file mode 100644 index 00000000..e176c456 Binary files /dev/null and b/assets/images/patient/vital_signs/height.png differ diff --git a/assets/images/patient/vital_signs/ovrweight_BMI-r.png b/assets/images/patient/vital_signs/ovrweight_BMI-r.png new file mode 100644 index 00000000..ff24fc61 Binary files /dev/null and b/assets/images/patient/vital_signs/ovrweight_BMI-r.png differ diff --git a/assets/images/patient/vital_signs/ovrweight_BMI.png b/assets/images/patient/vital_signs/ovrweight_BMI.png new file mode 100644 index 00000000..da8e67bb Binary files /dev/null and b/assets/images/patient/vital_signs/ovrweight_BMI.png differ diff --git a/assets/images/patient/vital_signs/respiration_rate.png b/assets/images/patient/vital_signs/respiration_rate.png new file mode 100644 index 00000000..ff695dec Binary files /dev/null and b/assets/images/patient/vital_signs/respiration_rate.png differ diff --git a/assets/images/patient/vital_signs/temperature.png b/assets/images/patient/vital_signs/temperature.png new file mode 100644 index 00000000..9953a130 Binary files /dev/null and b/assets/images/patient/vital_signs/temperature.png differ diff --git a/assets/images/patient/vital_signs/underweight_BMI-r.png b/assets/images/patient/vital_signs/underweight_BMI-r.png new file mode 100644 index 00000000..2f633b45 Binary files /dev/null and b/assets/images/patient/vital_signs/underweight_BMI-r.png differ diff --git a/assets/images/patient/vital_signs/underweight_BMI.png b/assets/images/patient/vital_signs/underweight_BMI.png new file mode 100644 index 00000000..83b0260a Binary files /dev/null and b/assets/images/patient/vital_signs/underweight_BMI.png differ diff --git a/assets/images/patient/vital_signs/weight.png b/assets/images/patient/vital_signs/weight.png new file mode 100644 index 00000000..4a3bd2cc Binary files /dev/null and b/assets/images/patient/vital_signs/weight.png differ diff --git a/assets/images/progress-loading-red.gif b/assets/images/progress-loading-red.gif new file mode 100644 index 00000000..517c3dab Binary files /dev/null and b/assets/images/progress-loading-red.gif differ diff --git a/assets/images/sick_leaves_icons.png b/assets/images/sick_leaves_icons.png new file mode 100644 index 00000000..67a9c937 Binary files /dev/null and b/assets/images/sick_leaves_icons.png differ diff --git a/assets/images/type-booked.png b/assets/images/type-booked.png new file mode 100644 index 00000000..c42945cf Binary files /dev/null and b/assets/images/type-booked.png differ diff --git a/assets/images/type-livecare.png b/assets/images/type-livecare.png new file mode 100644 index 00000000..05f3d213 Binary files /dev/null and b/assets/images/type-livecare.png differ diff --git a/assets/images/type-walkin.png b/assets/images/type-walkin.png new file mode 100644 index 00000000..555023b3 Binary files /dev/null and b/assets/images/type-walkin.png differ diff --git a/assets/images/vital_blood-pressure.png b/assets/images/vital_blood-pressure.png new file mode 100644 index 00000000..44c9f2e2 Binary files /dev/null and b/assets/images/vital_blood-pressure.png differ diff --git a/assets/images/vital_blood_type.png b/assets/images/vital_blood_type.png new file mode 100644 index 00000000..fbb5296f Binary files /dev/null and b/assets/images/vital_blood_type.png differ diff --git a/assets/images/vital_body_mass.png b/assets/images/vital_body_mass.png new file mode 100644 index 00000000..08476c51 Binary files /dev/null and b/assets/images/vital_body_mass.png differ diff --git a/assets/images/vital_heart_rate.png b/assets/images/vital_heart_rate.png new file mode 100644 index 00000000..e788658b Binary files /dev/null and b/assets/images/vital_heart_rate.png differ diff --git a/assets/images/vital_height.png b/assets/images/vital_height.png new file mode 100644 index 00000000..8c324b2c Binary files /dev/null and b/assets/images/vital_height.png differ diff --git a/assets/images/vital_respiration.png b/assets/images/vital_respiration.png new file mode 100644 index 00000000..7e1b4466 Binary files /dev/null and b/assets/images/vital_respiration.png differ diff --git a/assets/images/vital_signs.png b/assets/images/vital_signs.png new file mode 100644 index 00000000..7b642d6e Binary files /dev/null and b/assets/images/vital_signs.png differ diff --git a/assets/images/vital_temperature.png b/assets/images/vital_temperature.png new file mode 100644 index 00000000..7fe657de Binary files /dev/null and b/assets/images/vital_temperature.png differ diff --git a/assets/images/vital_weight.png b/assets/images/vital_weight.png new file mode 100644 index 00000000..5247e924 Binary files /dev/null and b/assets/images/vital_weight.png differ diff --git a/assets/images/walkin.png b/assets/images/walkin.png new file mode 100644 index 00000000..81f112f5 Binary files /dev/null and b/assets/images/walkin.png differ diff --git a/ios/GoogleService-Info .plist b/ios/GoogleService-Info .plist new file mode 100644 index 00000000..81c3af44 --- /dev/null +++ b/ios/GoogleService-Info .plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + API_KEY + AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + GCM_SENDER_ID + 1097451043303 + PLIST_VERSION + 1 + BUNDLE_ID + com.hmg.doctorApp + PROJECT_ID + doctor-app-35ddc + STORAGE_BUCKET + doctor-app-35ddc.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1097451043303:ios:0e9b87e77dcf397d866542 + + \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0575cdb6..878a1850 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -7,32 +7,114 @@ PODS: - connectivity (0.0.1): - Flutter - Reachability + - connectivity_for_web (0.1.0): + - Flutter - connectivity_macos (0.0.1): - Flutter - device_info (0.0.1): - Flutter + - Firebase/CoreOnly (6.33.0): + - FirebaseCore (= 6.10.3) + - Firebase/Messaging (6.33.0): + - Firebase/CoreOnly + - FirebaseMessaging (~> 4.7.0) + - firebase_core (0.5.3): + - Firebase/CoreOnly (~> 6.33.0) + - Flutter + - firebase_core_web (0.1.0): + - Flutter + - firebase_messaging (7.0.3): + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Messaging (~> 6.33.0) + - firebase_core + - Flutter + - FirebaseCore (6.10.3): + - FirebaseCoreDiagnostics (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - FirebaseCoreDiagnostics (1.7.0): + - GoogleDataTransport (~> 7.4) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - nanopb (~> 1.30906.0) + - FirebaseInstallations (1.7.0): + - FirebaseCore (~> 6.10) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - PromisesObjC (~> 1.2) + - FirebaseInstanceID (4.8.0): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - FirebaseMessaging (4.7.1): + - FirebaseCore (~> 6.10) + - FirebaseInstanceID (~> 4.7) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Reachability (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - Protobuf (>= 3.9.2, ~> 3.9) - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter + - GoogleDataTransport (7.5.1): + - nanopb (~> 1.30906.0) + - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (6.7.2): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (6.7.2)" + - GoogleUtilities/Reachability (6.7.2): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/Logger - hexcolor (0.0.1): - Flutter - imei_plugin (0.0.1): - Flutter - local_auth (0.0.1): - Flutter + - maps_launcher (0.0.1): + - Flutter - MTBBarcodeScanner (5.0.11) + - nanopb (1.30906.0): + - nanopb/decode (= 1.30906.0) + - nanopb/encode (= 1.30906.0) + - nanopb/decode (1.30906.0) + - nanopb/encode (1.30906.0) - OpenTok (2.15.3) - - "permission_handler (5.0.0+hotfix.5)": + - path_provider_linux (0.0.1): + - Flutter + - path_provider_windows (0.0.1): - Flutter + - "permission_handler (5.1.0+2)": + - Flutter + - PromisesObjC (1.2.11) + - Protobuf (3.13.0) - Reachability (3.2) + - screen (0.0.1): + - Flutter - shared_preferences (0.0.1): - Flutter + - shared_preferences_linux (0.0.1): + - Flutter - shared_preferences_macos (0.0.1): - Flutter - shared_preferences_web (0.0.1): - Flutter + - shared_preferences_windows (0.0.1): + - Flutter - speech_to_text (0.0.1): - Flutter - Try @@ -40,38 +122,77 @@ PODS: - Try (2.1.1) - url_launcher (0.0.1): - Flutter + - url_launcher_linux (0.0.1): + - Flutter - url_launcher_macos (0.0.1): - Flutter - url_launcher_web (0.0.1): - Flutter + - url_launcher_windows (0.0.1): + - Flutter + - video_player (0.0.1): + - Flutter + - video_player_web (0.0.1): + - Flutter + - wakelock (0.0.1): + - Flutter + - webview_flutter (0.0.1): + - Flutter DEPENDENCIES: - Alamofire - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) + - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) + - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) + - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - OpenTok + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) + - screen (from `.symlinks/plugins/screen/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) + - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) + - video_player (from `.symlinks/plugins/video_player/ios`) + - video_player_web (from `.symlinks/plugins/video_player_web/ios`) + - wakelock (from `.symlinks/plugins/wakelock/ios`) + - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) SPEC REPOS: trunk: - Alamofire + - Firebase + - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseInstallations + - FirebaseInstanceID + - FirebaseMessaging + - GoogleDataTransport + - GoogleUtilities - MTBBarcodeScanner + - nanopb - OpenTok + - PromisesObjC + - Protobuf - Reachability - SwiftProtobuf - Try @@ -81,10 +202,18 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/barcode_scan/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" + connectivity_for_web: + :path: ".symlinks/plugins/connectivity_for_web/ios" connectivity_macos: :path: ".symlinks/plugins/connectivity_macos/ios" device_info: :path: ".symlinks/plugins/device_info/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_core_web: + :path: ".symlinks/plugins/firebase_core_web/ios" + firebase_messaging: + :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter flutter_flexible_toast: @@ -97,49 +226,100 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/imei_plugin/ios" local_auth: :path: ".symlinks/plugins/local_auth/ios" + maps_launcher: + :path: ".symlinks/plugins/maps_launcher/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + path_provider_windows: + :path: ".symlinks/plugins/path_provider_windows/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" + screen: + :path: ".symlinks/plugins/screen/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" shared_preferences_macos: :path: ".symlinks/plugins/shared_preferences_macos/ios" shared_preferences_web: :path: ".symlinks/plugins/shared_preferences_web/ios" + shared_preferences_windows: + :path: ".symlinks/plugins/shared_preferences_windows/ios" speech_to_text: :path: ".symlinks/plugins/speech_to_text/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_linux: + :path: ".symlinks/plugins/url_launcher_linux/ios" url_launcher_macos: :path: ".symlinks/plugins/url_launcher_macos/ios" url_launcher_web: :path: ".symlinks/plugins/url_launcher_web/ios" + url_launcher_windows: + :path: ".symlinks/plugins/url_launcher_windows/ios" + video_player: + :path: ".symlinks/plugins/video_player/ios" + video_player_web: + :path: ".symlinks/plugins/video_player_web/ios" + wakelock: + :path: ".symlinks/plugins/wakelock/ios" + webview_flutter: + :path: ".symlinks/plugins/webview_flutter/ios" SPEC CHECKSUMS: Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75 + connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 + connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 + Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 + firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 + firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 + FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd + FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 + FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 + FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 + GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc OpenTok: fde03ecc5ea31fe0a453242847c4ee1f47e1d735 - permission_handler: 6226fcb78b97c7c7458a95c7346a11d5184fec12 + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 + PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f + Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 + screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c + url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 + video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e + video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 + wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 + webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dcd750d8..f35ae084 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 29211E4225C172B700DD740D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 29211E4125C172B700DD740D /* GoogleService-Info.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -34,6 +35,8 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 29211CD725C165D600DD740D /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = ""; }; + 29211E4125C172B700DD740D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -108,6 +111,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 29211E4125C172B700DD740D /* GoogleService-Info.plist */, + 29211CD725C165D600DD740D /* RunnerRelease.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -204,6 +209,7 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 29211E4225C172B700DD740D /* GoogleService-Info.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -354,7 +360,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -437,7 +443,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -486,7 +492,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -530,6 +536,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 4512a3b1..b97c7000 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,7 +1,6 @@ import UIKit import Flutter import OpenTok - // Created by Mohammad Aljammal & Elham Rababah on 24/06/20. // Copyright © 2020 Cloud. All rights reserved. @@ -23,7 +22,6 @@ import OpenTok _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - let controller : FlutterViewController = window?.rootViewController as! FlutterViewController let videoCallChannel = FlutterMethodChannel(name: "Dr.cloudSolution/videoCall", binaryMessenger: controller.binaryMessenger) diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..81c3af44 --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + API_KEY + AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + GCM_SENDER_ID + 1097451043303 + PLIST_VERSION + 1 + BUNDLE_ID + com.hmg.doctorApp + PROJECT_ID + doctor-app-35ddc + STORAGE_BUCKET + doctor-app-35ddc.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1097451043303:ios:0e9b87e77dcf397d866542 + + \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index d0d77b5e..171125d9 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -25,7 +25,9 @@ NSCameraUsageDescription Camera permission is required for barcode scanning. NSFaceIDUsageDescription - Why is my app authenticating using face id? + We are using it for authentication + + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -47,10 +49,13 @@ NSCameraUsageDescription - ${PRODUCT_NAME} always camera use - + App requires access to camera incase you are interested to attach images to your Qr Code. + NSPhotoLibraryUsageDescription + Need to upload image + NSMicrophoneUsageDescription ${PRODUCT_NAME} always Microphone use - + FirebaseAppDelegateProxyEnabled + diff --git a/ios/Runner/RunnerRelease.entitlements b/ios/Runner/RunnerRelease.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/ios/Runner/RunnerRelease.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..77545340 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,11 +3,12 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; -import 'package:provider/provider.dart'; +import 'dart:io' show Platform; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); @@ -30,7 +31,7 @@ Helpers helpers = new Helpers(); * */ class BaseAppClient { //TODO change the post fun to nun static when you change all service - post( + post( String endPoint, { Map body, Function(dynamic response, int statusCode) onSuccess, @@ -42,15 +43,24 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - - body['DoctorID'] = doctorProfile?.doctorID; - body['EditedBy'] = doctorProfile?.doctorID; - body['ProjectID'] = doctorProfile?.projectID; + if (body['DoctorID'] == null) + body['DoctorID'] = doctorProfile?.doctorID; + if (body['DoctorID'] == "") body['DoctorID'] = null; + if (body['EditedBy'] == null) + body['EditedBy'] = doctorProfile?.doctorID; + if (body['ProjectID'] == null) { + body['ProjectID'] = doctorProfile?.projectID; + } if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; } + if (body['DoctorID'] == '') { + body['DoctorID'] = null; + } + if (body['EditedBy'] == '') { + body.remove("EditedBy"); + } body['TokenID'] = token ?? ''; - String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -63,7 +73,16 @@ class BaseAppClient { body['Channel'] = CHANNEL; body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; - body['PatientOutSA'] = 0; // PATIENT_OUT_SA; + body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; + if (body['VidaAuthTokenID'] == null) { + body['VidaAuthTokenID'] = + await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + } + if (body['VidaRefreshTokenID'] == null) { + body['VidaRefreshTokenID'] = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + } + print("URL : $url"); print("Body : ${json.encode(body)}"); @@ -75,19 +94,174 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 || json == null) { + if (statusCode < 200 || statusCode >= 400) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - await helpers.logout(); - - helpers.showErrorToast('Your session expired Please login agian'); + if (body['OTP_SendType'] != null) { + onFailure(getError(parsed), statusCode); + } else { + await helpers.logout(); + helpers.showErrorToast('Your session expired Please login agian'); + } } else if (parsed['MessageStatus'] == 1) { + if (!parsed['IsAuthenticated']) + onFailure(getError(parsed), statusCode); + else + onSuccess(parsed, statusCode); + } else { + onFailure(getError(parsed), statusCode); + } + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } catch (e) { + print(e); + onFailure(e.toString(), -1); + } + } + + postPatient(String endPoint, + {Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + @required PatiantInformtion patient, + bool isExternal = false}) async { + String url = BASE_URL + endPoint; + + try { + Map headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }; + + String token = await sharedPref.getString(TOKEN); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); + if (body.containsKey('SetupID')) { + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; + } + + body['VersionID'] = VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + + body['IPAdress'] = IP_ADDRESS; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') + ? body['PatientOutSA'] != null + ? body['PatientOutSA'] + : PATIENT_OUT_SA_PATIENT_REQ + : PATIENT_OUT_SA_PATIENT_REQ; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = + body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + + body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null + ? body['PatientType'] + : patient.patientType != null + ? patient.patientType + : PATIENT_TYPE + : PATIENT_TYPE; + + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : patient.patientType != null + ? patient.patientType + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + + body['TokenID'] = token; + body['PatientID'] = body['PatientID'] != null + ? body['PatientID'] + : patient.patientId ?? patient.patientMRN; + + body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it + body['SessionID'] = SESSION_ID; //getSe + + print("URL : $url"); + print("Body : ${json.encode(body)}"); + + if (await Helpers.checkConnection()) { + final response = await http.post(url.trim(), + body: json.encode(body), headers: headers); + final int statusCode = response.statusCode; + print("statusCode :$statusCode"); + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + // var parsed = json.decode(response.body.toString()); + var parsed = json.decode(utf8.decode(response.bodyBytes)); + if (parsed['Response_Message'] != null) { onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed['IsAuthenticated'] == null) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else if (parsed['Result'] == 'OK') { + onSuccess(parsed, statusCode); + } else { + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + onFailure(getError(parsed), statusCode); + } + } + } else if (parsed['MessageStatus'] == 1 || + parsed['SMSLoginRequired'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 2 && + parsed['IsAuthenticated']) { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] == null && + parsed['ErrorEndUserMessage'] == null) { + if (parsed['ErrorSearchMsg'] == null) { + onFailure("Server Error found with no available message", + statusCode); + } else { + onFailure(parsed['ErrorSearchMsg'], statusCode); + } + } else { + onFailure( + parsed['message'] ?? + parsed['ErrorEndUserMessage'] ?? + parsed['ErrorMessage'], + statusCode); + } + } + } else { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } + } + } } } } else { @@ -98,4 +272,27 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + + String getError(parsed) { + //TODO change this fun + String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; + if (parsed["ValidationErrors"] != null) { + error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + + if (parsed["ValidationErrors"]["ValidationErrors"] != null && + parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + for (var i = 0; + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { + error = error + + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + + "\n"; + } + } + } + if (error == null || error == "null" || error == "null\n") { + return "This server not work probably in this time"; + } + return error; + } } diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..06768cbc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,9 +1,11 @@ +import 'package:flutter/material.dart'; + const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -//const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = @@ -22,10 +24,18 @@ const PATIENT_GET_LIST_REFERAL_URL = "Services/Lists.svc/REST/GetList_STPReferralFrequency"; const PATIENT_GET_CLINIC_BY_PROJECT_URL = "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; +const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; +const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics"; + +const GET_REFERRAL_FACILITIES = + 'Services/DoctorApplication.svc/REST/GetReferralFacilities'; + +const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo'; -const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN_DATA = + 'Services/DoctorApplication.svc/REST/GetVitalSigns'; const GET_PATIENT_LAB_OREDERS = 'Services/DoctorApplication.svc/REST/GetPatientLabOreders'; const GET_PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; @@ -43,6 +53,9 @@ const GET_PRESCRIPTION_REPORT = const GT_MY_PATIENT_QUESTION = 'Services/DoctorApplication.svc/REST/GtMyPatientsQuestions'; +const PRM_SEARCH_PATIENT = + 'Services/Patients.svc/REST/GetPatientInformation_PRM'; + const GET_PATIENT = 'Services/DoctorApplication.svc/REST/'; const GET_PRESCRIPTION_REPORT_FOR_IN_PATIENT = @@ -57,6 +70,19 @@ const ADD_REFERRED_DOCTOR_REMARKS = const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; +const GET_PENDING_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/PendingReferrals'; + +const CREATE_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/CreateReferral'; + +const RESPONSE_PENDING_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/RespondReferral'; + +const GET_PATIENT_REFERRAL = 'Services/DoctorApplication.svc/REST/GetRefferal'; + +const POST_UCAF = 'Services/DoctorApplication.svc/REST/PostUCAF'; + const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -64,19 +90,162 @@ const GET_PATIENT_LAB_RESULTS = 'Services/DoctorApplication.svc/REST/GetPatientLabResults'; const LOGIN_URL = 'Services/Sentry.svc/REST/MemberLogIN_New'; const INSERT_DEVICE_IMEI = - 'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; + 'Services/DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails'; +// 'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; +// const SELECT_DEVICE_IMEI = +// 'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; + const SELECT_DEVICE_IMEI = - 'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; + 'Services/DoctorApplication.svc/REST/DoctorApp_GetDeviceDetailsByIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; +const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = + 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp'; + +const SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN = + 'Services/DoctorApplication.svc/REST/SendVerificationCode'; const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; + +const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = + 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp'; + const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_DASHBOARD = + 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI'; +const GET_SICKLEAVE_STATISTIC = + 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; +const ARRIVED_PATIENT_URL = + 'Services/DoctorApplication.svc/REST/PatientArrivalList​'; +const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; +const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; +const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; + +const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; +const GET_COVERING_DOCTORS = + 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; +const ADD_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PostRequisition'; +const UPDATE_RESCHDEULE = + 'Services/DoctorApplication.svc/REST/PatchRequisition'; +const GET_RESCHEDULE_LEAVE = + 'Services/DoctorApplication.svc/REST/GetRequisition'; +const GET_PRESCRIPTION_LIST = + 'Services/DoctorApplication.svc/REST/GetPrescription'; + +const POST_PRESCRIPTION_LIST = + 'Services/DoctorApplication.svc/REST/PostPrescription'; +const GET_PROCEDURE_LIST = + 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; +const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure'; + +const GET_PATIENT_ARRIVAL_LIST = + 'Services/DoctorApplication.svc/REST/PatientArrivalList'; + +///Lab Order +const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; +const GET_Patient_LAB_SPECIAL_RESULT = + 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const SEND_LAB_RESULT_EMAIL = + 'Services/Notifications.svc/REST/SendLabReportEmail'; +const GET_Patient_LAB_RESULT = + 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = + 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; + +// SOAP + +const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; +const GET_MASTER_LOOKUP_LIST = + 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; + +const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; + +const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; +const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; +const POST_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = + 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = + '/Services/DoctorApplication.svc/REST/PostProgressNote'; +const POST_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PostAssessment'; + +const PATCH_ALLERGY = 'Services/DoctorApplication.svc/REST/PatchAllergies'; +const PATCH_HISTORY = 'Services/DoctorApplication.svc/REST/PatchHistory'; +const PATCH_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/PatchChiefcomplaint'; + +const PATCH_PHYSICAL_EXAM = + 'Services/DoctorApplication.svc/REST/PatchPhysicalExam'; +const PATCH_PROGRESS_NOTE = + 'Services/DoctorApplication.svc/REST/PatchProgressNote'; +const PATCH_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PatchAssessment'; + +const GET_ALLERGY = 'Services/DoctorApplication.svc/REST/GetAllergies'; +const GET_HISTORY = 'Services/DoctorApplication.svc/REST/GetHistory'; +const GET_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/GetChiefcomplaint'; +const GET_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/GetPhysicalExam'; +const GET_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/GetProgressNote'; +const GET_ASSESSMENT = 'Services/DoctorApplication.svc/REST/GetAssessment'; +const GET_ORDER_PROCEDURE = + 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; + +const GET_LIST_CATEGORISE = + 'Services/DoctorApplication.svc/REST/GetProcedureCategories'; + +const GET_CATEGORISE_PROCEDURE = + 'Services/DoctorApplication.svc/REST/GetProcedure'; +const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; +const UPDATE_PRESCRIPTION = + 'Services/DoctorApplication.svc/REST/PatchPrescription'; +const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; +const DRUG_TO_DRUG = + 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; +const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; +const GET_FLOORS = 'Services/DoctorApplication.svc/REST/GetFloors'; +const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; +const GET_ROOM_CATEGORIES = + 'Services/DoctorApplication.svc/REST/GetRoomCategories'; +const GET_DIAGNOSIS_TYPES = + 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; +const GET_DIET_TYPES = 'Services/DoctorApplication.svc/REST/DietTypes'; +const GET_ICD_CODES = 'Services/DoctorApplication.svc/REST/GetICDCodes'; +const POST_ADMISSION_REQUEST = + 'Services/DoctorApplication.svc/REST/PostAdmissionRequest'; +const GET_ITEM_BY_MEDICINE = + 'Services/DoctorApplication.svc/REST/GetItemByMedicineCode'; + +const GET_PROCEDURE_VALIDATION = + 'Services/DoctorApplication.svc/REST/ValidateProcedures'; +const GET_BOX_QUANTITY = + 'Services/DoctorApplication.svc/REST/CalculateBoxQuantity'; + +///GET ECG +const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; + +const GET_PAtIENTS_INSURANCE_APPROVALS = + "Services/Patients.svc/REST/GetApprovalStatus"; + +const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; +const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; + +///Prescriptions +const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const GET_PRESCRIPTIONS_ALL_ORDERS = + 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT_NEW = + 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = + 'Services/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTION_REPORT_ENH = + 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; +const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; var selectedPatientType = 1; @@ -88,7 +257,8 @@ var SERVICES_PATIANT = [ "GtMyReferredPatient", "GtMyDischargeReferralPatient", "GtMyTomorrowPatient", - "GtMyReferralPatient" + "GtMyReferralPatient", + "PatientArrivalList" ]; var SERVICES_PATIANT2 = [ "List_MyOutPatient", @@ -97,7 +267,8 @@ var SERVICES_PATIANT2 = [ "List_MyReferredPatient", "List_MyDischargeReferralPatient", "List_MyTomorrowPatient", - "List_MyReferralPatient" + "List_MyReferralPatient", + "patientArrivalList" ]; var SERVICES_PATIANT_HEADER = [ "Search Out-Patient", @@ -106,7 +277,8 @@ var SERVICES_PATIANT_HEADER = [ "Referred", "Referral Discharge", "Tomorrow", - "Referral" + "Referral", + "Arrival Patient" ]; var SERVICES_PATIANT_HEADER_AR = [ "المريض الخارجي", @@ -115,11 +287,14 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول الي", "المريض المحال المعافى", "مريض الغد", - "المريض المحول مني" + "المريض المحول مني", + "المريض الواصل" ]; //****************** // Colors ////// by : ibrahim + +var DEVICE_TOKEN = ""; const PRIMARY_COLOR = 0xff515B5D; const TRANSACTION_NO = 0; @@ -131,10 +306,17 @@ const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; +const IS_DENTAL_ALLOWED_BACKEND = false; +const PATIENT_OUT_SA_PATIENT_REQ = 0; +const SETUP_ID = '91877'; +const GENERAL_ID = 'Cs2020@2016\$2958'; +const PATIENT_TYPE = 1; +const PATIENT_TYPE_ID = 1; /// Timer Info const TIMER_MIN = 10; class AppGlobal { static var CONTEX; + static Color appPrimaryColor = Color(0xFFB9382C); } diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0dee26b9..9fa9c35c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -7,7 +7,7 @@ const Map> localizedValues = { 'theDoctor': {'en': 'Doctor', 'ar': 'الطبيب'}, 'reply': {'en': 'Reply', 'ar': 'رد'}, 'time': {'en': 'Time', 'ar': 'الوقت'}, - 'fileNo': {'en': 'File No:', 'ar': 'رقم الملف:'}, + 'fileNo': {'en': 'File No : ', 'ar': 'رقم الملف :'}, 'mobileNo': {'en': 'Mobile No', 'ar': 'رقم الموبايل'}, 'messagesScreenToolbarTitle': {'en': 'Messages', 'ar': 'الرسائل'}, 'mySchedule': {'en': 'Schedule', 'ar': 'جدولي'}, @@ -29,7 +29,7 @@ const Map> localizedValues = { 'en': 'Answer/Suggestions', 'ar': 'ملاحضات وتفاصيل العيادة' }, - 'outPatients': {'en': 'Out-Patients', 'ar': 'ةالمريض الخارجي'}, + 'outPatients': {'en': 'Out Patient', 'ar': 'المريض الخارجي'}, 'searchPatient': {'en': 'Search Patient', 'ar': 'البحث عن مريض'}, 'searchAbout': {'en': 'Search', 'ar': 'البحث عن'}, 'patient': {'en': 'Patient', 'ar': ' مريض'}, @@ -37,24 +37,27 @@ const Map> localizedValues = { 'lab': {'en': 'Lab', 'ar': 'المختبر'}, 'result': {'en': 'Result', 'ar': 'نتيجة'}, 'todayStatistics': {'en': 'Today Statistics', 'ar': 'إحصائيات اليوم'}, - 'arrived': {'en': 'Arrived', 'ar': 'وصل'}, + 'arrived': {'en': 'Arrival Patients', 'ar': ' المرضى الواصلين'}, 'er': {'en': 'ER', 'ar': 'حالة طوارئ'}, 'walkIn': {'en': 'Walk-in', 'ar': 'ادخل'}, 'notArrived': {'en': 'Not Arrived', 'ar': 'لم يصل'}, 'radiology': {'en': 'Radiology', 'ar': 'الأشعة'}, 'service': {'en': 'Service', 'ar': 'خدمة'}, 'referral': {'en': 'Referral', 'ar': 'االإحالة'}, - 'inPatient': {'en': 'In-Patient', 'ar': 'االمريض الداخلي'}, + 'inPatient': {'en': 'In Patient', 'ar': 'المريض الداخلي'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, + 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, + 'referredPatient': {'en': 'Referred Patient', 'ar': 'المرضى المحالين'}, + 'referredOn': {'en': 'referred On : ', 'ar': ' : تمت الإحالة في'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, 'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'}, 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, - 'phoneNumber': {'en': 'Phone Number ', 'ar': 'رقم الجوال'}, + 'phoneNumber': {'en': "Patient's Phone Number ", 'ar': 'رقم الجوال'}, 'patientID': {'en': 'Patient ID', 'ar': 'رقم المريض'}, 'patientFile': {'en': 'Patient File', 'ar': 'ملف المريض'}, 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'}, @@ -81,7 +84,7 @@ const Map> localizedValues = { 'speciality': {'en': 'Speciality', 'ar': 'التخصص'}, 'errorMessage': {'en': 'Something went wrong', 'ar': 'حدث خطأ ما'}, 'patientProfile': {'en': 'Patient Profile', 'ar': 'ملف المريض'}, - 'vitalSign': {'en': 'Vital Sign', 'ar': 'المؤشرات الحيوية'}, + 'vitalSign': {'en': 'Vital Signs', 'ar': 'المؤشرات الحيوية'}, 'vital': {'en': 'Vital', 'ar': 'الحيوية'}, 'signs': {'en': 'Signs', 'ar': 'المؤشرات'}, 'labOrder': {'en': 'Lab Order', 'ar': 'نتائج التحاليل'}, @@ -121,10 +124,10 @@ const Map> localizedValues = { 'ar': 'ليس لديك اي ملاحظة تقدم ' }, 'invoiceNo:': {'en': 'Invoice No :', 'ar': 'رقم الفاتورة'}, - 'generalResult': {'en': 'General Result :', 'ar': 'النتيجة العامة'}, + 'generalResult': {'en': 'General Result ', 'ar': 'النتيجة العامة'}, 'description': {'en': 'Description', 'ar': 'الوصف'}, 'value': {'en': 'Value', 'ar': 'القيمة'}, - 'range': {'en': 'range', 'ar': 'النطاق'}, + 'range': {'en': 'Range', 'ar': 'النطاق'}, 'enterId': {'en': 'Enter ID', 'ar': 'الهوية'}, 'pleaseEnterYourID': { 'en': 'Please enter your ID', @@ -171,8 +174,8 @@ const Map> localizedValues = { 'ar': 'الرجاء ادخال الرمز' }, 'youDon\'tHaveAnyPatient': { - 'en': 'You don\'t have any patient', - 'ar': 'ليس لديك اي مرضى' + 'en': 'No data found for the selected search criteria', + 'ar': 'لا توجد بيانات لمعايير البحث المختارة' }, 'age': {'en': 'Age', 'ar': 'العمر'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, @@ -201,6 +204,10 @@ const Map> localizedValues = { 'routine': {'en': 'Routine', 'ar': 'روتيني'}, 'send': {'en': 'Send', 'ar': 'ارسال'}, 'referralFrequency': {'en': 'Referral Frequency:', 'ar': 'تواتر الحالة:'}, + 'selectReferralFrequency': { + 'en': 'Select Referral Frequency:', + 'ar': 'اختار تواتر الحالة:' + }, 'clinicalDetailsAndRemarks': { 'en': 'Clinical Details and Remarks', 'ar': 'التفاصيل السرسرية والملاحظات' @@ -210,7 +217,7 @@ const Map> localizedValues = { 'en': 'Please fill all fields..!', 'ar': 'الرجاء ملأ جميع الحقول..!' }, - 'replay2': {'en': 'Replay', 'ar': 'رد الطبيب'}, + 'replay2': {'en': 'Reply', 'ar': 'رد الطبيب'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, 'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدليات'}, 'price': {'en': 'Price', 'ar': 'السعر'}, @@ -229,6 +236,7 @@ const Map> localizedValues = { 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'}, 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, + 'ok': {'en': 'OK', 'ar': 'موافق'}, 'done': {'en': 'DONE', 'ar': 'تأكيد'}, 'resumecall': {'en': 'Resume call', 'ar': 'استئناف المكالمة'}, 'endcallwithcharge': {'en': 'End with charge', 'ar': 'ينتهي مع الشحن'}, @@ -255,22 +263,557 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - 'replySuccessfully': { - 'en': 'Reply Successfully', - 'ar': 'تم الرد بنجاح' - }, + 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, + "sick-leaves": {"en": "Patient Sick Leave", "ar": "الاجازات المرضية"}, + "patient-sick": {"en": "Patient Sick", "ar": "المرضية"}, + "leave": {"en": "Leave", "ar": "غادر"}, + "submit": {"en": "Submit", "ar": "ارسال"}, + "doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"}, + "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, + "sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."}, + "sick-leave-days": {"en": "Leave Days: ", "ar": " :أيام الإجازة"}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, + 'date': {'en': 'Date', 'ar': 'التاريخ'}, 'admissionNo': {'en': 'ADMISSION #: ', 'ar': 'قبول #:'}, 'losNo': {'en': 'LOS #:', 'ar': 'LOS #:'}, 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, + 'next': {'en': 'Next', 'ar': 'التالي'}, + 'healthRecordInformation': { + 'en': 'HEALTH RECORD INFORMATION', + 'ar': 'معلومات السجل الصحي' + }, + "prevoius-sickleave-issed": { + "en": "Total previous sick leave issued by the doctor", + "ar": "مجموع الإجازات المرضية السابقة التي أصدرها الطبيب" + }, + 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, + 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, + "empty-message": { + "en": "Please enter this field", + "ar": "يرجى ادخال هذا الحقل" + }, + 'no-sickleve-applied': { + 'en': "No sick leave available, apply Now", + 'ar': 'لا توجد إجازة مرضية متاحة ، تقدم بطلب الآن' + }, + 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, + 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, + 'add': {'en': "Add", 'ar': 'أضف'}, + 'approved': {'en': "Approved", 'ar': 'وافق'}, + 'extended': {'en': "Extended", 'ar': 'وسعوا'}, + 'pending': {'en': "Pending", 'ar': 'قيد الانتظار'}, + 'leave-start-date': {'en': "Leave start date", 'ar': 'تاريخ بدء المغادرة'}, + 'days-sick-leave': {'en': "DAYS OF SICK LEAVE", 'ar': 'أيام الإجازة المرضية'}, + 'extend': {'en': "Extend", 'ar': 'تمديد'}, + 'extend-sickleave': { + 'en': "EXTEND SICK LEAVE", + 'ar': 'قم بتمديد الإجازة المرضية' + }, + "chiefComplaintLength": { + "en": "Chief Complaint length should be greater than 25", + "ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25" + }, + 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'}, + 'no-priscription-listed': { + 'en': 'No Prescription Listed', + 'ar': 'لا وصفة طبية مدرجة' + }, + 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, + 'referredFrom': {'en': "From : ", 'ar': ' : من'}, + 'branch': {'en': "Branch", 'ar': 'الفرع'}, + 'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'}, + 'appointmentNo': {'en': "Appointment # : ", 'ar': '# الموعد:'}, + 'refer': {'en': "REFER", 'ar': 'إحالة'}, + 'rejected': {'en': "Rejected", 'ar': 'مرفوض'}, + 'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'}, + 'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'}, + 'dr': {'en': "DR.", 'ar': 'د.'}, + 'previewHealth': {'en': "Health", 'ar': 'الصحة'}, + 'summaryReport': {'en': "Summary", 'ar': 'موجز'}, + 'accept': {'en': "ACCEPT", 'ar': 'قبول'}, + 'reject': {'en': "REJECT", 'ar': 'رفض'}, + 'noAppointmentsErrorMsg': { + 'en': "There is no appointments for at this date", + 'ar': 'لا توجد مواعيد في هذا التاريخ' + }, + 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, + 'noPrescriptionListed': { + 'en': 'NO PRESCRIPTION LISTED', + 'ar': 'لم يتم سرد أي وصف' + }, + 'addNow': {'en': 'ADD Now', 'ar': 'اضف الآن'}, + 'orderType': {'en': 'Order Type', 'ar': 'نوع الطلب'}, + 'strength': {'en': 'Strength', 'ar': 'شدة'}, + 'doseTime': {'en': 'Dose Time', 'ar': 'وقت الجرعة'}, + 'indication': {'en': 'Indication', 'ar': 'دواعي الاستخدام'}, + 'duration': {'en': 'Duration', 'ar': 'المدة الزمنية'}, + 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, + 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, + 'route': {'en': 'Route', 'ar': 'المسار'}, + 'reschedule-leave': { + 'en': 'Reschedule and leaves', + 'ar': 'إعادة الجدولة والأوراق' + }, + 'no-reschedule-leave': { + 'en': 'No Reschedule and leaves', + 'ar': 'لا إعادة جدولة ويغادر' + }, + 'weight': {'en': "Weight", 'ar': 'الوزن'}, + 'kg': {'en': "kg", 'ar': 'كغ'}, + 'height': {'en': "Height", 'ar': 'الطول'}, + 'cm': {'en': "cm", 'ar': 'سم'}, + 'idealBodyWeight': {'en': "Ideal Body Weight", 'ar': 'وزن الجسم المثالي'}, + 'waistSize': {'en': "Waist Size", 'ar': 'مقاس الخصر'}, + 'inch': {'en': "Inch", 'ar': 'إنش'}, + 'headCircum': {'en': "Head Circum", 'ar': 'محيط الرأس'}, + 'leanBodyWeight': {'en': "Lean Body Weight", 'ar': 'وزن الجسم الهزيل'}, + 'bodyMassIndex': {'en': "Body Mass Index", 'ar': 'مؤشر كتلة الجسم'}, + 'yourBodyMassIndex': {'en': "Your Body Mass Index is", 'ar': 'مؤشر كتلة جسمك هو'}, + 'bmiUnderWeight': {'en': "UnderWeight", 'ar': 'تحت الوزن'}, + 'bmiHealthy': {'en': "Healthy", 'ar': 'صحي'}, + 'bmiOverWeight': {'en': "OverWeight", 'ar': 'فوق الوزن'}, + 'bmiObese': {'en': "Obese", 'ar': 'سمين'}, + 'method': {'en': "Method", 'ar': 'الطريقة'}, + 'pulseBeats': {'en': 'Pulse(beats/minute)', 'ar': ' (دقة/دقيقة)النبض'}, + 'rhythm': {'en': "Rhythm", 'ar': 'الإيقاع'}, + 'respBeats': {'en': 'RESP (beats/minute)', 'ar': ' (دقة/دقيقة)التنفس'}, + 'patternOfRespiration': {'en': "Pattern Of Respiration", 'ar': 'نمط التنفس'}, + 'bloodPressureDiastoleAndSystole': { + 'en': 'Blood Pressure (Sys, Dias)', + 'ar': 'ضغط الدم (العظمى, الصغرى)' + }, + 'cuffLocation': {'en': "Cuff Location", 'ar': 'موقع الكف'}, + 'cuffSize': {'en': "Cuff Size", 'ar': 'حجم الكف'}, + 'patientPosition': {'en': "Patient Position", 'ar': 'موقع المريض'}, + 'fio2': {'en': "FIO2(%)", 'ar': 'FIO2(%)'}, + 'sao2': {'en': "SAO2(%)", 'ar': 'SAO2(%)'}, + 'painManagement': {'en': "Pain Management", 'ar': 'إدارة الألم'}, + 'holiday': {'en': "Holiday", 'ar': 'يوم الاجازة'}, + 'to': {'en': "To", 'ar': 'إلى'}, + 'coveringDoctor': {'en': "Covering Doctor: ", 'ar': ' :تغطية دكتور'}, + 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'}, + 'pleaseEnterDate': { + 'en': 'Please enter leave start date', + 'ar': 'الرجاء إدخال تاريخ بدء الإجازة' + }, + 'pleaseEnterNoOfDays': { + 'en': 'Please enter sick leave days', + 'ar': 'الرجاء إدخال أيام الإجازة المرضية' + }, + 'pleaseEnterRemarks': { + 'en': 'Please enter remarks', + 'ar': 'الرجاء إدخال الملاحظات' + }, + 'update': {'en': 'Update', 'ar': 'تحديث'}, + 'admission': {'en': "Admission", 'ar': 'قبول'}, + 'request': {'en': "Request", 'ar': 'طلب'}, + 'admissionRequest': {'en': "Admission Request", 'ar': 'طلب قبول'}, + 'patientDetails': {'en': "Patient Details", 'ar': 'تفاصيل المريض'}, + 'specialityAndDoctorDetail': { + 'en': "SPECIALITY AND DOCTOR DETAILS", + 'ar': 'تفاصيل التخصص والطبيب' + }, + 'referringDate': {'en': "Referring Date", 'ar': 'تاريخ الإحالة'}, + 'referringDoctor': {'en': "Referring Doctor", 'ar': 'دكتور الإحالة'}, + 'otherInformation': {'en': "Other Information", 'ar': 'معلومات أخرى'}, + 'expectedDays': {'en': "Expected Days", 'ar': 'الأيام المتوقعة'}, + 'expectedAdmissionDate': { + 'en': "Expected Admission Date", + 'ar': 'تاريخ القبول المتوقع' + }, + // 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, + 'isSickLeaveRequired': { + 'en': "Is Sick Leave Required", + 'ar': 'هل الإجازة المرضية مطلوبة' + }, + 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'حمل المريض'}, + 'treatmentLine': { + 'en': "Main line of treatment", + 'ar': 'الخط الرئيسي للعلاج' + }, + 'ward': {'en': "Ward", 'ar': 'رعاية'}, + 'preAnesthesiaReferred': { + 'en': "PRE ANESTHESIA REFERRED", + 'ar': 'الاحالة قبل التخدير' + }, + 'admissionType': {'en': "Admission Type", 'ar': 'نوع القبول'}, + 'diagnosis': {'en': "Diagnosis", 'ar': 'التشخيص'}, + 'allergies': {'en': "Allergies", 'ar': 'الحساسية'}, + 'preOperativeOrders': { + 'en': "Pre Operative Orders", + 'ar': 'أوامر ما قبل العملية' + }, + 'elementForImprovement': { + 'en': "Element For Improvement", + 'ar': 'عنصر للتحسين' + }, + 'dischargeDate': {'en': "Discharge Date", 'ar': 'تاريخ التفريغ'}, + 'dietType': {'en': "Diet Type", 'ar': 'نوع النظام الغذائي'}, + 'dietTypeRemarks': { + 'en': "Remarks on diet type", + 'ar': 'ملاحظات على نوع النظام الغذائي' + }, + 'save': {'en': "SAVE", 'ar': 'حفظ'}, + 'postPlansEstimatedCost': { + 'en': "POST PLANS & ESTIMATED COST", + 'ar': 'خطط البريد والتكلفة المقدرة' + }, + 'postPlans': {'en': "POST PLANS", 'ar': 'خطط البريد'}, + 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, + 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, + 'durationOfIllness': {'en': "duration Of Illness", 'ar': 'مدة المرض'}, + 'chiefComplaintsAndSymptoms': { + 'en': "CHIEF COMPLAINTS & OTHER SYMPTOMS", + 'ar': 'شكاوى الرئيس وأعراض أخرى' + }, + 'patientFeelsPainInHisBackAndCough': { + 'en': "Patient Feels pain in his back and cough", + 'ar': 'يشعر المريض بألم في ظهره ويسعل' + }, + 'additionalTextComplaints': { + 'en': "Additional text to add about Complaints", + 'ar': 'نص إضافي لإضافته حول الشكاوى' + }, + 'otherConditions': {'en': "OTHER CONDITIONS", 'ar': 'شروط أخرى'}, + 'other': {'en': "Other", 'ar': 'أخرى'}, + 'how': {'en': "How", 'ar': 'كيف'}, + 'when': {'en': "When", 'ar': 'متى'}, + 'where': {'en': "Where", 'ar': 'أين'}, + 'specifyPossibleLineManagement': { + 'en': "Specify possible line of management", + 'ar': 'حدد خط الإدارة المحتمل' + }, + 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, + 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, + 'reasons': {'en': "Reasons", 'ar': 'الأسباب'}, + 'createNew': {'en': "Create", 'ar': 'انشاء '}, + 'episode': {'en': "Episode", 'ar': 'Episode'}, + 'chiefComplaints': {'en': "Chief Complaints", 'ar': 'الشكاوى'}, + 'addChiefComplaints': {'en': "Add Chief Complaints", 'ar': ' اضافه الشكاوى'}, + 'histories': {'en': "Histories", 'ar': 'التاريخ المرضي'}, + 'allergiesSoap': {'en': "Allergies", 'ar': 'الحساسية'}, + 'historyOfPresentIllness': { + 'en': "History of Present Illness", + 'ar': 'تاريخ المرض الحالي' + }, + 'requiredMsg': { + 'en': "Please add required field correctly", + 'ar': "الرجاء إضافة الحقل المطلوب بشكل صحيح" + }, + 'addHistory': {'en': "Add History", 'ar': "اضافه تاريخ مرضي"}, + 'searchHistory': {'en': "Search History", 'ar': " البحث"}, + 'addSelectedHistories': { + 'en': "add selected histories", + 'ar': " اضافه تاريخ مرضي" + }, + 'addAllergies': {'en': "Add Allergies", 'ar': "أضف الحساسية"}, + 'itemExist': {'en': "This item already exist", 'ar': "هذا العنصر موجود"}, + 'selectAllergy': {'en': "Select Allergy", 'ar': "أختر الحساسية"}, + 'selectSeverity': {'en': "Select Severity", 'ar': "أختر الدرجه"}, + 'leaveCreated': {'en': "Leave has been created", 'ar': "تم إنشاء الإجازة"}, + 'medications': {'en': "Medications", 'ar': "الأدوية"}, + 'procedures': {'en': "Procedures", 'ar': "الإجراءات"}, + 'vitalSignEmptyMsg': { + 'en': "There is no vital signs for this patient", + 'ar': "لا توجد علامات حيوية لهذا المريض" + }, + 'referralEmptyMsg': { + 'en': "There is no referral data", + 'ar': "لا توجد بيانات إحالة" + }, + 'referralSuccessMsg': { + 'en': "You make referral successfully", + 'ar': "You make referral successfully" + }, + 'fromTime': {'en': "From Time", 'ar': "من وقت"}, + 'toTime': {'en': "To Time", 'ar': "الى وقت"}, + 'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"}, + 'condition': {'en': "Condition", 'ar': "الحالة"}, + 'id': {'en': "ID", 'ar': "بطاقة هوية"}, + 'quantity': {'en': "Quantity", 'ar': "الكمية"}, + 'durDays': {'en': "Dur.(days)", 'ar': "الفترة(أيام)"}, + 'codeNo': {'en': "Code #", 'ar': "# الرمز"}, + 'covered': {'en': "Covered", 'ar': "مغطى"}, + 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, + 'uncoveredByDoctor': { + 'en': "Uncovered By Doctor", + 'ar': "غير مغطى من قبل الدكتور" + }, + 'chiefComplaintEmptyMsg': { + 'en': "There is no Chief Complaint", + 'ar': "ليس هناك شكوى رئيس" + }, + "more-verify": { + "en": "More Verification Options", + "ar": "المزيد من خيارات التحقق" + }, + "welcome-back": {"en": "Welcome back!", "ar": "مرحبا بعودتك!"}, + "account-info": { + "en": "Would you like to login with current username?", + "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟" + }, + "another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"}, + "verify-login-with": { + "en": "Please choose one of the following options to verify", + "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" + }, + "register-user": {"en": "Register", "ar": "تسجيل"}, + "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, + "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, + "verify-with-sms": {"en": "SMS", "ar": "الرسائل القصيرة"}, + "verify-with-whatsapp": {"en": "Whatsapp", "ar": " الواتس اب"}, + "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, + "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, + "verify-fingerprint": { + "en": + "To activate the fingerprint login service, please verify data by using one of the following options.", + "ar": + "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" + }, + "verification_message": { + "en": "Please enter the Verification Code sent to", + "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى" + }, + "validation_message": { + "en": "The verification code expires in", + "ar": "تنتهي صلاحية رمز التحقق خلال" + }, + 'addAssessment': {'en': "Add ASSESSMENT", 'ar': "أضف التقييم"}, + 'assessment': {'en': "ASSESSMENT", 'ar': " التقييم"}, + 'physicalSystemExamination': { + 'en': "Physical/System Examination", + 'ar': " الفحص البدني / النظام" + }, + 'searchExamination': {'en': "Search Examination", 'ar': "فحص البحث"}, + 'addExamination': {'en': "Add Examination", 'ar': "اضافه"}, + 'doc': {'en': "Doc : ", 'ar': " د : "}, + 'patientNoDetailErrMsg': { + 'en': "There is no detail for this patient", + 'ar': "لا توجد تفاصيل لهذا المريض" + }, + 'allergicTO': {'en': "ALLERGIC TO ", 'ar': " حساس من"}, + 'normal': {'en': "Normal", 'ar': "عادي"}, + 'abnormal': {'en': "Abnormal", 'ar': " غير عادي"}, + 'notExamined': {'en': "Not Examined", 'ar': "لم يتم الفحص"}, + "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, + "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, + "mass": {"en": "Mass", "ar": "كتلة"}, + "temp-c": {"en": "°C", "ar": "°س"}, + "bpm": {"en": "bpm", "ar": "نبضة"}, + "respiration-signs": {"en": "Respiration", "ar": "تنفس"}, + "sys-dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, + "body": {"en": "Body \n Mass", "ar": "كتلة\nالجسم"}, + 'respirationRate': {'en': 'Respiration Rate', 'ar': 'معدل التنفس'}, + 'heart': {'en': 'Heart rate', 'ar': 'معدل ضربات القلب'}, + 'medicalReport': {'en': "medical Report", 'ar': "تقرير طبي"}, + 'visitDate': {'en': "Visit Date", 'ar': "تاريخ الزيارة"}, + 'test': {'en': "Procedures/Test", 'ar': "عمليات/تحاليل"}, + 'regular': {'en': "Regular", 'ar': "اعتيادي"}, + 'addMoreProcedure': { + 'en': "Add More Procedures", + 'ar': "اضف المزيد من العمليات" + }, + 'searchProcedures': {'en': "Search Procedures", 'ar': "البحث في العمليات"}, + 'selectProcedures': {'en': "Select procedure", 'ar': "اختر العملية"}, + 'procedureCategorise': { + 'en': "Select Procedure Category", + 'ar': "اختر صنف العمليات " + }, + 'addSelectedProcedures': { + 'en': "add Selected Procedures", + 'ar': "اضافة العمليات المختارة " + }, + 'updateProcedure': {'en': "Update Procedure", 'ar': "تحديث العملية"}, + 'orderProcedure': {'en': "order procedure", 'ar': "طلب العمليات"}, + 'nameOrICD': {'en': "Name or ICD", 'ar': "الاسم او  ICD"}, + 'dType': {'en': "Type", 'ar': "النوع"}, + 'addAssessmentDetails': { + 'en': "Add Assessment Details", + 'ar': "أضف تفاصيل التقييم" + }, + 'progressNoteSOAP': {'en': "Progress Note", 'ar': "ملاحظة التقدم"}, + 'addProgressNote': {'en': "Add Progress Note", 'ar': "أضف ملاحظة التقدم"}, + 'createdBy': {'en': "Created By :", 'ar': "أضيفت : "}, + 'editedBy': {'en': "Edited By :", 'ar': "عدلت : "}, + 'currentMedications': {'en': "Current Medications", 'ar': "الأدوية الحالية"}, + 'noItem': { + 'en': "No items exists in this list", + 'ar': "لا توجد عناصر في هذه القائمة" + }, + 'postUcafSuccessMsg': { + 'en': "UCAF request send successfully", + 'ar': "تم ارسال طلب UCAF بنجاح" + }, + 'vitalSignDetailEmpty': { + 'en': "There is no data for this vital sign", + 'ar': "لا توجد بيانات لهذه العلامة الحيوية" + }, + 'onlyOfftimeHoliday': { + 'en': "You can only apply holiday or offtime from mobile app", + 'ar': "يمكنك فقط تطبيق عطلة أو إجازة من تطبيق الهاتف" + }, + 'active': {'en': "Active", 'ar': "نشيط"}, + 'hold': {'en': "Hold", 'ar': "معلق"}, + 'loading': {'en': "Loading...", 'ar': "جار التحميل..."}, + 'assessmentErrorMsg': { + 'en': "You have to add at least one assessment.", + 'ar': "يجب عليك إضافة تقييم واحد على الأقل." + }, + 'examinationErrorMsg': { + 'en': "You have to add at least one examination.", + 'ar': "يجب عليك إضافة الفحص واحد على الأقل." + }, + 'progressNoteErrorMsg': { + 'en': "You have to add progress Note.", + 'ar': "يجب عليك إضافة ملاحظة التقدم." + }, + 'chiefComplaintErrorMsg': { + 'en': "You have to add chief complaint fields correctly .", + 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" + }, + 'referralStatus': {'en': "Referral Status : ", 'ar': "حالة الإحالة :"}, + 'referralRemark': {'en': "Referral Remark : ", 'ar': "ملاحظة الإحالة :"}, + 'ICDName': {'en': "ICDName", 'ar': "اسم ال ICD"}, + 'offTime': {'en': "OffTime", 'ar': "خارج الوقت"}, + 'patient-name': {'en': "Patient Name", 'ar': "اسم المريص"}, + 'icd': {'en': "ICD", 'ar': "التصنيف الدولي للأمراض"}, + 'days': {'en': "Days", 'ar': "أيام"}, + 'months': {'en': "Months", 'ar': "أشهر"}, + 'years': {'en': "Years", 'ar': "سنين"}, + 'hr': {'en': "HR", 'ar': "س"}, + 'min': {'en': "Min", 'ar': "د"}, + 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"}, + 'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, + 'referralStatusActive': {'en': "Active", 'ar': "نشط"}, + 'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"}, + 'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"}, + 'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"}, + + 'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"}, + 'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"}, + 'referralResponse': { + 'en': "Referral Response : ", + 'ar': " : استجابة الإحالة" + }, + 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, + 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, + 'referralSuccessMsgAccept': { + 'en': "Referral Accepted Successfully", + 'ar': "تم قبول الإحالة بنجاح" + }, + 'referralSuccessMsgReject': { + 'en': "Referral Rejected Successfully", + 'ar': "تم رفض الإحالة بنجاح" + }, + 'sickLeaveComments': { + 'en': "Sick leave comments", + 'ar': "تعليقات إجازة مرضية" + }, + 'pastMedicalHistory': {'en': "Past medical history", 'ar': "التاريخ الطبي"}, + 'pastSurgicalHistory': { + 'en': "Past surgical history", + 'ar': "التاريخ الجراحي" + }, + 'complications': {'en': "Complications", 'ar': "المضاعفات"}, + 'floor': {'en': "Floor", 'ar': "الطابق"}, + 'roomCategory': {'en': "Room category", 'ar': "فئة الغرفة"}, + 'otherDepartmentsInterventions': { + 'en': "Other departments interventions", + 'ar': "تدخلات الأقسام الأخرى" + }, + 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, + 'admissionRequestSuccessMsg': { + 'en': "Admission Request Created Successfully", + 'ar': "تم إنشاء طلب القبول بنجاح" + }, + // 'icd': {'en': "ICD", 'ar': " "}, + 'orderNo': {'en': "Order No : ", 'ar': "رقم الطلب"}, + 'infoStatus': {'en': "Info Status", 'ar': "حالة المعلومات"}, + 'doctorResponse': {'en': "Doctor Response", 'ar': "استجابة الطبيب"}, + 'sickleaveonhold': { + 'en': "A Sick leave is on Hold status for this patient", + 'ar': "الإجازة المرضية في حالة الانتظار لهذا المريض" + }, + 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"}, + 'otherStatistic': {'en': "Other Statistics", 'ar': "دیگر شماریات"}, + 'ptientsreferral': {'en': "Patient's Referrals", 'ar': "مریض کا حوالہ"}, + 'arrivalpatient': {'en': "Arrival Patients", 'ar': "مریضوں کی آمد"}, + 'searchmedicinepatient': { + 'en': "Search patient or Medicines", + 'ar': "مریض یا دوائیں تلاش کریں" + }, + 'appointmentDate': {'en': "Appointment Date", 'ar': "تاريخ الموعد"}, + 'arrived_p': {'en': "Arrived", 'ar': "وصل"}, + 'details': {'en': 'Details', 'ar': 'التفاصيل'}, + "liveCare": {"en": "Live Care", "ar": "لايف كير"}, + "out-patient": {"en": "Out Patient", "ar": "عيادات خارجية"}, + "BillNo": {"en": "Bill No :", "ar": "رقم الفاتورة"}, + "labResults": {"en": "Lab Result", "ar": "نتيجة المختبر"}, + "sendSuc": { + "en": "A copy has been sent to the email", + "ar": "تم إرسال نسخة إلى البريد الإلكتروني" + }, + "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, + "noDataAvailable": { + "en": "No data available", + "ar": " لا يوجد بيانات متاحة " + }, + "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, + + "open-rad": {"en": "Open Image", "ar": "فتح صور الاشعة"}, + + 'fileNumber': {'en': "File Number: ", 'ar': " :رقم الملف"}, + 'searchPatient-name': { + 'en': 'Search Name, Medical File, Phone Number', + 'ar': "اسم البحث ، الملف الطبي ، رقم الهاتف" + }, + 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة الجدولة'}, + 'leaves': {'en': 'Leaves', 'ar': 'يغادر'}, + "totalApproval": { + "en": "Total approval unused", + "ar": "اجمالي الموافقات الغير مستخدمة" + }, + "procedureStatus": {"en": "Procedure Status: ", "ar": "حالة الاجراء"}, + "unusedCount": {"en": "Unused Count: ", "ar": "غير مستخدم: "}, + "companyName": {"en": "Company Name ", "ar": "اسم الشركة: "}, + "procedureName": {"en": "Procedure Name", "ar": "اسم الاجراء"}, + "usageStatus": {"en": "Usage Status", "ar": "جالة الاستخدام"}, + "prescriptions": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, + "notes": {"en": "Notes", "ar": "ملاحظات"}, + "dailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"}, + "searchWithOther": { + "en": "Search With Other Criteria", + "ar": "البحث بمعايير أخرى" + }, + "hideOtherCriteria": { + "en": "Hide Other Criteria", + "ar": "إخفاء المعايير الأخرى" + }, + "applyForReschedule": { + "en": "Apply for leave or reschedule", + "ar": "تقدم بطلب للحصول على إجازة أو إعادة جدولة" + }, + "startDate": {"en": "Start Date: ", "ar": " :تاريخ البدء"}, + "endDate": {"en": "End Date: ", "ar": " :تاريخ الانتهاء"}, + + "add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"}, + "update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"}, + "sick_leave": {"en": "Sick Leave", "ar": "أجازة مرضية"}, + "addSickLeaveRequest": { + "en": "Add Sick Leave Request", + "ar": "إضافة طلب إجازة مرضية" + }, + "extendSickLeaveRequest": { + "en": "Extend Sick Leave Request", + "ar": "تمديد طلب الإجازة المرضية" + }, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 18b58c28..eea2ce76 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,10 +1,16 @@ final TOKEN = 'token'; final PROJECT_ID = 'projectID'; -//===========amjad============ +final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID'; +final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID'; +final LOGIN_TOKEN_ID = 'LogInToken'; final DOCTOR_ID = 'doctorID'; -//======================= final SLECTED_PATIENT_TYPE = 'slectedPatientType'; final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; final LIVE_CARE_PATIENT = 'livecare-patient-profile'; final LOGGED_IN_USER = 'loggedUser'; +final DASHBOARD_DATA = 'dashboard-data'; +final OTP_TYPE = 'otp-type'; +final LAST_LOGIN_USER = 'last-login-user'; +final PASSWORD = 'password'; +final CLINIC_NAME = 'clinic-name'; diff --git a/lib/core/enum/filter_type.dart b/lib/core/enum/filter_type.dart new file mode 100644 index 00000000..4591e023 --- /dev/null +++ b/lib/core/enum/filter_type.dart @@ -0,0 +1,2 @@ +enum FilterType { Clinic, Hospital } + diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart new file mode 100644 index 00000000..25e40d3b --- /dev/null +++ b/lib/core/enum/master_lookup_key.dart @@ -0,0 +1,95 @@ +enum MasterKeysService { + Allergies, + HistoryFamily, + HistoryMedical, + HistorySocial, + HistorySports, + HistorySurgical, + PhysicalExamination, + AllergySeverity, + physiotherapyGoals, + DiagnosisCondition, + DiagnosisType, + ICD10, + TemperatureMethods, + Speciality, + MedicationStrength, + MedicationDuration, + MedicationRoute, + MedicationFrequency, + MedicationDoseTime, + MedicationIndications, + + AdmissionRequestType, + DiagnosisSelectionType, +} + +extension SelectedMasterKeysService on MasterKeysService { + // ignore: missing_return + int getMasterKeyService() { + switch (this) { + case MasterKeysService.Allergies: + return 11; + break; + case MasterKeysService.HistoryFamily: + return 36; + break; + case MasterKeysService.HistoryMedical: + return 37; + break; + case MasterKeysService.HistorySocial: + return 38; + break; + case MasterKeysService.HistorySports: + return 39; + break; + case MasterKeysService.HistorySurgical: + return 66; + break; + case MasterKeysService.PhysicalExamination: + return 59; + break; + case MasterKeysService.AllergySeverity: + return 55; + break; + case MasterKeysService.physiotherapyGoals: + return 117; + break; + case MasterKeysService.DiagnosisCondition: + return 34; + break; + case MasterKeysService.DiagnosisType: + return 35; + break; + case MasterKeysService.ICD10: + return 2500; + case MasterKeysService.TemperatureMethods: + return 2005; + case MasterKeysService.Speciality: + return 10; + case MasterKeysService.MedicationStrength: + return 2100; + break; + case MasterKeysService.MedicationDuration: + return 118; + break; + case MasterKeysService.MedicationRoute: + return 32; + break; + case MasterKeysService.MedicationFrequency: + return 31; + break; + case MasterKeysService.MedicationDoseTime: + return 30; + break; + case MasterKeysService.MedicationIndications: + return 450; + case MasterKeysService.AdmissionRequestType: + return 2019; + break; + case MasterKeysService.DiagnosisSelectionType: + return 2024; + break; + } + } +} diff --git a/lib/core/model/PatientMuseResultsModel.dart b/lib/core/model/PatientMuseResultsModel.dart new file mode 100644 index 00000000..8b10de83 --- /dev/null +++ b/lib/core/model/PatientMuseResultsModel.dart @@ -0,0 +1,64 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class PatientMuseResultsModel { + int rowID; + String setupID; + int projectID; + String orderNo; + int lineItemNo; + int patientType; + int patientID; + String procedureID; + dynamic reportData; + String imageURL; + String createdBy; + String createdOn; + DateTime createdOnDateTime; + + PatientMuseResultsModel( + {this.rowID, + this.setupID, + this.projectID, + this.orderNo, + this.lineItemNo, + this.patientType, + this.patientID, + this.procedureID, + this.reportData, + this.imageURL, + this.createdBy, + this.createdOn}); + + PatientMuseResultsModel.fromJson(Map json) { + rowID = json['RowID']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + orderNo = json['OrderNo']; + lineItemNo = json['LineItemNo']; + patientType = json['PatientType']; + patientID = json['PatientID']; + procedureID = json['ProcedureID']; + reportData = json['ReportData']; + imageURL = json['ImageURL']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + createdOnDateTime = DateUtils.getDateTimeFromServerFormat(json['CreatedOn']); + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['OrderNo'] = this.orderNo; + data['LineItemNo'] = this.lineItemNo; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ProcedureID'] = this.procedureID; + data['ReportData'] = this.reportData; + data['ImageURL'] = this.imageURL; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/core/model/Prescriptions/Prescriptions.dart b/lib/core/model/Prescriptions/Prescriptions.dart new file mode 100644 index 00000000..78bc9105 --- /dev/null +++ b/lib/core/model/Prescriptions/Prescriptions.dart @@ -0,0 +1,158 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class Prescriptions { + String setupID; + int projectID; + int patientID; + int appointmentNo; + String appointmentDate; + String doctorName; + String clinicDescription; + String name; + int episodeID; + int actualDoctorRate; + int admission; + int clinicID; + String companyName; + String despensedStatus; + DateTime dischargeDate; + int dischargeNo; + int doctorID; + String doctorImageURL; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + bool isLiveCareAppointment; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + bool isInsurancePatient; + String nationalityFlagURL; + int noOfPatientsRate; + String qR; + List speciality; + + Prescriptions( + {this.setupID, + this.projectID, + this.patientID, + this.appointmentNo, + this.appointmentDate, + this.doctorName, + this.clinicDescription, + this.name, + this.episodeID, + this.actualDoctorRate, + this.admission, + this.clinicID, + this.companyName, + this.despensedStatus, + this.dischargeDate, + this.dischargeNo, + this.doctorID, + this.doctorImageURL, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.isInsurancePatient, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.qR, + this.speciality,this.isLiveCareAppointment}); + + Prescriptions.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = json['AppointmentDate']; + doctorName = json['DoctorName']; + clinicDescription = json['ClinicDescription']; + name = json['Name']; + episodeID = json['EpisodeID']; + actualDoctorRate = json['ActualDoctorRate']; + admission = json['Admission']; + clinicID = json['ClinicID']; + companyName = json['CompanyName']; + despensedStatus = json['Despensed_Status']; + dischargeDate = DateUtils.convertStringToDate(json['DischargeDate']); + dischargeNo = json['DischargeNo']; + doctorID = json['DoctorID']; + doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + isInsurancePatient = json['IsInsurancePatient']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + qR = json['QR']; + isLiveCareAppointment = json['IsLiveCareAppointment']; + // speciality = json['Speciality'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['DoctorName'] = this.doctorName; + data['ClinicDescription'] = this.clinicDescription; + data['Name'] = this.name; + data['EpisodeID'] = this.episodeID; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['Admission'] = this.admission; + data['ClinicID'] = this.clinicID; + data['CompanyName'] = this.companyName; + data['Despensed_Status'] = this.despensedStatus; + data['DischargeDate'] = this.dischargeDate; + data['DischargeNo'] = this.dischargeNo; + data['DoctorID'] = this.doctorID; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['IsInsurancePatient'] = this.isInsurancePatient; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + return data; + } +} + +class PrescriptionsList { + String filterName = ""; + List prescriptionsList = List(); + + PrescriptionsList({this.filterName, Prescriptions prescriptions}) { + prescriptionsList.add(prescriptions); + } +} diff --git a/lib/core/model/Prescriptions/perscription_pharmacy.dart b/lib/core/model/Prescriptions/perscription_pharmacy.dart new file mode 100644 index 00000000..3adaef7e --- /dev/null +++ b/lib/core/model/Prescriptions/perscription_pharmacy.dart @@ -0,0 +1,108 @@ +class PharmacyPrescriptions { + String expiryDate; + dynamic sellingPrice; + int quantity; + int itemID; + int locationID; + int projectID; + String setupID; + String locationDescription; + Null locationDescriptionN; + String itemDescription; + Null itemDescriptionN; + String alias; + int locationTypeID; + int barcode; + Null companybarcode; + int cityID; + String cityName; + int distanceInKilometers; + String latitude; + int locationType; + String longitude; + String phoneNumber; + String projectImageURL; + Null sortOrder; + + PharmacyPrescriptions( + {this.expiryDate, + this.sellingPrice, + this.quantity, + this.itemID, + this.locationID, + this.projectID, + this.setupID, + this.locationDescription, + this.locationDescriptionN, + this.itemDescription, + this.itemDescriptionN, + this.alias, + this.locationTypeID, + this.barcode, + this.companybarcode, + this.cityID, + this.cityName, + this.distanceInKilometers, + this.latitude, + this.locationType, + this.longitude, + this.phoneNumber, + this.projectImageURL, + this.sortOrder}); + + PharmacyPrescriptions.fromJson(Map json) { + expiryDate = json['ExpiryDate']; + sellingPrice = json['SellingPrice']; + quantity = json['Quantity']; + itemID = json['ItemID']; + locationID = json['LocationID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + locationDescription = json['LocationDescription']; + locationDescriptionN = json['LocationDescriptionN']; + itemDescription = json['ItemDescription']; + itemDescriptionN = json['ItemDescriptionN']; + alias = json['Alias']; + locationTypeID = json['LocationTypeID']; + barcode = json['Barcode']; + companybarcode = json['Companybarcode']; + cityID = json['CityID']; + cityName = json['CityName']; + distanceInKilometers = json['DistanceInKilometers']; + latitude = json['Latitude']; + locationType = json['LocationType']; + longitude = json['Longitude']; + phoneNumber = json['PhoneNumber']; + projectImageURL = json['ProjectImageURL']; + sortOrder = json['SortOrder']; + } + + Map toJson() { + final Map data = new Map(); + data['ExpiryDate'] = this.expiryDate; + data['SellingPrice'] = this.sellingPrice; + data['Quantity'] = this.quantity; + data['ItemID'] = this.itemID; + data['LocationID'] = this.locationID; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['LocationDescription'] = this.locationDescription; + data['LocationDescriptionN'] = this.locationDescriptionN; + data['ItemDescription'] = this.itemDescription; + data['ItemDescriptionN'] = this.itemDescriptionN; + data['Alias'] = this.alias; + data['LocationTypeID'] = this.locationTypeID; + data['Barcode'] = this.barcode; + data['Companybarcode'] = this.companybarcode; + data['CityID'] = this.cityID; + data['CityName'] = this.cityName; + data['DistanceInKilometers'] = this.distanceInKilometers; + data['Latitude'] = this.latitude; + data['LocationType'] = this.locationType; + data['Longitude'] = this.longitude; + data['PhoneNumber'] = this.phoneNumber; + data['ProjectImageURL'] = this.projectImageURL; + data['SortOrder'] = this.sortOrder; + return data; + } +} diff --git a/lib/core/model/Prescriptions/prescription_report.dart b/lib/core/model/Prescriptions/prescription_report.dart new file mode 100644 index 00000000..d2427004 --- /dev/null +++ b/lib/core/model/Prescriptions/prescription_report.dart @@ -0,0 +1,191 @@ +class PrescriptionReport { + String address; + int appointmentNo; + String clinic; + String companyName; + int days; + String doctorName; + var doseDailyQuantity; + String frequency; + int frequencyNumber; + String image; + String imageExtension; + String imageSRCUrl; + String imageString; + String imageThumbUrl; + String isCovered; + String itemDescription; + int itemID; + String orderDate; + int patientID; + String patientName; + String phoneOffice1; + String prescriptionQR; + int prescriptionTimes; + String productImage; + String productImageBase64; + String productImageString; + int projectID; + String projectName; + String remarks; + String route; + String sKU; + int scaleOffset; + String startDate; + + String patientAge; + String patientGender; + String phoneOffice; + int doseTimingID; + int frequencyID; + int routeID; + String name; + String itemDescriptionN; + String routeN; + String frequencyN; + + PrescriptionReport({ + this.address, + this.appointmentNo, + this.clinic, + this.companyName, + this.days, + this.doctorName, + this.doseDailyQuantity, + this.frequency, + this.frequencyNumber, + this.image, + this.imageExtension, + this.imageSRCUrl, + this.imageString, + this.imageThumbUrl, + this.isCovered, + this.itemDescription, + this.itemID, + this.orderDate, + this.patientID, + this.patientName, + this.phoneOffice1, + this.prescriptionQR, + this.prescriptionTimes, + this.productImage, + this.productImageBase64, + this.productImageString, + this.projectID, + this.projectName, + this.remarks, + this.route, + this.sKU, + this.scaleOffset, + this.startDate, + this.patientAge, + this.patientGender, + this.phoneOffice, + this.doseTimingID, + this.frequencyID, + this.routeID, + this.name, + this.itemDescriptionN, + this.routeN, + this.frequencyN, + }); + + PrescriptionReport.fromJson(Map json) { + address = json['Address']; + appointmentNo = json['AppointmentNo']; + clinic = json['Clinic']; + companyName = json['CompanyName']; + days = json['Days']; + doctorName = json['DoctorName']; + doseDailyQuantity = json['DoseDailyQuantity']; + frequency = json['Frequency']; + frequencyNumber = json['FrequencyNumber']; + image = json['Image']; + imageExtension = json['ImageExtension']; + imageSRCUrl = json['ImageSRCUrl']; + imageString = json['ImageString']; + imageThumbUrl = json['ImageThumbUrl']; + isCovered = json['IsCovered']; + itemDescription = json['ItemDescription']; + itemID = json['ItemID']; + orderDate = json['OrderDate']; + patientID = json['PatientID']; + patientName = json['PatientName']; + phoneOffice1 = json['PhoneOffice1']; + prescriptionQR = json['PrescriptionQR']; + prescriptionTimes = json['PrescriptionTimes']; + productImage = json['ProductImage']; + productImageBase64 = json['ProductImageBase64']; + productImageString = json['ProductImageString']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + route = json['Route']; + sKU = json['SKU']; + scaleOffset = json['ScaleOffset']; + startDate = json['StartDate']; + + patientAge = json['patientAge']; + patientGender = json['patientGender']; + phoneOffice = json['phoneOffice']; + doseTimingID = json['doseTimingID']; + frequencyID = json['frequencyID']; + routeID = json['routeID']; + name = json['name']; + itemDescriptionN = json['itemDescriptionN']; + routeN = json['routeN']; + frequencyN = json['frequencyN']; + } + + Map toJson() { + final Map data = new Map(); + + data['Address'] = this.address; + data['AppointmentNo'] = this.appointmentNo; + data['Clinic'] = this.clinic; + data['CompanyName'] = this.companyName; + data['Days'] = this.days; + data['DoctorName'] = this.doctorName; + data['DoseDailyQuantity'] = this.doseDailyQuantity; + data['Frequency'] = this.frequency; + data['FrequencyNumber'] = this.frequencyNumber; + data['Image'] = this.image; + data['ImageExtension'] = this.imageExtension; + data['ImageSRCUrl'] = this.imageSRCUrl; + data['ImageString'] = this.imageString; + data['ImageThumbUrl'] = this.imageThumbUrl; + data['IsCovered'] = this.isCovered; + data['ItemDescription'] = this.itemDescription; + data['ItemID'] = this.itemID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PhoneOffice1'] = this.phoneOffice1; + data['PrescriptionQR'] = this.prescriptionQR; + data['PrescriptionTimes'] = this.prescriptionTimes; + data['ProductImage'] = this.productImage; + data['ProductImageBase64'] = this.productImageBase64; + data['ProductImageString'] = this.productImageString; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['Route'] = this.route; + data['SKU'] = this.sKU; + data['ScaleOffset'] = this.scaleOffset; + data['StartDate'] = this.startDate; + + data['PatientAge'] = this.patientAge; + data['PatientGender'] = this.patientGender; + data['PhoneOffice'] = this.phoneOffice; + data['DoseTimingID'] = this.doseTimingID; + data['FrequencyID'] = this.frequencyID; + data['RouteID'] = this.routeID; + data['Name'] = this.name; + data['ItemDescriptionN'] = this.itemDescriptionN; + data['RouteN'] = this.routeN; + data['FrequencyN'] = this.frequencyN; + data['hasPlan'] = false; + + return data; + } +} diff --git a/lib/core/model/Prescriptions/prescription_report_enh.dart b/lib/core/model/Prescriptions/prescription_report_enh.dart new file mode 100644 index 00000000..203eaaff --- /dev/null +++ b/lib/core/model/Prescriptions/prescription_report_enh.dart @@ -0,0 +1,144 @@ +class PrescriptionReportEnh { + String address; + int appointmentNo; + String clinic; + Null companyName; + int days; + String doctorName; + int doseDailyQuantity; + String frequency; + int frequencyNumber; + Null image; + Null imageExtension; + String imageSRCUrl; + Null imageString; + String imageThumbUrl; + String isCovered; + String itemDescription; + int itemID; + String orderDate; + int patientID; + String patientName; + String phoneOffice1; + Null prescriptionQR; + int prescriptionTimes; + Null productImage; + Null productImageBase64; + String productImageString; + int projectID; + String projectName; + String remarks; + String route; + String sKU; + int scaleOffset; + String startDate; + + PrescriptionReportEnh( + {this.address, + this.appointmentNo, + this.clinic, + this.companyName, + this.days, + this.doctorName, + this.doseDailyQuantity, + this.frequency, + this.frequencyNumber, + this.image, + this.imageExtension, + this.imageSRCUrl, + this.imageString, + this.imageThumbUrl, + this.isCovered, + this.itemDescription, + this.itemID, + this.orderDate, + this.patientID, + this.patientName, + this.phoneOffice1, + this.prescriptionQR, + this.prescriptionTimes, + this.productImage, + this.productImageBase64, + this.productImageString, + this.projectID, + this.projectName, + this.remarks, + this.route, + this.sKU, + this.scaleOffset, + this.startDate}); + + PrescriptionReportEnh.fromJson(Map json) { + address = json['Address']; + appointmentNo = json['AppointmentNo']; + clinic = json['Clinic']; + companyName = json['CompanyName']; + days = json['Days']; + doctorName = json['DoctorName']; + doseDailyQuantity = json['DoseDailyQuantity']; + frequency = json['Frequency']; + frequencyNumber = json['FrequencyNumber']; + image = json['Image']; + imageExtension = json['ImageExtension']; + imageSRCUrl = json['ImageSRCUrl']; + imageString = json['ImageString']; + imageThumbUrl = json['ImageThumbUrl']; + isCovered = json['IsCovered']; + itemDescription = json['ItemDescription']; + itemID = json['ItemID']; + orderDate = json['OrderDate']; + patientID = json['PatientID']; + patientName = json['PatientName']; + phoneOffice1 = json['PhoneOffice1']; + prescriptionQR = json['PrescriptionQR']; + prescriptionTimes = json['PrescriptionTimes']; + productImage = json['ProductImage']; + productImageBase64 = json['ProductImageBase64']; + productImageString = json['ProductImageString']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + route = json['Route']; + sKU = json['SKU']; + scaleOffset = json['ScaleOffset']; + startDate = json['StartDate']; + } + + Map toJson() { + final Map data = new Map(); + data['Address'] = this.address; + data['AppointmentNo'] = this.appointmentNo; + data['Clinic'] = this.clinic; + data['CompanyName'] = this.companyName; + data['Days'] = this.days; + data['DoctorName'] = this.doctorName; + data['DoseDailyQuantity'] = this.doseDailyQuantity; + data['Frequency'] = this.frequency; + data['FrequencyNumber'] = this.frequencyNumber; + data['Image'] = this.image; + data['ImageExtension'] = this.imageExtension; + data['ImageSRCUrl'] = this.imageSRCUrl; + data['ImageString'] = this.imageString; + data['ImageThumbUrl'] = this.imageThumbUrl; + data['IsCovered'] = this.isCovered; + data['ItemDescription'] = this.itemDescription; + data['ItemID'] = this.itemID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PhoneOffice1'] = this.phoneOffice1; + data['PrescriptionQR'] = this.prescriptionQR; + data['PrescriptionTimes'] = this.prescriptionTimes; + data['ProductImage'] = this.productImage; + data['ProductImageBase64'] = this.productImageBase64; + data['ProductImageString'] = this.productImageString; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['Route'] = this.route; + data['SKU'] = this.sKU; + data['ScaleOffset'] = this.scaleOffset; + data['StartDate'] = this.startDate; + return data; + } +} diff --git a/lib/core/model/Prescriptions/prescriptions_order.dart b/lib/core/model/Prescriptions/prescriptions_order.dart new file mode 100644 index 00000000..4f77f7ec --- /dev/null +++ b/lib/core/model/Prescriptions/prescriptions_order.dart @@ -0,0 +1,134 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class PrescriptionsOrder { + int iD; + dynamic patientID; + bool patientOutSA; + bool isOutPatient; + int projectID; + int nearestProjectID; + double longitude; + double latitude; + dynamic appointmentNo; + dynamic dischargeID; + int lineItemNo; + int status; + dynamic description; + dynamic descriptionN; + DateTime createdOn; + int serviceID; + int createdBy; + DateTime editedOn; + int editedBy; + int channel; + dynamic clientRequestID; + bool returnedToQueue; + dynamic pickupDateTime; + dynamic pickupLocationName; + dynamic dropoffLocationName; + int realRRTHaveTransactions; + dynamic nearestProjectDescription; + dynamic nearestProjectDescriptionN; + dynamic projectDescription; + dynamic projectDescriptionN; + + PrescriptionsOrder( + {this.iD, + this.patientID, + this.patientOutSA, + this.isOutPatient, + this.projectID, + this.nearestProjectID, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeID, + this.lineItemNo, + this.status, + this.description, + this.descriptionN, + this.createdOn, + this.serviceID, + this.createdBy, + this.editedOn, + this.editedBy, + this.channel, + this.clientRequestID, + this.returnedToQueue, + this.pickupDateTime, + this.pickupLocationName, + this.dropoffLocationName, + this.realRRTHaveTransactions, + this.nearestProjectDescription, + this.nearestProjectDescriptionN, + this.projectDescription, + this.projectDescriptionN}); + + PrescriptionsOrder.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + isOutPatient = json['IsOutPatient']; + projectID = json['ProjectID']; + nearestProjectID = json['NearestProjectID']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeID = json['DischargeID']; + lineItemNo = json['LineItemNo']; + status = json['Status']; + description = json['Description']; + descriptionN = json['DescriptionN']; + createdOn = DateUtils.convertStringToDate(json['CreatedOn']); + serviceID = json['ServiceID']; + createdBy = json['CreatedBy']; + editedOn = DateUtils.convertStringToDate(json['EditedOn']); + editedBy = json['EditedBy']; + channel = json['Channel']; + clientRequestID = json['ClientRequestID']; + returnedToQueue = json['ReturnedToQueue']; + pickupDateTime = json['PickupDateTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + realRRTHaveTransactions = json['RealRRT_HaveTransactions']; + nearestProjectDescription = json['NearestProjectDescription']; + nearestProjectDescriptionN = json['NearestProjectDescriptionN']; + projectDescription = json['ProjectDescription']; + projectDescriptionN = json['ProjectDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectID'] = this.projectID; + data['NearestProjectID'] = this.nearestProjectID; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeID'] = this.dischargeID; + data['LineItemNo'] = this.lineItemNo; + data['Status'] = this.status; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['CreatedOn'] = this.createdOn; + data['ServiceID'] = this.serviceID; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['Channel'] = this.channel; + data['ClientRequestID'] = this.clientRequestID; + data['ReturnedToQueue'] = this.returnedToQueue; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['RealRRT_HaveTransactions'] = this.realRRTHaveTransactions; + data['NearestProjectDescription'] = this.nearestProjectDescription; + data['NearestProjectDescriptionN'] = this.nearestProjectDescriptionN; + data['ProjectDescription'] = this.projectDescription; + data['ProjectDescriptionN'] = this.projectDescriptionN; + return data; + } +} diff --git a/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart b/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart new file mode 100644 index 00000000..739bb838 --- /dev/null +++ b/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart @@ -0,0 +1,60 @@ +class RequestGetListPharmacyForPrescriptions { + int latitude; + int longitude; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int itemID; + + RequestGetListPharmacyForPrescriptions( + {this.latitude, + this.longitude, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.itemID}); + + RequestGetListPharmacyForPrescriptions.fromJson(Map json) { + latitude = json['Latitude']; + longitude = json['Longitude']; + 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']; + itemID = json['ItemID']; + } + + Map toJson() { + final Map data = new Map(); + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + 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['ItemID'] = this.itemID; + return data; + } +} diff --git a/lib/core/model/Prescriptions/request_prescription_report.dart b/lib/core/model/Prescriptions/request_prescription_report.dart new file mode 100644 index 00000000..c8323740 --- /dev/null +++ b/lib/core/model/Prescriptions/request_prescription_report.dart @@ -0,0 +1,88 @@ +class RequestPrescriptionReport { + 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; + int appointmentNo; + String setupID; + int episodeID; + int clinicID; + int projectID; + int dischargeNo; + + RequestPrescriptionReport( + {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, + this.appointmentNo, + this.setupID, + this.episodeID, + this.clinicID, + this.projectID, + this.dischargeNo}); + + RequestPrescriptionReport.fromJson(Map json) { + 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']; + appointmentNo = json['AppointmentNo']; + setupID = json['SetupID']; + episodeID = json['EpisodeID']; + clinicID = json['ClinicID']; + projectID = json['ProjectID']; + dischargeNo = json['DischargeNo']; + } + + Map toJson() { + final Map data = new Map(); + 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; + data['AppointmentNo'] = this.appointmentNo; + data['SetupID'] = this.setupID; + data['EpisodeID'] = this.episodeID; + data['ClinicID'] = this.clinicID; + data['ProjectID'] = this.projectID; + data['DischargeNo'] = this.dischargeNo; + return data; + } +} diff --git a/lib/core/model/Prescriptions/request_prescription_report_enh.dart b/lib/core/model/Prescriptions/request_prescription_report_enh.dart new file mode 100644 index 00000000..4905fc2a --- /dev/null +++ b/lib/core/model/Prescriptions/request_prescription_report_enh.dart @@ -0,0 +1,86 @@ +class RequestPrescriptionReportEnh { + 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; + int appointmentNo; + String setupID; + int dischargeNo; + int episodeID; + int clinicID; + int projectID; + + RequestPrescriptionReportEnh( + {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, + this.appointmentNo, + this.setupID, + this.episodeID, + this.clinicID, + this.projectID,this.dischargeNo}); + + RequestPrescriptionReportEnh.fromJson(Map json) { + 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']; + appointmentNo = json['AppointmentNo']; + setupID = json['SetupID']; + episodeID = json['EpisodeID']; + clinicID = json['ClinicID']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + 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; + data['AppointmentNo'] = this.appointmentNo; + data['SetupID'] = this.setupID; + data['EpisodeID'] = this.episodeID; + data['ClinicID'] = this.clinicID; + data['ProjectID'] = this.projectID; + data['DischargeNo'] = this.dischargeNo; + return data; + } +} diff --git a/lib/core/model/admissionRequest/admission-request.dart b/lib/core/model/admissionRequest/admission-request.dart new file mode 100644 index 00000000..1ab5a990 --- /dev/null +++ b/lib/core/model/admissionRequest/admission-request.dart @@ -0,0 +1,200 @@ +class AdmissionRequest { + int patientMRN; + int admitToClinic; + bool isPregnant; + int pregnancyWeeks; + int pregnancyType; + int noOfBabies; + int mrpDoctorID; + String admissionDate; + int expectedDays; + int admissionType; + int admissionLocationID; + int roomCategoryID; + int wardID; + bool isSickLeaveRequired; + String sickLeaveComments; + bool isTransport; + String transportComments; + bool isPhysioAppointmentNeeded; + String physioAppointmentComments; + bool isOPDFollowupAppointmentNeeded; + String opdFollowUpComments; + bool isDietType; + int dietType; + String dietRemarks; + bool isPhysicalActivityModification; + String physicalActivityModificationComments; + int orStatus; + String mainLineOfTreatment; + int estimatedCost; + String elementsForImprovement; + bool isPackagePatient; + String complications; + String otherDepartmentInterventions; + String otherProcedures; + String pastMedicalHistory; + String pastSurgicalHistory; + List admissionRequestDiagnoses; + List admissionRequestProcedures; + int appointmentNo; + int episodeID; + int admissionRequestNo; + + AdmissionRequest( + {this.patientMRN, + this.admitToClinic, + this.isPregnant, + this.pregnancyWeeks = 0, + this.pregnancyType = 0, + this.noOfBabies = 0, + this.mrpDoctorID, + this.admissionDate, + this.expectedDays, + this.admissionType, + this.admissionLocationID = 0, + this.roomCategoryID = 0, + this.wardID, + this.isSickLeaveRequired, + this.sickLeaveComments = "", + this.isTransport = false, + this.transportComments = "", + this.isPhysioAppointmentNeeded = false, + this.physioAppointmentComments = "", + this.isOPDFollowupAppointmentNeeded = false, + this.opdFollowUpComments = "", + this.isDietType, + this.dietType, + this.dietRemarks, + this.isPhysicalActivityModification = false, + this.physicalActivityModificationComments = "", + this.orStatus = 1, + this.mainLineOfTreatment, + this.estimatedCost, + this.elementsForImprovement, + this.isPackagePatient = false, + this.complications = "", + this.otherDepartmentInterventions = "", + this.otherProcedures = "", + this.pastMedicalHistory = "", + this.pastSurgicalHistory = "", + this.admissionRequestDiagnoses, + this.admissionRequestProcedures, + this.appointmentNo, + this.episodeID, + this.admissionRequestNo}); + + AdmissionRequest.fromJson(Map json) { + patientMRN = json['patientMRN']; + admitToClinic = json['admitToClinic']; + isPregnant = json['isPregnant']; + pregnancyWeeks = json['pregnancyWeeks']; + pregnancyType = json['pregnancyType']; + noOfBabies = json['noOfBabies']; + mrpDoctorID = json['mrpDoctorID']; + admissionDate = json['admissionDate']; + expectedDays = json['expectedDays']; + admissionType = json['admissionType']; + admissionLocationID = json['admissionLocationID']; + roomCategoryID = json['roomCategoryID']; + wardID = json['wardID']; + isSickLeaveRequired = json['isSickLeaveRequired']; + sickLeaveComments = json['sickLeaveComments']; + isTransport = json['isTransport']; + transportComments = json['transportComments']; + isPhysioAppointmentNeeded = json['isPhysioAppointmentNeeded']; + physioAppointmentComments = json['physioAppointmentComments']; + isOPDFollowupAppointmentNeeded = json['isOPDFollowupAppointmentNeeded']; + opdFollowUpComments = json['opdFollowUpComments']; + isDietType = json['isDietType']; + dietType = json['dietType']; + dietRemarks = json['dietRemarks']; + isPhysicalActivityModification = json['isPhysicalActivityModification']; + physicalActivityModificationComments = + json['physicalActivityModificationComments']; + orStatus = json['orStatus']; + mainLineOfTreatment = json['mainLineOfTreatment']; + estimatedCost = json['estimatedCost']; + elementsForImprovement = json['elementsForImprovement']; + isPackagePatient = json['isPackagePatient']; + complications = json['complications']; + otherDepartmentInterventions = json['otherDepartmentInterventions']; + otherProcedures = json['otherProcedures']; + pastMedicalHistory = json['pastMedicalHistory']; + pastSurgicalHistory = json['pastSurgicalHistory']; + if (json['admissionRequestDiagnoses'] != null) { + admissionRequestDiagnoses = new List(); + json['admissionRequestDiagnoses'].forEach((v) { + admissionRequestDiagnoses.add(v); + // admissionRequestDiagnoses + // .add(new AdmissionRequestDiagnoses.fromJson(v)); + }); + } + if (json['admissionRequestProcedures'] != null) { + admissionRequestProcedures = new List(); + json['admissionRequestProcedures'].forEach((v) { + admissionRequestProcedures.add(v); + // admissionRequestProcedures + // .add(new AdmissionRequestProcedures.fromJson(v)); + }); + } + appointmentNo = json['appointmentNo']; + episodeID = json['episodeID']; + admissionRequestNo = json['admissionRequestNo']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['admitToClinic'] = this.admitToClinic; + data['isPregnant'] = this.isPregnant; + data['pregnancyWeeks'] = this.pregnancyWeeks; + data['pregnancyType'] = this.pregnancyType; + data['noOfBabies'] = this.noOfBabies; + data['mrpDoctorID'] = this.mrpDoctorID; + data['admissionDate'] = this.admissionDate; + data['expectedDays'] = this.expectedDays; + data['admissionType'] = this.admissionType; + data['admissionLocationID'] = this.admissionLocationID; + data['roomCategoryID'] = this.roomCategoryID; + data['wardID'] = this.wardID; + data['isSickLeaveRequired'] = this.isSickLeaveRequired; + data['sickLeaveComments'] = this.sickLeaveComments; + data['isTransport'] = this.isTransport; + data['transportComments'] = this.transportComments; + data['isPhysioAppointmentNeeded'] = this.isPhysioAppointmentNeeded; + data['physioAppointmentComments'] = this.physioAppointmentComments; + data['isOPDFollowupAppointmentNeeded'] = + this.isOPDFollowupAppointmentNeeded; + data['opdFollowUpComments'] = this.opdFollowUpComments; + data['isDietType'] = this.isDietType; + data['dietType'] = this.dietType; + data['dietRemarks'] = this.dietRemarks; + data['isPhysicalActivityModification'] = + this.isPhysicalActivityModification; + data['physicalActivityModificationComments'] = + this.physicalActivityModificationComments; + data['orStatus'] = this.orStatus; + data['mainLineOfTreatment'] = this.mainLineOfTreatment; + data['estimatedCost'] = this.estimatedCost; + data['elementsForImprovement'] = this.elementsForImprovement; + data['isPackagePatient'] = this.isPackagePatient; + data['complications'] = this.complications; + data['otherDepartmentInterventions'] = this.otherDepartmentInterventions; + data['otherProcedures'] = this.otherProcedures; + data['pastMedicalHistory'] = this.pastMedicalHistory; + data['pastSurgicalHistory'] = this.pastSurgicalHistory; + if (this.admissionRequestDiagnoses != null) { + data['admissionRequestDiagnoses'] = this.admissionRequestDiagnoses; + // this.admissionRequestDiagnoses.map((v) => v.toJson()).toList(); + } + if (this.admissionRequestProcedures != null) { + data['admissionRequestProcedures'] = + this.admissionRequestProcedures.map((v) => v.toJson()).toList(); + } + data['appointmentNo'] = this.appointmentNo; + data['episodeID'] = this.episodeID; + data['admissionRequestNo'] = this.admissionRequestNo; + return data; + } +} diff --git a/lib/core/model/admissionRequest/clinic-model.dart b/lib/core/model/admissionRequest/clinic-model.dart new file mode 100644 index 00000000..05d34645 --- /dev/null +++ b/lib/core/model/admissionRequest/clinic-model.dart @@ -0,0 +1,33 @@ +class Clinic { + int clinicGroupID; + String clinicGroupName; + int clinicID; + String clinicNameArabic; + String clinicNameEnglish; + + Clinic( + {this.clinicGroupID, + this.clinicGroupName, + this.clinicID, + this.clinicNameArabic, + this.clinicNameEnglish}); + + Clinic.fromJson(Map json) { + clinicGroupID = json['clinicGroupID']; + clinicGroupName = json['clinicGroupName']; + clinicID = json['clinicID']; + clinicNameArabic = json['clinicNameArabic']; + clinicNameEnglish = json['clinicNameEnglish']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicGroupID'] = this.clinicGroupID; + data['clinicGroupName'] = this.clinicGroupName; + data['clinicID'] = this.clinicID; + data['clinicNameArabic'] = this.clinicNameArabic; + data['clinicNameEnglish'] = this.clinicNameEnglish; + return data; + } + +} \ No newline at end of file diff --git a/lib/core/model/admissionRequest/ward-model.dart b/lib/core/model/admissionRequest/ward-model.dart new file mode 100644 index 00000000..606758d3 --- /dev/null +++ b/lib/core/model/admissionRequest/ward-model.dart @@ -0,0 +1,26 @@ +class WardModel{ + + String description; + String descriptionN; + int floorID; + bool isActive; + + WardModel( + {this.description, this.descriptionN, this.floorID, this.isActive}); + + WardModel.fromJson(Map json) { + description = json['description']; + descriptionN = json['descriptionN']; + floorID = json['floorID']; + isActive = json['isActive']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['descriptionN'] = this.descriptionN; + data['floorID'] = this.floorID; + data['isActive'] = this.isActive; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/calculate_box_request_model.dart b/lib/core/model/calculate_box_request_model.dart new file mode 100644 index 00000000..80281854 --- /dev/null +++ b/lib/core/model/calculate_box_request_model.dart @@ -0,0 +1,32 @@ +class CalculateBoxQuantityRequestModel { + int itemCode; + double strength; + int frequency; + int duration; + String vidaAuthTokenID; + + CalculateBoxQuantityRequestModel( + {this.itemCode, + this.strength, + this.frequency, + this.duration, + this.vidaAuthTokenID}); + + CalculateBoxQuantityRequestModel.fromJson(Map json) { + itemCode = json['ItemCode']; + strength = json['Strength']; + frequency = json['Frequency']; + duration = json['Duration']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemCode'] = this.itemCode; + data['Strength'] = this.strength; + data['Frequency'] = this.frequency; + data['Duration'] = this.duration; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/model/get_medication_response_model.dart b/lib/core/model/get_medication_response_model.dart new file mode 100644 index 00000000..a42a8b47 --- /dev/null +++ b/lib/core/model/get_medication_response_model.dart @@ -0,0 +1,47 @@ +class GetMedicationResponseModel { + String description; + String genericName; + int itemId; + String keywords; + dynamic price; + dynamic quantity; + dynamic mediSpanGPICode; + bool isNarcotic; + String uom; + GetMedicationResponseModel( + {this.description, + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity, + this.isNarcotic, + this.uom, + this.mediSpanGPICode}); + + GetMedicationResponseModel.fromJson(Map json) { + description = json['Description']; + genericName = json['GenericName']; + itemId = json['ItemId']; + keywords = json['Keywords']; + price = json['Price']; + quantity = json['Quantity']; + mediSpanGPICode = json['mediSpanGPICode']; + isNarcotic = json['isNarcotic']; + uom = json['uom']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['GenericName'] = this.genericName; + data['ItemId'] = this.itemId; + data['Keywords'] = this.keywords; + data['Price'] = this.price; + data['Quantity'] = this.quantity; + data['mediSpanGPICode'] = this.mediSpanGPICode; + data['isNarcotic'] = this.isNarcotic; + data['uom'] = this.uom; + return data; + } +} diff --git a/lib/core/model/imei_details.dart b/lib/core/model/imei_details.dart new file mode 100644 index 00000000..eb37e736 --- /dev/null +++ b/lib/core/model/imei_details.dart @@ -0,0 +1,127 @@ +class GetIMEIDetailsModel { + int iD; + String iMEI; + int logInTypeID; + bool outSA; + String mobile; + dynamic identificationNo; + int doctorID; + String doctorName; + String doctorNameN; + int clinicID; + String clinicDescription; + dynamic clinicDescriptionN; + int projectID; + String projectName; + String genderDescription; + dynamic genderDescriptionN; + String titleDescription; + dynamic titleDescriptionN; + dynamic zipCode; + String createdOn; + dynamic createdBy; + String editedOn; + dynamic editedBy; + bool biometricEnabled; + dynamic preferredLanguage; + bool isActive; + String vidaAuthTokenID; + String vidaRefreshTokenID; + String password; + GetIMEIDetailsModel( + {this.iD, + this.iMEI, + this.logInTypeID, + this.outSA, + this.mobile, + this.identificationNo, + this.doctorID, + this.doctorName, + this.doctorNameN, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.projectID, + this.projectName, + this.genderDescription, + this.genderDescriptionN, + this.titleDescription, + this.titleDescriptionN, + this.zipCode, + this.createdOn, + this.createdBy, + this.editedOn, + this.editedBy, + this.biometricEnabled, + this.preferredLanguage, + this.isActive, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.password}); + + GetIMEIDetailsModel.fromJson(Map json) { + iD = json['ID']; + iMEI = json['IMEI']; + logInTypeID = json['LogInTypeID']; + outSA = json['OutSA']; + mobile = json['Mobile']; + identificationNo = json['IdentificationNo']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + genderDescription = json['Gender_Description']; + genderDescriptionN = json['Gender_DescriptionN']; + titleDescription = json['Title_Description']; + titleDescriptionN = json['Title_DescriptionN']; + zipCode = json['ZipCode']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + biometricEnabled = json['BiometricEnabled']; + preferredLanguage = json['PreferredLanguage']; + isActive = json['IsActive']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + password = json['Password']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['IMEI'] = this.iMEI; + data['LogInTypeID'] = this.logInTypeID; + data['OutSA'] = this.outSA; + data['Mobile'] = this.mobile; + data['IdentificationNo'] = this.identificationNo; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Gender_Description'] = this.genderDescription; + data['Gender_DescriptionN'] = this.genderDescriptionN; + data['Title_Description'] = this.titleDescription; + data['Title_DescriptionN'] = this.titleDescriptionN; + data['ZipCode'] = this.zipCode; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['BiometricEnabled'] = this.biometricEnabled; + data['PreferredLanguage'] = this.preferredLanguage; + data['IsActive'] = this.isActive; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['Password'] = this.password; + return data; + } +} diff --git a/lib/core/model/insert_imei_model.dart b/lib/core/model/insert_imei_model.dart new file mode 100644 index 00000000..25e22b7a --- /dev/null +++ b/lib/core/model/insert_imei_model.dart @@ -0,0 +1,143 @@ +class InsertIMEIDetailsModel { + String iMEI; + int logInTypeID; + dynamic outSA; + String mobile; + dynamic identificationNo; + int doctorID; + String doctorName; + String doctorNameN; + int clinicID; + String clinicDescription; + Null clinicDescriptionN; + String projectName; + String genderDescription; + Null genderDescriptionN; + String titleDescription; + Null titleDescriptionN; + bool bioMetricEnabled; + Null preferredLanguage; + bool isActive; + int editedBy; + int projectID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + int patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + dynamic password; + InsertIMEIDetailsModel( + {this.iMEI, + this.logInTypeID, + this.outSA, + this.mobile, + this.identificationNo, + this.doctorID, + this.doctorName, + this.doctorNameN, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.projectName, + this.genderDescription, + this.genderDescriptionN, + this.titleDescription, + this.titleDescriptionN, + this.bioMetricEnabled, + this.preferredLanguage, + this.isActive, + this.editedBy, + this.projectID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.password}); + + InsertIMEIDetailsModel.fromJson(Map json) { + iMEI = json['IMEI']; + logInTypeID = json['LogInTypeID']; + outSA = json['OutSA']; + mobile = json['MobileNo']; + identificationNo = json['IdentificationNo']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + projectName = json['ProjectName']; + genderDescription = json['GenderDescription']; + genderDescriptionN = json['GenderDescriptionN']; + titleDescription = json['TitleDescription']; + titleDescriptionN = json['Title_DescriptionN']; + bioMetricEnabled = json['BioMetricEnabled']; + preferredLanguage = json['PreferredLanguage']; + isActive = json['IsActive']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + password = json['Password']; + } + + Map toJson() { + final Map data = new Map(); + data['IMEI'] = this.iMEI; + data['LogInTypeID'] = this.logInTypeID; + data['OutSA'] = this.outSA; + data['MobileNo'] = this.mobile; + data['IdentificationNo'] = this.identificationNo; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ProjectName'] = this.projectName; + data['GenderDescription'] = this.genderDescription; + data['GenderDescriptionN'] = this.genderDescriptionN; + data['TitleDescription'] = this.titleDescription; + data['Title_DescriptionN'] = this.titleDescriptionN; + data['BioMetricEnabled'] = this.bioMetricEnabled; + data['PreferredLanguage'] = this.preferredLanguage; + data['IsActive'] = this.isActive; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['Password'] = this.password; + return data; + } +} diff --git a/lib/core/model/insurance_approval.dart b/lib/core/model/insurance_approval.dart new file mode 100644 index 00000000..894fad46 --- /dev/null +++ b/lib/core/model/insurance_approval.dart @@ -0,0 +1,140 @@ +class InsuranceApprovalDetails { + String procedureName; + String status; + String isInvoicedDesc; + + InsuranceApprovalDetails({ + this.procedureName, + this.status, + this.isInvoicedDesc, + }); + + InsuranceApprovalDetails.fromJson(Map json) { + try { + isInvoicedDesc = json['IsInvoicedDesc']; + status = json['Status']; + procedureName = json['ProcedureName']; + } catch (e) { + print(e); + } + } +} + +class InsuranceApprovalModel { + InsuranceApprovalDetails approvalDetails; + 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; + int eXuldAPPNO; + int projectID; + String doctorName; + String clinicName; + String patientDescription; + int approvalNo; + String approvalStatusDescption; + int unUsedCount; + + //String companyName; + String expiryDate; + String rceiptOn; + int appointmentNo; + + InsuranceApprovalModel( + {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, + this.eXuldAPPNO, + this.projectID, + this.doctorName, + this.clinicName, + this.patientDescription, + this.approvalNo, + this.approvalStatusDescption, + this.unUsedCount, + //this.companyName, + this.expiryDate, + this.rceiptOn, + this.approvalDetails, + this.appointmentNo}); + + InsuranceApprovalDetails x = InsuranceApprovalDetails(); + + InsuranceApprovalModel.fromJson(Map json) { + try { + rceiptOn = json['ReceiptOn']; + expiryDate = json['ExpiryDate']; + //companyName = json['CompanyName']; + unUsedCount = json['TotaUnUsedCount']; + approvalStatusDescption = json['ApprovalStatusDescption']; + approvalNo = json['ApprovalNo']; + patientDescription = json['IsInOutPatientDescription']; + 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']; + eXuldAPPNO = json['EXuldAPPNO']; + projectID = json['ProjectID']; + doctorName = json['DoctorName']; + clinicName = json['ClinicName']; + approvalDetails = + InsuranceApprovalDetails.fromJson(json['ApporvalDetails'][0]); + appointmentNo = json['AppointmentNo']; + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + 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; + if (appointmentNo == null) { + data['EXuldAPPNO'] = this.eXuldAPPNO; + data['ProjectID'] = this.projectID; + } + if (appointmentNo != null) { + data['AppointmentNo'] = this.appointmentNo; + } + return data; + } +} diff --git a/lib/core/model/item_by_medicine_model.dart b/lib/core/model/item_by_medicine_model.dart new file mode 100644 index 00000000..0a93a4f1 --- /dev/null +++ b/lib/core/model/item_by_medicine_model.dart @@ -0,0 +1,108 @@ +class ItemByMedicineModel { + List frequencies; + List routes; + List strengths; + + ItemByMedicineModel({this.frequencies, this.routes, this.strengths}); + + ItemByMedicineModel.fromJson(Map json) { + if (json['frequencies'] != null) { + frequencies = new List(); + json['frequencies'].forEach((v) { + frequencies.add(new Frequencies.fromJson(v)); + }); + } + if (json['routes'] != null) { + routes = new List(); + json['routes'].forEach((v) { + routes.add(new Routes.fromJson(v)); + }); + } + if (json['strengths'] != null) { + strengths = new List(); + json['strengths'].forEach((v) { + strengths.add(new Strengths.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.frequencies != null) { + data['frequencies'] = this.frequencies.map((v) => v.toJson()).toList(); + } + if (this.routes != null) { + data['routes'] = this.routes.map((v) => v.toJson()).toList(); + } + if (this.strengths != null) { + data['strengths'] = this.strengths.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Frequencies { + String description; + bool isDefault; + int parameterCode; + + Frequencies({this.description, this.isDefault, this.parameterCode}); + + Frequencies.fromJson(Map json) { + description = json['description']; + isDefault = json['isDefault']; + parameterCode = json['parameterCode']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['isDefault'] = this.isDefault; + data['parameterCode'] = this.parameterCode; + return data; + } +} + +class Strengths { + String description; + bool isDefault; + int parameterCode; + + Strengths({this.description, this.isDefault, this.parameterCode}); + + Strengths.fromJson(Map json) { + description = json['description']; + isDefault = json['isDefault']; + parameterCode = json['parameterCode']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['isDefault'] = this.isDefault; + data['parameterCode'] = this.parameterCode; + return data; + } +} + +class Routes { + String description; + bool isDefault; + int parameterCode; + + Routes({this.description, this.isDefault, this.parameterCode}); + + Routes.fromJson(Map json) { + description = json['description']; + isDefault = json['isDefault']; + parameterCode = json['parameterCode']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['isDefault'] = this.isDefault; + data['parameterCode'] = this.parameterCode; + return data; + } +} diff --git a/lib/core/model/item_by_medicine_request_model.dart b/lib/core/model/item_by_medicine_request_model.dart new file mode 100644 index 00000000..7460044b --- /dev/null +++ b/lib/core/model/item_by_medicine_request_model.dart @@ -0,0 +1,18 @@ +class ItemByMedicineRequestModel { + String vidaAuthTokenID; + int medicineCode; + + ItemByMedicineRequestModel({this.vidaAuthTokenID, this.medicineCode}); + + ItemByMedicineRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + medicineCode = json['MedicineCode']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['MedicineCode'] = this.medicineCode; + return data; + } +} diff --git a/lib/core/model/labs/LabOrderResult.dart b/lib/core/model/labs/LabOrderResult.dart new file mode 100644 index 00000000..ecb4ae65 --- /dev/null +++ b/lib/core/model/labs/LabOrderResult.dart @@ -0,0 +1,88 @@ +class LabOrderResult { + String description; + dynamic femaleInterpretativeData; + int gender; + int lineItemNo; + dynamic maleInterpretativeData; + dynamic notes; + String packageID; + int patientID; + String projectID; + String referanceRange; + String resultValue; + String sampleCollectedOn; + String sampleReceivedOn; + String setupID; + dynamic superVerifiedOn; + String testCode; + String uOM; + String verifiedOn; + String verifiedOnDateTime; + + LabOrderResult( + {this.description, + this.femaleInterpretativeData, + this.gender, + this.lineItemNo, + this.maleInterpretativeData, + this.notes, + this.packageID, + this.patientID, + this.projectID, + this.referanceRange, + this.resultValue, + this.sampleCollectedOn, + this.sampleReceivedOn, + this.setupID, + this.superVerifiedOn, + this.testCode, + this.uOM, + this.verifiedOn, + this.verifiedOnDateTime}); + + LabOrderResult.fromJson(Map json) { + description = json['Description']; + femaleInterpretativeData = json['FemaleInterpretativeData']; + gender = json['Gender']; + lineItemNo = json['LineItemNo']; + maleInterpretativeData = json['MaleInterpretativeData']; + notes = json['Notes']; + packageID = json['PackageID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + referanceRange = json['ReferanceRange']; + resultValue = json['ResultValue']; + sampleCollectedOn = json['SampleCollectedOn']; + sampleReceivedOn = json['SampleReceivedOn']; + setupID = json['SetupID']; + superVerifiedOn = json['SuperVerifiedOn']; + testCode = json['TestCode']; + uOM = json['UOM']; + verifiedOn = json['VerifiedOn']; + verifiedOnDateTime = json['VerifiedOnDateTime']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['FemaleInterpretativeData'] = this.femaleInterpretativeData; + data['Gender'] = this.gender; + data['LineItemNo'] = this.lineItemNo; + data['MaleInterpretativeData'] = this.maleInterpretativeData; + data['Notes'] = this.notes; + data['PackageID'] = this.packageID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ReferanceRange'] = this.referanceRange; + data['ResultValue'] = this.resultValue; + data['SampleCollectedOn'] = this.sampleCollectedOn; + data['SampleReceivedOn'] = this.sampleReceivedOn; + data['SetupID'] = this.setupID; + data['SuperVerifiedOn'] = this.superVerifiedOn; + data['TestCode'] = this.testCode; + data['UOM'] = this.uOM; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedOnDateTime'] = this.verifiedOnDateTime; + return data; + } +} diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart new file mode 100644 index 00000000..2deb13f3 --- /dev/null +++ b/lib/core/model/labs/lab_result.dart @@ -0,0 +1,98 @@ +class LabResult { + String description; + dynamic femaleInterpretativeData; + int gender; + int lineItemNo; + dynamic maleInterpretativeData; + String notes; + String packageID; + int patientID; + String projectID; + String referanceRange; + String resultValue; + String sampleCollectedOn; + String sampleReceivedOn; + String setupID; + dynamic superVerifiedOn; + String testCode; + String uOM; + String verifiedOn; + dynamic verifiedOnDateTime; + + LabResult( + {this.description, + this.femaleInterpretativeData, + this.gender, + this.lineItemNo, + this.maleInterpretativeData, + this.notes, + this.packageID, + this.patientID, + this.projectID, + this.referanceRange, + this.resultValue, + this.sampleCollectedOn, + this.sampleReceivedOn, + this.setupID, + this.superVerifiedOn, + this.testCode, + this.uOM, + this.verifiedOn, + this.verifiedOnDateTime}); + + LabResult.fromJson(Map json) { + description = json['Description']; + femaleInterpretativeData = json['FemaleInterpretativeData']; + gender = json['Gender']; + lineItemNo = json['LineItemNo']; + maleInterpretativeData = json['MaleInterpretativeData']; + notes = json['Notes']; + packageID = json['PackageID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + referanceRange = json['ReferanceRange']; + resultValue = json['ResultValue']; + sampleCollectedOn = json['SampleCollectedOn']; + sampleReceivedOn = json['SampleReceivedOn']; + setupID = json['SetupID']; + superVerifiedOn = json['SuperVerifiedOn']; + testCode = json['TestCode']; + uOM = json['UOM']; + verifiedOn = json['VerifiedOn']; + verifiedOnDateTime = json['VerifiedOnDateTime']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['FemaleInterpretativeData'] = this.femaleInterpretativeData; + data['Gender'] = this.gender; + data['LineItemNo'] = this.lineItemNo; + data['MaleInterpretativeData'] = this.maleInterpretativeData; + data['Notes'] = this.notes; + data['PackageID'] = this.packageID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ReferanceRange'] = this.referanceRange; + data['ResultValue'] = this.resultValue; + data['SampleCollectedOn'] = this.sampleCollectedOn; + data['SampleReceivedOn'] = this.sampleReceivedOn; + data['SetupID'] = this.setupID; + data['SuperVerifiedOn'] = this.superVerifiedOn; + data['TestCode'] = this.testCode; + data['UOM'] = this.uOM; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedOnDateTime'] = this.verifiedOnDateTime; + return data; + } +} + + +class LabResultList { + String filterName = ""; + List patientLabResultList = List(); + + LabResultList({this.filterName, LabResult lab}) { + patientLabResultList.add(lab); + } +} diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart new file mode 100644 index 00000000..07044b0e --- /dev/null +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -0,0 +1,158 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class PatientLabOrders { + int actualDoctorRate; + String clinicDescription; + String clinicDescriptionEnglish; + Null clinicDescriptionN; + int clinicID; + int doctorID; + String doctorImageURL; + String doctorName; + String doctorNameEnglish; + Null doctorNameN; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + String invoiceNo; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + bool isRead; + String nationalityFlagURL; + int noOfPatientsRate; + DateTime orderDate; + String orderNo; + String patientID; + String projectID; + String projectName; + Null projectNameN; + String qR; + String setupID; + List speciality; + bool isLiveCareAppointment; + PatientLabOrders( + {this.actualDoctorRate, + this.clinicDescription, + this.clinicDescriptionEnglish, + this.clinicDescriptionN, + this.clinicID, + this.doctorID, + this.doctorImageURL, + this.doctorName, + this.doctorNameEnglish, + this.doctorNameN, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.invoiceNo, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.isRead, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.orderDate, + this.orderNo, + this.patientID, + this.projectID, + this.projectName, + this.projectNameN, + this.qR, + this.setupID, + this.speciality,this.isLiveCareAppointment}); + + PatientLabOrders.fromJson(Map json) { + actualDoctorRate = json['ActualDoctorRate']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionEnglish = json['ClinicDescriptionEnglish']; + clinicDescriptionN = json['ClinicDescriptionN']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorNameEnglish = json['DoctorNameEnglish']; + doctorNameN = json['DoctorNameN']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + invoiceNo = json['InvoiceNo']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + isRead = json['IsRead']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + orderDate = DateUtils.convertStringToDate(json['OrderDate']); + orderNo = json['OrderNo']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + qR = json['QR']; + setupID = json['SetupID']; + isLiveCareAppointment = json['IsLiveCareAppointment']; + // speciality = json['Speciality'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['ActualDoctorRate'] = this.actualDoctorRate; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionEnglish'] = this.clinicDescriptionEnglish; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorNameEnglish'] = this.doctorNameEnglish; + data['DoctorNameN'] = this.doctorNameN; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['InvoiceNo'] = this.invoiceNo; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['IsRead'] = this.isRead; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['OrderDate'] = this.orderDate; + data['OrderNo'] = this.orderNo; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + data['QR'] = this.qR; + data['SetupID'] = this.setupID; + data['Speciality'] = this.speciality; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + return data; + } +} + +class PatientLabOrdersList { + String filterName = ""; + List patientLabOrdersList = List(); + + PatientLabOrdersList( + {this.filterName, PatientLabOrders patientDoctorAppointment}) { + patientLabOrdersList.add(patientDoctorAppointment); + } +} diff --git a/lib/core/model/labs/patient_lab_special_result.dart b/lib/core/model/labs/patient_lab_special_result.dart new file mode 100644 index 00000000..2fbcb832 --- /dev/null +++ b/lib/core/model/labs/patient_lab_special_result.dart @@ -0,0 +1,32 @@ +class PatientLabSpecialResult { + String invoiceNo; + String moduleID; + String resultData; + String resultDataHTML; + Null resultDataTxt; + + PatientLabSpecialResult( + {this.invoiceNo, + this.moduleID, + this.resultData, + this.resultDataHTML, + this.resultDataTxt}); + + PatientLabSpecialResult.fromJson(Map json) { + invoiceNo = json['InvoiceNo']; + moduleID = json['ModuleID']; + resultData = json['ResultData']; + resultDataHTML = json['ResultDataHTML']; + resultDataTxt = json['ResultDataTxt']; + } + + Map toJson() { + final Map data = new Map(); + data['InvoiceNo'] = this.invoiceNo; + data['ModuleID'] = this.moduleID; + data['ResultData'] = this.resultData; + data['ResultDataHTML'] = this.resultDataHTML; + data['ResultDataTxt'] = this.resultDataTxt; + return data; + } +} diff --git a/lib/core/model/labs/request_patient_lab_orders.dart b/lib/core/model/labs/request_patient_lab_orders.dart new file mode 100644 index 00000000..ce9263ef --- /dev/null +++ b/lib/core/model/labs/request_patient_lab_orders.dart @@ -0,0 +1,64 @@ +class RequestPatientLabOrders { + 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; + + RequestPatientLabOrders( + {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}); + + RequestPatientLabOrders.fromJson(Map json) { + 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['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/core/model/labs/request_patient_lab_special_result.dart b/lib/core/model/labs/request_patient_lab_special_result.dart new file mode 100644 index 00000000..bdeb3930 --- /dev/null +++ b/lib/core/model/labs/request_patient_lab_special_result.dart @@ -0,0 +1,84 @@ +class RequestPatientLabSpecialResult { + String invoiceNo; + String orderNo; + String setupID; + String projectID; + int clinicID; + 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; + + RequestPatientLabSpecialResult( + {this.invoiceNo, + this.orderNo, + this.setupID, + this.projectID, + this.clinicID, + 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}); + + RequestPatientLabSpecialResult.fromJson(Map json) { + invoiceNo = json['InvoiceNo']; + orderNo = json['OrderNo']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + 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['InvoiceNo'] = this.invoiceNo; + data['OrderNo'] = this.orderNo; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + 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/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart new file mode 100644 index 00000000..118da906 --- /dev/null +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -0,0 +1,112 @@ +class RequestSendLabReportEmail { + 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; + String to; + String dateofBirth; + String patientIditificationNum; + String patientMobileNumber; + String patientName; + String setupID; + String projectName; + String clinicName; + String doctorName; + String projectID; + String invoiceNo; + String orderDate; + + RequestSendLabReportEmail( + {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, + this.to, + this.dateofBirth, + this.patientIditificationNum, + this.patientMobileNumber, + this.patientName, + this.setupID, + this.projectName, + this.clinicName, + this.doctorName, + this.projectID, + this.invoiceNo, + this.orderDate}); + + RequestSendLabReportEmail.fromJson(Map json) { + 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']; + to = json['To']; + dateofBirth = json['DateofBirth']; + patientIditificationNum = json['PatientIditificationNum']; + patientMobileNumber = json['PatientMobileNumber']; + patientName = json['PatientName']; + setupID = json['SetupID']; + projectName = json['ProjectName']; + clinicName = json['ClinicName']; + doctorName = json['DoctorName']; + projectID = json['ProjectID']; + invoiceNo = json['InvoiceNo']; + orderDate = json['OrderDate']; + } + + Map toJson() { + final Map data = new Map(); + 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; + data['To'] = this.to; + data['DateofBirth'] = this.dateofBirth; + data['PatientIditificationNum'] = this.patientIditificationNum; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientName'] = this.patientName; + data['SetupID'] = this.setupID; + data['ProjectName'] = this.projectName; + data['ClinicName'] = this.clinicName; + data['DoctorName'] = this.doctorName; + data['ProjectID'] = this.projectID; + data['InvoiceNo'] = this.invoiceNo; + data['OrderDate'] = this.orderDate; + return data; + } +} diff --git a/lib/core/model/medical_file_model.dart b/lib/core/model/medical_file_model.dart new file mode 100644 index 00000000..f2b4ce3c --- /dev/null +++ b/lib/core/model/medical_file_model.dart @@ -0,0 +1,602 @@ +class MedicalFileModel { + List entityList; + dynamic statusMessage; + + MedicalFileModel({this.entityList, this.statusMessage}); + + MedicalFileModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + List timelines; + + EntityList({this.timelines}); + + EntityList.fromJson(Map json) { + if (json['Timelines'] != null) { + timelines = new List(); + json['Timelines'].forEach((v) { + timelines.add(new Timelines.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.timelines != null) { + data['Timelines'] = this.timelines.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Timelines { + int clinicId; + String clinicName; + String date; + int doctorId; + String doctorImage; + String doctorName; + int encounterNumber; + String encounterType; + int projectID; + String projectName; + String setupID; + List timeLineEvents; + + Timelines( + {this.clinicId, + this.clinicName, + this.date, + this.doctorId, + this.doctorImage, + this.doctorName, + this.encounterNumber, + this.encounterType, + this.projectID, + this.projectName, + this.setupID, + this.timeLineEvents}); + + Timelines.fromJson(Map json) { + clinicId = json['ClinicId']; + clinicName = json['ClinicName']; + date = json['Date']; + doctorId = json['DoctorId']; + doctorImage = json['DoctorImage']; + doctorName = json['DoctorName']; + encounterNumber = json['EncounterNumber']; + encounterType = json['EncounterType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + setupID = json['SetupID']; + if (json['TimeLineEvents'] != null) { + timeLineEvents = new List(); + json['TimeLineEvents'].forEach((v) { + timeLineEvents.add(new TimeLineEvents.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['ClinicId'] = this.clinicId; + data['ClinicName'] = this.clinicName; + data['Date'] = this.date; + data['DoctorId'] = this.doctorId; + data['DoctorImage'] = this.doctorImage; + data['DoctorName'] = this.doctorName; + data['EncounterNumber'] = this.encounterNumber; + data['EncounterType'] = this.encounterType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['SetupID'] = this.setupID; + if (this.timeLineEvents != null) { + data['TimeLineEvents'] = + this.timeLineEvents.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class TimeLineEvents { + List admissions; + String colorClass; + List consulations; + + TimeLineEvents({this.admissions, this.colorClass, this.consulations}); + + TimeLineEvents.fromJson(Map json) { + colorClass = json['ColorClass']; + if (json['Consulations'] != null) { + consulations = new List(); + json['Consulations'].forEach((v) { + consulations.add(new Consulations.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + + data['ColorClass'] = this.colorClass; + if (this.consulations != null) { + data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Consulations { + int admissionNo; + String appointmentDate; + int appointmentNo; + String appointmentType; + String clinicID; + String clinicName; + int doctorID; + String doctorName; + String endTime; + String episodeDate; + int episodeID; + int patientID; + int projectID; + String projectName; + String remarks; + String setupID; + String startTime; + String visitFor; + String visitType; + String dispalyName; + List lstAssessments; + List lstPhysicalExam; + List lstProcedure; + List lstMedicalHistory; + List lstCheifComplaint; + + Consulations( + {this.admissionNo, + this.appointmentDate, + this.appointmentNo, + this.appointmentType, + this.clinicID, + this.clinicName, + this.doctorID, + this.doctorName, + this.endTime, + this.episodeDate, + this.episodeID, + this.patientID, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.startTime, + this.visitFor, + this.visitType, + this.dispalyName, + this.lstAssessments, + this.lstPhysicalExam, + this.lstProcedure, + this.lstMedicalHistory, + this.lstCheifComplaint}); + + Consulations.fromJson(Map json) { + admissionNo = json['AdmissionNo']; + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + appointmentType = json['AppointmentType']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + endTime = json['EndTime']; + episodeDate = json['EpisodeDate']; + episodeID = json['EpisodeID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + startTime = json['StartTime']; + visitFor = json['VisitFor']; + visitType = json['VisitType']; + dispalyName = json['dispalyName']; + if (json['lstAssessments'] != null) { + lstAssessments = new List(); + json['lstAssessments'].forEach((v) { + lstAssessments.add(new LstAssessments.fromJson(v)); + }); + } + if (json['lstCheifComplaint'] != null) { + lstCheifComplaint = new List(); + json['lstCheifComplaint'].forEach((v) { + lstCheifComplaint.add(new LstCheifComplaint.fromJson(v)); + }); + } + if (json['lstPhysicalExam'] != null) { + lstPhysicalExam = new List(); + json['lstPhysicalExam'].forEach((v) { + lstPhysicalExam.add(new LstPhysicalExam.fromJson(v)); + }); + } + if (json['lstProcedure'] != null) { + lstProcedure = new List(); + json['lstProcedure'].forEach((v) { + lstProcedure.add(new LstProcedure.fromJson(v)); + }); + } + if (json['lstMedicalHistory'] != null) { + lstMedicalHistory = new List(); + json['lstMedicalHistory'].forEach((v) { + lstMedicalHistory.add(new LstMedicalHistory.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['AdmissionNo'] = this.admissionNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentType'] = this.appointmentType; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['EndTime'] = this.endTime; + data['EpisodeDate'] = this.episodeDate; + data['EpisodeID'] = this.episodeID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['StartTime'] = this.startTime; + data['VisitFor'] = this.visitFor; + data['VisitType'] = this.visitType; + data['dispalyName'] = this.dispalyName; + if (this.lstAssessments != null) { + data['lstAssessments'] = + this.lstAssessments.map((v) => v.toJson()).toList(); + } + if (this.lstCheifComplaint != null) { + data['lstCheifComplaint'] = + this.lstCheifComplaint.map((v) => v.toJson()).toList(); + } + if (this.lstPhysicalExam != null) { + data['lstPhysicalExam'] = + this.lstPhysicalExam.map((v) => v.toJson()).toList(); + } + if (this.lstProcedure != null) { + data['lstProcedure'] = this.lstProcedure.map((v) => v.toJson()).toList(); + } + if (this.lstMedicalHistory != null) { + data['lstMedicalHistory'] = + this.lstMedicalHistory.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LstCheifComplaint { + int appointmentNo; + String cCDate; + String chiefComplaint; + String currentMedication; + int episodeID; + String hOPI; + int patientID; + String patientType; + int projectID; + String projectName; + String setupID; + String dispalyName; + + LstCheifComplaint( + {this.appointmentNo, + this.cCDate, + this.chiefComplaint, + this.currentMedication, + this.episodeID, + this.hOPI, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.setupID, + this.dispalyName}); + + LstCheifComplaint.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + cCDate = json['CCDate']; + chiefComplaint = json['ChiefComplaint']; + currentMedication = json['CurrentMedication']; + episodeID = json['EpisodeID']; + hOPI = json['HOPI']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['CCDate'] = this.cCDate; + data['ChiefComplaint'] = this.chiefComplaint; + data['CurrentMedication'] = this.currentMedication; + data['EpisodeID'] = this.episodeID; + data['HOPI'] = this.hOPI; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; + return data; + } +} + +class LstAssessments { + int appointmentNo; + String condition; + String description; + int episodeID; + String iCD10; + int patientID; + String patientType; + int projectID; + String projectName; + String remarks; + String setupID; + String type; + String dispalyName; + + LstAssessments( + {this.appointmentNo, + this.condition, + this.description, + this.episodeID, + this.iCD10, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.type, + this.dispalyName}); + + LstAssessments.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + condition = json['Condition']; + description = json['Description']; + episodeID = json['EpisodeID']; + iCD10 = json['ICD10']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + type = json['Type']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['Condition'] = this.condition; + data['Description'] = this.description; + data['EpisodeID'] = this.episodeID; + data['ICD10'] = this.iCD10; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['Type'] = this.type; + data['dispalyName'] = this.dispalyName; + return data; + } +} + +class LstPhysicalExam { + String abnormal; + int appointmentNo; + int episodeID; + String examDesc; + String examID; + String examType; + int patientID; + String patientType; + int projectID; + String projectName; + String remarks; + String setupID; + String dispalyName; + + LstPhysicalExam( + {this.abnormal, + this.appointmentNo, + this.episodeID, + this.examDesc, + this.examID, + this.examType, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.dispalyName}); + + LstPhysicalExam.fromJson(Map json) { + abnormal = json['Abnormal']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + examDesc = json['ExamDesc']; + examID = json['ExamID']; + examType = json['ExamType']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['Abnormal'] = this.abnormal; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['ExamDesc'] = this.examDesc; + data['ExamID'] = this.examID; + data['ExamType'] = this.examType; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; + return data; + } +} + +class LstProcedure { + int appointmentNo; + int episodeID; + String orderDate; + int patientID; + String patientType; + String procName; + String procedureId; + int projectID; + String projectName; + String setupID; + String dispalyName; + + LstProcedure( + {this.appointmentNo, + this.episodeID, + this.orderDate, + this.patientID, + this.patientType, + this.procName, + this.procedureId, + this.projectID, + this.projectName, + this.setupID, + this.dispalyName}); + + LstProcedure.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + orderDate = json['OrderDate']; + patientID = json['PatientID']; + patientType = json['PatientType']; + procName = json['ProcName']; + procedureId = json['ProcedureId']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProcName'] = this.procName; + data['ProcedureId'] = this.procedureId; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; + return data; + } +} + +class LstMedicalHistory { + int appointmentNo; + String checked; + int episodeID; + String history; + int patientID; + String patientType; + int projectID; + String projectName; + String remarks; + String setupID; + String dispalyName; + + LstMedicalHistory( + {this.appointmentNo, + this.checked, + this.episodeID, + this.history, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.dispalyName}); + + LstMedicalHistory.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + checked = json['Checked']; + episodeID = json['EpisodeID']; + history = json['History']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['Checked'] = this.checked; + data['EpisodeID'] = this.episodeID; + data['History'] = this.history; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; + return data; + } +} diff --git a/lib/core/model/medical_file_request_model.dart b/lib/core/model/medical_file_request_model.dart new file mode 100644 index 00000000..c5a40bb7 --- /dev/null +++ b/lib/core/model/medical_file_request_model.dart @@ -0,0 +1,18 @@ +class MedicalFileRequestModel { + int patientMRN; + String vidaAuthTokenID; + + MedicalFileRequestModel({this.patientMRN, this.vidaAuthTokenID}); + + MedicalFileRequestModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/model/post_prescrition_req_model.dart b/lib/core/model/post_prescrition_req_model.dart new file mode 100644 index 00000000..06a524ed --- /dev/null +++ b/lib/core/model/post_prescrition_req_model.dart @@ -0,0 +1,106 @@ +class PostPrescriptionReqModel { + String vidaAuthTokenID; + int clinicID; + int episodeID; + int appointmentNo; + int patientMRN; + List prescriptionRequestModel; + + PostPrescriptionReqModel( + {this.vidaAuthTokenID, + this.clinicID, + this.episodeID, + this.appointmentNo, + this.patientMRN, + this.prescriptionRequestModel}); + + PostPrescriptionReqModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + clinicID = json['ClinicID']; + episodeID = json['EpisodeID']; + appointmentNo = json['AppointmentNo']; + patientMRN = json['PatientMRN']; + if (json['prescriptionRequestModel'] != null) { + prescriptionRequestModel = new List(); + json['prescriptionRequestModel'].forEach((v) { + prescriptionRequestModel.add(new PrescriptionRequestModel.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['ClinicID'] = this.clinicID; + data['EpisodeID'] = this.episodeID; + data['AppointmentNo'] = this.appointmentNo; + data['PatientMRN'] = this.patientMRN; + if (this.prescriptionRequestModel != null) { + data['prescriptionRequestModel'] = + this.prescriptionRequestModel.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PrescriptionRequestModel { + int itemId; + String doseStartDate; + int duration; + double dose; + int doseUnitId; + int route; + int frequency; + int doseTime; + bool covered; + bool approvalRequired; + String remarks; + String icdcode10Id; + + PrescriptionRequestModel({ + this.itemId, + this.doseStartDate, + this.duration, + this.dose, + this.doseUnitId, + this.route, + this.frequency, + this.doseTime, + this.covered, + this.approvalRequired, + this.remarks, + this.icdcode10Id, + }); + + PrescriptionRequestModel.fromJson(Map json) { + itemId = json['itemId']; + doseStartDate = json['doseStartDate']; + duration = json['duration']; + dose = json['dose']; + doseUnitId = json['doseUnitId']; + route = json['route']; + frequency = json['frequency']; + doseTime = json['doseTime']; + covered = json['covered']; + approvalRequired = json['approvalRequired']; + remarks = json['remarks']; + icdcode10Id = json['icdcode10Id']; + } + + Map toJson() { + final Map data = new Map(); + data['itemId'] = this.itemId; + data['doseStartDate'] = this.doseStartDate; + data['duration'] = this.duration; + data['dose'] = this.dose; + data['doseUnitId'] = this.doseUnitId; + data['route'] = this.route; + data['frequency'] = this.frequency; + data['doseTime'] = this.doseTime; + data['covered'] = this.covered; + data['approvalRequired'] = this.approvalRequired; + data['remarks'] = this.remarks; + data['icdcode10Id'] = this.icdcode10Id; + return data; + } +} diff --git a/lib/core/model/prescription_model.dart b/lib/core/model/prescription_model.dart new file mode 100644 index 00000000..92574c66 --- /dev/null +++ b/lib/core/model/prescription_model.dart @@ -0,0 +1,173 @@ +class PrescriptionModel { + List entityList; + dynamic rowcount; + dynamic statusMessage; + + PrescriptionModel({this.entityList, this.rowcount, this.statusMessage}); + + PrescriptionModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + dynamic appointmentNo; + dynamic clinicName; + dynamic createdBy; + dynamic createdOn; + dynamic doctorName; + dynamic doseDailyQuantity; + dynamic doseDailyUnitID; + dynamic doseDetail; + dynamic doseDurationDays; + dynamic doseTimingID; + dynamic episodeID; + dynamic frequencyID; + dynamic icdCode10ID; + dynamic indication; + dynamic isDispensed; + dynamic isMedicineCovered; + dynamic isSIG; + dynamic medicationName; + dynamic medicationPrice; + dynamic medicineCode; + dynamic orderTypeDescription; + dynamic qty; + dynamic quantity; + dynamic remarks; + dynamic routeID; + dynamic startDate; + dynamic status; + dynamic stopDate; + dynamic uom; + dynamic pharmacistRemarks; + dynamic pharmacyInervention; + dynamic refill; + dynamic mediSpanGPICode; + EntityList( + {this.appointmentNo, + this.clinicName, + this.createdBy, + this.createdOn, + this.doctorName, + this.doseDailyQuantity, + this.doseDailyUnitID, + this.doseDetail, + this.doseDurationDays, + this.doseTimingID, + this.episodeID, + this.frequencyID, + this.icdCode10ID, + this.indication, + this.isDispensed, + this.isMedicineCovered, + this.isSIG, + this.medicationName, + this.medicationPrice, + this.medicineCode, + this.orderTypeDescription, + this.qty, + this.quantity, + this.remarks, + this.routeID, + this.startDate, + this.status, + this.stopDate, + this.uom, + this.pharmacistRemarks, + this.mediSpanGPICode, + this.pharmacyInervention, + this.refill}); + + EntityList.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + clinicName = json['clinicName']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + doseDailyQuantity = json['doseDailyQuantity']; + doseDailyUnitID = json['doseDailyUnitID']; + doseDetail = json['doseDetail']; + doseDurationDays = json['doseDurationDays']; + doseTimingID = json['doseTimingID']; + episodeID = json['episodeID']; + frequencyID = json['frequencyID']; + icdCode10ID = json['icdCode10ID']; + indication = json['indication']; + isDispensed = json['isDispensed']; + isMedicineCovered = json['isMedicineCovered']; + isSIG = json['isSIG']; + medicationName = json['medicationName']; + medicationPrice = json['medicationPrice']; + medicineCode = json['medicineCode']; + orderTypeDescription = json['orderTypeDescription']; + qty = json['qty']; + quantity = json['quantity']; + remarks = json['remarks']; + routeID = json['routeID']; + startDate = json['startDate']; + status = json['status']; + stopDate = json['stopDate']; + uom = json['uom']; + pharmacistRemarks = json['pharmacistRemarks']; + mediSpanGPICode = json['mediSpanGPICode']; + refill = json['refill']; + pharmacyInervention = json['interventionID']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['clinicName'] = this.clinicName; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['doseDailyQuantity'] = this.doseDailyQuantity; + data['doseDailyUnitID'] = this.doseDailyUnitID; + data['doseDetail'] = this.doseDetail; + data['doseDurationDays'] = this.doseDurationDays; + data['doseTimingID'] = this.doseTimingID; + data['episodeID'] = this.episodeID; + data['frequencyID'] = this.frequencyID; + data['icdCode10ID'] = this.icdCode10ID; + data['indication'] = this.indication; + data['isDispensed'] = this.isDispensed; + data['isMedicineCovered'] = this.isMedicineCovered; + data['isSIG'] = this.isSIG; + data['medicationName'] = this.medicationName; + data['medicationPrice'] = this.medicationPrice; + data['medicineCode'] = this.medicineCode; + data['orderTypeDescription'] = this.orderTypeDescription; + data['qty'] = this.qty; + data['quantity'] = this.quantity; + data['remarks'] = this.remarks; + data['routeID'] = this.routeID; + data['startDate'] = this.startDate; + data['status'] = this.status; + data['stopDate'] = this.stopDate; + data['uom'] = this.uom; + data['pharmacistRemarks'] = this.pharmacistRemarks; + data['mediSpanGPICode'] = this.mediSpanGPICode; + data['refill'] = this.refill; + data['interventionID'] = this.pharmacyInervention; + + return data; + } +} diff --git a/lib/core/model/prescription_req_model.dart b/lib/core/model/prescription_req_model.dart new file mode 100644 index 00000000..3eb71072 --- /dev/null +++ b/lib/core/model/prescription_req_model.dart @@ -0,0 +1,21 @@ +class PrescriptionReqModel { + String vidaAuthTokenID; + dynamic patientMRN; + dynamic appNo; + + PrescriptionReqModel({this.vidaAuthTokenID, this.patientMRN, this.appNo}); + + PrescriptionReqModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + appNo = json['AppointmentNo']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appNo; + return data; + } +} diff --git a/lib/core/model/procedure/ControlsModel.dart b/lib/core/model/procedure/ControlsModel.dart new file mode 100644 index 00000000..b3e8ae9c --- /dev/null +++ b/lib/core/model/procedure/ControlsModel.dart @@ -0,0 +1,18 @@ +class Controls { + String code; + String controlValue; + + Controls({this.code, this.controlValue}); + + Controls.fromJson(Map json) { + code = json['Code']; + controlValue = json['ControlValue']; + } + + Map toJson() { + final Map data = new Map(); + data['Code'] = this.code; + data['ControlValue'] = this.controlValue; + return data; + } +} diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart new file mode 100644 index 00000000..9e6f847f --- /dev/null +++ b/lib/core/model/procedure/categories_procedure.dart @@ -0,0 +1,94 @@ +class CategoriseProcedureModel { + List entityList; + int rowcount; + dynamic statusMessage; + + CategoriseProcedureModel( + {this.entityList, this.rowcount, this.statusMessage}); + + CategoriseProcedureModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + bool allowedClinic; + String category; + String categoryID; + String genderValidation; + String group; + String orderedValidation; + dynamic price; + String procedureId; + String procedureName; + String specialPermission; + String subGroup; + String template; + String remarks; + String type; + + EntityList( + {this.allowedClinic, + this.category, + this.categoryID, + this.genderValidation, + this.group, + this.orderedValidation, + this.price, + this.procedureId, + this.procedureName, + this.specialPermission, + this.subGroup, + this.template, + this.remarks, + this.type}); + + EntityList.fromJson(Map json) { + allowedClinic = json['allowedClinic']; + category = json['category']; + categoryID = json['categoryID']; + genderValidation = json['genderValidation']; + group = json['group']; + orderedValidation = json['orderedValidation']; + price = json['price']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + specialPermission = json['specialPermission']; + subGroup = json['subGroup']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['allowedClinic'] = this.allowedClinic; + data['category'] = this.category; + data['categoryID'] = this.categoryID; + data['genderValidation'] = this.genderValidation; + data['group'] = this.group; + data['orderedValidation'] = this.orderedValidation; + data['price'] = this.price; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['specialPermission'] = this.specialPermission; + data['subGroup'] = this.subGroup; + data['template'] = this.template; + return data; + } +} diff --git a/lib/core/model/procedure/get_ordered_procedure_model.dart b/lib/core/model/procedure/get_ordered_procedure_model.dart new file mode 100644 index 00000000..b7185711 --- /dev/null +++ b/lib/core/model/procedure/get_ordered_procedure_model.dart @@ -0,0 +1,138 @@ +class GetOrderedProcedureModel { + List entityList; + int rowcount; + dynamic statusMessage; + + GetOrderedProcedureModel( + {this.entityList, this.rowcount, this.statusMessage}); + + GetOrderedProcedureModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + String achiCode; + String appointmentDate; + int appointmentNo; + int categoryID; + String clinicDescription; + String cptCode; + int createdBy; + String createdOn; + String doctorName; + bool isApprovalCreated; + bool isApprovalRequired; + bool isCovered; + bool isInvoiced; + bool isReferralInvoiced; + bool isUncoveredByDoctor; + int lineItemNo; + String orderDate; + int orderNo; + int orderType; + String procedureId; + String procedureName; + String remarks; + String status; + String template; + + EntityList( + {this.achiCode, + this.appointmentDate, + this.appointmentNo, + this.categoryID, + this.clinicDescription, + this.cptCode, + this.createdBy, + this.createdOn, + this.doctorName, + this.isApprovalCreated, + this.isApprovalRequired, + this.isCovered, + this.isInvoiced, + this.isReferralInvoiced, + this.isUncoveredByDoctor, + this.lineItemNo, + this.orderDate, + this.orderNo, + this.orderType, + this.procedureId, + this.procedureName, + this.remarks, + this.status, + this.template}); + + EntityList.fromJson(Map json) { + achiCode = json['achiCode']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + categoryID = json['categoryID']; + clinicDescription = json['clinicDescription']; + cptCode = json['cptCode']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + isApprovalCreated = json['isApprovalCreated']; + isApprovalRequired = json['isApprovalRequired']; + isCovered = json['isCovered']; + isInvoiced = json['isInvoiced']; + isReferralInvoiced = json['isReferralInvoiced']; + isUncoveredByDoctor = json['isUncoveredByDoctor']; + lineItemNo = json['lineItemNo']; + orderDate = json['orderDate']; + orderNo = json['orderNo']; + orderType = json['orderType']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + remarks = json['remarks']; + status = json['status']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['achiCode'] = this.achiCode; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['categoryID'] = this.categoryID; + data['clinicDescription'] = this.clinicDescription; + data['cptCode'] = this.cptCode; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['isApprovalCreated'] = this.isApprovalCreated; + data['isApprovalRequired'] = this.isApprovalRequired; + data['isCovered'] = this.isCovered; + data['isInvoiced'] = this.isInvoiced; + data['isReferralInvoiced'] = this.isReferralInvoiced; + data['isUncoveredByDoctor'] = this.isUncoveredByDoctor; + data['lineItemNo'] = this.lineItemNo; + data['orderDate'] = this.orderDate; + data['orderNo'] = this.orderNo; + data['orderType'] = this.orderType; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['remarks'] = this.remarks; + data['status'] = this.status; + data['template'] = this.template; + return data; + } +} diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart new file mode 100644 index 00000000..dfbd444c --- /dev/null +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -0,0 +1,18 @@ +class GetOrderedProcedureRequestModel { + String vidaAuthTokenID; + int patientMRN; + + GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); + + GetOrderedProcedureRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + return data; + } +} diff --git a/lib/core/model/procedure/get_procedure_model.dart b/lib/core/model/procedure/get_procedure_model.dart new file mode 100644 index 00000000..5c83b49b --- /dev/null +++ b/lib/core/model/procedure/get_procedure_model.dart @@ -0,0 +1,89 @@ +class GetProcedureModel { + List entityList; + int rowcount; + dynamic statusMessage; + + GetProcedureModel({this.entityList, this.rowcount, this.statusMessage}); + + GetProcedureModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + bool allowedClinic; + String category; + String categoryID; + String genderValidation; + String group; + String orderedValidation; + dynamic price; + String procedureId; + String procedureName; + String specialPermission; + String subGroup; + String template; + + EntityList( + {this.allowedClinic, + this.category, + this.categoryID, + this.genderValidation, + this.group, + this.orderedValidation, + this.price, + this.procedureId, + this.procedureName, + this.specialPermission, + this.subGroup, + this.template}); + + EntityList.fromJson(Map json) { + allowedClinic = json['allowedClinic']; + category = json['category']; + categoryID = json['categoryID']; + genderValidation = json['genderValidation']; + group = json['group']; + orderedValidation = json['orderedValidation']; + price = json['price']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + specialPermission = json['specialPermission']; + subGroup = json['subGroup']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['allowedClinic'] = this.allowedClinic; + data['category'] = this.category; + data['categoryID'] = this.categoryID; + data['genderValidation'] = this.genderValidation; + data['group'] = this.group; + data['orderedValidation'] = this.orderedValidation; + data['price'] = this.price; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['specialPermission'] = this.specialPermission; + data['subGroup'] = this.subGroup; + data['template'] = this.template; + return data; + } +} diff --git a/lib/core/model/procedure/get_procedure_req_model.dart b/lib/core/model/procedure/get_procedure_req_model.dart new file mode 100644 index 00000000..6202a520 --- /dev/null +++ b/lib/core/model/procedure/get_procedure_req_model.dart @@ -0,0 +1,40 @@ +class GetProcedureReqModel { + int clinicId; + int patientMRN; + int pageSize; + int pageIndex; + List search; + dynamic category; + String vidaAuthTokenID; + + GetProcedureReqModel( + {this.clinicId, + this.patientMRN, + this.pageSize, + this.pageIndex, + this.search, + this.category, + this.vidaAuthTokenID}); + + GetProcedureReqModel.fromJson(Map json) { + clinicId = json['ClinicId']; + patientMRN = json['PatientMRN']; + pageSize = json['PageSize']; + pageIndex = json['PageIndex']; + search = json['Search'].cast(); + category = json['Category']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['ClinicId'] = this.clinicId; + data['PatientMRN'] = this.patientMRN; + data['PageSize'] = this.pageSize; + data['PageIndex'] = this.pageIndex; + data['Search'] = this.search; + data['Category'] = this.category; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/model/procedure/post_procedure_req_model.dart b/lib/core/model/procedure/post_procedure_req_model.dart new file mode 100644 index 00000000..b12563f8 --- /dev/null +++ b/lib/core/model/procedure/post_procedure_req_model.dart @@ -0,0 +1,70 @@ +import 'ControlsModel.dart'; + +class PostProcedureReqModel { + int patientMRN; + int appointmentNo; + int episodeID; + List procedures; + String vidaAuthTokenID; + + PostProcedureReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.procedures, + this.vidaAuthTokenID}); + + PostProcedureReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + if (json['Procedures'] != null) { + procedures = new List(); + json['Procedures'].forEach((v) { + procedures.add(new Procedures.fromJson(v)); + }); + } + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + if (this.procedures != null) { + data['Procedures'] = this.procedures.map((v) => v.toJson()).toList(); + } + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} + +class Procedures { + String procedure; + String category; + List controls; + + Procedures({this.procedure, this.category, this.controls}); + + Procedures.fromJson(Map json) { + procedure = json['Procedure']; + category = json['Category']; + if (json['Controls'] != null) { + controls = new List(); + json['Controls'].forEach((v) { + controls.add(new Controls.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['Procedure'] = this.procedure; + data['Category'] = this.category; + if (this.controls != null) { + data['Controls'] = this.controls.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/core/model/procedure/procedure_category_list_model.dart b/lib/core/model/procedure/procedure_category_list_model.dart new file mode 100644 index 00000000..849e84e5 --- /dev/null +++ b/lib/core/model/procedure/procedure_category_list_model.dart @@ -0,0 +1,48 @@ +class ProcedureCategoryListModel { + List entityList; + int rowcount; + dynamic statusMessage; + + ProcedureCategoryListModel( + {this.entityList, this.rowcount, this.statusMessage}); + + ProcedureCategoryListModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + int categoryId; + String categoryName; + + EntityList({this.categoryId, this.categoryName}); + + EntityList.fromJson(Map json) { + categoryId = json['categoryId']; + categoryName = json['categoryName']; + } + + Map toJson() { + final Map data = new Map(); + data['categoryId'] = this.categoryId; + data['categoryName'] = this.categoryName; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_valadate_model.dart b/lib/core/model/procedure/procedure_valadate_model.dart new file mode 100644 index 00000000..3a3e23cf --- /dev/null +++ b/lib/core/model/procedure/procedure_valadate_model.dart @@ -0,0 +1,51 @@ +class ProcedureValadteModel { + List entityList; + int rowcount; + dynamic statusMessage; + dynamic success; + + ProcedureValadteModel( + {this.entityList, this.rowcount, this.statusMessage, this.success}); + + ProcedureValadteModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + success = json['success']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + data['success'] = this.success; + return data; + } +} + +class EntityList { + String procedureId; + List warringMessages; + + EntityList({this.procedureId, this.warringMessages}); + + EntityList.fromJson(Map json) { + procedureId = json['procedureId']; + warringMessages = json['warringMessages'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['procedureId'] = this.procedureId; + data['warringMessages'] = this.warringMessages; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_valadate_request_model.dart b/lib/core/model/procedure/procedure_valadate_request_model.dart new file mode 100644 index 00000000..0b872b93 --- /dev/null +++ b/lib/core/model/procedure/procedure_valadate_request_model.dart @@ -0,0 +1,32 @@ +class ProcedureValadteRequestModel { + String vidaAuthTokenID; + int patientMRN; + int appointmentNo; + int episodeID; + List procedure; + + ProcedureValadteRequestModel( + {this.vidaAuthTokenID, + this.patientMRN, + this.appointmentNo, + this.episodeID, + this.procedure}); + + ProcedureValadteRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + procedure = json['Procedure'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['Procedure'] = this.procedure; + return data; + } +} diff --git a/lib/core/model/procedure/update_procedure_request_model.dart b/lib/core/model/procedure/update_procedure_request_model.dart new file mode 100644 index 00000000..aee39879 --- /dev/null +++ b/lib/core/model/procedure/update_procedure_request_model.dart @@ -0,0 +1,75 @@ +import 'ControlsModel.dart'; + +class UpdateProcedureRequestModel { + int orderNo; + int patientMRN; + int appointmentNo; + int episodeID; + int lineItemNo; + ProcedureDetail procedureDetail; + String vidaAuthTokenID; + + UpdateProcedureRequestModel( + {this.orderNo, + this.patientMRN, + this.appointmentNo, + this.episodeID, + this.lineItemNo, + this.procedureDetail, + this.vidaAuthTokenID}); + + UpdateProcedureRequestModel.fromJson(Map json) { + orderNo = json['OrderNo']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + lineItemNo = json['LineItemNo']; + procedureDetail = json['procedureDetail'] != null + ? new ProcedureDetail.fromJson(json['procedureDetail']) + : null; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['OrderNo'] = this.orderNo; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['LineItemNo'] = this.lineItemNo; + if (this.procedureDetail != null) { + data['procedureDetail'] = this.procedureDetail.toJson(); + } + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} + +class ProcedureDetail { + String procedure; + String category; + List controls; + + ProcedureDetail({this.procedure, this.category, this.controls}); + + ProcedureDetail.fromJson(Map json) { + procedure = json['Procedure']; + category = json['Category']; + if (json['Controls'] != null) { + controls = new List(); + json['Controls'].forEach((v) { + controls.add(new Controls.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['Procedure'] = this.procedure; + data['Category'] = this.category; + if (this.controls != null) { + data['Controls'] = this.controls.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart new file mode 100644 index 00000000..66433091 --- /dev/null +++ b/lib/core/model/radiology/final_radiology.dart @@ -0,0 +1,190 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class FinalRadiology { + String setupID; + int projectID; + Null patientID; + int invoiceLineItemNo; + int invoiceNo; + int doctorID; + int clinicID; + DateTime orderDate; + String reportData; + String imageURL; + String procedureID; + int appointmentNo; + Null dIAPacsURL; + bool isRead; + String readOn; + var admissionNo; + bool isInOutPatient; + int actualDoctorRate; + String clinicDescription; + String dIAPACSURL; + String doctorImageURL; + String doctorName; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isExecludeDoctor; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + String nationalityFlagURL; + int noOfPatientsRate; + int orderNo; + String projectName; + String qR; + String reportDataHTML; + String reportDataTextString; + List speciality; + bool isCVI; + bool isRadMedicalReport; + bool isLiveCareAppointment; + + FinalRadiology( + {this.setupID, + this.projectID, + this.patientID, + this.invoiceLineItemNo, + this.invoiceNo, + this.doctorID, + this.clinicID, + this.orderDate, + this.reportData, + this.imageURL, + this.procedureID, + this.appointmentNo, + this.dIAPacsURL, + this.isRead, + this.readOn, + this.admissionNo, + this.isInOutPatient, + this.actualDoctorRate, + this.clinicDescription, + this.dIAPACSURL, + this.doctorImageURL, + this.doctorName, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isExecludeDoctor, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.orderNo, + this.projectName, + this.qR, + this.reportDataHTML, + this.reportDataTextString, + this.speciality, + this.isCVI, + this.isRadMedicalReport,this.isLiveCareAppointment}); + + FinalRadiology.fromJson(Map json) { + try { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + invoiceLineItemNo = json['InvoiceLineItemNo']; + invoiceNo = json['InvoiceNo']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + orderDate = DateUtils.convertStringToDate(json['OrderDate']); + reportData = json['ReportData']; + imageURL = json['ImageURL']; + procedureID = json['ProcedureID']; + appointmentNo = json['AppointmentNo']; + dIAPacsURL = json['DIAPacsURL']; + isRead = json['IsRead']; + readOn = json['ReadOn']; + admissionNo = json['AdmissionNo']; + isInOutPatient = json['IsInOutPatient']; + actualDoctorRate = json['ActualDoctorRate']; + clinicDescription = json['ClinicDescription']; + dIAPACSURL = json['DIA_PACS_URL']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + orderNo = json['OrderNo']; + projectName = json['ProjectName']; + qR = json['QR']; + isLiveCareAppointment = json['IsLiveCareAppointment']; + reportDataHTML = json['ReportDataHTML']; + reportDataTextString = json['ReportDataTextString']; + // speciality = json['Speciality'].cast(); + isCVI = json['isCVI']; + isRadMedicalReport = json['isRadMedicalReport']; + + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['InvoiceLineItemNo'] = this.invoiceLineItemNo; + data['InvoiceNo'] = this.invoiceNo; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['OrderDate'] = this.orderDate; + data['ReportData'] = this.reportData; + data['ImageURL'] = this.imageURL; + data['ProcedureID'] = this.procedureID; + data['AppointmentNo'] = this.appointmentNo; + data['DIAPacsURL'] = this.dIAPacsURL; + data['IsRead'] = this.isRead; + data['ReadOn'] = this.readOn; + data['AdmissionNo'] = this.admissionNo; + data['IsInOutPatient'] = this.isInOutPatient; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['ClinicDescription'] = this.clinicDescription; + data['DIA_PACS_URL'] = this.dIAPACSURL; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['OrderNo'] = this.orderNo; + data['ProjectName'] = this.projectName; + data['QR'] = this.qR; + data['ReportDataHTML'] = this.reportDataHTML; + data['ReportDataTextString'] = this.reportDataTextString; + data['Speciality'] = this.speciality; + data['isCVI'] = this.isCVI; + data['isRadMedicalReport'] = this.isRadMedicalReport; + return data; + } +} + +class FinalRadiologyList { + String filterName = ""; + List finalRadiologyList = List(); + + FinalRadiologyList({this.filterName, FinalRadiology finalRadiology}) { + finalRadiologyList.add(finalRadiology); + } +} diff --git a/lib/core/model/radiology/request_patient_rad_orders_details.dart b/lib/core/model/radiology/request_patient_rad_orders_details.dart new file mode 100644 index 00000000..9e3458d5 --- /dev/null +++ b/lib/core/model/radiology/request_patient_rad_orders_details.dart @@ -0,0 +1,92 @@ +class RequestPatientRadOrdersDetails { + int projectID; + int orderNo; + int invoiceNo; + String setupID; + String procedureID; + bool isMedicalReport; + bool isCVI; + 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; + + RequestPatientRadOrdersDetails( + {this.projectID, + this.orderNo, + this.invoiceNo, + this.setupID, + this.procedureID, + this.isMedicalReport, + this.isCVI, + 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}); + + RequestPatientRadOrdersDetails.fromJson(Map json) { + projectID = json['ProjectID']; + orderNo = json['OrderNo']; + invoiceNo = json['InvoiceNo']; + setupID = json['SetupID']; + procedureID = json['ProcedureID']; + isMedicalReport = json['IsMedicalReport']; + isCVI = json['isCVI']; + 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['ProjectID'] = this.projectID; + data['OrderNo'] = this.orderNo; + data['InvoiceNo'] = this.invoiceNo; + data['SetupID'] = this.setupID; + data['ProcedureID'] = this.procedureID; + data['IsMedicalReport'] = this.isMedicalReport; + data['isCVI'] = this.isCVI; + 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/core/model/radiology/request_send_rad_report_email.dart b/lib/core/model/radiology/request_send_rad_report_email.dart new file mode 100644 index 00000000..6d68653d --- /dev/null +++ b/lib/core/model/radiology/request_send_rad_report_email.dart @@ -0,0 +1,116 @@ +class RequestSendRadReportEmail { + int channel; + String clinicName; + String dateofBirth; + int deviceTypeID; + String doctorName; + String generalid; + int invoiceNo; + String iPAdress; + bool isDentalAllowedBackend; + int languageID; + String orderDate; + int patientID; + String patientIditificationNum; + String patientMobileNumber; + String patientName; + int patientOutSA; + int patientType; + int patientTypeID; + int projectID; + String projectName; + String radResult; + String sessionID; + String setupID; + String to; + String tokenID; + double versionID; + + RequestSendRadReportEmail( + {this.channel, + this.clinicName, + this.dateofBirth, + this.deviceTypeID, + this.doctorName, + this.generalid, + this.invoiceNo, + this.iPAdress, + this.isDentalAllowedBackend, + this.languageID, + this.orderDate, + this.patientID, + this.patientIditificationNum, + this.patientMobileNumber, + this.patientName, + this.patientOutSA, + this.patientType, + this.patientTypeID, + this.projectID, + this.projectName, + this.radResult, + this.sessionID, + this.setupID, + this.to, + this.tokenID, + this.versionID}); + + RequestSendRadReportEmail.fromJson(Map json) { + channel = json['Channel']; + clinicName = json['ClinicName']; + dateofBirth = json['DateofBirth']; + deviceTypeID = json['DeviceTypeID']; + doctorName = json['DoctorName']; + generalid = json['generalid']; + invoiceNo = json['InvoiceNo']; + iPAdress = json['IPAdress']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + languageID = json['LanguageID']; + orderDate = json['OrderDate']; + patientID = json['PatientID']; + patientIditificationNum = json['PatientIditificationNum']; + patientMobileNumber = json['PatientMobileNumber']; + patientName = json['PatientName']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + radResult = json['RadResult']; + sessionID = json['SessionID']; + setupID = json['SetupID']; + to = json['To']; + tokenID = json['TokenID']; + versionID = json['VersionID']; + } + + Map toJson() { + final Map data = new Map(); + data['Channel'] = this.channel; + data['ClinicName'] = this.clinicName; + data['DateofBirth'] = this.dateofBirth; + data['DeviceTypeID'] = this.deviceTypeID; + data['DoctorName'] = this.doctorName; + data['generalid'] = this.generalid; + data['InvoiceNo'] = this.invoiceNo; + data['IPAdress'] = this.iPAdress; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['LanguageID'] = this.languageID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientIditificationNum'] = this.patientIditificationNum; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientName'] = this.patientName; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['RadResult'] = this.radResult; + data['SessionID'] = this.sessionID; + data['SetupID'] = this.setupID; + data['To'] = this.to; + data['TokenID'] = this.tokenID; + data['VersionID'] = this.versionID; + return data; + } +} diff --git a/lib/core/model/search_drug_model.dart b/lib/core/model/search_drug_model.dart new file mode 100644 index 00000000..396526c1 --- /dev/null +++ b/lib/core/model/search_drug_model.dart @@ -0,0 +1,65 @@ +class SearchDrugModel { + List entityList; + int rowcount; + dynamic statusMessage; + + SearchDrugModel({this.entityList, this.rowcount, this.statusMessage}); + + SearchDrugModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + dynamic description; + dynamic genericName; + dynamic itemId; + dynamic keywords; + dynamic price; + dynamic quantity; + + EntityList( + {this.description, + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity}); + + EntityList.fromJson(Map json) { + description = json['Description']; + genericName = json['GenericName']; + itemId = json['ItemId']; + keywords = json['Keywords']; + price = json['Price']; + quantity = json['Quantity']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['GenericName'] = this.genericName; + data['ItemId'] = this.itemId; + data['Keywords'] = this.keywords; + data['Price'] = this.price; + data['Quantity'] = this.quantity; + return data; + } +} diff --git a/lib/core/model/search_drug_request_model.dart b/lib/core/model/search_drug_request_model.dart new file mode 100644 index 00000000..b64e7d18 --- /dev/null +++ b/lib/core/model/search_drug_request_model.dart @@ -0,0 +1,18 @@ +class SearchDrugRequestModel { + List search; + // String vidaAuthTokenID; + + SearchDrugRequestModel({this.search}); + + SearchDrugRequestModel.fromJson(Map json) { + search = json['Search'].cast(); + // vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['Search'] = this.search; + // data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/service/InsuranceCardService.dart b/lib/core/service/InsuranceCardService.dart new file mode 100644 index 00000000..43c0e811 --- /dev/null +++ b/lib/core/service/InsuranceCardService.dart @@ -0,0 +1,45 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/insurance_approval.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class InsuranceCardService extends BaseService { + InsuranceApprovalModel _insuranceApprovalModel = InsuranceApprovalModel( + isDentalAllowedBackend: false, + patientTypeID: 1, + patientType: 1, + eXuldAPPNO: 0, + projectID: 0); + + List _insuranceApproval = List(); + + List get insuranceApproval => _insuranceApproval; + + Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo}) async { + hasError = false; + // _cardList.clear(); + if (appointmentNo != null) { + _insuranceApprovalModel.appointmentNo = appointmentNo; + _insuranceApprovalModel.eXuldAPPNO = null; + _insuranceApprovalModel.projectID = null; + } else { + _insuranceApprovalModel.appointmentNo = null; + _insuranceApprovalModel.eXuldAPPNO = 0; + _insuranceApprovalModel.projectID = 0; + } + + await baseAppClient.postPatient(GET_PAtIENTS_INSURANCE_APPROVALS, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + print(response['HIS_Approval_List'].length); + _insuranceApproval.clear(); + _insuranceApproval.length = 0; + response['HIS_Approval_List'].forEach((item) { + _insuranceApproval.add(InsuranceApprovalModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _insuranceApprovalModel.toJson()); + } +} diff --git a/lib/core/service/PatientMuseService.dart b/lib/core/service/PatientMuseService.dart new file mode 100644 index 00000000..891029c3 --- /dev/null +++ b/lib/core/service/PatientMuseService.dart @@ -0,0 +1,28 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/PatientMuseResultsModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientMuseService extends BaseService { + List patientMuseResultsModelList = List(); + + getECGPatient({int patientType, int patientOutSA,int patientID}) async { + Map body = Map(); + body['PatientType'] = patientType; + body['PatientOutSA'] = patientOutSA; + body['PatientID'] = patientID; + await baseAppClient.post( + GET_ECG, + onSuccess: (dynamic response, int statusCode) { + patientMuseResultsModelList.clear(); + response['HIS_GetPatientMuseResultsList'].forEach((v) { + patientMuseResultsModelList.add(PatientMuseResultsModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } +} diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart new file mode 100644 index 00000000..d0cebe77 --- /dev/null +++ b/lib/core/service/SOAP_service.dart @@ -0,0 +1,313 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; + +import 'base/lookup-service.dart'; + +class SOAPService extends LookupService { + List patientChiefComplaintList = []; + List patientAllergiesList = []; + List patientHistoryList = []; + List patientPhysicalExamList = []; + List patientProgressNoteList = []; + List patientAssessmentList = []; + + int episodeID; + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { + await baseAppClient.post( + GET_ALLERGIES, + onSuccess: (dynamic response, int statusCode) { + allergiesList.clear(); + response['List_Allergies']['entityList'].forEach((v) { + allergiesList.add(MasterKeyModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getAllergiesRequestModel.toJson(), + ); + } + + Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { + hasError = false; + + await baseAppClient.post(POST_EPISODE, + onSuccess: (dynamic response, int statusCode) { + + print("Success"); + episodeID = response['EpisodeID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postEpisodeReqModel.toJson()); + } + + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + hasError = false; + + await baseAppClient.post(POST_ALLERGY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAllergyRequestModel.toJson()); + } + + Future postHistories( + PostHistoriesRequestModel postHistoriesRequestModel) async { + hasError = false; + await baseAppClient.post(POST_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postHistoriesRequestModel.toJson()); + } + + Future postChiefComplaint( + PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + hasError = false; + await baseAppClient.post(POST_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); + } + + Future postPhysicalExam( + PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); + } + + Future postProgressNote( + PostProgressNoteRequestModel postProgressNoteRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postProgressNoteRequestModel.toJson()); + } + + Future postAssessment( + PostAssessmentRequestModel postAssessmentRequestModel) async { + hasError = false; + await baseAppClient.post(POST_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAssessmentRequestModel.toJson()); + } + + + + Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async { + hasError = false; + + await baseAppClient.post(PATCH_ALLERGY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchAllergyRequestModel.toJson()); + } + + Future patchHistories( + PostHistoriesRequestModel patchHistoriesRequestModel) async { + hasError = false; + await baseAppClient.post(PATCH_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchHistoriesRequestModel.toJson()); + } + + Future patchChiefComplaint( + PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { + hasError = false; + await baseAppClient.post(PATCH_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchChiefComplaintRequestModel.toJson()); + } + + Future patchPhysicalExam( + PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { + hasError = false; + await baseAppClient.post(PATCH_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchPhysicalExamRequestModel.toJson()); + } + + Future patchProgressNote( + PostProgressNoteRequestModel patchProgressNoteRequestModel) async { + hasError = false; + await baseAppClient.post(PATCH_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchProgressNoteRequestModel.toJson()); + } + + Future patchAssessment( + PatchAssessmentReqModel patchAssessmentRequestModel) async { + hasError = false; + await baseAppClient.post(PATCH_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: patchAssessmentRequestModel.toJson()); + } + + + + Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP) async { + hasError = false; + + await baseAppClient.post (GET_ALLERGY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAllergiesList.clear(); + + response['List_Allergies']['entityList'].forEach((v) { + patientAllergiesList.add(GetAllergiesResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: generalGetReqForSOAP.toJson()); + } + + Future getPatientHistories( + GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async { + hasError = false; + await baseAppClient.post(GET_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + if (isFirst) + patientHistoryList.clear(); + response['List_History']['entityList'].forEach((v) { + patientHistoryList.add(GetHistoryResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHistoryReqModel.toJson()); + } + + Future getPatientChiefComplaint( + GetChiefComplaintReqModel getChiefComplaintReqModel) async { + hasError = false; + await baseAppClient.post (GET_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getChiefComplaintReqModel.toJson()); + } + + Future getPatientPhysicalExam( + GetPhysicalExamReqModel getPhysicalExamReqModel) async { + hasError = false; + await baseAppClient.post (GET_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + patientPhysicalExamList.clear(); + response['PhysicalExamList']['entityList'].forEach((v) { + patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v)); + }); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getPhysicalExamReqModel.toJson()); + } + + Future getPatientProgressNote( + GetGetProgressNoteReqModel getGetProgressNoteReqModel) async { + hasError = false; + await baseAppClient.post (GET_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientProgressNoteList.clear(); + response['ProgressNoteList']['entityList'].forEach((v) { + patientProgressNoteList.add(GetPatientProgressNoteResModel.fromJson(v)); + }); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getGetProgressNoteReqModel.toJson()); + } + + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + hasError = false; + await baseAppClient.post (GET_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getAssessmentReqModel.toJson()); + } +} diff --git a/lib/core/service/auth_service.dart b/lib/core/service/auth_service.dart new file mode 100644 index 00000000..e116ccdd --- /dev/null +++ b/lib/core/service/auth_service.dart @@ -0,0 +1,29 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/imei_details.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; + +class AuthService extends BaseService { + List _imeiDetails = []; + List get dashboardItemsList => _imeiDetails; + + Future selectDeviceImei(imei) async { + try { + // dynamic localRes; + await baseAppClient.post(SELECT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + _imeiDetails = []; + response['List_DoctorDeviceDetails'].forEach((v) { + _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {"IMEI": imei, "TokenID": "@dm!n"}); + //return Future.value(localRes); + } catch (error) { + hasError = true; + super.error = error; + } + } +} diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index c4cb240d..6f4c5d1e 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,8 +1,66 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); - //TODO add the user login model when we need it + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DoctorProfileModel doctorProfile; + + List patientArrivalList = []; + +//TODO add the user login model when we need it + Future getDoctorProfile() async { + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + return null; + } else { + return doctorProfile; + } + } + + Future getPatientArrivalList(String date,{String fromDate, int patientMrn = -1, int appointmentNo = -1}) async{ + hasError = false; + Map body = Map(); + body['From'] = fromDate == null ? date : fromDate; + body['To'] = date; + body['PageIndex'] = 0; + body['PageSize'] = 0; + if(patientMrn == -1){ + body['PatientMRN'] = patientMrn; + } + if(appointmentNo == -1){ + body['AppointmentNo'] = appointmentNo; + } + + await baseAppClient.post( + GET_PATIENT_ARRIVAL_LIST, + onSuccess: (dynamic response, int statusCode) { + patientArrivalList.clear(); + + response['patientArrivalList']['entityList'].forEach((v) { + PatiantInformtion item = PatiantInformtion.fromJson(v); + patientArrivalList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + this.error = error; + }, + body: body, + ); + } + } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart new file mode 100644 index 00000000..dd6310e8 --- /dev/null +++ b/lib/core/service/base/lookup-service.dart @@ -0,0 +1,216 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:flutter/cupertino.dart'; + +import 'base_service.dart'; + +class LookupService extends BaseService { + List allergiesList = []; + + List get allergySeverityList => _allergySeverityList; + List _allergySeverityList = []; + + List medicationStrengthList = []; + List medicationDurationList = []; + List medicationRouteList = []; + List medicationFrequencyList = []; + List medicationDoseTimeList = []; + List medicationIndicationsList = []; + // TODO make the person who create the list dynamic to change it. + List medicationStrengthListWithModel = []; + List medicationFrequencyListWithModel = []; + List medicationDoseTimeListWithModel = []; + List medicationRouteListWithModel = []; + + List patientAssessmentList = []; + + List get historyFamilyList => _historyFamilyList; + List _historyFamilyList = []; + + List get historyMedicalList => _historyMedicalList; + List _historyMedicalList = []; + + List get historySportList => _historySportList; + List _historySportList = []; + + List get historySocialList => _historySocialList; + List _historySocialList = []; + + List get historySurgicalList => _historySurgicalList; + List _historySurgicalList = []; + + List listOfPhysiotherapyGoals = []; + + List get physicalExaminationList => _physicalExaminationList; + List _physicalExaminationList = []; + + // List listOfPhysiotherapyGoals = []; + List listOfDiagnosisType = []; + List listOfDiagnosisCondition = []; + List listOfICD10 = []; + List listOfTemperatureMethods = []; + List listOfSpeciality = []; + List listOfAdmissionType = []; + List listOfDiagnosisSelectionTypes = []; + + Future getMasterLookup(MasterKeysService masterKeys) async { + hasError = false; + Map body = { + "MasterInput": masterKeys.getMasterKeyService() + }; + await baseAppClient.post(GET_MASTER_LOOKUP_LIST, + onSuccess: (dynamic response, int statusCode) { + setMasterLookupInCorrectArray( + response['MasterLookUpList']['entityList'], masterKeys); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { + switch (masterKeys) { + case MasterKeysService.Allergies: + allergiesList.clear(); + entryList.forEach((v) { + allergiesList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistoryFamily: + _historyFamilyList.clear(); + entryList.forEach((v) { + _historyFamilyList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistoryMedical: + _historyMedicalList.clear(); + entryList.forEach((v) { + _historyMedicalList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistorySocial: + historySocialList.clear(); + entryList.forEach((v) { + historySocialList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistorySports: + _historySportList.clear(); + entryList.forEach((v) { + _historySportList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistorySurgical: + _historySurgicalList.clear(); + entryList.forEach((v) { + _historySurgicalList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.PhysicalExamination: + _physicalExaminationList.clear(); + entryList.forEach((v) { + _physicalExaminationList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.AllergySeverity: + _allergySeverityList.clear(); + entryList.forEach((v) { + _allergySeverityList.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.physiotherapyGoals: + listOfPhysiotherapyGoals.clear(); + entryList.forEach((v) { + listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v)); + }); + break; + + case MasterKeysService.DiagnosisType: + listOfDiagnosisType.clear(); + entryList.forEach((v) { + listOfDiagnosisType.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.DiagnosisCondition: + listOfDiagnosisCondition.clear(); + entryList.forEach((v) { + listOfDiagnosisCondition.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.ICD10: + listOfICD10.clear(); + entryList.forEach((v) { + listOfICD10.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.TemperatureMethods: + listOfTemperatureMethods.clear(); + entryList.forEach((v) { + listOfTemperatureMethods.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.Speciality: + listOfSpeciality.clear(); + entryList.forEach((v) { + listOfSpeciality.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.MedicationStrength: + medicationStrengthList.clear(); + entryList.forEach((v) { + medicationStrengthListWithModel.add(MasterKeyModel.fromJson(v)); + medicationStrengthList.add(v); + }); + break; + case MasterKeysService.MedicationDuration: + medicationDurationList.clear(); + entryList.forEach((v) { + medicationDurationList.add(v); + }); + break; + case MasterKeysService.MedicationRoute: + medicationRouteList.clear(); + entryList.forEach((v) { + medicationRouteListWithModel.add(MasterKeyModel.fromJson(v)); + medicationRouteList.add(v); + }); + break; + case MasterKeysService.MedicationFrequency: + medicationFrequencyList.clear(); + entryList.forEach((v) { + medicationFrequencyListWithModel.add(MasterKeyModel.fromJson(v)); + medicationFrequencyList.add(v); + }); + break; + case MasterKeysService.MedicationDoseTime: + medicationDoseTimeList.clear(); + entryList.forEach((v) { + medicationDoseTimeListWithModel.add(MasterKeyModel.fromJson(v)); + medicationDoseTimeList.add(v); + }); + break; + case MasterKeysService.MedicationIndications: + medicationIndicationsList.clear(); + entryList.forEach((v) { + medicationIndicationsList.add(v); + }); + break; + case MasterKeysService.AdmissionRequestType: + listOfAdmissionType.clear(); + entryList.forEach((v) { + // listOfAdmissionType.add(MasterKeyModel.fromJson(v)); + listOfAdmissionType.add(v); + }); + break; + case MasterKeysService.DiagnosisSelectionType: + listOfDiagnosisSelectionTypes.clear(); + entryList.forEach((v) { + // listOfAdmissionType.add(MasterKeyModel.fromJson(v)); + listOfDiagnosisSelectionTypes.add(v); + }); + break; + } + } +} diff --git a/lib/core/service/dasboard_service.dart b/lib/core/service/dasboard_service.dart new file mode 100644 index 00000000..5a66e9eb --- /dev/null +++ b/lib/core/service/dasboard_service.dart @@ -0,0 +1,31 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; + +class DashboardService extends BaseService { + List _dashboardItemsList = []; + List get dashboardItemsList => _dashboardItemsList; + + // DashboardModel _dashboard = DashboardModel(); + + Future getDashboard() async { + hasError = false; + await baseAppClient.post( + GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + _dashboardItemsList.clear(); + response['listDoctorDashboarKPI'].forEach((v) { + _dashboardItemsList.add(DashboardModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + // "VidaAuthTokenID": + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" + }, + ); + } +} diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart new file mode 100644 index 00000000..1a641d1f --- /dev/null +++ b/lib/core/service/labs_service.dart @@ -0,0 +1,136 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/request_patient_lab_special_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/request_send_lab_report_email.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import 'base/base_service.dart'; + +class LabsService extends BaseService { + List patientLabOrdersList = List(); + + Future getPatientLabOrdersList(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.postPatient(GET_Patient_LAB_ORDERS, patient: patient, + onSuccess: (dynamic response, int statusCode) { + patientLabOrdersList.clear(); + response['ListPLO'].forEach((hospital) { + patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + RequestPatientLabSpecialResult _requestPatientLabSpecialResult = + RequestPatientLabSpecialResult(); + + List patientLabSpecialResult = List(); + List labResultList = List(); + List labOrdersResultsList = List(); + + Future getLaboratoryResult( + {String projectID, + int clinicID, + String invoiceNo, + String orderNo, + PatiantInformtion patient}) async { + hasError = false; + _requestPatientLabSpecialResult.projectID = projectID; + _requestPatientLabSpecialResult.clinicID = clinicID; + _requestPatientLabSpecialResult.invoiceNo = invoiceNo; + _requestPatientLabSpecialResult.orderNo = orderNo; + + await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + patientLabSpecialResult.clear(); + response['ListPLSR'].forEach((hospital) { + patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPatientLabSpecialResult.toJson()); + } + + Future getPatientLabResult({PatientLabOrders patientLabOrder,PatiantInformtion patient}) async { + hasError = false; + Map body = Map(); + body['InvoiceNo'] = patientLabOrder.invoiceNo; + body['OrderNo'] = patientLabOrder.orderNo; + body['isDentalAllowedBackend'] = false; + body['SetupID'] = patientLabOrder.setupID; + body['ProjectID'] = patientLabOrder.projectID; + body['ClinicID'] = patientLabOrder.clinicID; + await baseAppClient.postPatient(GET_Patient_LAB_RESULT, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + patientLabSpecialResult.clear(); + labResultList.clear(); + response['ListPLR'].forEach((lab) { + labResultList.add(LabResult.fromJson(lab)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientLabOrdersResults( + {PatientLabOrders patientLabOrder, String procedure,PatiantInformtion patient}) async { + hasError = false; + Map body = Map(); + body['InvoiceNo'] = patientLabOrder.invoiceNo; + body['OrderNo'] = patientLabOrder.orderNo; + body['isDentalAllowedBackend'] = false; + body['SetupID'] = patientLabOrder.setupID; + body['ProjectID'] = patientLabOrder.projectID; + body['ClinicID'] = patientLabOrder.clinicID; + body['Procedure'] = procedure; + await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + labOrdersResultsList.clear(); + response['ListPLR'].forEach((lab) { + labOrdersResultsList.add(LabOrderResult.fromJson(lab)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + RequestSendLabReportEmail _requestSendLabReportEmail = + RequestSendLabReportEmail(); + + Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async { + // _requestSendLabReportEmail.projectID = patientLabOrder.projectID; + // _requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo; + // _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; + // _requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription; + // _requestSendLabReportEmail.patientName = user.firstName +" "+ user.lastName; + // _requestSendLabReportEmail.patientIditificationNum = + // user.patientIdentificationNo; + // _requestSendLabReportEmail.dateofBirth = user.dateofBirth; + // _requestSendLabReportEmail.to = user.emailAddress; + // _requestSendLabReportEmail.orderDate = '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}'; + // _requestSendLabReportEmail.patientMobileNumber = user.mobileNumber; + // _requestSendLabReportEmail.projectName = patientLabOrder.projectName; + // _requestSendLabReportEmail.setupID = user.setupID; + // + // await baseAppClient.post(SEND_LAB_RESULT_EMAIL, + // onSuccess: (dynamic response, int statusCode) { + // + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: _requestSendLabReportEmail.toJson()); + } +} diff --git a/lib/core/service/medical_file_service.dart b/lib/core/service/medical_file_service.dart new file mode 100644 index 00000000..f1ab6dcd --- /dev/null +++ b/lib/core/service/medical_file_service.dart @@ -0,0 +1,30 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_request_model.dart'; +import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class MedicalFileService extends BaseService { + List _medicalFileList = List(); + List get medicalFileList => _medicalFileList; + + MedicalFileRequestModel _fileRequestModel = MedicalFileRequestModel( + //patientMRN: 1231755, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU", + ); + + Future getMedicalFile({int mrn}) async { + _fileRequestModel = MedicalFileRequestModel(patientMRN: mrn); + hasError = false; + _medicalFileList.clear(); + await baseAppClient.post(GET_MEDICAL_FILE, + onSuccess: (dynamic response, int statusCode) { + _medicalFileList + .add(MedicalFileModel.fromJson(response['PatientFileList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _fileRequestModel.toJson()); + } +} diff --git a/lib/core/service/medicine_service.dart b/lib/core/service/medicine_service.dart index df23172f..5c716d6d 100644 --- a/lib/core/service/medicine_service.dart +++ b/lib/core/service/medicine_service.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; import 'package:doctor_app_flutter/models/pharmacies/pharmacies_List_request_model.dart'; import 'package:doctor_app_flutter/models/pharmacies/pharmacies_items_request_model.dart'; @@ -9,14 +11,16 @@ class MedicineService extends BaseService { var _pharmaciesList = []; get pharmacyItemsList => _pharmacyItemsList; get pharmaciesList => _pharmaciesList; + String searchText=''; + List patientAssessmentList = []; PharmaciesItemsRequestModel _itemsRequestModel = PharmaciesItemsRequestModel(); PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); - Future getMedicineItem(String itemName) async { _itemsRequestModel.pHRItemName = itemName; + searchText =itemName; await baseAppClient.post( PHARMACY_ITEMS_URL, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/patient-admission-request-service.dart b/lib/core/service/patient-admission-request-service.dart new file mode 100644 index 00000000..093c4066 --- /dev/null +++ b/lib/core/service/patient-admission-request-service.dart @@ -0,0 +1,233 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class AdmissionRequestService extends LookupService { + List clinicList = []; + List doctorsList = []; + List specialityList = []; + List floorList = []; + List wardList = []; + List roomCategoryList = []; + List diagnosisTypesList = []; + List allergiesLookupList = []; + List dietTypesList = []; + List icdCodes = []; + + + setSpecialityList() { + specialityList.clear(); + listOfSpeciality.forEach((element) { + specialityList.add(element.toJson()); + }); + } + + setAllergies() { + allergiesLookupList.clear(); + allergiesList.forEach((element) { + allergiesLookupList.add(element.toJson()); + }); + } + + Future getDoctorsList(int clinicId) async { + hasError = false; + + Map body = Map(); + body['ClinicID'] = clinicId; + + await baseAppClient.post( + PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = []; + doctorsList = response['List_Doctors_All']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future getClinics() async { + hasError = false; + + await baseAppClient.post( + GET_CLINICS, + onSuccess: (dynamic response, int statusCode) { + clinicList.clear(); + if (response['listClinics'] != null && + response['listClinics']['entityList'] != null) { + clinicList.addAll(response['listClinics']['entityList']); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getFloors() async { + hasError = false; + + await baseAppClient.post( + GET_FLOORS, + onSuccess: (dynamic response, int statusCode) { + floorList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + floorList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getWardList() async { + hasError = false; + + await baseAppClient.post( + GET_WARDS, + onSuccess: (dynamic response, int statusCode) { + wardList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + // wardList.add(WardModel.fromJson(v)); + wardList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getRoomCategories() async { + hasError = false; + + await baseAppClient.post( + GET_ROOM_CATEGORIES, + onSuccess: (dynamic response, int statusCode) { + roomCategoryList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + roomCategoryList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getDiagnosisTypesList() async { + hasError = false; + + await baseAppClient.post( + GET_DIAGNOSIS_TYPES, + onSuccess: (dynamic response, int statusCode) { + diagnosisTypesList.clear(); + if (response['AdmissionDiagnosisList'] != null && + response['AdmissionDiagnosisList']['entityList'] != null) { + response['AdmissionDiagnosisList']['entityList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + diagnosisTypesList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getDietTypesList() async { + hasError = false; + + await baseAppClient.post( + GET_DIET_TYPES, + onSuccess: (dynamic response, int statusCode) { + dietTypesList.clear(); + if (response['DietTypeList'] != null && + response['DietTypeList']['entityList'] != null) { + response['DietTypeList']['entityList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + dietTypesList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getICDCodes(int patientMrn) async { + hasError = false; + + Map body = Map(); + body['PatientMRN'] = patientMrn; + body['isPatientDiagnosisOnly'] = true; + + await baseAppClient.post( + GET_ICD_CODES, + onSuccess: (dynamic response, int statusCode) { + icdCodes.clear(); + if (response['ICDCodesList'] != null) { + icdCodes.addAll(response['ICDCodesList']); + // response['ICDCodesList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + // icdCodes.add(v); + // }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future makeAdmissionRequest(AdmissionRequest admissionRequest) async{ + hasError = false; + + Map body = Map(); + body['AdmissionRequestViewModel'] = admissionRequest.toJson(); + + await baseAppClient.post( + POST_ADMISSION_REQUEST, + onSuccess: (dynamic response, int statusCode) { + print(response["admissionResponse"]["success"]); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + +} diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart new file mode 100644 index 00000000..3136b549 --- /dev/null +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -0,0 +1,278 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; +import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; + +import 'base/lookup-service.dart'; + +class PatientReferralService extends LookupService { + List projectsList = []; + List clinicsList = []; + List doctorsList = []; + List listMyReferredPatientModel = []; + List pendingReferralList = []; + List patientReferralList = []; + String setupID = "0"; + + Future getProjectsList() async { + hasError = false; + const url = GET_PROJECTS; + var info = { + "LanguageID": 1, + "stamp": "2020-02-26T13:51:44.111Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "", + "SessionID": "i1UJwCTSqt", + "IsLoginForDoctorApp": true, + // "MemberID": memberID + }; + dynamic localRes; + + await baseAppClient.post(url, onSuccess: (response, statusCode) async { + if (response['MessageStatus'] == 1) { + projectsList = response['ProjectInfo']; + } else { + // handel error + projectsList = ListProject; + } + }, onFailure: (String error, int statusCode) { + projectsList = ListProject; + }, body: info); + } + + Future getReferralFacilities() async { + hasError = false; + + Map body = Map(); + body['isSameBranch'] = false; + + await baseAppClient.post(GET_REFERRAL_FACILITIES, onSuccess: (response, statusCode) async { + projectsList = response['ProjectInfo']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getProjectInfo(int projectId) async { + Map body = Map(); + body['ProjectID'] = projectId; + + await baseAppClient.post( + PROJECT_GET_INFO, + onSuccess: (dynamic response, int statusCode) { + setupID = response['ProjectInfo'][0]['facilityGroupId']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future getClinicsList(int projectId) async { + hasError = false; + ClinicByProjectIdRequest _clinicByProjectIdRequest = + ClinicByProjectIdRequest(); + _clinicByProjectIdRequest.projectID = projectId; + + await baseAppClient.post( + PATIENT_GET_CLINIC_BY_PROJECT_URL, + onSuccess: (dynamic response, int statusCode) { + clinicsList = []; + clinicsList = response['List_Clinic_All']; + print(response['List_Clinic_All']); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _clinicByProjectIdRequest.toJson(), + ); + } + + Future getDoctorsList(String clinicId) async { + hasError = false; + DoctorsByClinicIdRequest _doctorsByClinicIdRequest = + DoctorsByClinicIdRequest(); + + _doctorsByClinicIdRequest.clinicID = clinicId; + await baseAppClient.post( + PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = []; + doctorsList = response['List_Doctors_All']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _doctorsByClinicIdRequest.toJson(), + ); + } + + Future getMyReferredPatient() async { + hasError = false; + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + await baseAppClient.post( + GET_MY_REFERRED_PATIENT, + onSuccess: (dynamic response, int statusCode) { + listMyReferredPatientModel.clear(); + + response['List_MyReferredPatient'].forEach((v) { + MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); + if (doctorProfile != null) { + item.isReferralDoctorSameBranch = + doctorProfile.projectID == item.projectId; + } else { + item.isReferralDoctorSameBranch = false; + } + listMyReferredPatientModel.add(item); + }); + // print(response['List_MyReferredPatient']); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestMyReferralPatient.toJson(), + ); + } + + Future getPendingReferralList() async { + hasError = false; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + Map body = Map(); + body['ClinicID'] = 0; + body['DoctorID'] = doctorProfile.doctorID; + + await baseAppClient.post( + GET_PENDING_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + pendingReferralList.clear(); + + response['PendingReferralList'].forEach((v) { + PendingReferral item = PendingReferral.fromJson(v); + item.isReferralDoctorSameBranch = + item.targetProjectId == item.sourceProjectId; + pendingReferralList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future getPatientReferral(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + + await baseAppClient.post( + GET_PATIENT_REFERRAL, + onSuccess: (dynamic response, int statusCode) { + patientReferralList.clear(); + + response['ReferralList']['entityList'].forEach((v) { + PendingReferral item = PendingReferral.fromJson(v); + item.isReferralDoctorSameBranch = + item.targetProjectId == item.sourceProjectId; + patientReferralList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + patientReferralList.clear(); + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + hasError = false; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + Map body = Map(); + body['PatientMRN'] = pendingReferral.patientID; + body['AppointmentNo'] = pendingReferral.targetAppointmentNo; + body['SetupID'] = pendingReferral.targetSetupID; + body['ProjectID'] = pendingReferral.targetProjectId; + body['IsAccepted'] = isAccepted; + body['PatientName'] = pendingReferral.patientName; + body['ReferralResponse'] = pendingReferral.remarksFromSource; + body['DoctorName'] = doctorProfile.doctorName; + + await baseAppClient.post( + RESPONSE_PENDING_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + print(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + + Future makeReferral( + PatiantInformtion patient, + String isoStringDate, + int projectID, + int clinicID, + int doctorID, + String remarks) async { + hasError = false; + Map body = Map(); + + List physiotheraphyGoalsList = []; + listOfPhysiotherapyGoals.forEach((element) { + physiotheraphyGoalsList + .add({"goalId": element.id, "remarks": element.remarks}); + }); + + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['SetupID'] = setupID; + body['appointmentDate'] = isoStringDate; + body['SlotStart'] = isoStringDate; + body['SlotEnd'] = isoStringDate; + body['Remarks'] = remarks; + body['ProjectID'] = projectID; + body['ClinicID'] = clinicID; + body['DoctorID'] = doctorID; + body['noOfSessions'] = 1; + body['physiotheraphyGoalsList'] = physiotheraphyGoalsList; + + await baseAppClient.post( + CREATE_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + print(response.toString()); + print("create referral status code = ${statusCode}"); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } +} diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart new file mode 100644 index 00000000..90a45ee2 --- /dev/null +++ b/lib/core/service/patient-ucaf-service.dart @@ -0,0 +1,140 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; + +class UcafService extends LookupService { + + List patientChiefComplaintList = []; + VitalSignData patientVitalSigns; + List patientAssessmentList = []; + List orderProcedureList = []; + PrescriptionModel prescriptionList; + + Future getPatientChiefComplaint(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + body['DoctorID'] = ""; + + await baseAppClient.post (GET_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + // body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if(response['VitalSignsList'] != null){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } + + Future getPatientAssessment(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post (GET_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescription(PatiantInformtion patient) async { + hasError = false; + + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + hasError = false; + prescriptionList = null; + await baseAppClient.post(GET_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + prescriptionList = PrescriptionModel.fromJson(response['PrescriptionList']); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getOrderProcedures(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post (GET_ORDER_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + orderProcedureList.clear(); + response['OrderedProcedureList']['entityList'].forEach((v) { + orderProcedureList.add(OrderProcedure.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future postUCAF(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + + await baseAppClient.post (POST_UCAF, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart new file mode 100644 index 00000000..75bc955f --- /dev/null +++ b/lib/core/service/patient-vital-signs-service.dart @@ -0,0 +1,71 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; + +class VitalSignsService extends BaseService { + VitalSignData patientVitalSigns; + List patientVitalSignsHistory = []; + + Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if (response['VitalSignsList'] != null) { + if (response['VitalSignsList']['entityList'] != null && + (response['VitalSignsList']['entityList'] as List).length > 0) { + patientVitalSigns = VitalSignData.fromJson( + response['VitalSignsList']['entityList'][0]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } + + Future getPatientVitalSignsHistory( + PatiantInformtion patient, String fromDate, String toDate) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientId; // patient.patientMRN + // body['AppointmentNo'] = patient.appointmentNo; + // body['EpisodeID'] = patient.episodeNo; + body['PatientTypeID'] = 1; + body['PatientType'] = 1; + body['DeviceTypeID'] = 1; + body['isDentalAllowedBackend'] = false; + body['From'] = fromDate; + body['To'] = toDate; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + patientVitalSignsHistory.clear(); + if (response['VitalSignsHistory'] != null) { + response['VitalSignsHistory'].forEach((v) { + patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v)); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } +} diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index b16753f5..477d9d80 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequency_request.dart'; @@ -62,6 +63,10 @@ class PatientService extends BaseService { // TODO: replace var with model var _doctorsList = []; + var _arrivedList = []; + + get arrivedList => _arrivedList; + get doctorsList => _doctorsList; // TODO: replace var with model @@ -82,15 +87,18 @@ class PatientService extends BaseService { ClinicByProjectIdRequest(); ReferToDoctorRequest _referToDoctorRequest; - RequestSchedule _requestSchedule = RequestSchedule(); - - Future getPatientList(PatientModel patient, patientType) async { + Future getPatientList(patient, patientType, {isView}) async { hasError = false; int val = int.parse(patientType); - + var url; + if (isView == false && patientType == '1') { + url = PRM_SEARCH_PATIENT; + } else { + url = GET_PATIENT + SERVICES_PATIANT[val]; + } dynamic localRes; await baseAppClient.post( - GET_PATIENT + SERVICES_PATIANT[val], + url, onSuccess: (dynamic response, int statusCode) { localRes = response; }, @@ -98,28 +106,32 @@ class PatientService extends BaseService { hasError = true; super.error = error; }, - body: { - "ProjectID": patient.ProjectID, - "ClinicID": patient.ClinicID, - "DoctorID": patient.DoctorID, - "FirstName": patient.FirstName, - "MiddleName": patient.MiddleName, - "LastName": patient.LastName, - "PatientMobileNumber": patient.PatientMobileNumber, - "PatientIdentificationID": patient.PatientIdentificationID, - "PatientID": patient.PatientID, - "From": patient.From, - "To": patient.To, - "LanguageID": patient.LanguageID, - "stamp": patient.stamp, - "IPAdress": patient.IPAdress, - "VersionID": patient.VersionID, - "Channel": patient.Channel, - "TokenID": patient.TokenID, - "SessionID": patient.SessionID, - "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, - "PatientOutSA": patient.PatientOutSA - }, + body: val == 7 + ? patient + : { + "ProjectID": patient.ProjectID, + "ClinicID": patient.ClinicID, + "DoctorID": patient.DoctorID, + "FirstName": patient.FirstName, + "MiddleName": patient.MiddleName, + "LastName": patient.LastName, + "PatientMobileNumber": patient.PatientMobileNumber, + "PatientIdentificationID": patient.PatientIdentificationID, + "PatientID": patient.PatientID, + "From": patient.From, + "To": patient.To, + "LanguageID": patient.LanguageID, + "stamp": patient.stamp, + "IPAdress": patient.IPAdress, + "VersionID": patient.VersionID, + "Channel": patient.Channel, + "TokenID": patient.TokenID, + "SessionID": patient.SessionID, + "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, + "PatientOutSA": patient.PatientOutSA, + "SearchType": patient.Searchtype, + "MobileNo": '' + }, ); return Future.value(localRes); @@ -276,7 +288,7 @@ class PatientService extends BaseService { ); } - Future getPatientInsuranceApprovals(patient) async { + Future getPatientInsuranceApprovals(patient) async { hasError = false; await baseAppClient.post( @@ -293,7 +305,7 @@ class PatientService extends BaseService { ); } - Future getPatientProgressNote(patient) async { + Future getPatientProgressNote(patient) async { hasError = false; await baseAppClient.post( @@ -310,7 +322,6 @@ class PatientService extends BaseService { ); } - Future getClinicsList() async { hasError = false; @@ -328,7 +339,6 @@ class PatientService extends BaseService { ); } - Future getReferralFrequancyList() async { hasError = false; @@ -363,19 +373,19 @@ class PatientService extends BaseService { ); } - // TODO send the total model insted of each parameter - Future referToDoctor({String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + Future referToDoctor( + {String selectedDoctorID, + String selectedClinicID, + int admissionNo, + String extension, + String priority, + String frequency, + String referringDoctorRemarks, + int patientID, + int patientTypeID, + String roomID, + int projectID}) async { hasError = false; // TODO Change it to use it when we implement authentication user Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -409,4 +419,21 @@ class PatientService extends BaseService { body: _referToDoctorRequest.toJson(), ); } + + Future getArrivedList() async { + hasError = false; + + await baseAppClient.post( + ARRIVED_PATIENT_URL, + onSuccess: (dynamic response, int statusCode) { + _arrivedList = []; + _arrivedList = response['"patientArrivalList": ']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _doctorsByClinicIdRequest.toJson(), + ); + } } diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart new file mode 100644 index 00000000..758f4595 --- /dev/null +++ b/lib/core/service/prescription_service.dart @@ -0,0 +1,289 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/item_by_medicine_request_model.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class PrescriptionService extends LookupService { + List _prescriptionList = List(); + List get prescriptionList => _prescriptionList; + List _drugsList = List(); + List get drugsList => _drugsList; + List doctorsList = []; + List allMedicationList = []; + List specialityList = []; + List drugToDrug = []; + List get drugToDrugList => drugToDrug; + List itemMedicineList = []; + List itemMedicineListRoute = []; + List itemMedicineListUnit = []; + dynamic boxQuantity; + + PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); + ItemByMedicineRequestModel _itemByMedicineRequestModel = + ItemByMedicineRequestModel(); + SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( + //search: ["Acetaminophen"], + search: ["Amoxicillin"], + ); + + CalculateBoxQuantityRequestModel _boxQuantityRequestModel = + CalculateBoxQuantityRequestModel(); + + PostPrescriptionReqModel _postPrescriptionReqModel = + PostPrescriptionReqModel(); + + Future getItem({int itemID}) async { + _itemByMedicineRequestModel = + ItemByMedicineRequestModel(medicineCode: itemID); + + hasError = false; + + await baseAppClient.post(GET_ITEM_BY_MEDICINE, + onSuccess: (dynamic response, int statusCode) { + itemMedicineList = []; + itemMedicineList = response['listItemByMedicineCode']['frequencies']; + itemMedicineListRoute = response['listItemByMedicineCode']['routes']; + itemMedicineListUnit = response['listItemByMedicineCode']['strengths']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _itemByMedicineRequestModel.toJson()); + } + + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + hasError = false; + await baseAppClient.post(GET_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getAssessmentReqModel.toJson()); + } + + Future getPrescription({int mrn}) async { + _prescriptionReqModel = PrescriptionReqModel( + patientMRN: mrn, + ); + hasError = false; + _prescriptionList.clear(); + await baseAppClient.post(GET_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + _prescriptionList + .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _prescriptionReqModel.toJson()); + } + + Future getDrugs({String drugName}) async { + _drugRequestModel = SearchDrugRequestModel(search: [drugName]); + + hasError = false; + + await baseAppClient.post(SEARCH_DRUG, + onSuccess: (dynamic response, int statusCode) { + doctorsList = []; + doctorsList = response['MedicationList']['entityList']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } + + Future getMedicationList() async { + hasError = false; + _drugRequestModel.search = [""]; + await baseAppClient.post(SEARCH_DRUG, + onSuccess: (dynamic response, int statusCode) { + allMedicationList = []; + response['MedicationList']['entityList'].forEach((v) { + allMedicationList.add(GetMedicationResponseModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } + + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel) async { + hasError = false; + //_prescriptionList.clear(); + await baseAppClient.post( + POST_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: postProcedureReqModel.toJson(), + ); + } + + Future updatePrescription( + PostPrescriptionReqModel updatePrescriptionReqModel) async { + hasError = false; + //_prescriptionList.clear(); + await baseAppClient.post( + UPDATE_PRESCRIPTION, + onSuccess: (dynamic response, int statusCode) { + print("Accepted"); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: updatePrescriptionReqModel.toJson(), + ); + } + + Future getDrugToDrug( + VitalSignData vital, + List lstAssessments, + List allergy, + PatiantInformtion patient, + List prescription) async { + // Map request = { + // "Prescription": { + // "objPatientInfo": {"Gender": "Male", "Age": "21/06/1967"}, + // "objVitalSign": {"Height": "180", "Weight": "37"}, + // "objPrescriptionItems": [ + // { + // "DrugId": "83-20-00-30-20-03-03", + // "DrugName": "WARFARIN 1 MG TAB 28'S (N)", + // "Dose": "1", + // "DoseType": "04", + // "Unit": "actuation(s)", + // "FrequencyType": "1/3/Day", + // "Duration": "3/Day", + // "IsScreen": "true" + // }, + // { + // "DrugId": "64-20-00-10-00-03-15", + // "DrugName": "PANADOL 500 MG TAB 24'S(DIS)", + // "Dose": "1", + // "DoseType": "04", + // "Unit": "MG", + // "FrequencyType": "3/1/Day", + // "Duration": "4/Day", + // "RouteID": "24", + // "IsScreen": "true" + // } + // ], + // "objAllergies": { + // "Allergy": { + // "objProperties": {"Id": "26", "Name": "phenoxymethylpenicillin"} + // } + // }, + // "objDiagnosis": { + // "Diagnosis": { + // "objProperties": {"Id": "A01.1", "Name": "Paratyphoid fever A"} + // } + // }, + // "IsDoctor": "false", + // "IsPharmacist": "false" + // }, + // "IPAdress": "10.10.10.10", + // "Channel": 9, + // "LanguageID": 2, + // "VersionID": 5.3, + // "SessionID": "BlUSkYymTt", + // "IsLoginForDoctorApp": true, + // "PatientOutSA": 0, + // "TokenID": "@dm!n", + // "OutSA": true + // }; + Map request = { + "Prescription": { + "objPatientInfo": { + "Gender": patient.gender == 1 ? 'Male' : 'Female', + "Age": DateUtils.convertDateFromServerFormat( + patient.dateofBirth, 'dd/MM/yyyy') + }, + "objVitalSign": {"Height": vital?.heightCm, "Weight": vital?.weightKg}, + "objPrescriptionItems": prescription, + "objAllergies": getAllergiesObj(allergy), + "objDiagnosis": getDiagnosisObj(lstAssessments), + "IsDoctor": "false", + "IsPharmacist": "false" + } + }; + + hasError = false; + await baseAppClient.post(DRUG_TO_DRUG, + onSuccess: (dynamic response, int statusCode) { + drugToDrug = []; + drugToDrug = + response['DrugToDrugResponse']['objPrescriptionCheckerResult']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + Future calculateBoxQuantity( + {int freq, int duration, int itemCode, double strength}) async { + _boxQuantityRequestModel = CalculateBoxQuantityRequestModel( + frequency: freq, + duration: duration, + itemCode: itemCode, + strength: strength); + + hasError = false; + + await baseAppClient.post(GET_BOX_QUANTITY, + onSuccess: (dynamic response, int statusCode) { + boxQuantity = response['BoxQuantity']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _boxQuantityRequestModel.toJson()); + } + + getAllergiesObj(List allergies) { + var allergiesObj = []; + allergies.forEach((element) { + allergiesObj.add({ + "objProperties": { + 'Id': element.allergyDiseaseId, + 'Name': element.allergyDiseaseName + } + }); + }); + return allergiesObj; + } + + getDiagnosisObj(List lstAssessments) { + var lstAssessmentsObj = []; + lstAssessments.forEach((element) { + lstAssessmentsObj.add({ + "objProperties": {'Id': element.icdCode10ID, 'Name': element.asciiDesc} + }); + }); + return lstAssessmentsObj; + } +} diff --git a/lib/core/service/prescriptions_service.dart b/lib/core/service/prescriptions_service.dart new file mode 100644 index 00000000..c720eec9 --- /dev/null +++ b/lib/core/service/prescriptions_service.dart @@ -0,0 +1,182 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:flutter/cupertino.dart'; + +import 'base/base_service.dart'; + +class PrescriptionsService extends BaseService { + List prescriptionsList = List(); + List prescriptionsOrderList = List(); + + Future getPrescriptions(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.postPatient(PRESCRIPTIONS,patient: patient, + onSuccess: (dynamic response, int statusCode) { + prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((prescriptions) { + prescriptionsList.add(Prescriptions.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + RequestPrescriptionReport _requestPrescriptionReport = + RequestPrescriptionReport( + appointmentNo: 0, isDentalAllowedBackend: false); + List prescriptionReportList = List(); + + Future getPrescriptionReport({Prescriptions prescriptions,@required PatiantInformtion patient}) async { + hasError = false; + _requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo; + _requestPrescriptionReport.projectID = prescriptions.projectID; + _requestPrescriptionReport.clinicID = prescriptions.clinicID; + _requestPrescriptionReport.setupID = prescriptions.setupID; + _requestPrescriptionReport.episodeID = prescriptions.episodeID; + _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; + + await baseAppClient.postPatient( + prescriptions.isInOutPatient + ? GET_PRESCRIPTION_REPORT_ENH + : GET_PRESCRIPTION_REPORT_NEW, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + prescriptionReportList.clear(); + prescriptionReportEnhList.clear(); + if (prescriptions.isInOutPatient) { + response['ListPRM'].forEach((prescriptions) { + prescriptionReportList + .add(PrescriptionReport.fromJson(prescriptions)); + prescriptionReportEnhList + .add(PrescriptionReportEnh.fromJson(prescriptions)); + }); + } else { + response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { + prescriptionReportList + .add(PrescriptionReport.fromJson(prescriptions)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptionReport.toJson()); + } + + RequestGetListPharmacyForPrescriptions + requestGetListPharmacyForPrescriptions = + RequestGetListPharmacyForPrescriptions( + latitude: 0, + longitude: 0, + isDentalAllowedBackend: false, + ); + List pharmacyPrescriptionsList = List(); + + Future getListPharmacyForPrescriptions({int itemId,@required PatiantInformtion patient}) async { + hasError = false; + requestGetListPharmacyForPrescriptions.itemID = itemId; + await baseAppClient.postPatient(GET_PHARMACY_LIST, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + pharmacyPrescriptionsList.clear(); + response['PharmList'].forEach((prescriptions) { + pharmacyPrescriptionsList + .add(PharmacyPrescriptions.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: requestGetListPharmacyForPrescriptions.toJson()); + } + + RequestPrescriptionReportEnh _requestPrescriptionReportEnh = + RequestPrescriptionReportEnh( + isDentalAllowedBackend: false, + ); + + List prescriptionReportEnhList = List(); + + Future getPrescriptionReportEnh( + {PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async { + ///This logic copy from the old app from class [order-history.component.ts] in line 45 + bool isInPatient = false; + prescriptionsList.forEach((element) { + if (prescriptionsOrder.appointmentNo == "0") { + if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) { + _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; + _requestPrescriptionReportEnh.clinicID = element.clinicID; + _requestPrescriptionReportEnh.projectID = element.projectID; + _requestPrescriptionReportEnh.episodeID = element.episodeID; + _requestPrescriptionReportEnh.setupID = element.setupID; + _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; + isInPatient = element.isInOutPatient; + } + } else { + if (int.parse(prescriptionsOrder.appointmentNo) == + element.appointmentNo) { + _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; + _requestPrescriptionReportEnh.clinicID = element.clinicID; + _requestPrescriptionReportEnh.projectID = element.projectID; + _requestPrescriptionReportEnh.episodeID = element.episodeID; + _requestPrescriptionReportEnh.setupID = element.setupID; + _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; + isInPatient = element.isInOutPatient; + + ///call inpGetPrescriptionReport + } + } + }); + + hasError = false; + + await baseAppClient.postPatient( + isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + prescriptionReportEnhList.clear(); + + if (isInPatient) { + response['ListPRM'].forEach((prescriptions) { + prescriptionReportEnhList + .add(PrescriptionReportEnh.fromJson(prescriptions)); + }); + } else { + response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { + PrescriptionReportEnh reportEnh = + PrescriptionReportEnh.fromJson(prescriptions); + reportEnh.itemDescription = prescriptions['ItemDescriptionN']; + prescriptionReportEnhList.add(reportEnh); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptionReportEnh.toJson()); + } + Future getPrescriptionsOrders() async { + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, + onSuccess: (dynamic response, int statusCode) { + prescriptionsOrderList.clear(); + response['PatientER_GetPatientAllPresOrdersList'] + .forEach((prescriptionsOrder) { + prescriptionsOrderList + .add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart new file mode 100644 index 00000000..f61166b9 --- /dev/null +++ b/lib/core/service/procedure_service.dart @@ -0,0 +1,139 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +import 'package:flutter/foundation.dart'; + +class ProcedureService extends BaseService { + List _procedureList = List(); + List get procedureList => _procedureList; + List _valadteProcedureList = List(); + List get valadteProcedureList => _valadteProcedureList; + List _categoriesList = List(); + List get categoriesList => _categoriesList; + List procedureslist = List(); + List categoryList = []; + + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = + GetOrderedProcedureRequestModel(); + + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( + // clinicId: 17, + // pageSize: 10, + // pageIndex: 1, + // //patientMRN: 3120725, + // //categoryId: null, + // vidaAuthTokenID: + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", + // + // search: ["lab"], + ); + + GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel( + clinicId: 0, + pageSize: 100, + pageIndex: 1, + patientMRN: 0, + //categoryId: null, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", + + //search: ["DENTAL"], + ); + + Future getProcedure({int mrn}) async { + _getOrderedProcedureRequestModel = + GetOrderedProcedureRequestModel(patientMRN: mrn); + hasError = false; + _procedureList.clear(); + await baseAppClient.post(GET_PROCEDURE_LIST, + onSuccess: (dynamic response, int statusCode) { + _procedureList.add( + GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getOrderedProcedureRequestModel.toJson()); + } + + Future getCategory() async { + hasError = false; + + await baseAppClient.post(GET_LIST_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + categoryList = []; + categoryList = response['listProcedureCategories']['entityList']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + Future getProcedureCategory({String categoryName, String categoryID}) async { + _getProcedureCategoriseReqModel = GetProcedureReqModel( + search: [categoryName], + patientMRN: 0, + pageIndex: 0, + clinicId: 0, + pageSize: 0, + category: categoryID ?? "01", + ); + hasError = false; + _categoriesList.clear(); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + _categoriesList + .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getProcedureCategoriseReqModel.toJson()); + } + + Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { + hasError = false; + _procedureList.clear(); + await baseAppClient.post(POST_PROCEDURE_LIST, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postProcedureReqModel.toJson()); + } + + Future updateProcedure( + UpdateProcedureRequestModel updateProcedureRequestModel) async { + hasError = false; + _procedureList.clear(); + await baseAppClient.post(UPDATE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + print("ACCEPTED"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updateProcedureRequestModel.toJson()); + } + + Future valadteProcedure( + ProcedureValadteRequestModel procedureValadteRequestModel) async { + hasError = false; + _valadteProcedureList.clear(); + await baseAppClient.post(GET_PROCEDURE_VALIDATION, + onSuccess: (dynamic response, int statusCode) { + _valadteProcedureList.add( + ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: procedureValadteRequestModel.toJson()); + } +} diff --git a/lib/core/service/radiology_service.dart b/lib/core/service/radiology_service.dart new file mode 100644 index 00000000..9c1f5a60 --- /dev/null +++ b/lib/core/service/radiology_service.dart @@ -0,0 +1,48 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; +import 'package:doctor_app_flutter/core/model/radiology/request_send_rad_report_email.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:flutter/cupertino.dart'; + +import 'base/base_service.dart'; + +class RadiologyService extends BaseService { + List finalRadiologyList = List(); + String url = ''; + + Future getRadImageURL({int invoiceNo, int lineItem, int projectId,@required PatiantInformtion patient}) async { + hasError = false; + final Map body = new Map(); + body['InvoiceNo'] = invoiceNo; + body['LineIt emNo'] = lineItem; + body['ProjectID'] = projectId; + + await baseAppClient.postPatient(GET_RAD_IMAGE_URL, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + url = response['Data']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientRadOrders(PatiantInformtion patient) async { + hasError = false; + await baseAppClient.postPatient(GET_PATIENT_ORDERS, + patient: patient, + onSuccess: (dynamic response, int statusCode) { + finalRadiologyList.clear(); + response['FinalRadiologyList'].forEach((radiology) { + finalRadiologyList.add(FinalRadiology.fromJson(radiology)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + + + +} diff --git a/lib/core/service/referral_patient_service.dart b/lib/core/service/referral_patient_service.dart index 088e40ca..e3ca6fae 100644 --- a/lib/core/service/referral_patient_service.dart +++ b/lib/core/service/referral_patient_service.dart @@ -24,6 +24,7 @@ class ReferralPatientService extends BaseService { response['List_MyReferralPatient'].forEach((v) { listMyReferralPatientModel.add(MyReferralPatientModel.fromJson(v)); }); + print(response['List_MyReferralPatient']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/referred_patient_service.dart b/lib/core/service/referred_patient_service.dart index 0fb3de64..7285d904 100644 --- a/lib/core/service/referred_patient_service.dart +++ b/lib/core/service/referred_patient_service.dart @@ -11,8 +11,6 @@ class ReferredPatientService extends BaseService { List get listMyReferredPatientModel => _listMyReferredPatientModel; - Helpers helpers = Helpers(); - RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = @@ -26,6 +24,7 @@ class ReferredPatientService extends BaseService { response['List_MyReferredPatient'].forEach((v) { listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); }); + // print(response['List_MyReferredPatient']); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart new file mode 100644 index 00000000..8a5babd5 --- /dev/null +++ b/lib/core/service/sickleave_service.dart @@ -0,0 +1,220 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +// import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; + +class SickLeaveService extends BaseService { + Map get sickLeavestatisitics => _statistics; + Map _statistics = {}; + List get getOffTimeList => offTime; + List offTime = []; + List get getReasons => reasonse; + List reasonse = []; + List get getAllSickLeave => _getAllsickLeave; + List _getAllsickLeave = []; + List get coveringDoctorsList => _coveringDoctors; + List _coveringDoctors = []; + + List get getAllRescheduleLeave => + _getReScheduleLeave; + List _getReScheduleLeave = []; + dynamic get postReschedule => _postReschedule; + dynamic _postReschedule; + + dynamic get sickLeaveResponse => _sickLeaveResponse; + dynamic _sickLeaveResponse; + Future getStatistics(appoNo, patientMRN) async { + hasError = false; + await baseAppClient.post( + GET_SICKLEAVE_STATISTIC, + onSuccess: (dynamic response, int statusCode) { + print(response); + _statistics = {}; + _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"PatientMRN": patientMRN, "AppointmentNo": appoNo}, + ); + } + + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + // addSickLeaveRequest.appointmentNo = '2016054661'; + // addSickLeaveRequest.patientMRN = '3120746'; + hasError = false; + await baseAppClient.post( + ADD_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + _sickLeaveResponse = response; + return Future.value(response); + }, + onFailure: (String error, int statusCode) { + DrAppToastMsg.showErrorToast(error); + // hasError = true; + // super.error = error; + }, + body: addSickLeaveRequest.toJson(), + ); + } + + Future extendSickLeave(GetAllSickLeaveResponse request) async { + var extendSickLeaveRequest = ExtendSickLeaveRequest(); + extendSickLeaveRequest.patientMRN = + request.patientMRN.toString(); //'3120746'; + extendSickLeaveRequest.previousRequestNo = request.requestNo.toString(); + extendSickLeaveRequest.noOfDays = request.noOfDays.toString(); + extendSickLeaveRequest.remarks = request.remarks; + hasError = false; + await baseAppClient.post( + EXTEND_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + _sickLeaveResponse = response; + return Future.value(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: extendSickLeaveRequest.toJson(), + ); + } + + Future getSickLeave(patientMRN) async { + hasError = false; + await baseAppClient.post( + GET_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getAllsickLeave.clear(); + response['SickLeavesList']['entityList'].forEach((v) { + _getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'PatientMRN': patientMRN, "Status": 0}, + ); + } + + Future getRescheduleLeave() async { + hasError = false; + await baseAppClient.post( + GET_RESCHEDULE_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getReScheduleLeave.clear(); + response['requisitionList']['entityList'].forEach((v) { + _getReScheduleLeave.add(GetRescheduleLeavesResponse.fromJson(v)); + }); + _getReScheduleLeave.sort((a, b) { + var adate = a.dateTimeFrom; //before -> var adate = a.date; + var bdate = b.dateTimeFrom; //var bdate = b.date; + return -adate.compareTo(bdate); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'ClinicID': 1}, + ); + } + + Future getOffTime() async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + offTime = []; + response['MasterLookUpList']['entityList'].forEach((item) => { + if (item['code'] == '1' || item['code'] == '2') + {offTime.add(item)} + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": 2013}, + ); + } + + Future getReasonsByID({id}) async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + reasonse = []; + reasonse = response['MasterLookUpList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": id ?? 18}, + ); + } + + Future getCoveringDoctors() async { + hasError = false; + + await baseAppClient.post( + GET_COVERING_DOCTORS, + onSuccess: (dynamic response, int statusCode) { + _coveringDoctors = []; + _coveringDoctors = response['coveringDoctorList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"ClinicID": 1}, + ); + } + + Future addReschedule(request) async { + hasError = false; + + await baseAppClient.post( + ADD_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + // return Future.value(response); + _postReschedule = response; + }, + onFailure: (String error, int statusCode) { + _postReschedule = null; + hasError = true; + super.error = error; + }, + body: request, + ); + } + + updateReschedule(request) async { + hasError = false; + + await baseAppClient.post( + UPDATE_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + _postReschedule = response; + // return Future.value(response); + }, + onFailure: (String error, int statusCode) { + _postReschedule = null; + hasError = true; + super.error = error; + }, + body: request, + ); + } +} diff --git a/lib/core/viewModel/InsuranceViewModel.dart b/lib/core/viewModel/InsuranceViewModel.dart new file mode 100644 index 00000000..b08469ef --- /dev/null +++ b/lib/core/viewModel/InsuranceViewModel.dart @@ -0,0 +1,31 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/insurance_approval.dart'; +import 'package:doctor_app_flutter/core/service/InsuranceCardService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; + +class InsuranceViewModel extends BaseViewModel{ + + InsuranceCardService _insuranceCardService = locator(); + + + List get insuranceApproval => + _insuranceCardService.insuranceApproval; + + Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo}) async { + error = ""; + setState(ViewState.Busy); + if (appointmentNo != null) + await _insuranceCardService.getInsuranceApproval(patient, + appointmentNo: appointmentNo); + else + await _insuranceCardService.getInsuranceApproval(patient); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModel/PatientMuseViewModel.dart b/lib/core/viewModel/PatientMuseViewModel.dart new file mode 100644 index 00000000..890b24d6 --- /dev/null +++ b/lib/core/viewModel/PatientMuseViewModel.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientMuseResultsModel.dart'; +import 'package:doctor_app_flutter/core/service/PatientMuseService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientMuseViewModel extends BaseViewModel { + + PatientMuseService _patientMuseService = locator(); + + List get patientMuseResultsModelList => _patientMuseService.patientMuseResultsModelList; + + getECGPatient({int patientType, int patientOutSA, int patientID}) async { + setState(ViewState.Busy); + await _patientMuseService.getECGPatient( + patientID: patientID, + patientOutSA: patientOutSA, + patientType: patientType); + if (_patientMuseService.hasError) { + error = _patientMuseService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart new file mode 100644 index 00000000..600a83a5 --- /dev/null +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -0,0 +1,455 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:flutter/material.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class SOAPViewModel extends BaseViewModel { + SOAPService _SOAPService = locator(); + PrescriptionService _prescriptionService = locator(); + + List get allergiesList => _SOAPService.allergiesList; + + List get allergySeverityList => + _SOAPService.allergySeverityList; + + + List get historyFamilyList => _SOAPService.historyFamilyList; + + List get historyMedicalList => _SOAPService.historyMedicalList; + + List get historySportList => _SOAPService.historySportList; + + List get historySocialList => _SOAPService.historySocialList; + + List get historySurgicalList => + _SOAPService.historySurgicalList; + + List get mergeHistorySurgicalWithHistorySportList => + [...historySurgicalList, ...historySportList]; + + List get physicalExaminationList => + _SOAPService.physicalExaminationList; + + List get listOfDiagnosisType => + _SOAPService.listOfDiagnosisType; + + List get listOfDiagnosisCondition => + _SOAPService.listOfDiagnosisCondition; + + List get listOfICD10 => _SOAPService.listOfICD10; + + List get patientChiefComplaintList => + _SOAPService.patientChiefComplaintList; + + List get patientAllergiesList => + _SOAPService.patientAllergiesList; + + List get patientHistoryList => + _SOAPService.patientHistoryList; + + List get patientPhysicalExamList => + _SOAPService.patientPhysicalExamList; + + List get patientProgressNoteList => + _SOAPService.patientProgressNoteList; + + List get patientAssessmentList => + _SOAPService.patientAssessmentList; + int get episodeID => + _SOAPService.episodeID; + + get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; + get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; + get medicationRouteList => _SOAPService.medicationRouteListWithModel; + get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel; + List get allMedicationList => + _prescriptionService.allMedicationList; + + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { + setState(ViewState.Busy); + await _SOAPService.getAllergies(getAllergiesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async { + if(isBusyLocal){ + setState(ViewState.Busy); + }else + setState(ViewState.Busy); + await _SOAPService.getMasterLookup(masterKeys); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postEpisode(postEpisodeReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postAllergy(postAllergyRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postHistories(postHistoriesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postProgressNote(postProgressNoteRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postAssessment(postAssessmentRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchAllergy(patchAllergyRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future patchHistories(PostHistoriesRequestModel patchHistoriesRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchHistories(patchHistoriesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future patchChiefComplaint(PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future patchPhysicalExam(PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future patchProgressNote(PostProgressNoteRequestModel patchProgressNoteRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchProgressNote(patchProgressNoteRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.patchAssessment(patchAssessmentRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP, + {isLocalBusy = false}) async { + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else + setState(ViewState.Busy); + await _SOAPService.getPatientAllergy(generalGetReqForSOAP); + if (_SOAPService.hasError) { + error = _SOAPService.error; + if (isLocalBusy) { + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + String getAllergicNames(isArabic) { + String allergiesString = ''; + patientAllergiesList.forEach((element) { + MasterKeyModel selectedAllergy = getOneMasterKey( + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); + if(selectedAllergy != null && element.isChecked) + allergiesString += + (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn )+ ' , '; + }); + return allergiesString; + } + + Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async { + setState(ViewState.Busy); + await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: isFirst); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientChiefComplaint( + GetChiefComplaintReqModel getChiefComplaintReqModel) async { + setState(ViewState.Busy); + await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async { + setState(ViewState.Busy); + await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientProgressNote(GetGetProgressNoteReqModel getGetProgressNoteReqModel) async { + setState(ViewState.Busy); + await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + setState(ViewState.Busy); + await _SOAPService.getPatientAssessment(getAssessmentReqModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationList() async { + setState(ViewState.Busy); + await _prescriptionService.getMedicationList(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + // ignore: missing_return + MasterKeyModel getOneMasterKey( + {@required MasterKeysService masterKeys, dynamic id, int typeId}) { + switch (masterKeys) { + case MasterKeysService.Allergies: + List result = allergiesList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + + case MasterKeysService.HistoryFamily: + List result = historyFamilyList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistoryMedical: + List result = historyMedicalList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySocial: + List result = historySocialList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySports: + List result = historySocialList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySurgical: + List result = historySurgicalList.where((element) { + return element.id == id;}).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.PhysicalExamination: + List result = physicalExaminationList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.AllergySeverity: + List result = allergySeverityList.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + // case MasterKeysService.physiotherapyGoals: + // listOfPhysiotherapyGoals.clear(); + // entryList.forEach((v) { + // listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v)); + // }); + // break; + + case MasterKeysService.DiagnosisType: + List result = listOfDiagnosisType.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.DiagnosisCondition: + List result = listOfDiagnosisCondition.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.ICD10: + List result = listOfICD10.where((element) { + return element.code == id ; + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + break; + } + } + + +} diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index 9b656d31..87b89123 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -1,4 +1,13 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/imei_details.dart'; +import 'package:doctor_app_flutter/core/model/insert_imei_model.dart'; +import 'package:doctor_app_flutter/core/service/auth_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -10,24 +19,24 @@ import '../../models/doctor/user_model.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } -class AuthViewModel with ChangeNotifier { +class AuthViewModel extends BaseViewModel { List doctorsClinicList = []; + String selectedClinicName; bool isLogin = false; bool isLoading = true; DoctorProfileModel doctorProfile; BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel){ + setDoctorProfile(DoctorProfileModel profileModel) { doctorProfile = profileModel; notifyListeners(); } - AuthViewModel() { getUserAuthentication(); } - getUserAuthentication() async { + getUserAuthentication() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -70,32 +79,53 @@ class AuthViewModel with ChangeNotifier { } } - Future insertDeviceImei(imei) async { + Future insertDeviceImei(request) async { + var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); + var user = await sharedPref.getObj(LAST_LOGIN_USER); + if (user != null) { + user = GetIMEIDetailsModel.fromJson(user); + } + request['IMEI'] = DEVICE_TOKEN; + request['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); + request['BioMetricEnabled'] = true; + request['MobileNo'] = + loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; + InsertIMEIDetailsModel nRequest = InsertIMEIDetailsModel.fromJson(request); + nRequest.genderDescription = request['Gender_Description']; + nRequest.genderDescriptionN = request['Gender_DescriptionN']; + nRequest.genderDescriptionN = request['Gender_DescriptionN']; + nRequest.titleDescription = request['Title_Description']; + nRequest.titleDescriptionN = request['Title_DescriptionN']; + nRequest.projectID = await sharedPref.getInt(PROJECT_ID); + nRequest.doctorID = loggedIn != null + ? loggedIn['List_MemberInformation'][0]['MemberID'] + : user.doctorID; + nRequest.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; + nRequest.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + nRequest.vidaRefreshTokenID = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + nRequest.password = await sharedPref.getString(PASSWORD); try { - dynamic localRes; - + var localRes; await baseAppClient.post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: imei); + }, onFailure: (String error, int statusCode) {}, body: nRequest.toJson()); return Future.value(localRes); } catch (error) { - print(error); throw error; } } - Future selectDeviceImei(imei) async { + Future sendActivationCodeByOtpNotificationType(activationCodeModel) async { try { - dynamic localRes; - await baseAppClient.post(SELECT_DEVICE_IMEI, + var localRes; + await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: imei); + }, body: activationCodeModel); return Future.value(localRes); } catch (error) { print(error); @@ -103,15 +133,16 @@ class AuthViewModel with ChangeNotifier { } } - Future sendActivationCodeByOtpNotificationType(activationCodeModel) async { + Future sendActivationCodeForDoctorApp( + ActivationCodeModel activationCodeModel) async { try { var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: activationCodeModel); + }, body: activationCodeModel.toJson()); return Future.value(localRes); } catch (error) { print(error); @@ -141,6 +172,29 @@ class AuthViewModel with ChangeNotifier { } } + Future checkActivationCodeForDoctorApp( + CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { + try { + dynamic localRes; + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + selectedClinicName = + ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; + + response['List_DoctorsClinic'].forEach((v) { + doctorsClinicList.add(new ClinicModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + throw error; + }, body: checkActivationCodeRequestModel.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } + /* *@author: Elham Rababah *@Date:17/5/2020 @@ -148,15 +202,19 @@ class AuthViewModel with ChangeNotifier { *@return:Future *@desc: getDocProfiles */ - Future getDocProfiles(docInfo) async { + Future getDocProfiles(docInfo, {bool allowChangeProfile = true}) async { try { dynamic localRes; await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; - doctorProfile = DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); - selectedClinicName = - response['DoctorProfileList'][0]['ClinicDescription']; + if(allowChangeProfile) { + doctorProfile = + DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); + selectedClinicName = + response['DoctorProfileList'][0]['ClinicDescription']; + } + }, onFailure: (String error, int statusCode) { throw error; }, body: docInfo); @@ -167,4 +225,21 @@ class AuthViewModel with ChangeNotifier { throw error; } } + + Future sendActivationCodeVerificationScreen( + ActivationCodeModel2 activationCodeModel) async { + try { + var localRes; + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 29acdd42..d8591660 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -1,17 +1,39 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DoctorProfileModel doctorProfile; + ViewState _state = ViewState.Idle; bool isInternetConnection = true; ViewState get state => _state; String error = ""; + //TODO add the user login model when we need it void setState(ViewState viewState) { _state = viewState; notifyListeners(); } + + Future getDoctorProfile() async { + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + return null; + } else { + return doctorProfile; + } + } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart new file mode 100644 index 00000000..9eb3c0fc --- /dev/null +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -0,0 +1,21 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class DashboardViewModel extends BaseViewModel { + DashboardService _dashboardService = locator(); + get dashboardItemsList => _dashboardService.dashboardItemsList; + + Future getDashboard() async { + setState(ViewState.Busy); + await _dashboardService.getDashboard(); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/hospital_view_model.dart b/lib/core/viewModel/hospital_view_model.dart index 56f03686..7865a40f 100644 --- a/lib/core/viewModel/hospital_view_model.dart +++ b/lib/core/viewModel/hospital_view_model.dart @@ -6,7 +6,7 @@ import 'package:flutter/cupertino.dart'; class HospitalViewModel with ChangeNotifier { BaseAppClient baseAppClient = BaseAppClient(); - Future getProjectsList() async { + Future getProjectsList(memberID) async { const url = GET_PROJECTS; // TODO create model or remove it if no info need var info = { @@ -17,7 +17,8 @@ class HospitalViewModel with ChangeNotifier { "Channel": 9, "TokenID": "", "SessionID": "i1UJwCTSqt", - "IsLoginForDoctorApp": true + "IsLoginForDoctorApp": true, + "MemberID": memberID }; dynamic localRes; diff --git a/lib/core/viewModel/imei_view_model.dart b/lib/core/viewModel/imei_view_model.dart new file mode 100644 index 00000000..29253b1d --- /dev/null +++ b/lib/core/viewModel/imei_view_model.dart @@ -0,0 +1,21 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/imei_details.dart'; +import 'package:doctor_app_flutter/core/service/auth_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; + +class IMEIViewModel extends BaseViewModel { + AuthService _authService = locator(); + List get imeiDetails => _authService.dashboardItemsList; + + Future selectDeviceImei(imei) async { + setState(ViewState.Busy); + await _authService.selectDeviceImei(imei); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart new file mode 100644 index 00000000..43851649 --- /dev/null +++ b/lib/core/viewModel/labs_view_model.dart @@ -0,0 +1,180 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; +import 'package:doctor_app_flutter/core/service/labs_service.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; + +import 'base_view_model.dart'; + +class LabsViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; + LabsService _labsService = locator(); + + List get labOrdersResultsList => + _labsService.labOrdersResultsList; + + List _patientLabOrdersListClinic = List(); + List _patientLabOrdersListHospital = List(); + + List get patientLabOrdersList => + filterType == FilterType.Clinic + ? _patientLabOrdersListClinic + : _patientLabOrdersListHospital; + + void getLabs(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersList(patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.patientLabOrdersList.forEach((element) { + List patientLabOrdersClinic = + _patientLabOrdersListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + _patientLabOrdersListClinic[_patientLabOrdersListClinic + .indexOf(patientLabOrdersClinic[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListClinic.add(PatientLabOrdersList( + filterName: element.clinicDescription, + patientDoctorAppointment: element)); + } + + // doctor list sort via project + List patientLabOrdersHospital = + _patientLabOrdersListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (patientLabOrdersHospital.length != 0) { + _patientLabOrdersListHospital[_patientLabOrdersListHospital + .indexOf(patientLabOrdersHospital[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListHospital.add(PatientLabOrdersList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); + + setState(ViewState.Idle); + } + } + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } + + List get patientLabSpecialResult => + _labsService.patientLabSpecialResult; + + List get labResultList => _labsService.labResultList; + + List labResultLists = List(); + + List get labResultListsCoustom { + + return labResultLists; + } + + getLaboratoryResult( + {String projectID, + int clinicID, + String invoiceNo, + String orderNo, + PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getLaboratoryResult( + invoiceNo: invoiceNo, + orderNo: orderNo, + projectID: projectID, + clinicID: clinicID, + patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + getPatientLabResult({PatientLabOrders patientLabOrder,PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder,patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.labResultList.forEach((element) { + List patientLabOrdersClinic = labResultLists + .where( + (elementClinic) => elementClinic.filterName == element.testCode) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + var value = + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .where((e) => + e.sampleCollectedOn == element.sampleCollectedOn && + e.resultValue == element.resultValue) + .toList(); + if (value.isEmpty) + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .add(element); + } else { + labResultLists + .add(LabResultList(filterName: element.testCode, lab: element)); + } + }); + setState(ViewState.Idle); + } + } + + getPatientLabOrdersResults( + {PatientLabOrders patientLabOrder, String procedure,PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersResults( + patientLabOrder: patientLabOrder, procedure: procedure,patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + bool isShouldClear = false; + if (_labsService.labOrdersResultsList.length == 1) { + labOrdersResultsList.forEach((element) { + if (element.resultValue.contains('/') || + element.resultValue.contains('*') || + element.resultValue.isEmpty) isShouldClear = true; + }); + } + if (isShouldClear) _labsService.labOrdersResultsList.clear(); + setState(ViewState.Idle); + } + } + + sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); + if (_labsService.hasError) { + error = _labsService.error; + } else + DrAppToastMsg.showSuccesToast(mes); + } +} diff --git a/lib/core/viewModel/leave_rechdule_response.dart b/lib/core/viewModel/leave_rechdule_response.dart new file mode 100644 index 00000000..d7cab8bf --- /dev/null +++ b/lib/core/viewModel/leave_rechdule_response.dart @@ -0,0 +1,52 @@ +class GetRescheduleLeavesResponse { + int clinicId; + var coveringDoctorId; + String date; + String dateTimeFrom; + String dateTimeTo; + int doctorId; + int reasonId; + int requisitionNo; + int requisitionType; + int status; + + GetRescheduleLeavesResponse( + {this.clinicId, + this.coveringDoctorId, + this.date, + this.dateTimeFrom, + this.dateTimeTo, + this.doctorId, + this.reasonId, + this.requisitionNo, + this.requisitionType, + this.status}); + + GetRescheduleLeavesResponse.fromJson(Map json) { + clinicId = json['clinicId']; + coveringDoctorId = json['coveringDoctorId']; + date = json['date']; + dateTimeFrom = json['dateTimeFrom']; + dateTimeTo = json['dateTimeTo']; + doctorId = json['doctorId']; + reasonId = json['reasonId']; + requisitionNo = json['requisitionNo']; + requisitionType = json['requisitionType']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicId'] = this.clinicId; + data['coveringDoctorId'] = this.coveringDoctorId; + data['date'] = this.date; + data['dateTimeFrom'] = this.dateTimeFrom; + data['dateTimeTo'] = this.dateTimeTo; + data['doctorId'] = this.doctorId; + data['reasonId'] = this.reasonId; + data['requisitionNo'] = this.requisitionNo; + data['requisitionType'] = this.requisitionType; + data['status'] = this.status; + return data; + } +} diff --git a/lib/core/viewModel/medical_file_view_model.dart b/lib/core/viewModel/medical_file_view_model.dart new file mode 100644 index 00000000..67760908 --- /dev/null +++ b/lib/core/viewModel/medical_file_view_model.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/service/medical_file_service.dart'; + +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; + +class MedicalFileViewModel extends BaseViewModel { + bool hasError = false; + MedicalFileService _medicalFileService = locator(); + + List get medicalFileList => + _medicalFileService.medicalFileList; + + Future getMedicalFile({int mrn}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _medicalFileService.getMedicalFile(mrn: mrn); + if (_medicalFileService.hasError) { + error = _medicalFileService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index a86f6dfb..9e83d63e 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -1,14 +1,59 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class MedicineViewModel extends BaseViewModel { MedicineService _medicineService = locator(); + PrescriptionService _prescriptionService = locator(); + get pharmacyItemsList => _medicineService.pharmacyItemsList; + get searchText=>_medicineService.searchText; get pharmaciesList => _medicineService.pharmaciesList; + get medicationStrengthList => _prescriptionService.medicationStrengthList; + + get medicationDurationList => _prescriptionService.medicationDurationList; + + get medicationRouteList => _prescriptionService.medicationRouteList; + + get medicationFrequencyList => _prescriptionService.medicationFrequencyList; + get boxQuintity => _prescriptionService.boxQuantity; + + get medicationIndicationsList => + _prescriptionService.medicationIndicationsList; + + get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; + List get patientAssessmentList => + _prescriptionService.patientAssessmentList; + + + List get allMedicationList => + _prescriptionService.allMedicationList; + List get itemMedicineList => _prescriptionService.itemMedicineList; + List get itemMedicineListRoute => + _prescriptionService.itemMedicineListRoute; + List get itemMedicineListUnit => + _prescriptionService.itemMedicineListUnit; + + Future getItem({int itemID}) async { + //hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getItem(itemID: itemID); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } Future getMedicineItem(String itemName) async { setState(ViewState.Busy); @@ -20,6 +65,105 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getMedicationList() async { + setState(ViewState.Busy); + await _prescriptionService.getMedicationList(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientAssessment( + GetAssessmentReqModel getAssessmentReqModel) async { + setState(ViewState.Busy); + await _prescriptionService.getPatientAssessment(getAssessmentReqModel); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationStrength() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationStrength); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationRoute() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationRoute); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationIndications() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationIndications); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationDoseTime() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationDoseTime); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationFrequency() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationFrequency); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationDuration() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationDuration); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getBoxQuantity( + {int itemCode, int duration, double strength, int freq}) async { + setState(ViewState.Busy); + await _prescriptionService.calculateBoxQuantity( + strength: strength, itemCode: itemCode, duration: duration, freq: freq); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getPharmaciesList(int itemId) async { setState(ViewState.Busy); await _medicineService.getPharmaciesList(itemId); @@ -29,4 +173,22 @@ class MedicineViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + dynamic getLookupById(List list, String id) { + for (int i = 0; i < list.length; i++) { + if (list[i]['id'].toString() == id) { + return list[i]; + } + } + return null; + } + + dynamic getLookupByIdFilter(List list, String id) { + for (int i = 0; i < list.length; i++) { + if (list[i]['parameterCode'].toString() == id) { + return list[i]; + } + } + return null; + } } diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart new file mode 100644 index 00000000..44261c26 --- /dev/null +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -0,0 +1,157 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; +import 'package:doctor_app_flutter/core/service/patient-admission-request-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +import '../../locator.dart'; + +class AdmissionRequestViewModel extends BaseViewModel{ + + AdmissionRequestService _admissionRequestService = locator(); + + List get clinicList => _admissionRequestService.clinicList; + + List get doctorsList => _admissionRequestService.doctorsList; + + List get speciality => _admissionRequestService.specialityList; + + List get floorList => _admissionRequestService.floorList; + + List get wardList => _admissionRequestService.wardList; + + List get roomCategoryList => _admissionRequestService.roomCategoryList; + + List get admissionTypeList => _admissionRequestService.listOfAdmissionType; + + List get diagnosisTypesList => _admissionRequestService.diagnosisTypesList; + + List get allergiesList => _admissionRequestService.allergiesLookupList; + + List get dietTypesList => _admissionRequestService.dietTypesList; + + List get icdCodes => _admissionRequestService.icdCodes; + + List get listOfDiagnosisSelectionTypes => _admissionRequestService.listOfDiagnosisSelectionTypes; + + AdmissionRequest admissionRequestData; + + Future getSpecialityList() async { + await getMasterLookup(MasterKeysService.Speciality); + if (!_admissionRequestService.hasError) { + _admissionRequestService.setSpecialityList(); + await getClinicDoctors(1); + } + } + + Future getClinics() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getClinics(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getClinicDoctors(int clinicId) async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getDoctorsList(clinicId); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getFloors() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getFloors(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getWards() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getWardList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getRoomCategories() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getRoomCategories(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getDiagnosis() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getDiagnosisTypesList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getAllergies() async { + await getMasterLookup(MasterKeysService.Allergies); + if (!_admissionRequestService.hasError) { + _admissionRequestService.setAllergies(); + } + } + + Future getDietTypes() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getDietTypesList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getICDCodes(int patientMrn) async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getICDCodes(patientMrn); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future makeAdmissionRequest() async{ + setState(ViewState.Busy); + await _admissionRequestService.makeAdmissionRequest(admissionRequestData); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getMasterLookup(MasterKeysService keysService) async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getMasterLookup(keysService); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } +} \ No newline at end of file diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart new file mode 100644 index 00000000..00ef09f6 --- /dev/null +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -0,0 +1,191 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient-doctor-referral-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; + +import '../../locator.dart'; + +class PatientReferralViewModel extends BaseViewModel { + PatientReferralService _referralPatientService = + locator(); + + List get branchesList => _referralPatientService.projectsList; + + List get clinicsList => _referralPatientService.clinicsList; + + List get doctorsList => _referralPatientService.doctorsList; + + List get listMyReferredPatientModel => + _referralPatientService.listMyReferredPatientModel; + + List get pendingReferral => + _referralPatientService.pendingReferralList; + + List get patientReferral => + _referralPatientService.patientReferralList; + + List get patientArrivalList => + _referralPatientService.patientArrivalList; + + Future getPatientReferral(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _referralPatientService.getPatientReferral(patient); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + if (patientReferral.length == 0) { + await getMasterLookup(MasterKeysService.physiotherapyGoals); + } else { + setState(ViewState.Idle); + } + } + } + + Future getMasterLookup(MasterKeysService masterKeys) async { + setState(ViewState.Busy); + await _referralPatientService.getMasterLookup(masterKeys); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + await getBranches(); + } + + Future getBranches() async { + setState(ViewState.BusyLocal); + await _referralPatientService.getReferralFacilities(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getClinics(int projectId) async { + setState(ViewState.BusyLocal); + await _referralPatientService.getClinicsList(projectId); + await _referralPatientService.getProjectInfo(projectId); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getClinicDoctors(String clinicId) async { + setState(ViewState.BusyLocal); + await _referralPatientService.getDoctorsList(clinicId); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getDoctorBranch() async { + DoctorProfileModel doctorProfile = await getDoctorProfile(); + if (doctorProfile != null) { + dynamic _selectedBranch = { + "facilityId": doctorProfile.projectID, + "facilityName": doctorProfile.projectName + }; + return _selectedBranch; + } + return null; + } + + Future getMyReferredPatient() async { + setState(ViewState.Busy); + await _referralPatientService.getMyReferredPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + MyReferredPatientModel getReferredPatientItem(int index) { + return listMyReferredPatientModel[index]; + } + + Future getPendingReferralPatients() async { + setState(ViewState.Busy); + await _referralPatientService.getPendingReferralList(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future responseReferral( + PendingReferral pendingReferral, bool isAccepted) async { + setState(ViewState.Busy); + await _referralPatientService.responseReferral(pendingReferral, isAccepted); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future makeReferral(PatiantInformtion patient, String isoStringDate, + int projectID, int clinicID, int doctorID, String remarks) async { + setState(ViewState.Busy); + await _referralPatientService.makeReferral( + patient, isoStringDate, projectID, clinicID, doctorID, remarks); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatientDetails( + String fromDate, String toDate, int patientMrn, int appointmentNo) async { + setState(ViewState.Busy); + + await _referralPatientService.getPatientArrivalList(toDate, + fromDate: fromDate, + patientMrn: patientMrn, + appointmentNo: appointmentNo); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + /* + * model + .getPatientArrivalList()*/ + + String getReferralStatusNameByCode(int statusCode, BuildContext context) { + switch (statusCode) { + case 1: + return TranslationBase.of(context).referralStatusHold; + case 2: + return TranslationBase.of(context).referralStatusActive; + case 4: + return TranslationBase.of(context).referralStatusCancelled; + case 46: + return TranslationBase.of(context).referralStatusCompleted; + case 63: + return TranslationBase.of(context).referralStatusNotSeen; + default: + return "-"; + } + } +} diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart new file mode 100644 index 00000000..f48ef485 --- /dev/null +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -0,0 +1,151 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; +import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:flutter/material.dart'; + +import '../../locator.dart'; + +class UcafViewModel extends BaseViewModel { + UcafService _ucafService = locator(); + + List get patientChiefComplaintList => + _ucafService.patientChiefComplaintList; + + VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns; + + List get patientAssessmentList => + _ucafService.patientAssessmentList; + + List get diagnosisTypes => _ucafService.listOfDiagnosisType; + + List get diagnosisConditions => + _ucafService.listOfDiagnosisCondition; + + PrescriptionModel get prescriptionList => _ucafService.prescriptionList; + + List get orderProcedures => _ucafService.orderProcedureList; + + String selectedLanguage; + + resetDataInFirst(){ + _ucafService.patientAssessmentList = []; + _ucafService.orderProcedureList = []; + _ucafService.prescriptionList = null; + } + + Future getLanguage() async { + selectedLanguage = await sharedPref.getString(APP_Language); + } + + Future getUCAFData(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _ucafService.getPatientVitalSign(patient); + await _ucafService.getPatientChiefComplaint(patient); + + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatientAssessment(PatiantInformtion patient) async { + if (patientAssessmentList.isEmpty) { + setState(ViewState.Busy); + await _ucafService.getPatientAssessment(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + if (patientAssessmentList.isNotEmpty) { + if (diagnosisConditions.length == 0) { + await _ucafService + .getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (diagnosisTypes.length == 0) { + await _ucafService.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } else + setState(ViewState.Idle); // but with empty list + } + } + } + + Future getOrderProcedures(PatiantInformtion patient) async { + if (orderProcedures.isEmpty) { + setState(ViewState.Busy); + await _ucafService.getOrderProcedures(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + + Future getPrescription(PatiantInformtion patient) async { + if (prescriptionList == null) { + setState(ViewState.Busy); + await _ucafService.getPrescription(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + + MasterKeyModel findMasterDataById( + {@required MasterKeysService masterKeys, dynamic id}) { + switch (masterKeys) { + case MasterKeysService.DiagnosisCondition: + List result = diagnosisConditions.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + return null; + case MasterKeysService.DiagnosisType: + List result = diagnosisTypes.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + return null; + default: + return null; + } + } + + Future postUCAF(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _ucafService.postUCAF(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); // but with empty list + } + } +} diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart new file mode 100644 index 00000000..0a51f7f5 --- /dev/null +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -0,0 +1,129 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient-vital-signs-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; + +import '../../locator.dart'; + +class VitalSignsViewModel extends BaseViewModel { + VitalSignsService _vitalSignService = locator(); + + VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; + + List get patientVitalSignsHistory => + _vitalSignService.patientVitalSignsHistory; + + String heightCm = "0"; + String weightKg = "0"; + String bodyMax = "0"; + String temperatureCelcius = "0"; + String hartRat = "0"; + String respirationBeatPerMinute = "0"; + String bloodPressure = "0 / 0"; + + Future getPatientVitalSign(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _vitalSignService.getPatientVitalSign(patient); + if (_vitalSignService.hasError) { + error = _vitalSignService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatientVitalSignHistory( + PatiantInformtion patient, String from, String to) async { + setState(ViewState.Busy); + if (from == null || from == "0") { + from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + if (to == null || to == "0") { + to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + + await _vitalSignService.getPatientVitalSignsHistory(patient, from, to); + if (_vitalSignService.hasError) { + error = _vitalSignService.error; + setState(ViewState.Error); + } else { + patientVitalSignsHistory.forEach((element) { + if (heightCm == "0" || heightCm == null || heightCm == 'null') { + heightCm = element.heightCm.toString(); + } + if (weightKg == "0" || weightKg == null || weightKg == 'null') { + weightKg = element.weightKg.toString(); + } + if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') { + bodyMax = element.bodyMassIndex.toString(); + } + if (temperatureCelcius == "0" || + temperatureCelcius == null || + temperatureCelcius == 'null') { + temperatureCelcius = element.temperatureCelcius.toString(); + } + if (hartRat == "0" || hartRat == null || hartRat == 'null') { + hartRat = element.pulseBeatPerMinute.toString(); + } + if (respirationBeatPerMinute == "0" || + respirationBeatPerMinute == null || + respirationBeatPerMinute == 'null') { + respirationBeatPerMinute = + element.respirationBeatPerMinute.toString(); + } + if (bloodPressure == "0 / 0" || + bloodPressure == null || + bloodPressure == 'null') { + bloodPressure = element.bloodPressure.toString(); + } + }); + setState(ViewState.Idle); + } + } + + String getBMI(var bodyMassIndex) { + if (bodyMassIndex <= 18.5) { + return "Underweight"; + } else if (bodyMassIndex <= 25.0) { + return "Normal"; + } else if (bodyMassIndex <= 30) { + return "Overweight"; + } else { + // > 30.0 + return "Obese"; + } + } + + int getBMIStatus() { + var bodyMassIndex = double.parse(bodyMax); + if (bodyMassIndex <= 18.5) { + return 1; + } else if (bodyMassIndex <= 25.0) { + return 2; + } else if (bodyMassIndex <= 30) { + return 3; + } else { + return 4; + } + } + + String getTempratureMethod(int temperatureCelciusMethod) { + // temperatureCelciusMethod ( vital sign response field )- master 2005 + if (temperatureCelciusMethod == 1) { + return "Oral"; + } else if (temperatureCelciusMethod == 2) { + return "Axilla"; + } else if (temperatureCelciusMethod == 3) { + return "Rectal"; + } else if (temperatureCelciusMethod == 4) { + return "Tympanic"; + } else if (temperatureCelciusMethod == 5) { + return "Temporal"; + } + } +} diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index f39a3d48..5f4b6c9a 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -2,7 +2,6 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient_service.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; @@ -42,26 +41,29 @@ class PatientViewModel extends BaseViewModel { get patientProgressNoteList => _patientService.patientProgressNoteList; - get clinicsList => _patientService.clinicsList; - get doctorsList => _patientService.doctorsList; + List get clinicsList => _patientService.clinicsList; - get referalFrequancyList => _patientService.referalFrequancyList; - Future getPatientList(PatientModel patient, patientType, - {bool isBusyLocal = false}) async { - if(isBusyLocal) { + List get doctorsList => _patientService.doctorsList; + + List get referralFrequencyList => + _patientService.referalFrequancyList; + + Future getPatientList(patient, patientType, + {bool isBusyLocal = false, isView}) async { + var localRes; + if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - return _patientService.getPatientList(patient, patientType); + localRes = await _patientService.getPatientList(patient, patientType, + isView: isView); + if (_patientService.hasError) { error = _patientService.error; - if(isBusyLocal) { - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Error); - } } else - setState(ViewState.Idle); + setState(ViewState.Error); + } + return localRes; } Future getPatientVitalSign(patient) async { @@ -167,6 +169,7 @@ class PatientViewModel extends BaseViewModel { } } } + Future getDoctorsList(String clinicId) async { setState(ViewState.BusyLocal); await _patientService.getDoctorsList(clinicId); @@ -182,8 +185,9 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = - _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); + var doctorNamelist = _patientService.doctorsList + .map((value) => value['DoctorName'].toString()) + .toList(); return doctorNamelist; } @@ -193,6 +197,7 @@ class PatientViewModel extends BaseViewModel { .toList(); return clinicsNameslist; } + Future getReferralFrequancyList() async { setState(ViewState.Busy); await _patientService.getReferralFrequancyList(); @@ -241,4 +246,14 @@ class PatientViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getArrivedList() async { + setState(ViewState.Busy); + await _patientService.getArrivedList(); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart new file mode 100644 index 00000000..a07ae715 --- /dev/null +++ b/lib/core/viewModel/prescription_view_model.dart @@ -0,0 +1,122 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; + +class PrescriptionViewModel extends BaseViewModel { + bool hasError = false; + PrescriptionService _prescriptionService = locator(); + List get allMedicationList => + _prescriptionService.allMedicationList; + + List get prescriptionList => + _prescriptionService.prescriptionList; + List get drugsList => _prescriptionService.doctorsList; + //List get allMedicationList => _prescriptionService.allMedicationList; + List get drugToDrug => _prescriptionService.drugToDrugList; + + List get itemMedicineList => _prescriptionService.itemMedicineList; + + Future getItem({int itemID}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.BusyLocal); + await _prescriptionService.getItem(itemID: itemID); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getPrescription({int mrn}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getPrescription(mrn: mrn); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel, int mrn) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.postPrescription(postProcedureReqModel); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else { + await getPrescription(mrn: mrn); + setState(ViewState.Idle); + } + } + + Future getMedicationList() async { + setState(ViewState.Busy); + await _prescriptionService.getMedicationList(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future updatePrescription( + PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.updatePrescription(updatePrescriptionReqModel); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else { + await getPrescription(mrn: mrn); + setState(ViewState.Idle); + } + } + + Future getDrugs({String drugName}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.BusyLocal); + await _prescriptionService.getDrugs(drugName: drugName); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getDrugToDrug( + VitalSignData vital, + List lstAssessments, + List allergy, + PatiantInformtion patient, + List prescription) async { + hasError = false; + setState(ViewState.Busy); + await _prescriptionService.getDrugToDrug( + vital, lstAssessments, allergy, patient, prescription); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/prescriptions_view_model.dart b/lib/core/viewModel/prescriptions_view_model.dart new file mode 100644 index 00000000..916a6563 --- /dev/null +++ b/lib/core/viewModel/prescriptions_view_model.dart @@ -0,0 +1,145 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart'; +import 'package:doctor_app_flutter/core/service/prescriptions_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:flutter/material.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class PrescriptionsViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; + PrescriptionsService _prescriptionsService = locator(); + + List _prescriptionsOrderListClinic = List(); + List _prescriptionsOrderListHospital = List(); + + + List get prescriptionReportList => + _prescriptionsService.prescriptionReportList; + + List get prescriptionsList => + _prescriptionsService.prescriptionsList; + + List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList ; + List get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList; + + + List get prescriptionsOrderList => + filterType == FilterType.Clinic + ? _prescriptionsOrderListClinic + : _prescriptionsOrderListHospital; + + getPrescriptions(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptions(patient); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + _filterList(); + await _getPrescriptionsOrders(); + + setState(ViewState.Idle); + } + } + _getPrescriptionsOrders() async { + await _prescriptionsService.getPrescriptionsOrders(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + void _filterList() { + _prescriptionsService.prescriptionsList.forEach((element) { + /// PrescriptionsList list sort clinic + List prescriptionsByClinic = + _prescriptionsOrderListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (prescriptionsByClinic.length != 0) { + _prescriptionsOrderListClinic[ + _prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])] + .prescriptionsList + .add(element); + } else { + _prescriptionsOrderListClinic.add(PrescriptionsList( + filterName: element.clinicDescription, prescriptions: element)); + } + + /// PrescriptionsList list sort via hospital + List prescriptionsByHospital = + _prescriptionsOrderListHospital + .where( + (elementClinic) => elementClinic.filterName == element.name, + ) + .toList(); + + if (prescriptionsByHospital.length != 0) { + _prescriptionsOrderListHospital[_prescriptionsOrderListHospital + .indexOf(prescriptionsByHospital[0])] + .prescriptionsList + .add(element); + } else { + _prescriptionsOrderListHospital.add(PrescriptionsList( + filterName: element.name, prescriptions: element)); + } + }); + } + + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } + + getPrescriptionReport({Prescriptions prescriptions,@required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions,patient: patient); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + + + getListPharmacyForPrescriptions({int itemId,@required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId,patient: patient); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + + + getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder,@required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder,patient: patient); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + + +} diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart new file mode 100644 index 00000000..6af34f4d --- /dev/null +++ b/lib/core/viewModel/procedure_View_model.dart @@ -0,0 +1,104 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/service/procedure_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; + +class ProcedureViewModel extends BaseViewModel { + bool hasError = false; + ProcedureService _procedureService = locator(); + List get procedureList => + _procedureService.procedureList; + List get valadteProcedureList => + _procedureService.valadteProcedureList; + List get categoriesList => + _procedureService.categoriesList; + List get categoryList => _procedureService.categoryList; + + Future getProcedure({int mrn}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedure(mrn: mrn); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getProcedureCategory({String categoryName, String categoryID}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedureCategory( + categoryName: categoryName, categoryID: categoryID); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getCategory() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getCategory(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postProcedure( + PostProcedureReqModel postProcedureReqModel, int mrn) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.postProcedure(postProcedureReqModel); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + await getProcedure(mrn: mrn); + setState(ViewState.Idle); + } + } + + Future valadteProcedure( + ProcedureValadteRequestModel procedureValadteRequestModel) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.valadteProcedure(procedureValadteRequestModel); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future updateProcedure( + {UpdateProcedureRequestModel updateProcedureRequestModel, + int mrn}) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.updateProcedure(updateProcedureRequestModel); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + //await getProcedure(mrn: mrn); + } +} diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index a12846c7..e144042e 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -15,7 +15,7 @@ import 'package:provider/provider.dart'; Helpers helpers = Helpers(); -class ProjectProvider with ChangeNotifier { +class ProjectViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); Locale _appLocale; String currentLanguage = 'ar'; @@ -24,6 +24,7 @@ class ProjectProvider with ChangeNotifier { List doctorClinicsList = []; bool isLoading = false; bool isError = false; + bool isLogin = false; String error = ''; BaseAppClient baseAppClient = BaseAppClient(); @@ -31,7 +32,7 @@ class ProjectProvider with ChangeNotifier { bool get isArabic => _isArabic; StreamSubscription subscription; - ProjectProvider() { + ProjectViewModel() { loadSharedPrefLanguage(); subscription = Connectivity() @@ -56,7 +57,9 @@ class ProjectProvider with ChangeNotifier { currentLanguage = await sharedPref.getString(APP_Language); _appLocale = Locale(currentLanguage ?? 'en'); _isArabic = currentLanguage != null - ? currentLanguage == 'ar' ? true : false + ? currentLanguage == 'ar' + ? true + : false : false; notifyListeners(); } @@ -101,7 +104,7 @@ class ProjectProvider with ChangeNotifier { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: {}); + }, body: Map()); return Future.value(localRes); } catch (error) { @@ -114,12 +117,11 @@ class ProjectProvider with ChangeNotifier { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: doctorProfile.clinicID, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); + doctorID: doctorProfile.doctorID, + clinicID: doctorProfile.clinicID, + license: true, + projectID: doctorProfile.projectID, + ); Provider.of(AppGlobal.CONTEX, listen: false) .getDocProfiles(docInfo.toJson()) diff --git a/lib/core/viewModel/radiology_view_model.dart b/lib/core/viewModel/radiology_view_model.dart new file mode 100644 index 00000000..3a194970 --- /dev/null +++ b/lib/core/viewModel/radiology_view_model.dart @@ -0,0 +1,88 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; +import 'package:doctor_app_flutter/core/service/radiology_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:flutter/foundation.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class RadiologyViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; + RadiologyService _radiologyService = locator(); + + List _finalRadiologyListClinic = List(); + List _finalRadiologyListHospital = List(); + + List get finalRadiologyList => + filterType == FilterType.Clinic + ? _finalRadiologyListClinic + : _finalRadiologyListHospital; + + void getPatientRadOrders(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _radiologyService.getPatientRadOrders(patient); + if (_radiologyService.hasError) { + error = _radiologyService.error; + setState(ViewState.Error); + } else { + _radiologyService.finalRadiologyList.forEach((element) { + List finalRadiologyListClinic = + _finalRadiologyListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (finalRadiologyListClinic.length != 0) { + _finalRadiologyListClinic[ + finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] + .finalRadiologyList + .add(element); + } else { + _finalRadiologyListClinic.add(FinalRadiologyList( + filterName: element.clinicDescription, finalRadiology: element)); + } + + // FinalRadiologyList list sort via project + List finalRadiologyListHospital = + _finalRadiologyListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (finalRadiologyListHospital.length != 0) { + _finalRadiologyListHospital[finalRadiologyListHospital + .indexOf(finalRadiologyListHospital[0])] + .finalRadiologyList + .add(element); + } else { + _finalRadiologyListHospital.add(FinalRadiologyList( + filterName: element.projectName, finalRadiology: element)); + } + }); + + setState(ViewState.Idle); + } + } + + String get radImageURL => _radiologyService.url; + + getRadImageURL({int invoiceNo, int lineItem, int projectId,@required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _radiologyService.getRadImageURL( + invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId,patient: patient); + if (_radiologyService.hasError) { + error = _radiologyService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } +} diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart new file mode 100644 index 00000000..80f9ea1d --- /dev/null +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -0,0 +1,121 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class SickLeaveViewModel extends BaseViewModel { + SickLeaveService _sickLeaveService = locator(); + get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; + get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + List get allOffTime => _sickLeaveService.getOffTimeList; + List get allReasons => _sickLeaveService.getReasons; + List get coveringDoctors => _sickLeaveService.coveringDoctorsList; + get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; + get postSechedule => _sickLeaveService.postReschedule; + get sickleaveResponse => _sickLeaveService.sickLeaveResponse; + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.addSickLeave(addSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future preSickLeaveStatistics(appoNo, patientMRN) async { + setState(ViewState.Busy); + await _sickLeaveService.getStatistics(appoNo, patientMRN); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getSickLeave(patientMRN) async { + setState(ViewState.Busy); + await _sickLeaveService.getSickLeave(patientMRN); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getRescheduleLeave() async { + setState(ViewState.Busy); + await _sickLeaveService.getRescheduleLeave(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getOffTime() async { + setState(ViewState.Busy); + await _sickLeaveService.getOffTime(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getReasons(id) async { + setState(ViewState.Busy); + await _sickLeaveService.getReasonsByID(id: id); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getCoveringDoctors() async { + setState(ViewState.Busy); + await _sickLeaveService.getCoveringDoctors(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future addReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.addReschedule(request); + + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future updateReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.updateReschedule(request); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index fef927b0..ee0723f4 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -384,6 +384,102 @@ "sync" ] }, + { + "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", + "css": "drawer_icon", + "code": 59429, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", + "width": 1633 + }, + "search": [ + "drawer_icon" + ] + }, + { + "uid": "764baf138776221a3e1e845391b188a4", + "css": "leaves", + "code": 59446, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M968.7 468.7H572.9A31.3 31.3 0 1 1 572.9 406.2H968.7A31.3 31.3 0 1 1 968.7 468.7ZM968.7 468.7M812.5 625A31.3 31.3 0 0 1 790.4 571.6L924.5 437.5 790.4 303.3A31.3 31.3 0 0 1 834.6 259.1L990.9 415.4A31.3 31.3 0 0 1 990.9 459.6L834.6 615.8A31.2 31.2 0 0 1 812.5 625ZM812.5 625M333.3 1000A83.3 83.3 0 0 0 416.7 916.7V166.7A83.9 83.9 0 0 0 360.3 87.5L109.9 4.1A84.2 84.2 0 0 0 0 83.4V833.4A83.9 83.9 0 0 0 56.4 912.4L306.8 995.8A87.2 87.2 0 0 0 333.3 1000ZM83.3 62.5A24.5 24.5 0 0 1 90.8 63.6L340.1 146.7A21.4 21.4 0 0 1 354.2 166.6V916.6A22 22 0 0 1 325.9 936.4L76.6 853.3A21.5 21.5 0 0 1 62.5 833.3V83.3A20.9 20.9 0 0 1 83.3 62.5ZM83.3 62.5M635.4 208.3A31.3 31.3 0 0 0 666.7 177.1V114.6A114.7 114.7 0 0 0 552.1 0H83.3A31.3 31.3 0 0 0 83.3 62.5H552.1A52.1 52.1 0 0 1 604.2 114.6V177.1A31.3 31.3 0 0 0 635.4 208.3ZM635.4 208.3M385.4 875H552.1A114.7 114.7 0 0 0 666.6 760.4V697.9A31.3 31.3 0 0 0 604.1 697.9V760.4A52.1 52.1 0 0 1 552.1 812.5H385.4A31.3 31.3 0 0 0 385.4 875ZM385.4 875", + "width": 1000 + }, + "search": [ + "leaves" + ] + }, + { + "uid": "4477771717c5280f9030b8e410040eda", + "css": "search_patient-1", + "code": 59465, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1142.7 436.8A165.2 165.2 0 1 0 1307.8 601.9 165.4 165.4 0 0 0 1142.7 436.8ZM1142.7 748.8A146.9 146.9 0 1 1 1289.5 601.9 147 147 0 0 1 1142.7 748.8ZM1023.4 611.1H1041.7A110.3 110.3 0 0 1 1151.8 500.9V482.7A128.5 128.5 0 0 0 1023.4 611.1ZM1476.4 883.8L1489.3 870.9 1357.9 739.4 1345 752.4 1322 729.4A219.8 219.8 0 1 0 1270.1 781.5L1293.1 804.5 1280.2 817.4 1411.4 948.7 1424.4 935.7 1306 817.3 1357.9 765.4ZM1142.6 803.9A201.9 201.9 0 1 1 1344.4 602 202.2 202.2 0 0 1 1142.6 803.9ZM1306 791.3L1284.7 770.1A220.1 220.1 0 0 0 1310.7 744.1L1332.1 765.5ZM48.4 483.9H301.4A96.4 96.4 0 0 1 276.7 346.5 305.1 305.1 0 0 1 257.9 242V201.9A201.8 201.8 0 0 1 564.5 29.2 201.8 201.8 0 0 1 871 201.8V205.4L887 177.2 957.1 299.9A80.6 80.6 0 0 1 869.7 417.5 96.9 96.9 0 0 1 785.1 499.2 226.4 226.4 0 0 1 645.1 662.2V696.2L780.4 720.8A267.4 267.4 0 0 1 999.9 983.9V999.9H129V983.9A267.4 267.4 0 0 1 348.6 720.8L483.9 696.2V662.3A224.6 224.6 0 0 1 396.8 602.3C396 602.6 395.1 602.8 394.3 603.1A92.8 92.8 0 0 1 352.9 612.9H48.4A48.4 48.4 0 0 1 0 564.5V532.3A48.4 48.4 0 0 1 48.4 483.9ZM339.5 465.8C339.3 461.1 338.7 456.4 338.7 451.7V341A64.2 64.2 0 0 0 339.5 465.7ZM838.7 242V201.9A169.6 169.6 0 0 0 575.1 60.8L564.5 67.8 554 60.8A169.6 169.6 0 0 0 290.3 201.9V242A273.2 273.2 0 0 0 302.3 322.2 96.2 96.2 0 0 1 338.7 308.1V282.4L403.2 234V193.5A32.3 32.3 0 0 1 435.5 161.3H693.5A32.3 32.3 0 0 1 725.8 193.5V233.9L790.3 282.3V307.8A95.4 95.4 0 0 1 810.8 313.9 78.8 78.8 0 0 1 817 299.9L837.7 263.6C838.3 256.4 838.7 249.2 838.7 242ZM435.5 290.4H693.6V193.5H435.5ZM887.9 387.2A47.6 47.6 0 0 0 929.3 316L887.1 242.2 844.9 315.9A47.6 47.6 0 0 0 887.6 387.1ZM838.8 403.2A79.4 79.4 0 0 1 807.4 348.1 63.2 63.2 0 0 0 790.4 340.9V451.6C790.4 456.4 790 461 789.7 465.7A64.5 64.5 0 0 0 838.7 403.2ZM758.1 451.6V298.4L725.9 274.3V290.4A32.3 32.3 0 0 1 693.6 322.6H435.5A32.3 32.3 0 0 1 403.2 290.4V274.3L370.9 298.4V451.6A195.2 195.2 0 0 0 374.4 486.4 92.8 92.8 0 0 1 394.3 493.6 60.6 60.6 0 0 0 421.2 500H532.2A48.4 48.4 0 1 1 532.2 596.7H436.9A193.2 193.2 0 0 0 758.1 451.6ZM532.3 564.5A16 16 0 1 0 532.3 532.2H516.3V564.5ZM637.4 727.6A80.7 80.7 0 0 1 583.6 771.6 64.5 64.5 0 0 0 645.1 806.4C680.7 806.4 709.6 784.7 709.6 758A36.4 36.4 0 0 0 704.4 739.7ZM161.8 967.8H967.2A235 235 0 0 0 774.7 752.6L740.8 746.5A64.8 64.8 0 0 1 742 758.2C742 802.6 698.6 838.8 645.2 838.8A102.9 102.9 0 0 1 564.6 802.6 102.9 102.9 0 0 1 483.9 838.7C430.4 838.7 387.1 802.5 387.1 758.1A65.9 65.9 0 0 1 388.2 746.4L354.4 752.6A235 235 0 0 0 161.8 967.8ZM424.5 739.9A36.4 36.4 0 0 0 419.4 758.2C419.4 784.9 448.3 806.6 483.9 806.6A64.5 64.5 0 0 0 545.4 771.8 80.6 80.6 0 0 1 491.6 727.7ZM516 677.4V693.4A48.4 48.4 0 1 0 612.8 693.4V672.1A222.6 222.6 0 0 1 516 672.1ZM379.6 574.3A92.9 92.9 0 0 1 421 564.5H483.9V532.3H421.2A93.1 93.1 0 0 1 379.9 522.5 60.6 60.6 0 0 0 352.9 516H129V580.5H352.9A60.6 60.6 0 0 0 379.9 574.3ZM32.1 564.5A16 16 0 0 0 48.1 580.5H96.8V516H48.4A16 16 0 0 0 32.4 532ZM524.9 368.4L507 341.5 410.3 406.1 428.2 432.9ZM718.5 405.8L621.8 341.3 603.9 368.1 700.6 432.7Z", + "width": 1489 + }, + "search": [ + "search_patient" + ] + }, + { + "uid": "acee3dc68dc70f4b268b59a42fd957ee", + "css": "referral-1", + "code": 59408, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M681.4 793.1L735.5 860.8 683 913.3 659.1 793.7C663.5 793.4 667.9 793.1 672.4 793.1ZM791.7 793.1L758.6 834.3 725.6 793.1ZM835.9 793.1H844.8C849.3 793.1 853.7 793.4 858.1 793.7L834.2 913.3 781.7 860.8ZM913.8 655.1H912.8A154.1 154.1 0 0 0 913.8 637.9V586.2A34.5 34.5 0 0 1 913.8 655.1ZM603.4 482.7A103.6 103.6 0 0 1 706.9 379.3H810.3A103.6 103.6 0 0 1 913.8 482.8V551.7H844.8A34.5 34.5 0 0 1 810.3 517.2V448.3H775.9V465.5A86.3 86.3 0 0 1 689.7 551.7H603.5ZM603.4 655.1A34.5 34.5 0 1 1 603.4 586.2V637.9A154.1 154.1 0 0 0 604.4 655.1ZM637.9 637.9V586.2H689.6A120.4 120.4 0 0 0 781.2 543.9 69 69 0 0 0 844.7 586.2H879.2V637.9A120.6 120.6 0 0 1 637.9 637.9ZM1000 1000H517.2V948.3A155.6 155.6 0 0 1 625.2 800.5L655.4 951.7A17.3 17.3 0 0 0 667.3 964.8 17.6 17.6 0 0 0 672.3 965.5 17.3 17.3 0 0 0 684.5 960.4L758.5 886.4 832.5 960.5A17.2 17.2 0 0 0 861.7 951.7L891.9 800.5A155.6 155.6 0 0 1 999.8 948.3ZM164.1 413.8L218.3 481.5 165.7 534 141.8 414.5C146.3 414.1 150.7 413.8 155.2 413.8ZM274.5 413.8L241.4 455 208.3 413.8ZM318.6 413.8H327.6C332.1 413.8 336.5 414.1 340.9 414.4L317 534 264.5 481.5ZM396.5 275.8H395.5A154 154 0 0 0 396.5 258.6V206.9A34.5 34.5 0 0 1 396.5 275.8ZM86.2 103.5A103.6 103.6 0 0 1 189.7 0H293.1A103.6 103.6 0 0 1 396.6 103.5V172.4H327.6A34.5 34.5 0 0 1 293.1 137.9V69H258.6V86.2A86.3 86.3 0 0 1 172.4 172.4H86.2ZM86.2 275.9A34.5 34.5 0 1 1 86.2 206.9V258.6A154 154 0 0 0 87.2 275.9ZM120.6 258.6V206.9H172.4A120.4 120.4 0 0 0 264 164.6 69 69 0 0 0 327.5 206.9H362V258.6A120.6 120.6 0 1 1 120.7 258.6ZM482.8 620.7H0V569A155.6 155.6 0 0 1 107.9 421.2L138.2 572.3A17.3 17.3 0 0 0 150.1 585.5 17.6 17.6 0 0 0 155.1 586.2 17.3 17.3 0 0 0 167.3 581.1L241.3 507.1 315.3 581.2A17.2 17.2 0 0 0 344.4 572.3L374.7 421.2A155.6 155.6 0 0 1 482.6 569ZM172.4 827.6A17.2 17.2 0 0 0 155.2 810.3H127.8L206.8 731.3 286.1 810.2H258.8A17.2 17.2 0 0 0 241.6 827.4 206.9 206.9 0 0 0 333.6 999.5 172.6 172.6 0 0 1 172.4 827.6Z", + "width": 1000 + }, + "search": [ + "referral" + ] + }, + { + "uid": "7c82c028b3a01309cc1ffd1eaeb1ccf8", + "css": "search", + "code": 59467, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M543.6 353.5A132.3 132.3 0 1 1 411.3 221.2 132.3 132.3 0 0 1 543.6 353.5ZM974.2 974.1A88.2 88.2 0 0 1 849.4 974.1S624.7 749.2 622.9 747A405.4 405.4 0 1 1 747 622.8C749.2 624.6 974.2 849.4 974.2 849.4A88.2 88.2 0 0 1 974.1 974.1ZM726 405.2A320.8 320.8 0 1 0 206.8 657.2 146.9 146.9 0 0 1 352.4 530H470.1A146.9 146.9 0 0 1 614.3 648.4 320 320 0 0 0 726 405.2Z", + "width": 1000 + }, + "search": [ + "search" + ] + }, + { + "uid": "898cfb6ea07e1c004d9173c59903b3c3", + "css": "arrival-patients", + "code": 59469, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M490.4 621.6L473.9 574.9A181.3 181.3 0 0 1 396.3 590.7 177.3 177.3 0 0 1 318 574.2L295.4 620.7A13.4 13.4 0 0 1 287.5 627.5Q281.1 629.6 274.2 631.7A117.4 117.4 0 0 0 304 686.6 127.3 127.3 0 0 0 493.2 682.1 264 264 0 0 1 513.3 634.8C508.1 633.1 503.1 631.4 498.5 629.9A13.2 13.2 0 0 1 490.4 621.6ZM481.4 761.4A266.9 266.9 0 0 1 483.6 727 150.9 150.9 0 0 1 396.3 753.5 149.3 149.3 0 0 1 284.6 705 146.4 146.4 0 0 1 248.5 639.3L233.3 643.5C129.3 672.7 0 708.9 0 820.9V960.9C0 977.4 7.5 1000.1 19.8 1000.1H630.7A265.8 265.8 0 0 1 481.4 761.4ZM401.9 191.2C406.8 191.6 411.8 192 416.4 192.4 457.3 196.1 484.3 198.5 510.1 141.6A13.2 13.2 0 0 1 534.3 141.2L535.6 143.8A198.4 198.4 0 0 1 571.3 227.5C572.5 212.4 573.2 199.6 573.2 194.6S573.2 184.2 573.4 178.7A151.6 151.6 0 0 0 536.5 56.1 193.6 193.6 0 0 0 393.6 0.1 191.6 191.6 0 0 0 255.3 63L251.6 67.2A164.1 164.1 0 0 0 205.3 202.8 286.8 286.8 0 0 0 212.2 239.2 145.9 145.9 0 0 1 243.7 164 70.6 70.6 0 0 1 297.3 140.8C317.2 140.8 324.1 160.7 330.7 179.6 340.6 208.7 352 241.1 399 243.9 374.8 216.8 379 207 381.1 202.3A19.2 19.2 0 0 1 401.9 191.2ZM541.8 420.1A12.9 12.9 0 0 1 549.2 418.1H549.6C571.7 418.1 597.4 385 607.1 343.9A25.6 25.6 0 0 0 599.3 314.8 13.2 13.2 0 0 0 584.1 319.6 13.4 13.4 0 0 1 572.7 328.1L571.6 328.1A13.2 13.2 0 0 1 558.4 315.9 438.1 438.1 0 0 0 524 173C491.9 225.9 452.4 222.6 414.1 219.1H413.5A270.3 270.3 0 0 0 438.7 245.5 13.2 13.2 0 0 1 431.6 268.7C337.9 281.9 317.5 223.2 305.3 188.1A89.3 89.3 0 0 0 296.5 167.3 44.1 44.1 0 0 0 263.2 181.9 131.4 131.4 0 0 0 236.7 255.8 309.2 309.2 0 0 0 235.2 305.5 15.4 15.4 0 0 1 210.2 321.5C204.3 315.3 198 313.3 192.9 316.1A24.5 24.5 0 0 0 185.5 344C195.3 385.1 221 418.2 243.1 418.2H243.7A13.2 13.2 0 0 1 257 431.2 150 150 0 0 0 318.4 544 143.4 143.4 0 0 0 396.2 564.1 146.3 146.3 0 0 0 474.1 544.5L474.3 544.5A145.9 145.9 0 0 0 535.4 431.5 13.2 13.2 0 0 1 541.7 420.4ZM746.8 522.7A238.6 238.6 0 1 0 985.4 761.3 238.6 238.6 0 0 0 746.8 522.7ZM881.7 796.9A17.9 17.9 0 0 1 863.8 814.7H792.4V888.4A17.9 17.9 0 0 1 774.5 906.2H712A17.9 17.9 0 0 1 694.1 888.4V814.7H620.5A17.9 17.9 0 0 1 602.6 796.9V734.4A17.9 17.9 0 0 1 620.5 716.5H694.1V645.1A17.9 17.9 0 0 1 712 627.2H774.5A17.9 17.9 0 0 1 792.4 645.1V716.5H863.8A17.9 17.9 0 0 1 881.7 734.4ZM765.6 725.4V654H721V725.4A17.9 17.9 0 0 1 703.1 743.3H629.5V787.9H703.1A17.9 17.9 0 0 1 721 805.8V879.5H765.6V805.8A17.9 17.9 0 0 1 783.5 787.9H854.9V743.3H783.5A17.9 17.9 0 0 1 765.6 725.4Z", + "width": 985 + }, + "search": [ + "arrival-patients" + ] + }, + { + "uid": "23c2239369a69f752e790de95123b9e9", + "css": "male-2", + "code": 59417, + "src": "mfglabs" + }, + { + "uid": "10b2be8b48bebc1974d6f94bac9de71d", + "css": "female-1", + "code": 59419, + "src": "mfglabs" + }, { "uid": "740f78c2b53c8cc100a8b0d283bbd34f", "css": "home_icon-1", @@ -429,7 +525,7 @@ { "uid": "e2f6f0a56d4570c777c8bd5c50e38ea7", "css": "menu_icon_active-1", - "code": 59408, + "code": 59409, "src": "custom_icons", "selected": false, "svg": { @@ -443,7 +539,7 @@ { "uid": "f7eb1344b3a40f36bb4d32cdd0d76496", "css": "message_icon-1", - "code": 59409, + "code": 59410, "src": "custom_icons", "selected": false, "svg": { @@ -481,18 +577,47 @@ "search": [ "scdedule_icon_active" ] - }, { - "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", - "css": "drawer_icon", - "code": 59429, + }, + { + "uid": "2661cb62f53ed61755aa809d5280808e", + "css": "referral-bg", + "code": 59466, "src": "custom_icons", - "selected": true, + "selected": false, "svg": { - "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", - "width": 1633 + "path": "M681.4 793.1L735.5 860.8 683 913.3 659.1 793.8C663.5 793.4 667.9 793.1 672.4 793.1ZM791.7 793.1L758.6 834.5 725.5 793.1ZM835.9 793.1H844.8C849.4 793.1 853.7 793.4 858.1 793.8L834.2 913.3 781.7 860.8ZM913.8 655.2H912.8A154 154 0 0 0 913.8 637.9V586.2A34.5 34.5 0 0 1 913.8 655.2ZM603.4 482.8A103.6 103.6 0 0 1 706.9 379.3H810.3A103.6 103.6 0 0 1 913.8 482.8V551.7H844.8A34.5 34.5 0 0 1 810.3 517.3V448.3H775.9V465.5A86.3 86.3 0 0 1 689.7 551.7H603.4ZM603.4 655.2A34.5 34.5 0 0 1 603.4 586.2V637.9A154 154 0 0 0 604.5 655.2ZM637.9 637.9V586.2H689.6A120.4 120.4 0 0 0 781.2 543.9 69 69 0 0 0 844.8 586.2H879.3V637.9A120.7 120.7 0 1 1 637.9 637.9ZM1000 1000H517.2V948.3A155.4 155.4 0 0 1 625.3 800.5L655.5 951.7A17.3 17.3 0 0 0 667.4 964.8 17.6 17.6 0 0 0 672.4 965.5 17.3 17.3 0 0 0 684.6 960.5L758.6 886.5 832.6 960.5A17.2 17.2 0 0 0 861.7 951.7L891.9 800.5A155.5 155.5 0 0 1 999.9 948.3ZM164.1 413.8L218.3 481.5 165.8 534 141.9 414.5C146.3 414.1 150.7 413.8 155.2 413.8ZM274.5 413.8L241.4 455.2 208.3 413.8ZM318.6 413.8H327.6C332.1 413.8 336.5 414.1 340.9 414.5L317 534 264.5 481.5ZM396.6 275.9H395.5A154 154 0 0 0 396.5 258.6V206.9A34.5 34.5 0 0 1 396.5 275.9ZM86.2 103.5A103.6 103.6 0 0 1 189.7 0H293.1A103.6 103.6 0 0 1 396.6 103.5V172.4H327.6A34.5 34.5 0 0 1 293.1 137.9V69H258.6V86.2A86.3 86.3 0 0 1 172.4 172.4H86.2ZM86.2 275.9A34.5 34.5 0 1 1 86.2 206.9V258.6A154 154 0 0 0 87.2 275.9ZM120.7 258.6V206.9H172.4A120.4 120.4 0 0 0 264 164.6 69 69 0 0 0 327.6 206.9H362V258.6A120.7 120.7 0 1 1 120.7 258.6ZM482.8 620.7H0V569A155.4 155.4 0 0 1 108 421.2L138.2 572.4A17.3 17.3 0 0 0 150.2 585.5 17.6 17.6 0 0 0 155.1 586.2 17.3 17.3 0 0 0 167.3 581.2L241.3 507.2 315.3 581.2A17.2 17.2 0 0 0 344.4 572.3L374.6 421.2A155.5 155.5 0 0 1 482.7 569ZM172.4 827.6A17.2 17.2 0 0 0 155.2 810.3H127.8L206.9 731.3 286 810.3H258.6A17.2 17.2 0 0 0 241.4 827.6 206.9 206.9 0 0 0 333.5 999.6 172.6 172.6 0 0 1 172.4 827.6Z", + "width": 1000 }, "search": [ - "drawer_icon" + "referral-bg" + ] + }, + { + "uid": "961571413453d8de8d1d6325705ef204", + "css": "search-bg", + "code": 59468, + "src": "custom_icons", + "selected": false, + "svg": { + "path": "M543.6 353.5A132.3 132.3 0 1 1 411.3 221.2 132.3 132.3 0 0 1 543.6 353.5ZM974.2 974.2A88.2 88.2 0 0 1 849.4 974.2S624.7 749.2 622.9 747A405.4 405.4 0 1 1 747 622.9C749.2 624.6 974.2 849.4 974.2 849.4A88.2 88.2 0 0 1 974.2 974.2ZM726 405.2A320.8 320.8 0 1 0 206.8 657.2 147 147 0 0 1 352.4 530H470A147.1 147.1 0 0 1 614.3 648.5 320 320 0 0 0 726 405.2Z", + "width": 1000 + }, + "search": [ + "search-bg" + ] + }, + { + "uid": "6ec3034cfbe5c91e478ef9b9437647ed", + "css": "arrival-patients-bg", + "code": 59470, + "src": "custom_icons", + "selected": false, + "svg": { + "path": "M490.4 621.6L473.9 574.8A181.3 181.3 0 0 1 396.3 590.7 177.3 177.3 0 0 1 318 574.1L295.4 620.6A13.4 13.4 0 0 1 287.5 627.5Q281.1 629.6 274.3 631.6A117.4 117.4 0 0 0 304.2 686.6 127.3 127.3 0 0 0 493.5 682 264 264 0 0 1 513.6 634.6C508.3 633 503.4 631.3 498.7 629.8A13.4 13.4 0 0 1 490.4 621.6ZM481.4 761.4A266.9 266.9 0 0 1 483.6 727 150.9 150.9 0 0 1 396.3 753.3 149.3 149.3 0 0 1 284.6 704.8 146.4 146.4 0 0 1 248.5 639.1L233.3 643.4C129.4 672.5 0 708.8 0 820.7V960.8C0 977.1 7.5 1000 19.9 1000H630.7A265.8 265.8 0 0 1 481.4 761.4ZM401.8 191.2C406.8 191.6 411.6 192 416.4 192.4 457.3 196.1 484.2 198.5 510.1 141.7A13.4 13.4 0 0 1 534.2 141.2L535.5 143.8C552.2 161.8 563.7 195.1 571.3 227.6 572.5 212.4 573.2 199.7 573.2 194.7S573.3 184.3 573.4 178.8C574.2 139.6 575 95.1 536.5 56.1A193.6 193.6 0 0 0 393.6 0 191.5 191.5 0 0 0 255.3 62.7L251.6 67C228.8 92.4 203.1 121.1 205.1 202.5A286.9 286.9 0 0 0 212 238.8 146 146 0 0 1 243.5 163.5 70.6 70.6 0 0 1 297.2 140.4C317.1 140.4 324 160.1 330.5 179.2 340.6 208.3 351.7 240.7 398.9 243.5 374.6 216.4 378.9 206.6 380.9 201.9A19.2 19.2 0 0 1 401.8 191.2ZM541.8 420.1A12.9 12.9 0 0 1 549.2 418.1H549.6C571.7 418.1 597.4 384.9 607.2 343.8A25.6 25.6 0 0 0 599.3 314.8 13.4 13.4 0 0 0 584.2 319.5 13.4 13.4 0 0 1 572.8 328C572.5 328 572.1 328 571.7 328A13.4 13.4 0 0 1 558.3 315.8C555.8 285.8 544.9 209 523.9 172.9 491.9 226 452.4 222.4 414.1 219L413.5 219A270.3 270.3 0 0 0 438.7 245.4 13.4 13.4 0 0 1 431.6 268.5C337.9 281.9 317.5 223.1 305.3 187.9A89.4 89.4 0 0 0 296.5 167.2 44.1 44.1 0 0 0 263.2 181.7 131.4 131.4 0 0 0 236.8 255.7 309.1 309.1 0 0 0 235.3 305.2 15.4 15.4 0 0 1 210.2 321.3C204.3 315.1 198 313.1 192.9 315.9A24.5 24.5 0 0 0 185.6 343.8C195.3 384.9 221 418.1 243.2 418.1H243.8A13.4 13.4 0 0 1 257.2 431C258.1 443.9 265.2 510.1 318.6 543.8A143.4 143.4 0 0 0 396.4 563.9 146.4 146.4 0 0 0 474.3 544.3L474.6 544.1C528.8 510.5 534.9 444.1 535.6 431.1A13.4 13.4 0 0 1 541.9 420.1ZM746.8 522.7A238.6 238.6 0 1 0 985.5 761.3 238.7 238.7 0 0 0 746.8 522.7ZM881.7 796.9A17.9 17.9 0 0 1 863.9 814.7H792.4V888.4A17.9 17.9 0 0 1 774.6 906.2H712.1A17.9 17.9 0 0 1 694.2 888.4V814.7H620.6A17.9 17.9 0 0 1 602.7 796.9V734.4A17.9 17.9 0 0 1 620.6 716.5H694.2V645.1A17.9 17.9 0 0 1 712.1 627.3H774.6A17.9 17.9 0 0 1 792.4 645.1V716.5H863.9A17.9 17.9 0 0 1 881.7 734.4ZM765.6 725.4V654H721V725.4A17.9 17.9 0 0 1 703.1 743.3H629.4V787.9H703.1A17.9 17.9 0 0 1 721 805.8V879.4H765.6V805.8A17.9 17.9 0 0 1 783.5 787.9H854.9V743.3H783.5A17.9 17.9 0 0 1 765.6 725.4Z", + "width": 985 + }, + "search": [ + "arrival-patients-bg" ] } ] diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index 80db55c1..1ed8d895 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -1,5 +1,5 @@ /// Flutter icons DoctorApp -/// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com +/// Copyright (C) 2021 by original authors @ fluttericon.com, fontello.com /// This font was generated by FlutterIcon.com, which is derived from Fontello. /// /// To use this font, place it in your fonts/ directory and include the @@ -11,7 +11,11 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// +/// * MFG Labs, Copyright (C) 2012 by Daniel Bruce +/// Author: MFG Labs +/// License: SIL (http://scripts.sil.org/OFL) +/// Homepage: http://www.mfglabs.com/ /// import 'package:flutter/widgets.dart'; @@ -19,35 +23,76 @@ class DoctorApp { DoctorApp._(); static const _kFontFam = 'DoctorApp'; - static const _kFontPkg = null; - - static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reject_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patient = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData operations = IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData out_patient = IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient = IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology = IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mail = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medicine_search = IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code = IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral = IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referred = IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient = IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sync_icon = IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drawer_icon = IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const String _kFontPkg = null; + static const IconData female_icon = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = + IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active = + IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon = + IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active = + IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active = + IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_icon = + IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patient = + IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData approved_icon = + IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData pending_icon = + IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData in_patient_white = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = + IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon = + IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_1 = + IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData operations = + IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData out_patient = + IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient = + IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code = + IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology = + IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral = + IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_2 = + IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient = + IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_1 = + IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mail = + IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medicine_search = + IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referred = + IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData sync_icon = + IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData drawer_icon = + IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData leaves = + IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient_1 = + IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search = + IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrival_patients = + IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/landing_page.dart b/lib/landing_page.dart index f67957d3..a997675a 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -1,7 +1,10 @@ +import 'package:doctor_app_flutter/screens/QR_reader_screen.dart'; import 'package:doctor_app_flutter/screens/dashboard_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/message_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/services_screen.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart'; @@ -39,17 +42,17 @@ class _LandingPageState extends State { return Scaffold( appBar: AppBar( elevation: 0, - backgroundColor: HexColor('#515B5D'), - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white)), - title: Text(getText(currentTab).toUpperCase()), + backgroundColor: Colors.grey[100], + //textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), + title: currentTab != 0 + ? Text(getText(currentTab).toUpperCase()) + : Text(''), leading: Builder( builder: (BuildContext context) { return IconButton( icon: Icon(DoctorApp.drawer_icon), iconSize: 15, - color: Colors.white, + color: Colors.black, onPressed: () => Scaffold.of(context).openDrawer(), ); }, @@ -65,9 +68,9 @@ class _LandingPageState extends State { ShowCaseWidget( builder: Builder(builder: (context) => DashboardScreen()), ), - MessagesScreen(), MyScheduleScreen(), - ServicesScreen() + QrReaderScreen(), + DoctorReplyScreen(), ], ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), @@ -79,11 +82,11 @@ class _LandingPageState extends State { case 0: return TranslationBase.of(context).home; case 1: - return TranslationBase.of(context).replay; - case 2: return TranslationBase.of(context).mySchedule; + case 2: + return TranslationBase.of(context).qr; case 3: - return TranslationBase.of(context).services; + return TranslationBase.of(context).replay; } } } diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..1e688d96 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,14 +1,47 @@ +import 'package:doctor_app_flutter/core/service/auth_service.dart'; +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/medical_file_service.dart'; import 'package:doctor_app_flutter/core/service/patient_service.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/core/service/procedure_service.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/InsuranceCardService.dart'; +import 'core/service/PatientMuseService.dart'; +import 'core/service/SOAP_service.dart'; +import 'core/service/labs_service.dart'; +import 'core/service/patient-admission-request-service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; +import 'core/service/patient-ucaf-service.dart'; +import 'core/service/patient-vital-signs-service.dart'; +import 'core/service/patient-doctor-referral-service.dart'; +import 'core/service/prescriptions_service.dart'; +import 'core/service/radiology_service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; +import 'core/viewModel/InsuranceViewModel.dart'; +import 'core/viewModel/PatientMuseViewModel.dart'; +import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; +import 'core/viewModel/labs_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; +import 'core/viewModel/patient-admission-request-viewmodel.dart'; +import 'core/viewModel/patient-ucaf-viewmodel.dart'; +import 'core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'core/viewModel/patient-referral-viewmodel.dart'; +import 'core/viewModel/prescriptions_view_model.dart'; +import 'core/viewModel/radiology_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; @@ -24,12 +57,44 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => DashboardService()); + locator.registerLazySingleton(() => SickLeaveService()); + locator.registerLazySingleton(() => SOAPService()); + locator.registerLazySingleton(() => PatientReferralService()); + locator.registerLazySingleton(() => PrescriptionService()); + locator.registerLazySingleton(() => ProcedureService()); + locator.registerLazySingleton(() => VitalSignsService()); + locator.registerLazySingleton(() => MedicalFileService()); + locator.registerLazySingleton(() => AdmissionRequestService()); + locator.registerLazySingleton(() => UcafService()); + locator.registerLazySingleton(() => AuthService()); + locator.registerLazySingleton(() => PatientMuseService()); + locator.registerLazySingleton(() => LabsService()); + locator.registerLazySingleton(() => InsuranceCardService()); + locator.registerLazySingleton(() => RadiologyService()); + locator.registerLazySingleton(() => PrescriptionsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); + locator.registerFactory(() => IMEIViewModel()); locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => DashboardViewModel()); + locator.registerFactory(() => SickLeaveViewModel()); + locator.registerFactory(() => SOAPViewModel()); + locator.registerFactory(() => PatientReferralViewModel()); + locator.registerFactory(() => PrescriptionViewModel()); + locator.registerFactory(() => ProcedureViewModel()); + locator.registerFactory(() => VitalSignsViewModel()); + locator.registerFactory(() => AdmissionRequestViewModel()); + locator.registerFactory(() => UcafViewModel()); + locator.registerFactory(() => MedicalFileViewModel()); + locator.registerFactory(() => PatientMuseViewModel()); + locator.registerFactory(() => LabsViewModel()); + locator.registerFactory(() => InsuranceViewModel()); + locator.registerFactory(() => RadiologyViewModel()); + locator.registerFactory(() => PrescriptionsViewModel()); } diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 189535ce..5418c357 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -1,8 +1,8 @@ -const PATIENT_TYPE = const [ - {"text": "outPatiant", "text_ar": "المريض الخارجي", "val": "0"}, - {"text": "InPatiant", "text_ar": "المريض المنوم", "val": "1"}, +const PATIENT_TYPE_Des = const [ + {"text": "Outpatient", "text_ar": "المريض الخارجي", "val": "0"}, + {"text": "Inpatient", "text_ar": "المريض المنوم", "val": "1"}, {"text": "Discharge", "text_ar": "المريض المعافى", "val": "2"}, - {"text": "Referrd", "text_ar": "المريض المحول الي", "val": "3"}, + {"text": "Referred", "text_ar": "المريض المحول الي", "val": "3"}, { "text": "Referral Discharge", "text_ar": "المريض المحال المعافى", @@ -10,6 +10,7 @@ const PATIENT_TYPE = const [ }, {"text": "Tomorrow Patient", "text_ar": "مريض الغد", "val": "5"}, {"text": "Referral", "text_ar": "المريض المحول مني", "val": "6"}, + {"text": "Arrival", "text_ar": "المريض الواصل", "val": "7"}, ]; const LOCATIONS = const [ @@ -26,11 +27,14 @@ const LOCATIONS = const [ ]; enum vitalSignDetails { - bodyMeasurements, - temperature, - pulse, - pespiration, - bloodPressure, - oxygenation, - painScale + BodyMeasurements, + Temperature, + Pulse, + Prescriptions, + BloodPressure, + Respiration, + heart, + PainScale, + Weight, + Height } diff --git a/lib/main.dart b/lib/main.dart index 06d0ecfa..e3db2e49 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -13,7 +14,9 @@ import './routes.dart'; import 'config/config.dart'; import 'locator.dart'; -void main() { +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(); setupLocator(); runApp(MyApp()); } @@ -33,40 +36,39 @@ class MyApp extends StatelessWidget { create: (context) => AuthViewModel()), ChangeNotifierProvider( create: (context) => HospitalViewModel()), - ChangeNotifierProvider( - create: (context) => ProjectProvider(), + ChangeNotifierProvider( + create: (context) => ProjectViewModel(), ), ChangeNotifierProvider( create: (context) => LiveCareViewModel(), ), ], - child: Consumer( - builder: (context,projectProvider,child) => MaterialApp( - showSemanticsDebugger: false, - title: 'Flutter Demo', - locale: projectProvider.appLocal, - localizationsDelegates: [ - TranslationBaseDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ], - supportedLocales: [ - const Locale('ar', ''), // Arabic - const Locale('en', ''), // English - ], - theme: ThemeData( - primarySwatch: Colors.grey, - primaryColor: Colors.grey, - buttonColor: HexColor('#B8382C'), - fontFamily: 'WorkSans', - dividerColor: Colors.grey[350], - backgroundColor: Color.fromRGBO(255,255,255, 1) - ), - initialRoute: INIT_ROUTE, - routes: routes, - debugShowCheckedModeBanner: false, - ) - ), + child: Consumer( + builder: (context, projectProvider, child) => MaterialApp( + showSemanticsDebugger: false, + title: 'Flutter Demo', + locale: projectProvider.appLocal, + localizationsDelegates: [ + TranslationBaseDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + supportedLocales: [ + const Locale('ar', ''), // Arabic + const Locale('en', ''), // English + ], + theme: ThemeData( + primarySwatch: Colors.grey, + primaryColor: Colors.grey, + buttonColor: HexColor('#B8382C'), + fontFamily: 'WorkSans', + dividerColor: Colors.grey[350], + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + ), + initialRoute: INIT_ROUTE, + routes: routes, + debugShowCheckedModeBanner: false, + )), ); }); }, diff --git a/lib/models/SOAP/Allergy_model.dart b/lib/models/SOAP/Allergy_model.dart new file mode 100644 index 00000000..c3493832 --- /dev/null +++ b/lib/models/SOAP/Allergy_model.dart @@ -0,0 +1,60 @@ +class AllergyModel { + int allergyDiseaseId; + String allergyDiseaseName; + int allergyDiseaseType; + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + int episodeID; + bool isChecked; + bool isUpdatedByNurse; + int severity; + String severityName; + + AllergyModel( + {this.allergyDiseaseId, + this.allergyDiseaseName, + this.allergyDiseaseType, + this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.episodeID, + this.isChecked, + this.isUpdatedByNurse, + this.severity, + this.severityName}); + + AllergyModel.fromJson(Map json) { + allergyDiseaseId = json['allergyDiseaseId']; + allergyDiseaseName = json['allergyDiseaseName']; + allergyDiseaseType = json['allergyDiseaseType']; + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + episodeID = json['episodeID']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + severity = json['severity']; + severityName = json['severityName']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['allergyDiseaseName'] = this.allergyDiseaseName; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['episodeID'] = this.episodeID; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['severity'] = this.severity; + data['severityName'] = this.severityName; + return data; + } +} diff --git a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart new file mode 100644 index 00000000..80188dfe --- /dev/null +++ b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart @@ -0,0 +1,30 @@ +class GetChiefComplaintReqModel { + int patientMRN; + int appointmentNo; + int episodeId; + int episodeID; + dynamic doctorID; + + GetChiefComplaintReqModel( + {this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID, this.doctorID}); + + GetChiefComplaintReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + episodeID = json['EpisodeID']; + doctorID = json['DoctorID']; + +} + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['EpisodeID'] = this.episodeID; + data['DoctorID'] = this.doctorID; + + return data; + } +} diff --git a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart new file mode 100644 index 00000000..85ada324 --- /dev/null +++ b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart @@ -0,0 +1,60 @@ +class GetChiefComplaintResModel { + int appointmentNo; + String ccdate; + String chiefComplaint; + String clinicDescription; + int clinicID; + String currentMedication; + int doctorID; + String doctorName; + int episodeId; + String hopi; + int patientMRN; + int status; + + GetChiefComplaintResModel( + {this.appointmentNo, + this.ccdate, + this.chiefComplaint, + this.clinicDescription, + this.clinicID, + this.currentMedication, + this.doctorID, + this.doctorName, + this.episodeId, + this.hopi, + this.patientMRN, + this.status}); + + GetChiefComplaintResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + ccdate = json['ccdate']; + chiefComplaint = json['chiefComplaint']; + clinicDescription = json['clinicDescription']; + clinicID = json['clinicID']; + currentMedication = json['currentMedication']; + doctorID = json['doctorID']; + doctorName = json['doctorName']; + episodeId = json['episodeId']; + hopi = json['hopi']; + patientMRN = json['patientMRN']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['ccdate'] = this.ccdate; + data['chiefComplaint'] = this.chiefComplaint; + data['clinicDescription'] = this.clinicDescription; + data['clinicID'] = this.clinicID; + data['currentMedication'] = this.currentMedication; + data['doctorID'] = this.doctorID; + data['doctorName'] = this.doctorName; + data['episodeId'] = this.episodeId; + data['hopi'] = this.hopi; + data['patientMRN'] = this.patientMRN; + data['status'] = this.status; + return data; + } +} diff --git a/lib/models/SOAP/GeneralGetReqForSOAP.dart b/lib/models/SOAP/GeneralGetReqForSOAP.dart new file mode 100644 index 00000000..70e76313 --- /dev/null +++ b/lib/models/SOAP/GeneralGetReqForSOAP.dart @@ -0,0 +1,34 @@ +class GeneralGetReqForSOAP { + int patientMRN; + int appointmentNo; + int episodeId; + dynamic editedBy; + dynamic doctorID; + + GeneralGetReqForSOAP({ + this.patientMRN, + this.appointmentNo, + this.episodeId, + this.doctorID, + this.editedBy, + }); + + GeneralGetReqForSOAP.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + + return data; + } +} diff --git a/lib/models/SOAP/GetAllergiesResModel.dart b/lib/models/SOAP/GetAllergiesResModel.dart new file mode 100644 index 00000000..1eeca63e --- /dev/null +++ b/lib/models/SOAP/GetAllergiesResModel.dart @@ -0,0 +1,63 @@ +class GetAllergiesResModel { + int allergyDiseaseId; + String allergyDiseaseName; + int allergyDiseaseType; + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + int episodeID; + bool isChecked; + bool isUpdatedByNurse; + int severity; + String severityName; + String remarks; + + GetAllergiesResModel( + {this.allergyDiseaseId, + this.allergyDiseaseName, + this.allergyDiseaseType, + this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.episodeID, + this.isChecked, + this.isUpdatedByNurse, + this.severity, + this.severityName, this.remarks=''}); + + GetAllergiesResModel.fromJson(Map json) { + allergyDiseaseId = json['allergyDiseaseId']; + allergyDiseaseName = json['allergyDiseaseName']; + allergyDiseaseType = json['allergyDiseaseType']; + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + episodeID = json['episodeID']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + severity = json['severity']; + severityName = json['severityName']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['allergyDiseaseName'] = this.allergyDiseaseName; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['episodeID'] = this.episodeID; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['severity'] = this.severity; + data['severityName'] = this.severityName; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetAssessmentReqModel.dart b/lib/models/SOAP/GetAssessmentReqModel.dart new file mode 100644 index 00000000..965382b5 --- /dev/null +++ b/lib/models/SOAP/GetAssessmentReqModel.dart @@ -0,0 +1,44 @@ +class GetAssessmentReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + int clinicID; + dynamic doctorID; + dynamic editedBy; + + GetAssessmentReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.editedBy, + this.doctorID}); + + GetAssessmentReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + return data; + } +} diff --git a/lib/models/SOAP/GetAssessmentResModel.dart b/lib/models/SOAP/GetAssessmentResModel.dart new file mode 100644 index 00000000..4d1b1b68 --- /dev/null +++ b/lib/models/SOAP/GetAssessmentResModel.dart @@ -0,0 +1,72 @@ +class GetAssessmentResModel { + int appointmentNo; + String asciiDesc; + String clinicDescription; + int clinicID; + bool complexDiagnosis; + int conditionID; + int createdBy; + String createdOn; + int diagnosisTypeID; + int doctorID; + String doctorName; + int episodeId; + String icdCode10ID; + int patientMRN; + String remarks; + + GetAssessmentResModel( + {this.appointmentNo, + this.asciiDesc, + this.clinicDescription, + this.clinicID, + this.complexDiagnosis, + this.conditionID, + this.createdBy, + this.createdOn, + this.diagnosisTypeID, + this.doctorID, + this.doctorName, + this.episodeId, + this.icdCode10ID, + this.patientMRN, + this.remarks}); + + GetAssessmentResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + asciiDesc = json['ascii_Desc']; + clinicDescription = json['clinicDescription']; + clinicID = json['clinicID']; + complexDiagnosis = json['complexDiagnosis']; + conditionID = json['conditionID']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + diagnosisTypeID = json['diagnosisTypeID']; + doctorID = json['doctorID']; + doctorName = json['doctorName']; + episodeId = json['episodeId']; + icdCode10ID = json['icdCode10ID']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['ascii_Desc'] = this.asciiDesc; + data['clinicDescription'] = this.clinicDescription; + data['clinicID'] = this.clinicID; + data['complexDiagnosis'] = this.complexDiagnosis; + data['conditionID'] = this.conditionID; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['diagnosisTypeID'] = this.diagnosisTypeID; + data['doctorID'] = this.doctorID; + data['doctorName'] = this.doctorName; + data['episodeId'] = this.episodeId; + data['icdCode10ID'] = this.icdCode10ID; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetGetProgressNoteReqModel.dart b/lib/models/SOAP/GetGetProgressNoteReqModel.dart new file mode 100644 index 00000000..1da4a8bf --- /dev/null +++ b/lib/models/SOAP/GetGetProgressNoteReqModel.dart @@ -0,0 +1,45 @@ +class GetGetProgressNoteReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + int clinicID; + dynamic doctorID; + dynamic editedBy; + + GetGetProgressNoteReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.editedBy, + this.doctorID}); + + GetGetProgressNoteReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + return data; + } +} diff --git a/lib/models/SOAP/GetGetProgressNoteResModel.dart b/lib/models/SOAP/GetGetProgressNoteResModel.dart new file mode 100644 index 00000000..ce6c0a12 --- /dev/null +++ b/lib/models/SOAP/GetGetProgressNoteResModel.dart @@ -0,0 +1,56 @@ +class GetPatientProgressNoteResModel { + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + String dName; + String editedByName; + String editedOn; + int episodeId; + String mName; + int patientMRN; + String planNote; + + GetPatientProgressNoteResModel( + {this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.dName, + this.editedByName, + this.editedOn, + this.episodeId, + this.mName, + this.patientMRN, + this.planNote}); + + GetPatientProgressNoteResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + dName = json['dName']; + editedByName = json['editedByName']; + editedOn = json['editedOn']; + episodeId = json['episodeId']; + mName = json['mName']; + patientMRN = json['patientMRN']; + planNote = json['planNote']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['dName'] = this.dName; + data['editedByName'] = this.editedByName; + data['editedOn'] = this.editedOn; + data['episodeId'] = this.episodeId; + data['mName'] = this.mName; + data['patientMRN'] = this.patientMRN; + data['planNote'] = this.planNote; + return data; + } +} diff --git a/lib/models/SOAP/GetHistoryReqModel.dart b/lib/models/SOAP/GetHistoryReqModel.dart new file mode 100644 index 00000000..720b6342 --- /dev/null +++ b/lib/models/SOAP/GetHistoryReqModel.dart @@ -0,0 +1,50 @@ +class GetHistoryReqModel { + int patientMRN; + int historyType; + String episodeID; + String from; + String to; + int clinicID; + int appointmentNo; + dynamic editedBy; + dynamic doctorID; + + GetHistoryReqModel( + {this.patientMRN, + this.historyType, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.doctorID, + this.editedBy, + this.appointmentNo}); + + GetHistoryReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + historyType = json['HistoryType']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + appointmentNo = json['AppointmentNo']; + editedBy = json['EditedBy']; + + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['HistoryType'] = this.historyType; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + + return data; + } +} diff --git a/lib/models/SOAP/GetHistoryResModel.dart b/lib/models/SOAP/GetHistoryResModel.dart new file mode 100644 index 00000000..c4b4f129 --- /dev/null +++ b/lib/models/SOAP/GetHistoryResModel.dart @@ -0,0 +1,40 @@ +class GetHistoryResModel { + int appointmentNo; + int episodeId; + int historyId; + int historyType; + bool isChecked; + int patientMRN; + String remarks; + + GetHistoryResModel( + {this.appointmentNo, + this.episodeId, + this.historyId, + this.historyType, + this.isChecked, + this.patientMRN, + this.remarks}); + + GetHistoryResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + episodeId = json['episodeId']; + historyId = json['historyId']; + historyType = json['historyType']; + isChecked = json['isChecked']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['episodeId'] = this.episodeId; + data['historyId'] = this.historyId; + data['historyType'] = this.historyType; + data['isChecked'] = this.isChecked; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamListResModel.dart b/lib/models/SOAP/GetPhysicalExamListResModel.dart new file mode 100644 index 00000000..c97189b1 --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamListResModel.dart @@ -0,0 +1,88 @@ +class GetPhysicalExamResModel { + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + Null editedBy; + String editedByName; + String editedOn; + int episodeId; + int examId; + String examName; + int examType; + int examinationType; + String examinationTypeName; + bool isAbnormal; + bool isNew; + bool isNormal; + bool notExamined; + int patientMRN; + String remarks; + + GetPhysicalExamResModel( + {this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.editedBy, + this.editedByName, + this.editedOn, + this.episodeId, + this.examId, + this.examName, + this.examType, + this.examinationType, + this.examinationTypeName, + this.isAbnormal, + this.isNew, + this.isNormal, + this.notExamined, + this.patientMRN, + this.remarks}); + + GetPhysicalExamResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedByName = json['editedByName']; + editedOn = json['editedOn']; + episodeId = json['episodeId']; + examId = json['examId']; + examName = json['examName']; + examType = json['examType']; + examinationType = json['examinationType']; + examinationTypeName = json['examinationTypeName']; + isAbnormal = json['isAbnormal']; + isNew = json['isNew']; + isNormal = json['isNormal']; + notExamined = json['notExamined']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedByName'] = this.editedByName; + data['editedOn'] = this.editedOn; + data['episodeId'] = this.episodeId; + data['examId'] = this.examId; + data['examName'] = this.examName; + data['examType'] = this.examType; + data['examinationType'] = this.examinationType; + data['examinationTypeName'] = this.examinationTypeName; + data['isAbnormal'] = this.isAbnormal; + data['isNew'] = this.isNew; + data['isNormal'] = this.isNormal; + data['notExamined'] = this.notExamined; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamReqModel.dart b/lib/models/SOAP/GetPhysicalExamReqModel.dart new file mode 100644 index 00000000..5145c419 --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamReqModel.dart @@ -0,0 +1,41 @@ +class GetPhysicalExamReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + dynamic editedBy; + dynamic doctorID; + + GetPhysicalExamReqModel({ + this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to, + this.doctorID, + this.editedBy, + }); + + GetPhysicalExamReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + return data; + } +} diff --git a/lib/models/SOAP/PostEpisodeReqModel.dart b/lib/models/SOAP/PostEpisodeReqModel.dart new file mode 100644 index 00000000..6d3ee45a --- /dev/null +++ b/lib/models/SOAP/PostEpisodeReqModel.dart @@ -0,0 +1,28 @@ +class PostEpisodeReqModel { + int appointmentNo; + int patientMRN; + int doctorID; + String vidaAuthTokenID; + + PostEpisodeReqModel( + {this.appointmentNo, + this.patientMRN, + this.doctorID, + this.vidaAuthTokenID}); + + PostEpisodeReqModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + patientMRN = json['PatientMRN']; + doctorID = json['DoctorID']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['PatientMRN'] = this.patientMRN; + data['DoctorID'] = this.doctorID; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/models/SOAP/get_Allergies_request_model.dart b/lib/models/SOAP/get_Allergies_request_model.dart new file mode 100644 index 00000000..7676d530 --- /dev/null +++ b/lib/models/SOAP/get_Allergies_request_model.dart @@ -0,0 +1,32 @@ +class GetAllergiesRequestModel { + String vidaAuthTokenID; + int patientMRN; + int appointmentNo; + int episodeId; + String doctorID; + + GetAllergiesRequestModel( + {this.vidaAuthTokenID, + this.patientMRN, + this.appointmentNo, + this.episodeId, + this.doctorID}); + + GetAllergiesRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['DoctorID'] = this.doctorID; + return data; + } +} diff --git a/lib/models/SOAP/master_key_model.dart b/lib/models/SOAP/master_key_model.dart new file mode 100644 index 00000000..a1c32039 --- /dev/null +++ b/lib/models/SOAP/master_key_model.dart @@ -0,0 +1,76 @@ +class MasterKeyModel { + String alias; + String aliasN; + dynamic code; + dynamic description; + dynamic detail1; + dynamic detail2; + dynamic detail3; + dynamic detail4; + dynamic detail5; + int groupID; + int id; + String nameAr; + String nameEn; + dynamic remarks; + int typeId; + String valueList; + + MasterKeyModel( + {this.alias, + this.aliasN, + this.code, + this.description, + this.detail1, + this.detail2, + this.detail3, + this.detail4, + this.detail5, + this.groupID, + this.id, + this.nameAr, + this.nameEn, + this.remarks, + this.typeId, + this.valueList}); + + MasterKeyModel.fromJson(Map json) { + alias = json['alias']; + aliasN = json['aliasN']; + code = json['code']; + description = json['description']; + detail1 = json['detail1']; + detail2 = json['detail2']; + detail3 = json['detail3']; + detail4 = json['detail4']; + detail5 = json['detail5']; + groupID = json['groupID']; + id = json['id']; + nameAr = json['nameAr']; + nameEn = json['nameEn']; + remarks = json['remarks']; + typeId = json['typeId']; + valueList = json['valueList']; + } + + Map toJson() { + final Map data = new Map(); + data['alias'] = this.alias; + data['aliasN'] = this.aliasN; + data['code'] = this.code; + data['description'] = this.description; + data['detail1'] = this.detail1; + data['detail2'] = this.detail2; + data['detail3'] = this.detail3; + data['detail4'] = this.detail4; + data['detail5'] = this.detail5; + data['groupID'] = this.groupID; + data['id'] = this.id; + data['nameAr'] = this.nameAr; + data['nameEn'] = this.nameEn; + data['remarks'] = this.remarks; + data['typeId'] = this.typeId; + data['valueList'] = this.valueList; + return data; + } +} diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart new file mode 100644 index 00000000..5a6bd749 --- /dev/null +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -0,0 +1,42 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAllergy { + MasterKeyModel selectedAllergySeverity; + MasterKeyModel selectedAllergy; + String remark; + bool isChecked; + int createdBy; + + MySelectedAllergy( + {this.selectedAllergySeverity, + this.selectedAllergy, + this.remark, + this.isChecked, + this.createdBy}); + + MySelectedAllergy.fromJson(Map json) { + selectedAllergySeverity = json['selectedAllergySeverity'] != null + ? new MasterKeyModel.fromJson(json['selectedAllergySeverity']) + : null; + selectedAllergy = json['selectedAllergy'] != null + ? new MasterKeyModel.fromJson(json['selectedAllergy']) + : null; + remark = json['remark']; + remark = json['isChecked']; + createdBy = json['createdBy']; + } + + Map toJson() { + final Map data = new Map(); + if (this.selectedAllergySeverity != null) { + data['selectedAllergySeverity'] = this.selectedAllergySeverity.toJson(); + } + if (this.selectedAllergy != null) { + data['selectedAllergy'] = this.selectedAllergy.toJson(); + } + data['remark'] = this.remark; + data['isChecked'] = this.remark; + data['createdBy'] = this.createdBy; + return data; + } +} diff --git a/lib/models/SOAP/my_selected_assement.dart b/lib/models/SOAP/my_selected_assement.dart new file mode 100644 index 00000000..4d4afc2d --- /dev/null +++ b/lib/models/SOAP/my_selected_assement.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAssessment { + MasterKeyModel selectedICD; + MasterKeyModel selectedDiagnosisCondition; + MasterKeyModel selectedDiagnosisType; + String remark; + int appointmentId; + int createdBy; + String createdOn; + int doctorID; + String doctorName; + String icdCode10ID; + + MySelectedAssessment( + {this.selectedICD, + this.selectedDiagnosisCondition, + this.selectedDiagnosisType, + this.remark, this.appointmentId, this.createdBy, + this.createdOn, + this.doctorID, + this.doctorName, + this.icdCode10ID}); + + MySelectedAssessment.fromJson(Map json) { + selectedICD = json['selectedICD'] != null + ? new MasterKeyModel.fromJson(json['selectedICD']) + : null; + selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition']) + : null; + selectedDiagnosisType = json['selectedDiagnosisType'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisType']) + : null; + remark = json['remark']; + appointmentId = json['appointmentId']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorID = json['doctorID']; + doctorName = json['doctorName']; + icdCode10ID = json['icdCode10ID']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedICD != null) { + data['selectedICD'] = this.selectedICD.toJson(); + } + if (this.selectedDiagnosisCondition != null) { + data['selectedICD'] = this.selectedDiagnosisCondition.toJson(); + } + if (this.selectedDiagnosisType != null) { + data['selectedICD'] = this.selectedDiagnosisType.toJson(); + } + data['remark'] = this.remark; + data['appointmentId'] = this.appointmentId; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorID'] = this.doctorID; + data['doctorName'] = this.doctorName; + data['icdCode10ID'] = this.icdCode10ID; + return data; + } +} diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart new file mode 100644 index 00000000..393af944 --- /dev/null +++ b/lib/models/SOAP/my_selected_examination.dart @@ -0,0 +1,47 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + bool notExamined; + bool isNew; + int createdBy; + + MySelectedExamination( + {this.selectedExamination, + this.remark, + this.isNormal = false, + this.isAbnormal = false, + this.notExamined = true, + this.isNew = true, + this.createdBy}); + + MySelectedExamination.fromJson(Map json) { + selectedExamination = json['selectedExamination'] != null + ? new MasterKeyModel.fromJson(json['selectedExamination']) + : null; + remark = json['remark']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + isNew = json['isNew']; + createdBy = json['createdBy']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedExamination != null) { + data['selectedExamination'] = this.selectedExamination.toJson(); + } + data['remark'] = this.remark; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + return data; + } +} diff --git a/lib/models/SOAP/my_selected_history.dart b/lib/models/SOAP/my_selected_history.dart new file mode 100644 index 00000000..11e366c2 --- /dev/null +++ b/lib/models/SOAP/my_selected_history.dart @@ -0,0 +1,30 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedHistory { + MasterKeyModel selectedHistory; + String remark; + bool isChecked; + + MySelectedHistory( + { this.selectedHistory, this.remark, this.isChecked}); + + MySelectedHistory.fromJson(Map json) { + + selectedHistory = json['selectedHistory'] != null + ? new MasterKeyModel.fromJson(json['selectedHistory']) + : null; + remark = json['remark']; + remark = json['isChecked']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedHistory != null) { + data['selectedHistory'] = this.selectedHistory.toJson(); + } + data['remark'] = this.remark; + data['isChecked'] = this.remark; + return data; + } +} diff --git a/lib/models/SOAP/order-procedure.dart b/lib/models/SOAP/order-procedure.dart new file mode 100644 index 00000000..4e134a07 --- /dev/null +++ b/lib/models/SOAP/order-procedure.dart @@ -0,0 +1,110 @@ +class OrderProcedure { + + String achiCode; + String appointmentDate; + int appointmentNo; + int categoryID; + String clinicDescription; + String cptCode; + int createdBy; + String createdOn; + String doctorName; + bool isApprovalCreated; + bool isApprovalRequired; + bool isCovered; + bool isInvoiced; + bool isReferralInvoiced; + bool isUncoveredByDoctor; + int lineItemNo; + String orderDate; + int orderNo; + int orderType; + String procedureId; + String procedureName; + String remarks; + String status; + String template; + + OrderProcedure( + {this.achiCode, + this.appointmentDate, + this.appointmentNo, + this.categoryID, + this.clinicDescription, + this.cptCode, + this.createdBy, + this.createdOn, + this.doctorName, + this.isApprovalCreated, + this.isApprovalRequired, + this.isCovered, + this.isInvoiced, + this.isReferralInvoiced, + this.isUncoveredByDoctor, + this.lineItemNo, + this.orderDate, + this.orderNo, + this.orderType, + this.procedureId, + this.procedureName, + this.remarks, + this.status, + this.template}); + + OrderProcedure.fromJson(Map json) { + achiCode = json['achiCode']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + categoryID = json['categoryID']; + clinicDescription = json['clinicDescription']; + cptCode = json['cptCode']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + isApprovalCreated = json['isApprovalCreated']; + isApprovalRequired = json['isApprovalRequired']; + isCovered = json['isCovered']; + isInvoiced = json['isInvoiced']; + isReferralInvoiced = json['isReferralInvoiced']; + isUncoveredByDoctor = json['isUncoveredByDoctor']; + lineItemNo = json['lineItemNo']; + orderDate = json['orderDate']; + orderNo = json['orderNo']; + orderType = json['orderType']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + remarks = json['remarks']; + status = json['status']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['achiCode'] = this.achiCode; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['categoryID'] = this.categoryID; + data['clinicDescription'] = this.clinicDescription; + data['cptCode'] = this.cptCode; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['isApprovalCreated'] = this.isApprovalCreated; + data['isApprovalRequired'] = this.isApprovalRequired; + data['isCovered'] = this.isCovered; + data['isInvoiced'] = this.isInvoiced; + data['isReferralInvoiced'] = this.isReferralInvoiced; + data['isUncoveredByDoctor'] = this.isUncoveredByDoctor; + data['lineItemNo'] = this.lineItemNo; + data['orderDate'] = this.orderDate; + data['orderNo'] = this.orderNo; + data['orderType'] = this.orderType; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['remarks'] = this.remarks; + data['status'] = this.status; + data['template'] = this.template; + return data; + } + +} \ No newline at end of file diff --git a/lib/models/SOAP/post_allergy_request_model.dart b/lib/models/SOAP/post_allergy_request_model.dart new file mode 100644 index 00000000..6783d885 --- /dev/null +++ b/lib/models/SOAP/post_allergy_request_model.dart @@ -0,0 +1,93 @@ +class PostAllergyRequestModel { + List + listHisProgNotePatientAllergyDiseaseVM; + + PostAllergyRequestModel({this.listHisProgNotePatientAllergyDiseaseVM}); + + PostAllergyRequestModel.fromJson(Map json) { + if (json['listHisProgNotePatientAllergyDiseaseVM'] != null) { + listHisProgNotePatientAllergyDiseaseVM = + new List(); + json['listHisProgNotePatientAllergyDiseaseVM'].forEach((v) { + listHisProgNotePatientAllergyDiseaseVM + .add(new ListHisProgNotePatientAllergyDiseaseVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePatientAllergyDiseaseVM != null) { + data['listHisProgNotePatientAllergyDiseaseVM'] = this + .listHisProgNotePatientAllergyDiseaseVM + .map((v) => v.toJson()) + .toList(); + } + return data; + } +} + +class ListHisProgNotePatientAllergyDiseaseVM { + int patientMRN; + int allergyDiseaseType; + int allergyDiseaseId; + int episodeId; + int appointmentNo; + int severity; + bool isChecked; + bool isUpdatedByNurse; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + + ListHisProgNotePatientAllergyDiseaseVM( + {this.patientMRN, + this.allergyDiseaseType, + this.allergyDiseaseId, + this.episodeId, + this.appointmentNo, + this.severity, + this.isChecked, + this.isUpdatedByNurse, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + ListHisProgNotePatientAllergyDiseaseVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + allergyDiseaseType = json['allergyDiseaseType']; + allergyDiseaseId = json['allergyDiseaseId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + severity = json['severity']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['severity'] = this.severity; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/models/SOAP/post_assessment_request_model.dart b/lib/models/SOAP/post_assessment_request_model.dart new file mode 100644 index 00000000..af577671 --- /dev/null +++ b/lib/models/SOAP/post_assessment_request_model.dart @@ -0,0 +1,69 @@ +class PostAssessmentRequestModel { + int patientMRN; + int appointmentNo; + int episodeId; + List icdCodeDetails; + + PostAssessmentRequestModel( + {this.patientMRN, + this.appointmentNo, + this.episodeId, + this.icdCodeDetails}); + + PostAssessmentRequestModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeID']; + if (json['icdCodeDetails'] != null) { + icdCodeDetails = new List(); + json['icdCodeDetails'].forEach((v) { + icdCodeDetails.add(new IcdCodeDetails.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeId; + if (this.icdCodeDetails != null) { + data['icdCodeDetails'] = + this.icdCodeDetails.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class IcdCodeDetails { + String icdcode10Id; + int conditionId; + int diagnosisTypeId; + bool complexDiagnosis; + String remarks; + + IcdCodeDetails( + {this.icdcode10Id, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + IcdCodeDetails.fromJson(Map json) { + icdcode10Id = json['icdcode10Id']; + conditionId = json['conditionId']; + diagnosisTypeId = json['diagnosisTypeId']; + complexDiagnosis = json['complexDiagnosis']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['icdcode10Id'] = this.icdcode10Id; + data['conditionId'] = this.conditionId; + data['diagnosisTypeId'] = this.diagnosisTypeId; + data['complexDiagnosis'] = this.complexDiagnosis; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/post_chief_complaint_request_model.dart b/lib/models/SOAP/post_chief_complaint_request_model.dart new file mode 100644 index 00000000..f1e9c2b4 --- /dev/null +++ b/lib/models/SOAP/post_chief_complaint_request_model.dart @@ -0,0 +1,58 @@ +class PostChiefComplaintRequestModel { + int appointmentNo; + int episodeID; + int patientMRN; + String chiefComplaint; + String hopi; + String currentMedication; + bool ispregnant; + bool isLactation; + int numberOfWeeks; + dynamic doctorID; + dynamic editedBy; + + + PostChiefComplaintRequestModel( + {this.appointmentNo, + this.episodeID, + this.patientMRN, + this.chiefComplaint, + this.hopi, + this.currentMedication, + this.ispregnant, + this.isLactation, + this.doctorID, + this.editedBy, + this.numberOfWeeks}); + + PostChiefComplaintRequestModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + patientMRN = json['PatientMRN']; + chiefComplaint = json['chiefComplaint']; + hopi = json['Hopi']; + currentMedication = json['CurrentMedication']; + ispregnant = json['ispregnant']; + isLactation = json['isLactation']; + numberOfWeeks = json['numberOfWeeks']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['PatientMRN'] = this.patientMRN; + data['chiefComplaint'] = this.chiefComplaint; + data['Hopi'] = this.hopi; + data['CurrentMedication'] = this.currentMedication; + data['ispregnant'] = this.ispregnant; + data['isLactation'] = this.isLactation; + data['numberOfWeeks'] = this.numberOfWeeks; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + + return data; + } +} diff --git a/lib/models/SOAP/post_histories_request_model.dart b/lib/models/SOAP/post_histories_request_model.dart new file mode 100644 index 00000000..d8be3fb2 --- /dev/null +++ b/lib/models/SOAP/post_histories_request_model.dart @@ -0,0 +1,67 @@ +class PostHistoriesRequestModel { + List listMedicalHistoryVM; + dynamic doctorID; + + PostHistoriesRequestModel({this.listMedicalHistoryVM, this.doctorID}); + + PostHistoriesRequestModel.fromJson(Map json) { + if (json['listMedicalHistoryVM'] != null) { + listMedicalHistoryVM = new List(); + json['listMedicalHistoryVM'].forEach((v) { + listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v)); + }); + } + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + if (this.listMedicalHistoryVM != null) { + data['listMedicalHistoryVM'] = + this.listMedicalHistoryVM.map((v) => v.toJson()).toList(); + } + data['DoctorID'] = this.doctorID; + return data; + } +} + +class ListMedicalHistoryVM { + int patientMRN; + int historyType; + int historyId; + int episodeId; + int appointmentNo; + bool isChecked; + String remarks; + + ListMedicalHistoryVM( + {this.patientMRN, + this.historyType, + this.historyId, + this.episodeId, + this.appointmentNo, + this.isChecked, + this.remarks}); + + ListMedicalHistoryVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + historyType = json['historyType']; + historyId = json['historyId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + isChecked = json['isChecked']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['historyType'] = this.historyType; + data['historyId'] = this.historyId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['isChecked'] = this.isChecked; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart new file mode 100644 index 00000000..d1b64837 --- /dev/null +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -0,0 +1,115 @@ + import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class PostPhysicalExamRequestModel { + List listHisProgNotePhysicalExaminationVM; + + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); + + PostPhysicalExamRequestModel.fromJson(Map json) { + if (json['listHisProgNotePhysicalExaminationVM'] != null) { + listHisProgNotePhysicalExaminationVM = new List(); + json['listHisProgNotePhysicalExaminationVM'].forEach((v) { + listHisProgNotePhysicalExaminationVM + .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePhysicalExaminationVM != null) { + data['listHisProgNotePhysicalExaminationVM'] = + this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + + class ListHisProgNotePhysicalExaminationVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + bool notExamined; + String examName; + String examinationTypeName; + int examinationType; + String remarks; + bool isNew; + int createdBy; + String createdOn; + String createdByName; + int editedBy; + String editedOn; + String editedByName; + + ListHisProgNotePhysicalExaminationVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.notExamined, + this.examName, + this.examinationTypeName, + this.examinationType, + this.remarks, + this.isNew, + this.createdBy, + this.createdOn, + this.createdByName, + this.editedBy, + this.editedOn, + this.editedByName}); + + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + examName = json['examName']; + examinationTypeName = json['examinationTypeName']; + examinationType = json['examinationType']; + remarks = json['remarks']; + isNew = json['isNew']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + createdByName = json['createdByName']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + editedByName = json['editedByName']; + } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['examName'] = this.examName; + data['examinationTypeName'] = this.examinationTypeName; + data['examinationType'] = this.examinationType; + data['remarks'] = this.remarks; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['createdByName'] = this.createdByName; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['editedByName'] = this.editedByName; + return data; + } + } diff --git a/lib/models/SOAP/post_progress_note_request_model.dart b/lib/models/SOAP/post_progress_note_request_model.dart new file mode 100644 index 00000000..2925819d --- /dev/null +++ b/lib/models/SOAP/post_progress_note_request_model.dart @@ -0,0 +1,36 @@ +class PostProgressNoteRequestModel { + int appointmentNo; + int episodeId; + int patientMRN; + String planNote; + dynamic doctorID; + dynamic editedBy; + + PostProgressNoteRequestModel( + {this.appointmentNo, + this.episodeId, + this.patientMRN, + this.planNote, + this.doctorID, + this.editedBy}); + + PostProgressNoteRequestModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeID']; + patientMRN = json['PatientMRN']; + planNote = json['PlanNote']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeId; + data['PatientMRN'] = this.patientMRN; + data['PlanNote'] = this.planNote; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + return data; + } +} diff --git a/lib/models/auth/activation_Code_req_model.dart b/lib/models/auth/activation_Code_req_model.dart new file mode 100644 index 00000000..1a9510e8 --- /dev/null +++ b/lib/models/auth/activation_Code_req_model.dart @@ -0,0 +1,51 @@ +class ActivationCodeModel { + String mobileNumber; + String zipCode; + int channel; + int languageID; + double versionID; + int memberID; + String password; + int facilityId; + String generalid; + String otpSendType; + ActivationCodeModel( + {this.mobileNumber, + this.zipCode, + this.channel, + this.languageID, + this.versionID, + this.memberID, + this.password, + this.facilityId, + this.otpSendType, + this.generalid}); + + ActivationCodeModel.fromJson(Map json) { + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + channel = json['Channel']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + memberID = json['MemberID']; + password = json['Password']; + facilityId = json['facilityId']; + otpSendType = json['OTP_SendType']; + generalid = json['generalid']; + } + + Map toJson() { + final Map data = new Map(); + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['MemberID'] = this.memberID; + data['Password'] = this.password; + data['facilityId'] = this.facilityId; + data['OTP_SendType'] = otpSendType; + data['generalid'] = this.generalid; + return data; + } +} diff --git a/lib/models/auth/check_activation_code_request_model.dart b/lib/models/auth/check_activation_code_request_model.dart new file mode 100644 index 00000000..9bb3d4f6 --- /dev/null +++ b/lib/models/auth/check_activation_code_request_model.dart @@ -0,0 +1,67 @@ +class CheckActivationCodeRequestModel { + String mobileNumber; + String zipCode; + int doctorID; + String iPAdress; + int channel; + int languageID; + int projectID; + double versionID; + String generalid; + String logInTokenID; + String activationCode; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int oTPSendType; + CheckActivationCodeRequestModel( + {this.mobileNumber, + this.zipCode, + this.doctorID, + this.iPAdress, + this.channel, + this.languageID, + this.projectID, + this.versionID, + this.generalid, + this.logInTokenID, + this.activationCode, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.oTPSendType}); + + CheckActivationCodeRequestModel.fromJson(Map json) { + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + doctorID = json['DoctorID']; + iPAdress = json['IPAdress']; + channel = json['Channel']; + languageID = json['LanguageID']; + projectID = json['ProjectID']; + versionID = json['VersionID']; + generalid = json['generalid']; + logInTokenID = json['LogInTokenID']; + activationCode = json['activationCode']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + oTPSendType = json['OTP_SendType']; + } + + Map toJson() { + final Map data = new Map(); + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['DoctorID'] = this.doctorID; + data['IPAdress'] = this.iPAdress; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['ProjectID'] = this.projectID; + data['VersionID'] = this.versionID; + data['generalid'] = this.generalid; + data['LogInTokenID'] = this.logInTokenID; + data['activationCode'] = this.activationCode; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['OTP_SendType'] = this.oTPSendType; + return data; + } +} diff --git a/lib/models/auth/send_activation_code_model2.dart b/lib/models/auth/send_activation_code_model2.dart new file mode 100644 index 00000000..68a90c85 --- /dev/null +++ b/lib/models/auth/send_activation_code_model2.dart @@ -0,0 +1,63 @@ +class ActivationCodeModel2 { + int oTPSendType; + String mobileNumber; + String zipCode; + int channel; + int languageID; + double versionID; + int memberID; + int facilityId; + String generalid; + int isMobileFingerPrint; + String vidaAuthTokenID; + String vidaRefreshTokenID; + String iMEI; + ActivationCodeModel2( + {this.oTPSendType, + this.mobileNumber, + this.zipCode, + this.channel, + this.languageID, + this.versionID, + this.memberID, + this.facilityId, + this.generalid, + this.isMobileFingerPrint, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.iMEI}); + + ActivationCodeModel2.fromJson(Map json) { + oTPSendType = json['OTP_SendType']; + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + channel = json['Channel']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + memberID = json['MemberID']; + facilityId = json['facilityId']; + generalid = json['generalid']; + isMobileFingerPrint = json['IsMobileFingerPrint']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + iMEI = json['IMEI']; + } + + Map toJson() { + final Map data = new Map(); + data['OTP_SendType'] = this.oTPSendType; + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['MemberID'] = this.memberID; + data['facilityId'] = this.facilityId; + data['generalid'] = this.generalid; + data['IsMobileFingerPrint'] = this.isMobileFingerPrint; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['IMEI'] = this.iMEI; + return data; + } +} diff --git a/lib/models/dashboard/dashboard_model.dart b/lib/models/dashboard/dashboard_model.dart new file mode 100644 index 00000000..0e03e899 --- /dev/null +++ b/lib/models/dashboard/dashboard_model.dart @@ -0,0 +1,70 @@ +class DashboardModel { + String kPIName; + int displaySequence; + List summaryoptions; + + DashboardModel({this.kPIName, this.displaySequence, this.summaryoptions}); + + DashboardModel.fromJson(Map json) { + kPIName = json['KPIName']; + displaySequence = json['displaySequence']; + if (json['summaryoptions'] != null) { + summaryoptions = new List(); + json['summaryoptions'].forEach((v) { + summaryoptions.add(new Summaryoptions.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['KPIName'] = this.kPIName; + data['displaySequence'] = this.displaySequence; + if (this.summaryoptions != null) { + data['summaryoptions'] = + this.summaryoptions.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Summaryoptions { + String kPIParameter; + String captionColor; + bool isCaptionBold; + bool isValueBold; + int order; + int value; + String valueColor; + + Summaryoptions( + {this.kPIParameter, + this.captionColor, + this.isCaptionBold, + this.isValueBold, + this.order, + this.value, + this.valueColor}); + + Summaryoptions.fromJson(Map json) { + kPIParameter = json['KPIParameter']; + captionColor = json['captionColor']; + isCaptionBold = json['isCaptionBold']; + isValueBold = json['isValueBold']; + order = json['order']; + value = json['value']; + valueColor = json['valueColor']; + } + + Map toJson() { + final Map data = new Map(); + data['KPIParameter'] = this.kPIParameter; + data['captionColor'] = this.captionColor; + data['isCaptionBold'] = this.isCaptionBold; + data['isValueBold'] = this.isValueBold; + data['order'] = this.order; + data['value'] = this.value; + data['valueColor'] = this.valueColor; + return data; + } +} diff --git a/lib/models/doctor/list_doctor_working_hours_table_model.dart b/lib/models/doctor/list_doctor_working_hours_table_model.dart index cb103c8a..5f1630bc 100644 --- a/lib/models/doctor/list_doctor_working_hours_table_model.dart +++ b/lib/models/doctor/list_doctor_working_hours_table_model.dart @@ -5,10 +5,14 @@ class ListDoctorWorkingHoursTable { String dayName; String workingHours; - ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours}); + ListDoctorWorkingHoursTable({ + this.date, + this.dayName, + this.workingHours, + }); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = Helpers.convertStringToDate(json['Date']) ; + date = Helpers.convertStringToDate(json['Date']); dayName = json['DayName']; workingHours = json['WorkingHours']; } @@ -18,6 +22,7 @@ class ListDoctorWorkingHoursTable { data['Date'] = this.date; data['DayName'] = this.dayName; data['WorkingHours'] = this.workingHours; + return data; } } @@ -25,6 +30,5 @@ class ListDoctorWorkingHoursTable { class WorkingHours { String from; String to; - WorkingHours({this.from,this.to}); - + WorkingHours({this.from, this.to}); } diff --git a/lib/models/doctor/list_gt_my_patients_question_model.dart b/lib/models/doctor/list_gt_my_patients_question_model.dart index b743ade6..0d2cff9a 100644 --- a/lib/models/doctor/list_gt_my_patients_question_model.dart +++ b/lib/models/doctor/list_gt_my_patients_question_model.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; + + class ListGtMyPatientsQuestions { String setupID; int projectID; @@ -17,11 +19,14 @@ class ListGtMyPatientsQuestions { int editedBy; String editedOn; String patientName; - String patientNameN; + Null patientNameN; int gender; String dateofBirth; String mobileNumber; String emailAddress; + String doctorResponse; + String infoStatus; + Null clinicID; String age; String genderDescription; bool isVidaCall; @@ -48,6 +53,9 @@ class ListGtMyPatientsQuestions { this.dateofBirth, this.mobileNumber, this.emailAddress, + this.doctorResponse, + this.infoStatus, + this.clinicID, this.age, this.genderDescription, this.isVidaCall}); @@ -61,6 +69,7 @@ class ListGtMyPatientsQuestions { doctorID = json['DoctorID']; requestType = json['RequestType']; requestDate = Helpers.convertStringToDate(json['RequestDate']) ; + requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; @@ -74,6 +83,9 @@ class ListGtMyPatientsQuestions { dateofBirth = json['DateofBirth']; mobileNumber = json['MobileNumber']; emailAddress = json['EmailAddress']; + doctorResponse = json['DoctorResponse']; + infoStatus = json['InfoStatus']; + clinicID = json['ClinicID']; age = json['Age']; genderDescription = json['GenderDescription']; isVidaCall = json['IsVidaCall']; @@ -102,9 +114,12 @@ class ListGtMyPatientsQuestions { data['DateofBirth'] = this.dateofBirth; data['MobileNumber'] = this.mobileNumber; data['EmailAddress'] = this.emailAddress; + data['DoctorResponse'] = this.doctorResponse; + data['InfoStatus'] = this.infoStatus; + data['ClinicID'] = this.clinicID; data['Age'] = this.age; data['GenderDescription'] = this.genderDescription; data['IsVidaCall'] = this.isVidaCall; return data; } -} \ No newline at end of file +} diff --git a/lib/models/patient/PatientArrivalEntity.dart b/lib/models/patient/PatientArrivalEntity.dart new file mode 100644 index 00000000..54622cd7 --- /dev/null +++ b/lib/models/patient/PatientArrivalEntity.dart @@ -0,0 +1,84 @@ +class PatientArrivalEntity { + String age; + String appointmentDate; + int appointmentNo; + String appointmentType; + String arrivedOn; + String companyName; + String endTime; + int episodeNo; + int fallRiskScore; + String gender; + int medicationOrders; + String mobileNumber; + String nationality; + int patientMRN; + String patientName; + int rowCount; + String startTime; + String visitType; + + PatientArrivalEntity( + {this.age, + this.appointmentDate, + this.appointmentNo, + this.appointmentType, + this.arrivedOn, + this.companyName, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.gender, + this.medicationOrders, + this.mobileNumber, + this.nationality, + this.patientMRN, + this.patientName, + this.rowCount, + this.startTime, + this.visitType}); + + PatientArrivalEntity.fromJson(Map json) { + age = json['age']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + appointmentType = json['appointmentType']; + arrivedOn = json['arrivedOn']; + companyName = json['companyName']; + endTime = json['endTime']; + episodeNo = json['episodeNo']; + fallRiskScore = json['fallRiskScore']; + gender = json['gender']; + medicationOrders = json['medicationOrders']; + mobileNumber = json['mobileNumber']; + nationality = json['nationality']; + patientMRN = json['patientMRN']; + patientName = json['patientName']; + rowCount = json['rowCount']; + startTime = json['startTime']; + visitType = json['visitType']; + } + + Map toJson() { + final Map data = new Map(); + data['age'] = this.age; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['appointmentType'] = this.appointmentType; + data['arrivedOn'] = this.arrivedOn; + data['companyName'] = this.companyName; + data['endTime'] = this.endTime; + data['episodeNo'] = this.episodeNo; + data['fallRiskScore'] = this.fallRiskScore; + data['gender'] = this.gender; + data['medicationOrders'] = this.medicationOrders; + data['mobileNumber'] = this.mobileNumber; + data['nationality'] = this.nationality; + data['patientMRN'] = this.patientMRN; + data['patientName'] = this.patientName; + data['rowCount'] = this.rowCount; + data['startTime'] = this.startTime; + data['visitType'] = this.visitType; + return data; + } +} \ No newline at end of file diff --git a/lib/models/patient/my_referral/PendingReferral.dart b/lib/models/patient/my_referral/PendingReferral.dart new file mode 100644 index 00000000..9da17985 --- /dev/null +++ b/lib/models/patient/my_referral/PendingReferral.dart @@ -0,0 +1,119 @@ +class PendingReferral { + String responded; + String answerFromTarget; + String createdOn; + int data; + String editedOn; + int interBranchReferral; + int patientID; + String patientName; + int patientType; + int referralNo; + String referralStatus; + String referredByDoctorInfo; + String referredFromBranchName; + String referredOn; + String referredType; + String remarksFromSource; + String respondedOn; + int sourceAppointmentNo; + int sourceProjectId; + String sourceSetupID; + String startDate; + int targetAppointmentNo; + String targetClinicID; + String targetDoctorID; + int targetProjectId; + String targetSetupID; + bool isReferralDoctorSameBranch; + + PendingReferral( + {this.responded, + this.answerFromTarget, + this.createdOn, + this.data, + this.editedOn, + this.interBranchReferral, + this.patientID, + this.patientName, + this.patientType, + this.referralNo, + this.referralStatus, + this.referredByDoctorInfo, + this.referredFromBranchName, + this.referredOn, + this.referredType, + this.remarksFromSource, + this.respondedOn, + this.sourceAppointmentNo, + this.sourceProjectId, + this.sourceSetupID, + this.startDate, + this.targetAppointmentNo, + this.targetClinicID, + this.targetDoctorID, + this.targetProjectId, + this.targetSetupID, + this.isReferralDoctorSameBranch, + }); + + PendingReferral.fromJson(Map json) { + responded = json['Responded']; + answerFromTarget = json['answerFromTarget']; + createdOn = json['createdOn']; + data = json['data']; + editedOn = json['editedOn']; + interBranchReferral = json['interBranchReferral']; + patientID = json['patientID']; + patientName = json['patientName']; + patientType = json['patientType']; + referralNo = json['referralNo']; + referralStatus = json['referralStatus']; + referredByDoctorInfo = json['referredByDoctorInfo']; + referredFromBranchName = json['referredFromBranchName']; + referredOn = json['referredOn']; + referredType = json['referredType']; + remarksFromSource = json['remarksFromSource']; + respondedOn = json['respondedOn']; + sourceAppointmentNo = json['sourceAppointmentNo']; + sourceProjectId = json['sourceProjectId']; + sourceSetupID = json['sourceSetupID']; + startDate = json['startDate']; + targetAppointmentNo = json['targetAppointmentNo']; + targetClinicID = json['targetClinicID']; + targetDoctorID = json['targetDoctorID']; + targetProjectId = json['targetProjectId']; + targetSetupID = json['targetSetupID']; + } + + Map toJson() { + final Map data = new Map(); + data['Responded'] = this.responded; + data['answerFromTarget'] = this.answerFromTarget; + data['createdOn'] = this.createdOn; + data['data'] = this.data; + data['editedOn'] = this.editedOn; + data['interBranchReferral'] = this.interBranchReferral; + data['patientID'] = this.patientID; + data['patientName'] = this.patientName; + data['patientType'] = this.patientType; + data['referralNo'] = this.referralNo; + data['referralStatus'] = this.referralStatus; + data['referredByDoctorInfo'] = this.referredByDoctorInfo; + data['referredFromBranchName'] = this.referredFromBranchName; + data['referredOn'] = this.referredOn; + data['referredType'] = this.referredType; + data['remarksFromSource'] = this.remarksFromSource; + data['respondedOn'] = this.respondedOn; + data['sourceAppointmentNo'] = this.sourceAppointmentNo; + data['sourceProjectId'] = this.sourceProjectId; + data['sourceSetupID'] = this.sourceSetupID; + data['startDate'] = this.startDate; + data['targetAppointmentNo'] = this.targetAppointmentNo; + data['targetClinicID'] = this.targetClinicID; + data['targetDoctorID'] = this.targetDoctorID; + data['targetProjectId'] = this.targetProjectId; + data['targetSetupID'] = this.targetSetupID; + return data; + } +} \ No newline at end of file diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 9ecfdb2f..850c29cb 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -59,6 +59,7 @@ class MyReferredPatientModel { this.priorityDescription, this.referralClinicDescription, this.referralDoctorName, + this.isReferralDoctorSameBranch, }); int projectId; @@ -111,6 +112,7 @@ class MyReferredPatientModel { String priorityDescription; String referralClinicDescription; String referralDoctorName; + bool isReferralDoctorSameBranch; factory MyReferredPatientModel.fromJson(Map json) => MyReferredPatientModel( projectId: json["ProjectID"], diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 2b2fd876..8903791c 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,138 +1,199 @@ -import 'dart:convert'; - -//PatiantInformtion patiantInformtionFromJson(String str) => PatiantInformtion.fromJson(json.decode(str)); - -////String patiantInformtionToJson(PatiantInformtion data) => json.encode(data.toJson()); -//****************************** */ - -/* - *@author: Amjad Amireh - *@Date:27/4/2020 - *@param: - *@return:Patian information Model - - *@desc: - */ - - +// TODO : it have to be changed. class PatiantInformtion { - final List list; - int projectId; - int clinicId; - int doctorId; - int patientId; - String doctorName; - String doctorNameN; - String firstName; - String middleName; - String lastName; - String firstNameN; - String middleNameN; - String lastNameN; - int gender; - String dateofBirth; - String nationalityId; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomId; - String bedId; - String nursingStationId; - String description; - String clinicDescription; - String clinicDescriptionN; - String nationalityName; - String nationalityNameN; - String age; - String genderDescription; - String nursingStationName; - String appointmentDate; - String startTime; - - PatiantInformtion({ - this.list, - this.projectId, - this.clinicId, - this.doctorId, - this.patientId, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.nationalityId, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.roomId, - this.bedId, - this.nursingStationId, - this.description, - this.clinicDescription, - this.clinicDescriptionN, - this.nationalityName, - this.nationalityNameN, - this.age, - this.genderDescription, - this.nursingStationName, - this.appointmentDate, - this.startTime, + final PatiantInformtion patientDetails; + int genderInt; + dynamic age; + String appointmentDate; + int appointmentNo; + String appointmentType; + int appointmentTypeId; + String arrivedOn; + int clinicGroupId; + String companyName; + Null dischargeStatus; + Null doctorDetails; + int doctorId; + String endTime; + int episodeNo; + int fallRiskScore; + bool isSigned; + int medicationOrders; + String mobileNumber; + String nationality; + int projectId; + int clinicId; + int patientId; + String doctorName; + String doctorNameN; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + String fullName; + String fullNameN; + int gender; + String dateofBirth; + String nationalityId; + String emailAddress; + String patientIdentificationNo; + int patientType; + int patientMRN; + String admissionNo; + String admissionDate; + String createdOn; + String roomId; + String bedId; + String nursingStationId; + String description; + String clinicDescription; + String clinicDescriptionN; + String nationalityName; + String nationalityNameN; + String genderDescription; + String nursingStationName; + String startTime; + String visitType; + String nationalityFlagURL; + int patientStatusType; + int visitTypeId; + String startTimes; + PatiantInformtion( + {this.patientDetails, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.createdOn, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + this.appointmentDate, + this.startTime, + this.appointmentNo, + this.appointmentType, + this.appointmentTypeId, + this.arrivedOn, + this.clinicGroupId, + this.companyName, + this.dischargeStatus, + this.doctorDetails, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.genderInt, + this.isSigned, + this.medicationOrders, + this.nationality, + this.patientMRN, + this.visitType, + this.fullName, + this.fullNameN, + this.nationalityFlagURL, + this.patientStatusType, + this.visitTypeId, + this.startTimes}); - }); - - factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( - projectId: json["ProjectID"], - clinicId: json["ClinicID"], - doctorId: json["DoctorID"], - patientId: json["PatientID"], - doctorName: json["DoctorName"], - doctorNameN: json["DoctorNameN"], - firstName: json["FirstName"], - middleName: json["MiddleName"], - lastName: json["LastName"], - firstNameN: json["FirstNameN"], - middleNameN: json["MiddleNameN"], - lastNameN: json["LastNameN"], - gender: json["Gender"], - dateofBirth: json["DateofBirth"], - nationalityId: json["NationalityID"], - mobileNumber: json["MobileNumber"], - emailAddress: json["EmailAddress"], - patientIdentificationNo: json["PatientIdentificationNo"], - patientType: json["PatientType"], - admissionNo: json["AdmissionNo"], - admissionDate: json["AdmissionDate"], - roomId: json["RoomID"], - bedId: json["BedID"], - nursingStationId: json["NursingStationID"], - description: json["Description"], - clinicDescription: json["ClinicDescription"], - clinicDescriptionN: json["ClinicDescriptionN"], - nationalityName: json["NationalityName"], - nationalityNameN: json["NationalityNameN"], - age: json["Age"], + factory PatiantInformtion.fromJson(Map json) => + PatiantInformtion( + patientDetails: json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails']) + : null, + projectId: json["ProjectID"] ?? json["projectID"], + clinicId: json["ClinicID"] ?? json["clinicID"], + doctorId: json["DoctorID"] ?? json["doctorID"], + patientId: json["PatientID"] ?? + json["patientID"] ?? + json['patientMRN'] ?? + json['PatientMRN'], + doctorName: json["DoctorName"] ?? json["doctorName"], + doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"], + firstName: json["FirstName"] ?? json["firstName"], + middleName: json["MiddleName"] ?? json["middleName"], + lastName: json["LastName"] ?? json["lastName"], + firstNameN: json["FirstNameN"] ?? json["firstNameN"], + middleNameN: json["MiddleNameN"] ?? json["middleNameN"], + lastNameN: json["LastNameN"] ?? json["lastNameN"], + gender: json["Gender"] ?? json["gender"], + fullName: json["fullName"] ?? json["fullName"], + fullNameN: json["fullNameN"] ?? json["fullNameN"], + dateofBirth: json["DateofBirth"] ?? json["dob"], + nationalityId: json["NationalityID"] ?? json["nationalityID"], + mobileNumber: json["MobileNumber"] ?? json["mobileNumber"], + emailAddress: json["EmailAddress"] ?? json["emailAddress"], + patientIdentificationNo: + json["PatientIdentificationNo"] ?? json["patientIdentificationNo"], + //TODO make 7 dynamic when the backend retrun it in patient arrival + patientType: json["PatientType"] ?? json["patientType"]??7, + admissionNo: json["AdmissionNo"] ?? json["admissionNo"], + admissionDate: json["AdmissionDate"] ?? json["admissionDate"], + createdOn: json["CreatedOn"] ?? json["CreatedOn"], + roomId: json["RoomID"] ?? json["roomID"], + bedId: json["BedID"] ?? json["bedID"], + nursingStationId: json["NursingStationID"] ?? json["nursingStationID"], + description: json["Description"] ?? json["description"], + clinicDescription: + json["ClinicDescription"] ?? json["clinicDescription"], + clinicDescriptionN: + json["ClinicDescriptionN"] ?? json["clinicDescriptionN"], + nationalityName: json["NationalityName"] ?? + json["nationalityName"] ?? + json['NationalityName'], + nationalityNameN: json["NationalityNameN"] ?? + json["nationalityNameN"] ?? + json['NationalityNameN'], + age: json["Age"] ?? json["age"], genderDescription: json["GenderDescription"], nursingStationName: json["NursingStationName"], - appointmentDate: json["AppointmentDate"]?? '', - startTime: json["StartTime"], - ); - - - - - - - + appointmentDate: json["AppointmentDate"] ?? '', + startTime: json["startTime"], + appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], + appointmentType: json['appointmentType'], + appointmentTypeId: json['appointmentTypeId'], + arrivedOn: json['arrivedOn'], + clinicGroupId: json['clinicGroupId'], + companyName: json['companyName'], + dischargeStatus: json['dischargeStatus'], + doctorDetails: json['doctorDetails'], + endTime: json['endTime'], + episodeNo: json['episodeNo'] ?? json['EpisodeID'], + fallRiskScore: json['fallRiskScore'], + isSigned: json['isSigned'], + medicationOrders: json['medicationOrders'], + nationality: json['nationality'] ?? json['NationalityNameN'], + patientMRN: json['patientMRN'] ?? json['PatientMRN'], + visitType: json['visitType'] ?? json['visitType'], + nationalityFlagURL: + json['NationalityFlagURL'] ?? json['NationalityFlagURL'], + patientStatusType: + json['patientStatusType'] ?? json['patientStatusType'], + visitTypeId: json['visitTypeId'] ?? json['visitTypeId'], + startTimes: json['StartTime'] ?? json['StartTime'], + ); } diff --git a/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart b/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart new file mode 100644 index 00000000..1d0da9c5 --- /dev/null +++ b/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart @@ -0,0 +1,46 @@ +class GetPatientArrivalListRequestModel { + String vidaAuthTokenID; + String from; + String to; + String doctorID; + int pageIndex; + int pageSize; + int clinicID; + int patientMRN; + + GetPatientArrivalListRequestModel( + {this.vidaAuthTokenID, + this.from, + this.to, + this.doctorID, + this.pageIndex, + this.pageSize, + this.clinicID, + this.patientMRN}); + + GetPatientArrivalListRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + from = json['From']; + to = json['To']; + doctorID = json['DoctorID']; + pageIndex = json['PageIndex']; + pageSize = json['PageSize']; + clinicID = json['ClinicID']; + patientMRN = json['PatientMRN']; + } + + Map toJson() { + final Map data = new Map(); + data['From'] = this.from; + data['To'] = this.to; + data['DoctorID'] = this.doctorID; + data['PageIndex'] = this.pageIndex; + data['PageSize'] = this.pageSize; + data['ClinicID'] = this.clinicID; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + + + return data; + } +} diff --git a/lib/models/patient/patient_model.dart b/lib/models/patient/patient_model.dart index c6f4602d..08b5d1d0 100644 --- a/lib/models/patient/patient_model.dart +++ b/lib/models/patient/patient_model.dart @@ -1,4 +1,3 @@ - /* *@author:Modified by amjad add getter and setter Amjad Amireh *@Date:11/5/2020 @@ -29,91 +28,88 @@ class PatientModel { String SessionID; bool IsLoginForDoctorApp; bool PatientOutSA; + int Searchtype; + int get getProjectID => ProjectID; - int get getProjectID => ProjectID; - - set setProjectID(int ProjectID) => this.ProjectID = ProjectID; + set setProjectID(int ProjectID) => this.ProjectID = ProjectID; - int get getClinicID => ClinicID; + int get getClinicID => ClinicID; - set setClinicID(int ClinicID) => this.ClinicID = ClinicID; + set setClinicID(int ClinicID) => this.ClinicID = ClinicID; - int get getDoctorID => DoctorID; + int get getDoctorID => DoctorID; - set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; + set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; String get getFirstName => FirstName; - set setFirstName(String FirstName) => this.FirstName = FirstName; + set setFirstName(String FirstName) => this.FirstName = FirstName; - String get getMiddleName => MiddleName; + String get getMiddleName => MiddleName; - set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; + set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; - String get getLastName => LastName; + String get getLastName => LastName; - set setLastName(String LastName) => this.LastName = LastName; + set setLastName(String LastName) => this.LastName = LastName; - String get getPatientMobileNumber => PatientMobileNumber; + String get getPatientMobileNumber => PatientMobileNumber; - set setPatientMobileNumber(String PatientMobileNumber) => this.PatientMobileNumber = PatientMobileNumber; + set setPatientMobileNumber(String PatientMobileNumber) => + this.PatientMobileNumber = PatientMobileNumber; // String get getPatientIdentificationID => PatientIdentificationID; // set setPatientIdentificationID(String PatientIdentificationID) => this.PatientIdentificationID = PatientIdentificationID; - int get getPatientID => PatientID; - - set setPatientID(int PatientID) => this.PatientID = PatientID; - - String get getFrom => From; + int get getPatientID => PatientID; - set setFrom(String From) => this.From = From; + set setPatientID(int PatientID) => this.PatientID = PatientID; - String get getTo => To; + String get getFrom => From; - set setTo(String To) => this.To = To; + set setFrom(String From) => this.From = From; - int get getLanguageID => LanguageID; + String get getTo => To; - set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; + set setTo(String To) => this.To = To; - String get getStamp => stamp; + int get getLanguageID => LanguageID; - set setStamp(String stamp) => this.stamp = stamp; + set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; - String get getIPAdress => IPAdress; + String get getStamp => stamp; - set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; + set setStamp(String stamp) => this.stamp = stamp; - double get getVersionID => VersionID; + String get getIPAdress => IPAdress; - set setVersionID(double VersionID) => this.VersionID = VersionID; + set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; - int get getChannel => Channel; + double get getVersionID => VersionID; - set setChannel(int Channel) => this.Channel = Channel; + set setVersionID(double VersionID) => this.VersionID = VersionID; - String get getTokenID => TokenID; + int get getChannel => Channel; - set setTokenID(String TokenID) => this.TokenID = TokenID; + set setChannel(int Channel) => this.Channel = Channel; - String get getSessionID => SessionID; + String get getTokenID => TokenID; - set setSessionID(String SessionID) => this.SessionID = SessionID; + set setTokenID(String TokenID) => this.TokenID = TokenID; - bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; - - set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => this.IsLoginForDoctorApp = IsLoginForDoctorApp; - - bool get getPatientOutSA => PatientOutSA; - - set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; + String get getSessionID => SessionID; + set setSessionID(String SessionID) => this.SessionID = SessionID; + bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; + set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => + this.IsLoginForDoctorApp = IsLoginForDoctorApp; + bool get getPatientOutSA => PatientOutSA; + set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; PatientModel( {this.ProjectID, @@ -135,15 +131,13 @@ class PatientModel { this.TokenID, this.SessionID, this.IsLoginForDoctorApp, - this.PatientOutSA}); - + this.PatientOutSA, + this.Searchtype}); - factory PatientModel.fromJson(Map json) => PatientModel( - + factory PatientModel.fromJson(Map json) => PatientModel( FirstName: json["FirstName"], - LastName: json["LasttName"], - - ); + LastName: json["LasttName"], + ); Map toJson() { final Map data = new Map(); data['ProjectID'] = this.ProjectID; @@ -167,8 +161,8 @@ class PatientModel { data['SessionID'] = this.SessionID; data['IsLoginForDoctorApp'] = this.IsLoginForDoctorApp; data['PatientOutSA'] = this.PatientOutSA; + data['Searchtype'] = this.Searchtype; return data; } } //*************************** - \ No newline at end of file diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart new file mode 100644 index 00000000..57133a08 --- /dev/null +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -0,0 +1,137 @@ +class VitalSignData { + int appointmentNo; + int bloodPressureCuffLocation; + int bloodPressureCuffSize; + int bloodPressureHigher; + int bloodPressureLower; + int bloodPressurePatientPosition; + var bodyMassIndex; + int fio2; + int headCircumCm; + var heightCm; + int idealBodyWeightLbs; + bool isPainManagementDone; + bool isVitalsRequired; + int leanBodyWeightLbs; + String painCharacter; + String painDuration; + String painFrequency; + String painLocation; + int painScore; + int patientMRN; + int patientType; + int pulseBeatPerMinute; + int pulseRhythm; + int respirationBeatPerMinute; + int respirationPattern; + int sao2; + int status; + var temperatureCelcius; + int temperatureCelciusMethod; + var waistSizeInch; + var weightKg; + + VitalSignData( + {this.appointmentNo, + this.bloodPressureCuffLocation, + this.bloodPressureCuffSize, + this.bloodPressureHigher, + this.bloodPressureLower, + this.bloodPressurePatientPosition, + this.bodyMassIndex, + this.fio2, + this.headCircumCm, + this.heightCm, + this.idealBodyWeightLbs, + this.isPainManagementDone, + this.isVitalsRequired, + this.leanBodyWeightLbs, + this.painCharacter, + this.painDuration, + this.painFrequency, + this.painLocation, + this.painScore, + this.patientMRN, + this.patientType, + this.pulseBeatPerMinute, + this.pulseRhythm, + this.respirationBeatPerMinute, + this.respirationPattern, + this.sao2, + this.status, + this.temperatureCelcius, + this.temperatureCelciusMethod, + this.waistSizeInch, + this.weightKg}); + + VitalSignData.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + bloodPressureCuffLocation = json['bloodPressureCuffLocation']; + bloodPressureCuffSize = json['bloodPressureCuffSize']; + bloodPressureHigher = json['bloodPressureHigher']; + bloodPressureLower = json['bloodPressureLower']; + bloodPressurePatientPosition = json['bloodPressurePatientPosition']; + bodyMassIndex = json['bodyMassIndex']; + fio2 = json['fio2']; + headCircumCm = json['headCircumCm']; + heightCm = json['heightCm']; + idealBodyWeightLbs = json['idealBodyWeightLbs']; + isPainManagementDone = json['isPainManagementDone']; + isVitalsRequired = json['isVitalsRequired']; + leanBodyWeightLbs = json['leanBodyWeightLbs']; + painCharacter = json['painCharacter']; + painDuration = json['painDuration']; + painFrequency = json['painFrequency']; + painLocation = json['painLocation']; + painScore = json['painScore']; + patientMRN = json['patientMRN']; + patientType = json['patientType']; + pulseBeatPerMinute = json['pulseBeatPerMinute']; + pulseRhythm = json['pulseRhythm']; + respirationBeatPerMinute = json['respirationBeatPerMinute']; + respirationPattern = json['respirationPattern']; + sao2 = json['sao2']; + status = json['status']; + temperatureCelcius = json['temperatureCelcius']; + temperatureCelciusMethod = json['temperatureCelciusMethod']; + waistSizeInch = json['waistSizeInch']; + weightKg = json['weightKg']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['bloodPressureCuffLocation'] = this.bloodPressureCuffLocation; + data['bloodPressureCuffSize'] = this.bloodPressureCuffSize; + data['bloodPressureHigher'] = this.bloodPressureHigher; + data['bloodPressureLower'] = this.bloodPressureLower; + data['bloodPressurePatientPosition'] = this.bloodPressurePatientPosition; + data['bodyMassIndex'] = this.bodyMassIndex; + data['fio2'] = this.fio2; + data['headCircumCm'] = this.headCircumCm; + data['heightCm'] = this.heightCm; + data['idealBodyWeightLbs'] = this.idealBodyWeightLbs; + data['isPainManagementDone'] = this.isPainManagementDone; + data['isVitalsRequired'] = this.isVitalsRequired; + data['leanBodyWeightLbs'] = this.leanBodyWeightLbs; + data['painCharacter'] = this.painCharacter; + data['painDuration'] = this.painDuration; + data['painFrequency'] = this.painFrequency; + data['painLocation'] = this.painLocation; + data['painScore'] = this.painScore; + data['patientMRN'] = this.patientMRN; + data['patientType'] = this.patientType; + data['pulseBeatPerMinute'] = this.pulseBeatPerMinute; + data['pulseRhythm'] = this.pulseRhythm; + data['respirationBeatPerMinute'] = this.respirationBeatPerMinute; + data['respirationPattern'] = this.respirationPattern; + data['sao2'] = this.sao2; + data['status'] = this.status; + data['temperatureCelcius'] = this.temperatureCelcius; + data['temperatureCelciusMethod'] = this.temperatureCelciusMethod; + data['waistSizeInch'] = this.waistSizeInch; + data['weightKg'] = this.weightKg; + return data; + } + +} diff --git a/lib/models/patient/vital_sign/patient-vital-sign-history.dart b/lib/models/patient/vital_sign/patient-vital-sign-history.dart new file mode 100644 index 00000000..40ff5d00 --- /dev/null +++ b/lib/models/patient/vital_sign/patient-vital-sign-history.dart @@ -0,0 +1,257 @@ +class VitalSignHistory { + 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; + + VitalSignHistory( + {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}); + + VitalSignHistory.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 = json['VitalSignDate']; + 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/models/sickleave/add_sickleave_request.dart b/lib/models/sickleave/add_sickleave_request.dart new file mode 100644 index 00000000..d398153b --- /dev/null +++ b/lib/models/sickleave/add_sickleave_request.dart @@ -0,0 +1,32 @@ +class AddSickLeaveRequest { + String patientMRN; + String appointmentNo; + String startDate; + String noOfDays; + String remarks; + + AddSickLeaveRequest( + {this.patientMRN, + this.appointmentNo, + this.startDate, + this.noOfDays, + this.remarks}); + + AddSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + startDate = json['StartDate']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['StartDate'] = this.startDate; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/extend_sick_leave_request.dart b/lib/models/sickleave/extend_sick_leave_request.dart new file mode 100644 index 00000000..8b61eb90 --- /dev/null +++ b/lib/models/sickleave/extend_sick_leave_request.dart @@ -0,0 +1,25 @@ +class ExtendSickLeaveRequest { + String patientMRN; + String previousRequestNo; + String noOfDays; + String remarks; + + ExtendSickLeaveRequest( + {this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks}); + + ExtendSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + previousRequestNo = json['PreviousRequestNo']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['PreviousRequestNo'] = this.previousRequestNo; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/get_all_sickleave_response.dart b/lib/models/sickleave/get_all_sickleave_response.dart new file mode 100644 index 00000000..f3fc8032 --- /dev/null +++ b/lib/models/sickleave/get_all_sickleave_response.dart @@ -0,0 +1,44 @@ +class GetAllSickLeaveResponse { + int appointmentNo; + bool isExtendedLeave; + int noOfDays; + int patientMRN; + String remarks; + int requestNo; + String startDate; + int status; + + GetAllSickLeaveResponse( + {this.appointmentNo, + this.isExtendedLeave, + this.noOfDays, + this.patientMRN, + this.remarks, + this.requestNo, + this.startDate, + this.status}); + + GetAllSickLeaveResponse.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + isExtendedLeave = json['isExtendedLeave']; + noOfDays = json['noOfDays']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + requestNo = json['requestNo']; + startDate = json['startDate']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['isExtendedLeave'] = this.isExtendedLeave; + data['noOfDays'] = this.noOfDays; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + data['requestNo'] = this.requestNo; + data['startDate'] = this.startDate; + data['status'] = this.status; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index dff02129..dc905ba8 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,12 +1,26 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/screens/medical-file/medical_file_page.dart'; +import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; +import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_screen_history.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_soap_index.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -37,6 +51,14 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; +import 'screens/patients/profile/admission-request/admission-request-detail-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; +import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; +import 'screens/patients/profile/referral/refer-patient-screen.dart'; +import 'screens/prescription/prescription_screen.dart'; +import 'screens/patients/profile/vital_sign/vital-signs-screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -61,19 +83,42 @@ const String SERVICES = 'services'; const String SETTINGS = 'settings'; const String VITAL_SIGN = 'patients/vital-sign'; const String LAB_ORDERS = 'patients/lab_orders'; +const String LAB_RESULT = 'patients/lab_result'; const String PRESCRIPTIONS = 'patients/prescription'; -const String RADIOLOGY = 'patients/radiology'; +const String MEDICAL_FILE = 'patients/radiology'; const String PROGRESS_NOTE = 'patients/progress-note'; const String REFER_PATIENT = 'patients/refer-patient'; +const String MY_REFERRAL_DETAIL = 'my_referral_detail'; +const String REFER_PATIENT_TO_DOCTOR = 'patients/refer-to-doctor'; const String PATIENT_ORDERS = 'patients/patient_orders'; -const String PATIENT_INSURANCE_APPROVALS = - 'patients/patient_insurance_approvals'; +const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; +const String PATIENT_INSURANCE_APPROVALS_NEW = 'patients/patient_insurance_approvals_new'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; +const String PATIENT_VITAL_SIGN = 'patients/vital-sign-data'; +const String CREATE_EPISODE = 'patients/create-episode'; +const String UPDATE_EPISODE = 'patients/update-episode'; +const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; +const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; +const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; +const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; +const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; +const String PATIENT_ECG = 'patients/ecg'; + const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; // const String VIDEO_CALL = 'video-call'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; +const String ORDER_PRESCRIPTION = 'prescription/prescriptionsss'; +const String ORDER_PRESCRIPTION_NEW = 'prescription/prescription_new'; +const String ORDER_PRESCRIPTION_HISTORY = 'prescription/prescriptionsssH'; +const String ORDER_PROCEDURE = 'procedure/procedure'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; +const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; +const String ADD_SICKLEAVE = 'add-sickleave'; +const String SHOW_SICKLEAVE = 'show-sickleave'; +const String RADIOLOGY = 'radiology'; +const String RADIOLOGY_PATIENT = 'radiology-patient'; +//todo: change the routing way. var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -98,16 +143,45 @@ var routes = { MESSAGES: (_) => MessagesScreen(), SERVICES: (_) => ServicesScreen(), LAB_ORDERS: (_) => LabOrdersScreen(), + LAB_RESULT: (_) => LabsHomePage(), PRESCRIPTIONS: (_) => PrescriptionScreen(), - RADIOLOGY: (_) => RadiologyScreen(), + MEDICAL_FILE: (_) => MedicalFilePage(), PROGRESS_NOTE: (_) => ProgressNoteScreen(), REFER_PATIENT: (_) => ReferPatientScreen(), + REFER_PATIENT_TO_DOCTOR: (_) => PatientMakeReferralScreen(), PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), + PATIENT_INSURANCE_APPROVALS_NEW: (_) => InsuranceApprovalScreenNew(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), + PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), + RADIOLOGY: (_) => RadiologyScreen(), + RADIOLOGY_PATIENT: (_) => RadiologyHomePage(), + PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), + PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), + PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), + // PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), + CREATE_EPISODE: (_) => UpdateSoapIndex( + isUpdate: true, + ), + UPDATE_EPISODE: (_) => UpdateSoapIndex( + isUpdate: true, + ), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), + // LIVECARE_END_DIALOG: (_) => EndCallDialogBox(), + PATIENT_SICKLEAVE: (_) => SickLeaveScreen(), + ADD_SICKLEAVE: (_) => AddSickLeavScreen(), + SHOW_SICKLEAVE: (_) => ShowSickLeaveScreen(), + ORDER_PRESCRIPTION: (_) => NewPrescriptionScreen(), + ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), + ORDER_PRESCRIPTION_HISTORY: (_) => NewPrescriptionHistoryScreen(), + ORDER_PROCEDURE: (_) => ProcedureScreen(), + // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() + MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), + PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), + PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), + PATIENT_ECG: (_) => ECGPage(), }; diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 825abb83..2ddb4049 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -17,6 +17,7 @@ import 'package:flutter/material.dart'; import '../routes.dart'; import 'base/base_view.dart'; + Helpers helpers = Helpers(); class QrReaderScreen extends StatefulWidget { @@ -59,6 +60,7 @@ class _QrReaderScreenState extends State { onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).qr + TranslationBase.of(context).reader, body: Center( @@ -71,63 +73,63 @@ class _QrReaderScreenState extends State { AppText( TranslationBase.of(context).startScanning, fontSize: 18, - fontWeight: FontWeight.bold, - textAlign: TextAlign.center, - ), - SizedBox( - height: 7, - ), - AppText(TranslationBase.of(context).scanQrCode, - fontSize: 14, - fontWeight: FontWeight.w400, - textAlign: TextAlign.center), - SizedBox( - height: 15, - ), - Container( - height: 150, - child: Image.asset('assets/images/qr_code.png'), - ), - SizedBox( - height: 35, - ), - Button( - onTap: () { - _scanQrAndGetPatient(context, model); - }, - title: TranslationBase.of(context).scanQr, - loading: isLoading, - icon: Image.asset('assets/images/qr_code_white.png'), - ), - isError - ? Container( - margin: EdgeInsets.only(top: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Theme.of(context).errorColor.withOpacity(0.06), - ), - padding: EdgeInsets.symmetric( - vertical: 8.0, horizontal: 12.0), - child: Row( - children: [ - Expanded( - child: AppText( - error ?? - TranslationBase.of(context) - .errorMessage, - color: Theme - .of(context) - .errorColor)), - ], - ), - ) - : Container(), - ], + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + ), + SizedBox( + height: 7, + ), + AppText(TranslationBase.of(context).scanQrCode, + fontSize: 14, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center), + SizedBox( + height: 15, + ), + Container( + height: 150, + child: Image.asset('assets/images/qr_code.png'), + ), + SizedBox( + height: 35, ), - ), + Button( + onTap: () { + _scanQrAndGetPatient(context, model); + }, + title: TranslationBase.of(context).scanQr, + loading: isLoading, + icon: Image.asset('assets/images/qr_code_white.png'), + ), + isError + ? Container( + margin: EdgeInsets.only(top: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: + Theme.of(context).errorColor.withOpacity(0.06), + ), + padding: EdgeInsets.symmetric( + vertical: 8.0, horizontal: 12.0), + child: Row( + children: [ + Expanded( + child: AppText( + error ?? + TranslationBase.of(context) + .errorMessage, + color: Theme.of(context).errorColor)), + ], + ), + ) + : Container(), + ], ), ), - ),); + ), + ), + ), + ); } _scanQrAndGetPatient(BuildContext context, PatientViewModel model) async { @@ -135,15 +137,15 @@ class _QrReaderScreenState extends State { /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result var result = await BarcodeScanner.scan(); - // if (result.rawContent == "") { - List listOfParams = result.rawContent.split(','); - String patientType = "1"; - setState(() { - isLoading = true; - isError = false; - patientList = []; - }); - String token = await sharedPref.getString(TOKEN); + if (result.rawContent != "") { + List listOfParams = result.rawContent.split(','); + String patientType = "1"; + setState(() { + isLoading = true; + isError = false; + patientList = []; + }); + String token = await sharedPref.getString(TOKEN); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); // patient.PatientID = 8808; @@ -152,66 +154,65 @@ class _QrReaderScreenState extends State { // patient.setClinicID = doctorProfile.clinicID; // patient.setProjectID = doctorProfile.projectID; // Provider.of(context, listen: false); - patient.PatientID = 8808; - patient.TokenID = token; - model - .getPatientList(patient, "1", isBusyLocal: true) - .then((response) { - if (response['MessageStatus'] == 1) { - switch (patientType) { - case "0": - if (response['List_MyOutPatient'] != null) { - setState(() { - patientList = - ModelResponse.fromJson(response['List_MyOutPatient']).list; - isLoading = false; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); - } - break; - case "1": - if (response['List_MyInPatient'] != null) { - setState(() { - patientList = - ModelResponse.fromJson(response['List_MyInPatient']).list; - isLoading = false; - error = ""; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); + patient.PatientID = 8808; + patient.TokenID = token; + model.getPatientList(patient, "1", isBusyLocal: true).then((response) { + if (response['MessageStatus'] == 1) { + switch (patientType) { + case "0": + if (response['List_MyOutPatient'] != null) { + setState(() { + patientList = + ModelResponse.fromJson(response['List_MyOutPatient']) + .list; + isLoading = false; + }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); + } else { + setState(() { + isError = true; + isLoading = false; + }); + DrAppToastMsg.showErrorToast('No patient'); + } break; - } + case "1": + if (response['List_MyInPatient'] != null) { + setState(() { + patientList = + ModelResponse.fromJson(response['List_MyInPatient']).list; + isLoading = false; + error = ""; + }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); + } else { + setState(() { + isError = true; + isLoading = false; + }); + DrAppToastMsg.showErrorToast('No patient'); + break; + } + } + } else { + setState(() { + isLoading = false; + isError = true; + }); + DrAppToastMsg.showErrorToast( + response['ErrorEndUserMessage'] ?? response['ErrorMessage']); } - } else { + }).catchError((error) { setState(() { isLoading = false; - isError = true; }); - DrAppToastMsg.showErrorToast( - response['ErrorEndUserMessage'] ?? response['ErrorMessage']); - } - }).catchError((error) { - setState(() { - isLoading = false; + helpers.showErrorToast(error.message); + //DrAppToastMsg.showErrorToast(error); }); - helpers.showErrorToast(error); - //DrAppToastMsg.showErrorToast(error); - }); + } } -// } } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 5b495abb..84121abf 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -1,7 +1,18 @@ import 'dart:async'; +import 'dart:io'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/service/auth_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../lookups/auth_lookup.dart'; @@ -23,21 +34,48 @@ class _LoginsreenState extends State { Future _prefs = SharedPreferences.getInstance(); String platformImei; - Future platformImeiFuture; - - bool _isLoading = false; - - Future getSharedPref() async { - sharedPref.getString('platformImei').then((imei) { - platformImei = imei; - }); - } - + // Future platformImeiFuture; + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + bool _isLoading = true; + ProjectViewModel projectViewModel; + AuthService authService = AuthService(); @override void initState() { super.initState(); - platformImeiFuture = _prefs.then((SharedPreferences prefs) { - return (prefs.getString('platformImei')); + + _firebaseMessaging.setAutoInitEnabled(true); + if (Platform.isIOS) { + _firebaseMessaging.requestNotificationPermissions(); + } + + _firebaseMessaging.getToken().then((String token) async { + if (DEVICE_TOKEN == "" && projectViewModel.isLogin == false) { + DEVICE_TOKEN = token; + changeLoadingStata(true); + authService.selectDeviceImei(DEVICE_TOKEN).then((value) { + print(authService.dashboardItemsList); + + if (authService.dashboardItemsList.length > 0) { + sharedPref.setObj( + LAST_LOGIN_USER, authService.dashboardItemsList[0]); + Navigator.of(context).pushReplacement(MaterialPageRoute( + builder: (BuildContext context) => VerificationMethodsScreen( + password: null, + ))); + } else { + changeLoadingStata(false); + } + //changeLoadingStata(false); + }); + } else { + changeLoadingStata(false); + } + + // else if (projectViewModel.isLogin) { + // getNotificationCount(token); + // } + }).catchError((err) { + print(err); }); } @@ -56,54 +94,37 @@ class _LoginsreenState extends State { @override Widget build(BuildContext context) { - getSharedPref(); - return AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - body: SafeArea( - child: ListView(children: [ - FutureBuilder( - future: platformImeiFuture, - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - return Text('Error: ${snapshot.error}'); - } else { - return Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), - alignment: Alignment.topLeft, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (platformImei == null) - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.knownUser), - LoginForm( - changeLoadingStata: - changeLoadingStata, - ), - ], - ) - : Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.unknownUser), - KnownUserLogin(), - ], + projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) => {}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SafeArea( + child: (_isLoading == false) + ? ListView(children: [ + Container( + margin: + EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), + alignment: Alignment.topLeft, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.knownUser), + LoginForm( + changeLoadingStata: changeLoadingStata, ), - ])); - } - } - }), - ]), - ), - ); + ], + ) + ])) + ]) + : Center(child: AppLoaderWidget()), + ), + )); } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index d5ab66ad..0045f032 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -13,9 +13,13 @@ import '../../widgets/auth/verification_methods.dart'; *@desc: Verification Methods screen */ class VerificationMethodsScreen extends StatefulWidget { + const VerificationMethodsScreen({Key key, this.password}) : super(key: key); + @override _VerificationMethodsScreenState createState() => _VerificationMethodsScreenState(); + + final password; } class _VerificationMethodsScreenState extends State { @@ -38,7 +42,7 @@ class _VerificationMethodsScreenState extends State { Widget build(BuildContext context) { return AppScaffold( isLoading: _isLoading, - isShowAppBar: false, + isShowAppBar: false, body: ListView(children: [ Container( margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), @@ -47,6 +51,7 @@ class _VerificationMethodsScreenState extends State { children: [ AuthHeader(loginType.verificationMethods), VerificationMethods( + password: widget.password, changeLoadingStata: changeLoadingStata, ), ], diff --git a/lib/screens/base/base_view.dart b/lib/screens/base/base_view.dart index cf24b47f..7a5c93e6 100644 --- a/lib/screens/base/base_view.dart +++ b/lib/screens/base/base_view.dart @@ -33,8 +33,8 @@ class _BaseViewState extends State> { @override Widget build(BuildContext context) { - return ChangeNotifierProvider( - create: (BuildContext context) => model, + return ChangeNotifierProvider.value( + value: model, child: Consumer(builder: widget.builder), ); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 80697352..3351f831 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,5 +1,9 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -7,22 +11,38 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/doctor/patient_arrival_screen.dart'; +import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:provider/provider.dart'; - +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import '../routes.dart'; import '../widgets/shared/app_texts_widget.dart'; import 'doctor/doctor_reply_screen.dart'; import 'doctor/my_referral_patient_screen.dart'; import 'doctor/my_referred_patient_screen.dart'; import 'medicine/medicine_search_screen.dart'; +import 'patients/profile/referral/referred-patient-screen.dart'; +import '../widgets/shared/rounded_container_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -38,18 +58,64 @@ class DashboardScreen extends StatefulWidget { } class _DashboardScreenState extends State { + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); HospitalViewModel hospitalProvider; AuthViewModel authProvider; bool isLoading = false; - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; var _isInit = true; DoctorProfileModel profile; - + bool isExpanded = false; + String isInpatient = ""; + var clinicName = []; + int sliderActiveIndex = 0; + var clinicId; + var _patientSearchFormValues = PatientModel( + FirstName: "0", + MiddleName: "0", + LastName: "0", + PatientMobileNumber: "0", + PatientIdentificationID: "0", + PatientID: 0, + From: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), + To: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), + LanguageID: 2, + stamp: "2020-03-02T13:56:39.170Z", + IPAdress: "11.11.11.11", + VersionID: 1.2, + Channel: 9, + TokenID: "2Fi7HoIHB0eDyekVa6tCJg==", + SessionID: "5G0yXn0Jnq", + IsLoginForDoctorApp: true, + PatientOutSA: false); void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { - projectsProvider = Provider.of(context); + projectsProvider = Provider.of(context); projectsProvider.getDoctorClinicsList(); + + // _firebaseMessaging.setAutoInitEnabled(true); + _firebaseMessaging.requestNotificationPermissions( + const IosNotificationSettings( + sound: true, badge: true, alert: true, provisional: true)); + _firebaseMessaging.onIosSettingsRegistered + .listen((IosNotificationSettings settings) { + print("Settings registered: $settings"); + }); + clinicName = await sharedPref.getObj(CLINIC_NAME); + print(clinicName); + _firebaseMessaging.getToken().then((String token) async { + if (token != '') { + DEVICE_TOKEN = token; + var request = await sharedPref.getObj(DOCTOR_PROFILE); + authProvider.insertDeviceImei(request).then((value) { + // print(value); + changeIsLoading(false); + }); + } + }); } _isInit = false; } @@ -69,575 +135,786 @@ class _DashboardScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } - return SafeArea( - bottom: true, - child: AppScaffold( + + return BaseView( + onModelReady: (model) => model.getDashboard(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, isShowAppBar: false, - isLoading: isLoading, body: ListView(children: [ Column( children: [ Stack(children: [ Column( children: [ - Container( - height: 140, - color: HexColor('#515B5D'), - width: double.infinity, - child: FractionallySizedBox( - widthFactor: 0.9, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - children: [ - AppText( - TranslationBase - .of(context) - .welcome, - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.white, - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - 'Dr. ${authProvider.doctorProfile.doctorName}', - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.white, - ) - ], - ), - SizedBox( - height: 4, - ), - InkWell( - onTap: () async { - showCupertinoPicker( - decKey: '', - context: context, - actionList: projectsProvider - .doctorClinicsList); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: AppText( - authProvider.selectedClinicName != - null - ? authProvider.selectedClinicName - : authProvider.doctorProfile - .clinicDescription, - fontSize: - SizeConfig.textMultiplier * 1.7, - color: Colors.white, - textAlign: TextAlign.center, - ), - alignment: projectsProvider.isArabic - ? Alignment.topRight - : Alignment.topLeft, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - - child: Container( - margin: EdgeInsets.only( - left: 5, - top: projectsProvider - .isArabic ? 0 : 5, - right: 10, - bottom: projectsProvider - .isArabic ? 15 : 7), - child: Icon( - DoctorApp.sync_icon, - - color: Colors.white, - size: SizeConfig - .textMultiplier * - 1.8, - )), - ), - ], - ), - ]), - ), - - ], + ProfileWelcomeWidget( + Row( + children: [ + Container( + padding: EdgeInsets.all(4), + margin: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(20), ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - - children: [ - Container( - decoration: BoxDecoration( - color: Theme - .of(context) - .backgroundColor, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - height: 50, - width: 60, - child: Image.network( - authProvider.doctorProfile - .doctorImageURL, -// fit: BoxFit.fill, - ), - ), - ], + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + projectsProvider.doctorClinicsList.length + .toString(), + style: new TextStyle( + color: Colors.white, + fontSize: projectsProvider.isArabic ? 10 : 11, ), + textAlign: TextAlign.center, ), - ], - ), + ), + Container( + width: MediaQuery.of(context).size.width * .6, + // // height: 100, + child: projectsProvider.doctorClinicsList.length > 0 + ? Stack( + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[0].clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item.clinicName, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic( + newValue, context, model); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + ], + ) + : AppText(TranslationBase.of(context).noClinic), + ), + ], ), + isClilic: true, ), Container( - color: Colors.white, - height: 90, + height: MediaQuery.of(context).size.height * 0.20, ), ], ), Positioned( right: 9.0, left: 9, - bottom: 19, + top: MediaQuery.of(context).size.height * .05, child: Container( - decoration: BoxDecoration( - color: HexColor("#DED8CF"), - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - margin: EdgeInsets.only(left: 10, right: 10), - height: 140, - width: double.infinity, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Divider(), - Padding( - padding: const EdgeInsets.only( - top: 8.0, bottom: 8, right: 40, left: 8), - child: CircularPercentIndicator( - radius: 100, - animation: true, - animationDuration: 1200, - lineWidth: 7.0, - percent: .75, - center: Column( - mainAxisAlignment: MainAxisAlignment.center, + height: MediaQuery.of(context).size.height * 0.30, + child: model.dashboardItemsList.length > 0 + ? new Swiper( + onIndexChanged: (index) { + if (mounted) { + setState(() { + sliderActiveIndex = index; + }); + } + }, + itemBuilder: (BuildContext context, int index) { + return getSwiperWidget(model)[index]; + }, + itemCount: 3, + + pagination: new SwiperCustomPagination(builder: + (BuildContext context, + SwiperPluginConfig config) { + return new Stack( + alignment: Alignment.bottomCenter, + children: [ + Positioned( + bottom: -5, + child: Center( + child: InkWell( + onTap: () {}, + child: Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all(2), + color: + config.activeIndex == + 0 + ? Colors.black + : Colors + .grey), + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all(2), + color: + config.activeIndex == + 1 + ? Colors.black + : Colors + .grey), + Container( + height: 10, + width: 50, + margin: + EdgeInsets.all(2), + color: + config.activeIndex == + 2 + ? Colors.black + : Colors + .grey), + ], + ))))) + ]); + }), + viewportFraction: 0.9, + // scale: 0.9, + // control: new SwiperControl(), + ) + : SizedBox()), + + //ExpandableCardContainer( + // expandedChild: Container( + // margin: EdgeInsets.only(left: 10, right: 10), + // height: MediaQuery.of(context).orientation == + // Orientation.portrait + // ? MediaQuery.of(context).size.height * 0.22 + // : MediaQuery.of(context).size.height * 0.25, + // width: double.infinity, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // DashboardItem( + // onTap: () { + // setState(() { + // this.isExpanded = false; + // }); + // }, + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Column( + // children: [ + // Row( + // children: [ + // Expanded( + // child: Column( + // children: [ + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[0] + // .value + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[0] + // .value + // .toString() + // : "", + // fontWeight: FontWeight.bold, + // color: Colors.white, + // fontSize: 24, + // ), + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[0] + // .kPIParameter + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[0] + // .kPIParameter + // : "", + // //'My Admitted Patient', + // color: Colors.white, + // textAlign: TextAlign.center, + // fontSize: 12, + // ) + // ], + // )), + // Expanded( + // child: Column( + // children: [ + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[1] + // .value + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[1] + // .value + // .toString() + // : "", + // fontWeight: FontWeight.bold, + // color: Colors.white, + // fontSize: 28, + // ), + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[1] + // .kPIParameter + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[1] + // .kPIParameter + // : "", + // color: Colors.white, + // textAlign: TextAlign.center, + // fontSize: 12, + // ) + // ], + // )), + // Expanded( + // child: Column( + // children: [ + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[2] + // .value + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[2] + // .value + // .toString() + // : "", + // fontWeight: FontWeight.bold, + // color: Colors.white, + // fontSize: 28), + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[2] + // .kPIParameter + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[2] + // .kPIParameter + // .toString() + // : "", + // color: Colors.white, + // fontSize: 12, + // textAlign: TextAlign.center) + // ], + // )) + // ], + // ), + // Row( + // children: [ + // Expanded( + // child: Column( + // children: [ + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[3] + // .value + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[3] + // .value + // .toString() + // : "", + // fontWeight: FontWeight.bold, + // color: Colors.white, + // fontSize: 28), + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[3] + // .kPIParameter + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[3] + // .kPIParameter + // .toString() + // : "", + // color: Colors.white, + // fontSize: 12, + // textAlign: TextAlign.center) + // ], + // )), + // Expanded( + // child: Column( + // children: [ + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[ + // 4] + // .value + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[ + // 4] + // .value + // .toString() + // : "", + // fontWeight: FontWeight.bold, + // color: Colors.white, + // fontSize: 28), + // AppText( + // model.dashboardItemsList + // .length > + // 0 + // ? isInpatient == 'in' + // ? model + // .dashboardItemsList[ + // 0] + // .summaryoptions[ + // 4] + // .kPIParameter + // .toString() + // : model + // .dashboardItemsList[ + // 1] + // .summaryoptions[ + // 4] + // .kPIParameter + // .toString() + // : "", + // color: Colors.white, + // fontSize: 12, + // textAlign: TextAlign.center) + // ], + // ), + // ), + // Expanded( + // child: Container(), + // ) + // ], + // ) + // ], + // )), + // imageName: '5.png', + // color: HexColor('#B8382C'), + // hasBorder: false, + // width: MediaQuery.of(context).size.width * 0.9, + // height: MediaQuery.of(context).orientation == + // Orientation.portrait + // ? MediaQuery.of(context).size.height * 0.22 + // : MediaQuery.of(context).size.height * 0.25, + // ), + // ], + // ), + // ), + // collapsedChild: Container( + // margin: EdgeInsets.only(left: 10, right: 10), + // height: MediaQuery.of(context).orientation == + // Orientation.portrait + // ? MediaQuery.of(context).size.height * 0.15 + // : MediaQuery.of(context).size.height * 0.25, + // width: double.infinity, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // DashboardItem( + // onTap: () { + // setState(() { + // this.isExpanded = true; + // this.isInpatient = 'in'; + // }); + // }, + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Column( + // mainAxisAlignment: + // MainAxisAlignment.start, + // children: [ + // AppText( + // model.dashboardItemsList.length > 0 + // ? getPatientCount( + // model.dashboardItemsList[0]) + // : "", + // fontSize: + // SizeConfig.textMultiplier * 6, + // color: Colors.white, + // ), + // Flexible( + // child: AppText( + // TranslationBase.of(context).inPatient, + // color: Colors.white, + // textOverflow: TextOverflow.ellipsis, + // )), + // ], + // ), + // Padding( + // padding: EdgeInsets.all(5), + // child: Column( + // mainAxisAlignment: + // MainAxisAlignment.end, + // children: [ + // Icon( + // DoctorApp.in_patient_white, + // size: 35, + // color: Colors.white, + // ) + // ], + // )) + // ], + // ), + // ), + // imageName: '4.png', + // color: HexColor('#B8382C'), + // hasBorder: false, + // width: MediaQuery.of(context).size.width * 0.44, + // height: MediaQuery.of(context).orientation == + // Orientation.portrait + // ? MediaQuery.of(context).size.height * 0.15 + // : MediaQuery.of(context).size.height * 0.25, + // ), + // DashboardItem( + // onTap: () { + // setState(() { + // isExpanded = true; + // this.isInpatient = 'out'; + // }); + // }, + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Column( + // mainAxisAlignment: + // MainAxisAlignment.start, + // children: [ + // AppText( + // model.dashboardItemsList.length > 0 + // ? getPatientCount( + // model.dashboardItemsList[1]) + // : "", + // fontSize: + // SizeConfig.textMultiplier * 6, + // color: Colors.white, + // ), + // Flexible( + // child: AppText( + // TranslationBase.of(context) + // .outPatients, + // color: Colors.white, + // textOverflow: TextOverflow.ellipsis, + // )), + // ], + // ), + // Padding( + // padding: EdgeInsets.all(5), + // child: Column( + // mainAxisAlignment: + // MainAxisAlignment.end, + // children: [ + // Icon( + // DoctorApp.out_patient, + // size: 35, + // color: Colors.white, + // ) + // ], + // )) + // ], + // ), + // ), + // imageName: '5.png', + // color: HexColor('#B8382C'), + // hasBorder: false, + // width: MediaQuery.of(context).size.width * 0.44, + // height: MediaQuery.of(context).orientation == + // Orientation.portrait + // ? MediaQuery.of(context).size.height * 0.15 + // : MediaQuery.of(context).size.height * 0.25, + // ), + // ], + // ), + // ), + // isExpanded: isExpanded, + // )) + ) + ]), + model.dashboardItemsList.length > 0 + ? FractionallySizedBox( + widthFactor: 0.90, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - AppText("38", - fontSize: - SizeConfig.textMultiplier * 3.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold,), - AppText(TranslationBase - .of(context) - .outPatients, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.4, - color: HexColor('#5D4C35'), - ), - ], + SizedBox( + height: 15, ), - circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: Colors.blueGrey[100], - progressColor: HexColor('#B8382C'), - ), - ), - Container( - child: Table( - defaultColumnWidth: FixedColumnWidth( - MediaQuery.of(context).size.width / 5), -// border: TableBorder.all( -// color: Colors.black26, -// width: 1, -// style: BorderStyle.solid), - border: TableBorder.symmetric( - inside: BorderSide( - width: 0.5, - color: HexColor('#5D4C35'), - ), - ), - children: [ - TableRow( - children: [ - TableCell( - child: Center( - child: Column( - children: [ - AppText( - TranslationBase.of(context).arrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "23", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, - ), - ], - ), - )), - TableCell( - child: Column( - children: [ - AppText( - TranslationBase.of(context).er, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "03", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, - ), - ], - ), - ), - ], -// - ), - TableRow(children: [ - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).notArrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "15", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, + sliderActiveIndex == 1 + ? Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + model.dashboardItemsList[3].kPIName, + fontSize: + SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.bold, + ), + ], ), + new Container( + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.15 + : MediaQuery.of(context) + .size + .height * + 0.20, + child: new ListView( + scrollDirection: Axis.horizontal, + children: new List.generate( + model + .dashboardItemsList[3] + .summaryoptions + .length, (int index) { + return getActivityButton(model + .dashboardItemsList[3] + .summaryoptions[index]); + }))) ], - ), - ), - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).walkIn, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "04", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, + ) + : sliderActiveIndex == 0 + ? Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + model.dashboardItemsList[4] + .kPIName, + fontSize: + SizeConfig.textMultiplier * + 2.2, + fontWeight: FontWeight.bold, + ), + ], + ), + new Container( + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.15 + : MediaQuery.of(context) + .size + .height * + 0.20, + child: new ListView( + scrollDirection: + Axis.horizontal, + children: new List.generate( + model + .dashboardItemsList[4] + .summaryoptions + .length, (int index) { + return getActivityButton(model + .dashboardItemsList[4] + .summaryoptions[index]); + }))) + ], + ) + : Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + model.dashboardItemsList[6] + .kPIName, + fontSize: + SizeConfig.textMultiplier * + 2.2, + fontWeight: FontWeight.bold, + ), + ], + ), + new Container( + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.15 + : MediaQuery.of(context) + .size + .height * + 0.20, + child: new ListView( + scrollDirection: + Axis.horizontal, + children: new List.generate( + model + .dashboardItemsList[6] + .summaryoptions + .length, (int index) { + return getActivityButton(model + .dashboardItemsList[6] + .summaryoptions[index]); + }))) + ], ), - ], - ), - ), - ]), - ], - ), - ), - Divider(), - ], - ), - ), - ) - ]), + ]))) + : SizedBox(), FractionallySizedBox( - widthFactor: 0.90, + // widthFactor: 0.90, child: Container( - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(50), + )), + padding: EdgeInsets.all(15), + margin: EdgeInsets.only(top: 15), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.lab_results, - size: 40, - color: Colors.white, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10), - child: Column( - children: [ - AppText( - "08", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase - .of(context) - .labResult, - color: Colors.white, - ) - ], - ), - ), - - ], - ), - imageName: '1.png', - opacity: 0.82, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.radiology, - size: 40, - color: Colors.white, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10), - - child: Column( - children: [ - AppText( - "10", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase - .of(context) - .radiology, - color: Colors.white, - ) - ], - ), - ), - - ], - ), - imageName: '2.png', - opacity: 0.9, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - margin: EdgeInsets.only(top: 10), - child: Icon( - DoctorApp.referral, - size: 40, - color: Colors.white, - ), - ), - - Container( - margin: EdgeInsets.only(bottom: 10), - - child: Column( - children: [ - AppText( - "05", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase - .of(context) - .referral, - color: Colors.white, - ) - ], - ), - ), - - ], - ), - imageName: '3.png', - opacity: 0.9, - - ), - ], - ), SizedBox( height: 15, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, children: [ - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.in_patient_white, - size: 40, - color: Colors.white, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "14", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase - .of(context) - .inPatient, - color: Colors.white, - ) - ], - ) - ], - ), - ), - imageName: '4.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery - .of(context) - .size - .width * 0.44, - height: MediaQuery - .of(context) - .orientation == Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.13: - MediaQuery - .of(context) - .size - .height * 0.25, - ), - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.operations, - size: 40, - color: Colors.white, - ), - ], + Container( + width: 150, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.bold, ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "07", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase - .of(context) - .operations, - color: Colors.white, - ) - ], + AppText( + TranslationBase.of(context).services, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, ) ], - ), - ), - imageName: '5.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery - .of(context) - .size - .width * 0.44, - height: MediaQuery - .of(context) - .orientation == Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.13: - MediaQuery - .of(context) - .size - .height * 0.25, - ), - ], - ), - SizedBox( - height: 15, - ), - Row( - children: [ - AppText( - TranslationBase - .of(context) - .patientServices, - fontSize: SizeConfig.textMultiplier * 3, - ), + )), ], ), SizedBox( @@ -648,211 +925,122 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ DashboardItem( + color: Colors.red[800], child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Center( - child: Icon( - DoctorApp.search_patient, - size: 50, - color: Colors.black, - ), - ), - Column( - children: [ - AppText( - TranslationBase.of(context).searchAbout, - color: Colors.black, - textAlign: TextAlign.center, - ), - AppText( - TranslationBase.of(context).patient, - color: Colors.black, - textAlign: TextAlign.center, - ) - ], - ) + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.referral_1, + size: 35, + color: Colors.white, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .patientsreferral, + color: Colors.white, + textAlign: TextAlign.start, + )) ], ), - hasBorder: true, + hasBorder: false, onTap: () { - Navigator.of(context).pushNamed(PATIENT_SEARCH); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PatientReferralScreen(), + // MyReferredPatient(), + ), + ); }, ), DashboardItem( + color: Colors.grey[300], child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - DoctorApp.mail, - size: 50, - color: Colors.black, - ), - Column( - children: [ - AppText( - TranslationBase - .of(context) - .theDoctor, - textAlign: TextAlign.center, + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.arrival_patients, + size: 35, color: Colors.black, - ), - AppText( - TranslationBase - .of(context) - .reply, - textAlign: TextAlign.center, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .arrivalpatient, color: Colors.black, - ), - ], - ) + textAlign: TextAlign.start, + )) ], ), - hasBorder: true, + hasBorder: false, onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - DoctorReplyScreen(), - ), - ); + Navigator.of(context) + .pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": "7", + "arrivalType": "1" + }); }, ), DashboardItem( + color: Colors.black, child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - DoctorApp.medicine_search, - size: 50, - color: Colors.black, - ), - AppText( - TranslationBase - .of(context) - .searchMedicine, - color: Colors.black, - textAlign: TextAlign.center, - ) + Padding( + padding: EdgeInsets.only( + top: 10, left: 10, right: 0), + child: Icon( + DoctorApp.search, + size: 35, + color: Colors.white, + )), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context) + .searchmedicinepatient, + color: Colors.white, + textAlign: TextAlign.start, + )) ], ), - hasBorder: true, + hasBorder: false, onTap: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MedicineSearchScreen(), - ), - ); + context, + MaterialPageRoute( + builder: (context) => + SearchMedicinePatientScreen(), + )); }, - ), + ) ], ), SizedBox( height: 10, ), + SizedBox( + height: 20, + ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Icon( - DoctorApp.qr_code, - size: 50, - color: Colors.black, - ), - Column( - children: [ - AppText( - projectsProvider.isArabic - ? TranslationBase.of(context).reader - : TranslationBase.of(context).qr, - color: Colors.black, - textAlign: TextAlign.center, - ), - AppText( - projectsProvider.isArabic - ? TranslationBase - .of(context) - .qr - : TranslationBase - .of(context) - .reader, - color: Colors.black, - textAlign: TextAlign.center, - ), - ], - ) - ], - ), -// imageName: '1.png', - hasBorder: true, - onTap: () { - Navigator.of(context).pushNamed(QR_READER); - }, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Icon( - DoctorApp.referral, - size: 50, - color: Colors.black, - ), - AppText( - TranslationBase - .of(context) - .myReferralPatient, - textAlign: TextAlign.center, - color: Colors.black, - ) - ], - ), - hasBorder: true, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MyReferralPatient(), - ), - ); - }, - ), - DashboardItem( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Icon( - DoctorApp.referred, - size: 50, - color: Colors.black, - ), - AppText( - TranslationBase - .of(context) - .myReferredPatient, - color: Colors.black, - textAlign: TextAlign.center, - ) - ], - ), - hasBorder: true, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MyReferredPatient(), - ), - ); - }, + children: [ + SizedBox( + width: 8, ), ], ), @@ -870,78 +1058,39 @@ class _DashboardScreenState extends State { ); } - showCupertinoPicker( - {context, List actionList, decKey, onSelectFun}) { - showModalBottomSheet( - isDismissible: false, - isScrollControlled: true, - context: context, - builder: (BuildContext builder) { - return Container( - // height: 500, - height: SizeConfig.realScreenHeight * 0.4, - color: Color(0xfff7f7f7), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - color: Color(0xfff7f7f7), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - CupertinoButton( - child: AppText(TranslationBase - .of(context) - .cancel - // style: TextStyle(context) - ), - onPressed: () { - Navigator.pop(context); - }, - ), - CupertinoButton( - child: AppText(TranslationBase - .of(context) - .done - // style: textStyle(context), - ), - onPressed: () { - Navigator.pop(context); - // onSelectFun(cupertinoPickerIndex); - }, - ) - ], - ), - ), - Container( - height: SizeConfig.realScreenHeight * 0.3, - color: Color(0xfff7f7f7), - child: Column( - children: actionList - .map((e) => Flexible( - child: Container( - height: 50, - child: InkWell( - onTap: () => - changeClinic(e.clinicID, context), - child: AppText( - e.clinicName, - fontSize: - SizeConfig.textMultiplier * - 1.9, - )), - ), - )) - .toList(), - )) - ], - ), - ); - }); + static List> _createReferralData(model) { + final data = [ + new GaugeSegment( + model.dashboardItemsList[2].summaryoptions[0].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[0].value), + charts.MaterialPalette.black), + new GaugeSegment( + model.dashboardItemsList[2].summaryoptions[1].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[1].value), + charts.MaterialPalette.gray.shadeDefault), + new GaugeSegment( + model.dashboardItemsList[2].summaryoptions[2].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[2].value), + charts.MaterialPalette.red.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + colorFn: (GaugeSegment segment, _) => segment.color, + ) + ]; } - changeClinic(clinicId, BuildContext context) async { - Navigator.pop(context); + static int getValue(value) { + return value == 0 ? 1 : value; + } + + changeClinic(clinicId, BuildContext context, model) async { + // Navigator.pop(context); changeIsLoading(true); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -957,6 +1106,7 @@ class _DashboardScreenState extends State { authProvider.getDocProfiles(docInfo.toJson()).then((res) async { changeIsLoading(false); sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); + // model.getDashboard(); }).catchError((err) { changeIsLoading(false); helpers.showErrorToast(err); @@ -968,20 +1118,255 @@ class _DashboardScreenState extends State { this.isLoading = val; }); } + + getPatientCount(DashboardModel inPatientCount) { + int value = 0; + inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + + return value.toString(); + } + + Widget getActivityButton(value) { + return Container( + width: MediaQuery.of(context).size.width * 0.24, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + height: MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: AppText(value.value.toString(), + fontSize: 28, fontWeight: FontWeight.bold)), + Expanded( + child: AppText( + value.kPIParameter, + textOverflow: TextOverflow.clip, + fontSize: 12, + textAlign: TextAlign.center, + ), + ), + ], + ), + ); + } + + Widget dot(Color c) { + return Container( + padding: EdgeInsets.all(5.0), + margin: EdgeInsets.all(5.0), + decoration: BoxDecoration(color: c, shape: BoxShape.circle)); + } + + Widget rowCount(name, int count, Color c) { + return Row( + children: [ + dot(c), + Padding( + padding: EdgeInsets.only(top: 5, bottom: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + name, + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 12, + textOverflow: TextOverflow.ellipsis, + ), + AppText( + ' (' + count.toString() + ')', + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 14, + fontWeight: FontWeight.bold, + ) + ], + )), + ], + ); + } + + Widget getOutPatientStack(value) { + value.summaryoptions + .sort((Summaryoptions a, Summaryoptions b) => b.value - a.value); + + var list = new List(); + value.summaryoptions.forEach((result) => + {list.add(getStack(result, value.summaryoptions.first.value))}); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Texts( + value.kPIName, + medium: true, + ), + Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) + ], + ); + } + + getStack(Summaryoptions value, max) { + return Stack(children: [ + Container( + height: 150, + margin: EdgeInsets.all(5), + width: ((SizeConfig.screenWidth * .55) / 5), + child: SizedBox(), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), color: Colors.red[50]), + ), + Positioned( + bottom: 0, + child: Container( + child: SizedBox(), + margin: EdgeInsets.all(5), + padding: EdgeInsets.all(10), + height: max != 0 ? (150 * value.value) / max : 0, + width: ((SizeConfig.screenWidth * .55) / 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.red[300]))), + Container( + height: 150, + margin: EdgeInsets.only(left: 10, top: 5), + padding: EdgeInsets.all(8), + child: RotatedBox( + quarterTurns: 1, + child: Center( + child: Align( + child: AppText( + value.kPIParameter + ' (' + value.value.toString() + ') ', + fontSize: 11, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + )), + ), + )) + ]); + } + + List getSwiperWidget(model) { + return [ + RoundedContainer( + height: MediaQuery.of(context).size.height * 0.32, + margin: 5, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: getOutPatientStack(model.dashboardItemsList[1]))), + RoundedContainer( + height: MediaQuery.of(context).size.height * 0.32, + margin: 5, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: getOutPatientStack(model.dashboardItemsList[0]))), + RoundedContainer( + height: MediaQuery.of(context).size.height * 0.24, + margin: 5, + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Expanded( + flex: 1, + child: Row( + children: [ + Expanded( + flex: 4, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Padding( + child: AppText( + TranslationBase.of(context).referral, + fontSize: 20, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10))), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + rowCount( + model.dashboardItemsList[2] + .summaryoptions[0].kPIParameter, + model.dashboardItemsList[2] + .summaryoptions[0].value, + Colors.black), + rowCount( + model.dashboardItemsList[2] + .summaryoptions[1].kPIParameter, + model.dashboardItemsList[2] + .summaryoptions[1].value, + Colors.grey), + rowCount( + model.dashboardItemsList[2] + .summaryoptions[2].kPIParameter, + model.dashboardItemsList[2] + .summaryoptions[2].value, + Colors.red), + ], + ), + ) + ], + ))), + Expanded( + flex: 3, + child: Stack(children: [ + Container( + child: GaugeChart(_createReferralData(model))), + Positioned( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + getPatientCount(model.dashboardItemsList[2]) + .toString(), + fontSize: 30, + fontWeight: FontWeight.bold, + ) + ], + ), + top: MediaQuery.of(context).size.height * 0.12, + left: 0, + right: 0) + ]), + ), + ], + )), + ])), + ]; + } } + // TODO Move to it file class DashboardItem extends StatelessWidget { - const DashboardItem({ - this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 0.4 - }) : super(key: key); + const DashboardItem( + {this.hasBorder = false, + this.imageName, + @required this.child, + this.onTap, + Key key, + this.width, + this.height, + this.color, + this.opacity = 0.4}) + : super(key: key); final bool hasBorder; final String imageName; final Widget child; @@ -996,39 +1381,62 @@ class DashboardItem extends StatelessWidget { return InkWell( onTap: onTap, child: Container( - width: width != null ? width : MediaQuery - .of(context) - .size - .width * 0.29, - height: height != null ? height : MediaQuery - .of(context) - .orientation == Orientation.portrait ? MediaQuery - .of(context) - .size - .height * 0.19 : MediaQuery - .of(context) - .size - .height * 0.35, - + width: width != null ? width : MediaQuery.of(context).size.width * 0.29, + height: height != null + ? height + : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.16 + : MediaQuery.of(context).size.height * 0.36, decoration: BoxDecoration( - color: !hasBorder ? color != null ? color : HexColor('#050705') - .withOpacity(opacity) : Colors - .white, - borderRadius: BorderRadius.circular(6.0), - border: hasBorder ? Border.all( - width: 1.0, color: const Color(0xffcccccc)) : Border.all( - width: 0.0, color: Colors.transparent), - image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/dashboard/${imageName}'), - fit: BoxFit.cover, - colorFilter: new ColorFilter.mode( - Colors.black.withOpacity(0.2), BlendMode.dstIn), - - ) : null, - + color: !hasBorder + ? color != null + ? color + : HexColor('#050705').withOpacity(opacity) + : Colors.white, + borderRadius: BorderRadius.circular(15.0), + border: hasBorder + ? Border.all(width: 1.0, color: const Color(0xffcccccc)) + : Border.all(width: 0.0, color: Colors.transparent), + image: imageName != null + ? DecorationImage( + image: AssetImage('assets/images/dashboard/${imageName}'), + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn), + ) + : null, + ), + child: Center( + child: child, ), - child: Center(child: child,), ), ); } + + getDashboardWidget() {} +} + +class ExpandableCardContainer extends StatefulWidget { + final bool isExpanded; + final Widget collapsedChild; + final Widget expandedChild; + + const ExpandableCardContainer( + {Key key, this.isExpanded, this.collapsedChild, this.expandedChild}) + : super(key: key); + + @override + _ExpandableCardContainerState createState() => + _ExpandableCardContainerState(); +} + +class _ExpandableCardContainerState extends State { + @override + Widget build(BuildContext context) { + return new AnimatedContainer( + duration: new Duration(milliseconds: 1000), + curve: Curves.easeInOut, + child: widget.isExpanded ? widget.expandedChild : widget.collapsedChild, + ); + } } diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index 4326397f..b57bd1a2 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/doctor/doctor_reply_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,31 +15,32 @@ import 'package:flutter/material.dart'; *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service */ class DoctorReplyScreen extends StatelessWidget { - @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getDoctorReply(), builder: (_, model, w) => AppScaffold( - baseViewModel: model, + baseViewModel: model, appBarTitle: TranslationBase.of(context).replay2, - body: Container( - padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - child: ListView( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: model - .listDoctorWorkingHoursTable - .map((reply) { - return DoctorReplyWidget(reply: reply); - }).toList(), - ) - ], - ), - ), + isShowAppBar: false, + body: model.listDoctorWorkingHoursTable.isEmpty + ? DrAppEmbeddedError( + error: TranslationBase.of(context).noItem) + : Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: + model.listDoctorWorkingHoursTable.map((reply) { + return DoctorReplyWidget(reply: reply); + }).toList(), + ) + ], + ), + ), )); } } diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart index cd9112e2..86e5de53 100644 --- a/lib/screens/doctor/my_referred_patient_screen.dart +++ b/lib/screens/doctor/my_referred_patient_screen.dart @@ -8,41 +8,39 @@ import 'package:flutter/material.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; class MyReferredPatient extends StatelessWidget { - @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getMyReferredPatient(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).myReferredPatient, - body: model.listMyReferredPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).myReferredPatient, + body: model.listMyReferredPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : Container( + padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), + child: ListView( + children: [ + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 10, + height: 100, ), Container( child: Column( //children: referredPatientProvider.listMyReferralPatientModel.map((item) { - children: model - .listMyReferredPatientModel + children: model.listMyReferredPatientModel .map((item) { return MyReferredPatientWidget( - myReferredPatientModel: item, - model:model - ); + myReferredPatientModel: item, + model: model); }).toList(), ), ), @@ -51,6 +49,6 @@ class MyReferredPatient extends StatelessWidget { ], ), ), - )); + )); } } diff --git a/lib/screens/doctor/patient_arrival_screen.dart b/lib/screens/doctor/patient_arrival_screen.dart new file mode 100644 index 00000000..fa2bd11b --- /dev/null +++ b/lib/screens/doctor/patient_arrival_screen.dart @@ -0,0 +1,125 @@ +import 'dart:ui'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PatientArrivalScreen extends StatefulWidget { + @override + _PatientArrivalScreen createState() => _PatientArrivalScreen(); +} + +class _PatientArrivalScreen extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + var _patientSearchFormValues = PatientModel( + FirstName: "0", + MiddleName: "0", + LastName: "0", + PatientMobileNumber: "0", + PatientIdentificationID: "0", + PatientID: 0, + From: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), + To: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), + LanguageID: 2, + stamp: "2020-03-02T13:56:39.170Z", + IPAdress: "11.11.11.11", + VersionID: 1.2, + Channel: 9, + TokenID: "2Fi7HoIHB0eDyekVa6tCJg==", + SessionID: "5G0yXn0Jnq", + IsLoginForDoctorApp: true, + PatientOutSA: false); + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).arrivalpatient, + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.92, // 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.9), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText( + TranslationBase.of(context).arrivalpatient), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText( + TranslationBase.of(context).rescheduleLeaves), + ), + ), + ], + ), + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddRescheduleLeavScreen(), + ], + ), + ) + ], + ), + )); + } +} diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart new file mode 100644 index 00000000..77fddfe5 --- /dev/null +++ b/lib/screens/medical-file/medical_file_details.dart @@ -0,0 +1,1026 @@ +import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/patient_profile_screen.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +class MedicalFileDetails extends StatefulWidget { + String age; + String firstName; + String lastName; + String gender; + int encounterNumber; + int pp; + PatiantInformtion patient; + + MedicalFileDetails( + {this.age, + this.firstName, + this.lastName, + this.gender, + this.encounterNumber, + this.pp, + this.patient}); + + @override + _MedicalFileDetailsState createState() => _MedicalFileDetailsState( + firstName: firstName, + age: age, + lastName: lastName, + gender: gender, + encounterNumber: encounterNumber, + pp: pp, + patient: patient, + ); +} + +class _MedicalFileDetailsState extends State { + int encounterNumber; + String age; + String firstName; + String lastName; + String gender; + int pp; + PatiantInformtion patient; + + _MedicalFileDetailsState( + {this.age, + this.firstName, + this.lastName, + this.gender, + this.encounterNumber, + this.pp, + this.patient}); + bool isPhysicalExam = false; + bool isProcedureExpand = false; + bool isHistoryExpand = false; + bool isAssessmentExpand = false; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getMedicalFile(mrn: pp), + builder: + (BuildContext context, MedicalFileViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Center( + child: Container( + child: Column( + children: [ + PatientProfileHeaderNewDesign(patient, + patient.patientType.toString(), patient.arrivedOn), + model.medicalFileList.length != 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0 + ? Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], width: 0.5), + ), + child: Column( + children: [ + Row( + children: [ + if (model.medicalFileList.length != + 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + Expanded( + child: AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .doctorName + .toUpperCase(), + fontWeight: FontWeight.w700, + ), + ), + ], + ), + if (model.medicalFileList.length != 0) + Row( + children: [ + AppText( + TranslationBase.of(context) + .clinic + + ": ", + ), + if (model.medicalFileList + .length != + 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .clinicName, + fontWeight: FontWeight.w700, + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .episode + + ": ", + fontWeight: FontWeight.w700, + ), + if (model.medicalFileList.length != + 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .episodeID + .toString(), + fontWeight: FontWeight.w700, + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .visitDate + + ": ", + fontWeight: FontWeight.w700, + ), + if (model.medicalFileList.length != + 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .appointmentDate + .toString(), + fontWeight: FontWeight.w700, + ), + SizedBox(width: 35.0), + // AppText( + // 'Appt Date : ', + // fontWeight: FontWeight.w700, + // ), + // AppText( + // '23/12/2020', + // ), + ], + ), + ], + ), + ), + + SizedBox(height: 25.0), + if (model.medicalFileList.length != 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], + width: 0.5), + ), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts( + TranslationBase.of( + context) + .historyOfPresentIllness + .toUpperCase(), + variant: isHistoryExpand + ? "bodyText" + : '', + bold: isHistoryExpand + ? true + : true, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isHistoryExpand = + !isHistoryExpand; + }); + }, + child: Icon(isHistoryExpand + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) + ], + ), + bodyWidget: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstCheifComplaint + .length, + itemBuilder: (BuildContext ctxt, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Row( + children: [ + Expanded( + child: AppText( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstCheifComplaint[ + index] + .hOPI + .trim(), + ), + ), + SizedBox( + width: 35.0), + ], + ), + ], + ), + ), + ); + }), + isExpand: isHistoryExpand, + ), + ), + ), + // SizedBox( + // height: 30, + // ), + + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], + width: 0.5), + ), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts( + TranslationBase.of( + context) + .assessment + .toUpperCase(), + variant: + isAssessmentExpand + ? "bodyText" + : '', + bold: isAssessmentExpand + ? true + : true, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = + !isAssessmentExpand; + }); + }, + child: Icon(isAssessmentExpand + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) + ], + ), + bodyWidget: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments + .length, + itemBuilder: (BuildContext ctxt, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Row( + children: [ + AppText( + 'ICD', + fontWeight: + FontWeight + .w700, + ), + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstAssessments[ + index] + .iCD10 + .trim(), + ), + SizedBox( + width: 35.0), + AppText( + 'Condition: ', + fontWeight: + FontWeight + .w700, + ), + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstAssessments[ + index] + .condition + .trim(), + ), + ], + ), + Row( + children: [ + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstAssessments[ + index] + .description, + fontWeight: + FontWeight + .w700, + ) + ], + ), + Row( + children: [ + AppText( + 'Type: ', + fontWeight: + FontWeight + .w700, + ), + AppText(model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[0] + .lstAssessments[ + index] + .type), + ], + ), + SizedBox( + height: 15.0, + ), + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[ + index] + .remarks + .trim(), + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isAssessmentExpand, + ), + ), + ), + // SizedBox( + // height: 30, + // ), + // Container( + // width: double.infinity, + // height: 1, + // color: Color(0xffCCCCCC), + // ), + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], + width: 0.5), + ), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts( + TranslationBase.of( + context) + .test + .toUpperCase(), + variant: isProcedureExpand + ? "bodyText" + : '', + bold: isProcedureExpand + ? true + : true, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isProcedureExpand = + !isProcedureExpand; + }); + }, + child: Icon(isProcedureExpand + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) + ], + ), + bodyWidget: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstProcedure + .length, + itemBuilder: (BuildContext ctxt, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Row( + children: [ + Column( + children: [ + AppText( + 'Procedure ID: ', + fontWeight: + FontWeight + .w700, + ), + AppText( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstProcedure[ + index] + .procedureId + .trim(), + ), + ], + ), + SizedBox( + width: 35.0), + Column( + children: [ + AppText( + 'Order Date: ', + fontWeight: + FontWeight + .w700, + ), + AppText( + Helpers.getDateFormatted( + DateTime + .parse( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstProcedure[ + index] + .orderDate + .trim(), + )), + fontSize: + 13.5, + ), + ], + ), + ], + ), + SizedBox( + height: 20.0, + ), + Row( + children: [ + Expanded( + child: AppText( + model + .medicalFileList[ + 0] + .entityList[ + 0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstProcedure[ + index] + .procName, + fontWeight: + FontWeight + .w700, + ), + ) + ], + ), + Row( + children: [ + AppText( + 'CPT Code : ', + fontWeight: + FontWeight + .w700, + ), + AppText(model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[0] + .lstProcedure[ + index] + .patientID + .toString()), + ], + ), + SizedBox( + height: 15.0, + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isProcedureExpand, + ), + ), + ), + // SizedBox( + // height: 30, + // ), + // Container( + // width: double.infinity, + // height: 1, + // color: Color(0xffCCCCCC), + // ), + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0 && + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations + .length != + 0) + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], + width: 0.5), + ), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts( + TranslationBase.of( + context) + .physicalSystemExamination + .toUpperCase(), + variant: isPhysicalExam + ? "bodyText" + : '', + bold: isPhysicalExam + ? true + : true, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isPhysicalExam = + !isPhysicalExam; + }); + }, + child: Icon(isPhysicalExam + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) + ], + ), + bodyWidget: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam + .length, + itemBuilder: (BuildContext ctxt, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + children: [ + Row( + children: [ + AppText( + 'Exam Type: ', + fontWeight: + FontWeight + .w700, + ), + AppText(model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[0] + .lstPhysicalExam[ + index] + .examDesc), + ], + ), + Row( + children: [ + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[ + 0] + .lstPhysicalExam[ + index] + .examDesc, + fontWeight: + FontWeight + .w700, + ) + ], + ), + Row( + children: [ + AppText( + 'Abnormal: ', + fontWeight: + FontWeight + .w700, + ), + AppText(model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[ + 0] + .consulations[0] + .lstPhysicalExam[ + index] + .abnormal), + ], + ), + SizedBox( + height: 15.0, + ), + AppText( + model + .medicalFileList[ + 0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam[ + index] + .remarks, + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isPhysicalExam, + ), + ), + ), + SizedBox( + height: 30, + ), + // Container( + // width: double.infinity, + // height: 1, + // color: Color(0xffCCCCCC), + // ), + ], + ), + ), + ) + : Text("There's no medical file for this patient") + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart new file mode 100644 index 00000000..5f53c2b9 --- /dev/null +++ b/lib/screens/medical-file/medical_file_page.dart @@ -0,0 +1,291 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/patient_profile_screen.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class MedicalFilePage extends StatefulWidget { + @override + _MedicalFilePageState createState() => _MedicalFilePageState(); +} + +class _MedicalFilePageState extends State { + PatiantInformtion patient; + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + + return BaseView( + onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId), + builder: + (BuildContext context, MedicalFileViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + // mainAxisAlignment: model.medicalFileList.length != 0 && + // model.medicalFileList != null + // ? MainAxisAlignment.start + // : MainAxisAlignment.center, + children: [ + PatientProfileHeaderNewDesign( + patient, patient.patientType.toString(), arrivalType), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + AppText( + 'Medical', + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + 'Report', + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ), + ), + ), + ), + (model.medicalFileList != null && + model.medicalFileList.length != 0) + ? ListView.builder( + //physics: , + physics: NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.medicalFileList[0].entityList[0] + .timelines.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 8.0), + child: InkWell( + child: Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], width: 0.5), + ), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName, + fontWeight: FontWeight.w700, + fontSize: 17.0, + fontFamily: 'Poppins', + ) + ], + ), + Row( + children: [ + AppText( + Helpers.convertStringToDate(model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .date) + .day + .toString() + + "/", + ), + AppText( + Helpers.convertStringToDate(model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .date) + .month + .toString() + + "/", + ), + AppText( + Helpers.convertStringToDate( + model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .date) + .year + .toString(), + ), + ], + ) + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + ClipRRect( + borderRadius: + BorderRadius.all( + Radius.circular(30)), + child: Image.network( + 'https://previews.123rf.com/images/yupiramos/yupiramos1705/yupiramos170524444/78443570-a-female-doctor-avatar-character-vector-illustration-design.jpg', + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + ], + ), + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context) + .clinic + + ": ", + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .clinicName, + fontWeight: FontWeight.w600, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .branch + + ": ", + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .projectName, + fontWeight: FontWeight.w600, + ), + ], + ), + ], + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + children: [ + Icon( + Icons.remove_red_eye, + size: 30.0, + ) + ], + ) + ], + ), + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MedicalFileDetails( + age: patient.age, + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientId, + patient: patient, + )), + ); + }, + ), + ); + }) + : Column( + children: [ + Container( + child: AppText( + 'THERES NO MEDICAL FILE FOR THIS Patient', + ), + ), + SizedBox( + height: 400, + ) + ], + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 3a2ff96c..a37debbf 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -1,9 +1,10 @@ import 'dart:math'; +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; @@ -15,8 +16,9 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_recognition_result.dart'; @@ -44,6 +46,9 @@ class _MedicineSearchState extends State { bool _isInit = true; final SpeechToText speech = SpeechToText(); String lastStatus = ''; + GetMedicationResponseModel _selectedMedication; + GlobalKey key = + new GlobalKey>(); // String lastWords; List _localeNames = []; @@ -83,176 +88,179 @@ class _MedicineSearchState extends State { }); } + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + @override Widget build(BuildContext context) { return BaseView( - builder: (_, model, w) => AppScaffold( - appBarTitle: TranslationBase.of(context).searchMedicine, - body: FractionallySizedBox( - widthFactor: 0.97, - child: SingleChildScrollView( - child: Column( - children: [ - Column( - children: [ - Container( - child: Icon( - DoctorApp.medicine_search, - size: 100, - color: Colors.black, - ), - margin: EdgeInsets.only(top: 50), - ), - Padding( - padding: const EdgeInsets.only(top: 12.0), - child: AppText( - TranslationBase.of(context).type.toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: SizeConfig.heightMultiplier * 2.5, - ), - ), - Padding( - padding: const EdgeInsets.only(top: 5.0), - child: AppText( - TranslationBase.of(context).searchMedicineImageCaption, - fontSize: SizeConfig.heightMultiplier * 2, - ), - ) - ], - ), - SizedBox( - height: 15, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - child: AppTextFormField( - hintText: TranslationBase.of(context) - .searchMedicineNameHere, - controller: myController, - onSaved: (value) {}, - onFieldSubmitted: (value) { - searchMedicine(context, model); - }, - textInputAction: TextInputAction.search, - // TODO return it back when it needed - // prefix: IconButton( - // icon: Icon(Icons.mic), - // color: - // lastStatus == 'listening' ? Colors.red : Colors.grey, - // onPressed: () { - // myController.text = ''; - // setState(() { - // lastStatus = 'listening'; - // }); - // - // startVoiceSearch(); - // }), - inputFormatter: ONLY_LETTERS), - ), - SizedBox( - height: 15, - ), - Container( - child: Wrap( - alignment: WrapAlignment.center, - children: [ - // TODO change it secondary button and add loading - AppButton( - title: TranslationBase.of(context).search, - onPressed: () { + onModelReady: (model) async { + // if (model.allMedicationList.length == 0) + // await model.getMedicationList(); + }, + builder: (_, model, w) { + myController.text =model.searchText; + return AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).searchMedicine, + body: SingleChildScrollView( + child: FractionallySizedBox( + widthFactor: 0.97, + child: SingleChildScrollView( + child: Container( + // height: SizeConfig.screenHeight, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.screenHeight * .16, + ), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + borderColor: Colors.white, + hintText: TranslationBase.of(context) + .searchMedicineNameHere, + controller: myController, + onSaved: (value) {}, + onFieldSubmitted: (value) { searchMedicine(context, model); }, + inputFormatter: ONLY_LETTERS, ), - ], + ), ), - ), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Wrap( + alignment: WrapAlignment.center, + children: [ + // TODO change it secondary button and add loading + AppButton( + title: TranslationBase.of(context).search, + onPressed: () async{ + await searchMedicine(context, model); - NetworkBaseView( - baseViewModel: model, - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase - .of(context) - .youCanFind + - model.pharmacyItemsList.length - .toString() + - " " + - TranslationBase - .of(context) - .itemsInSearch, - fontWeight: FontWeight.bold, - ), - ], + }, ), - ), - Container( - height: MediaQuery + ], + ), + ), + ), + + Container( + margin: EdgeInsets.only( + left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase .of(context) - .size - .height * 0.35, - child: Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: - model.pharmacyItemsList == - null - ? 0 - : model - .pharmacyItemsList.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: MedicineItemWidget( - label: model - .pharmacyItemsList[index] - ["ItemDescription"], - url: model - .pharmacyItemsList[index] - ["ImageSRCUrl"], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PharmaciesListScreen( - itemID: model - .pharmacyItemsList[ - index]["ItemID"], - url: model - .pharmacyItemsList[ - index]["ImageSRCUrl"]), - ), - ); - }, - ); - }, - ), - ), + .youCanFind + + (myController.text !=''?model.pharmacyItemsList.length + .toString():'0' )+ + " " + + TranslationBase + .of(context) + .itemsInSearch, + fontWeight: FontWeight.bold, ), ], - )), - ], - ), - ), - ], - ), - ), - ),),); + ), + ), + SizedBox( + height:10, + ), + if(myController.text !='') + Container( + height: MediaQuery + .of(context) + .size + .height * 0.5, + child: ListView.builder( + padding: const EdgeInsets.only(top:20), + + scrollDirection: Axis.vertical, + // shrinkWrap: true, + itemCount: + model.pharmacyItemsList == + null + ? 0 + : model + .pharmacyItemsList.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: MedicineItemWidget( + label: model + .pharmacyItemsList[index] + ["ItemDescription"], + url: model + .pharmacyItemsList[index] + ["ImageSRCUrl"], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PharmaciesListScreen( + itemID: model + .pharmacyItemsList[ + index]["ItemID"], + url: model + .pharmacyItemsList[ + index]["ImageSRCUrl"]), + ), + ); + }, + ); + }, + ), + ), + ], + ), + )), + ), + ), + );} + + ); } - searchMedicine(context, MedicineViewModel model) { + searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); if (myController.text.isNullOrEmpty()) { helpers.showErrorToast(TranslationBase @@ -267,7 +275,11 @@ class _MedicineSearchState extends State { .moreThan3Letter); return; } - model.getMedicineItem(myController.text); + + GifLoaderDialogUtils.showMyDialog(context); + + await model.getMedicineItem(myController.text); + GifLoaderDialogUtils.hideDialog(context); } startVoiceSearch() { diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index 6057bf23..6af1d5b7 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -34,7 +34,7 @@ class PharmaciesListScreen extends StatefulWidget { class _PharmaciesListState extends State { var _data; Helpers helpers = new Helpers(); - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; bool _isInit = true; //bool _isOutOfStuck = false; @@ -62,18 +62,18 @@ class _PharmaciesListState extends State { children: [ model.pharmaciesList.length > 0 ? RoundedContainer( - child: Row( - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(7)), - child: widget.url != null - ? Image.network( - widget.url, - height: - SizeConfig.imageSizeMultiplier * + child: Row( + children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(7)), + child: widget.url != null + ? Image.network( + widget.url, + height: + SizeConfig.imageSizeMultiplier * 21, width: SizeConfig.imageSizeMultiplier * @@ -230,8 +230,8 @@ class _PharmaciesListState extends State { }), ), ) - ]), - ),),); + ]), + ),),); } @@ -242,7 +242,7 @@ class _PharmaciesListState extends State { //TODO CHECK THE URL IS NULL OR NOT Uint8List dataFromBase64String(String base64String) { if(base64String !=null) - return base64Decode(base64String); + return base64Decode(base64String); } String base64String(Uint8List data) { diff --git a/lib/screens/medicine/search_medicine_patient_screen.dart b/lib/screens/medicine/search_medicine_patient_screen.dart new file mode 100644 index 00000000..245c0602 --- /dev/null +++ b/lib/screens/medicine/search_medicine_patient_screen.dart @@ -0,0 +1,118 @@ +import 'dart:ui'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SearchMedicinePatientScreen extends StatefulWidget { + @override + _SearchMedicinePatientScreen createState() => _SearchMedicinePatientScreen(); +} + +class _SearchMedicinePatientScreen extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + var activeIndex = 0; + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).searchmedicinepatient, + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.92, // 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.9), //width: 0.7 + ), + color: Colors.white), + child: TabBar( + isScrollable: true, + onTap: (index) { + setState(() { + activeIndex = index; + }); + }, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText( + TranslationBase.of(context).searchPatient, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText( + TranslationBase.of(context).searchMedicine, + fontWeight: FontWeight.bold, + color: Colors.black), + ), + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PatientSearchScreen(), + MedicineSearchScreen() + ], + ), + ) + ], + ), + )); + } +} diff --git a/lib/screens/patients/ECGPage.dart b/lib/screens/patients/ECGPage.dart new file mode 100644 index 00000000..ffb12ee1 --- /dev/null +++ b/lib/screens/patients/ECGPage.dart @@ -0,0 +1,125 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMuseViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class ECGPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patient-type']; + String arrivalType = routeArgs['arrival-type']; + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getECGPatient( + patientType: patient.patientType, + patientOutSA: 0, + patientID: patient.patientId), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + backgroundColor: Color(0xffF8F8F8), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), + SizedBox(height: 12,), + Texts('Service',style: "caption2",color: Colors.black,), + Texts('ECG',bold: true,fontSize: 22,), + SizedBox(height: 12,), + ...List.generate(model.patientMuseResultsModelList.length, (index) => InkWell( + onTap: () async { + await launch( + model.patientMuseResultsModelList[index].imageURL); + }, + child: Container( + width: double.infinity, + height: 110, + margin: EdgeInsets.only(top: 5,bottom: 5), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all(color: Colors.white,width: 2), + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), + child: Column( + children: [ + Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('ECG Report',fontWeight: FontWeight.w700,fontSize: 17,), + SizedBox(height:3), + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: + TranslationBase.of(context).orderNo, + style: TextStyle( + fontSize: 12, + fontFamily: + 'Poppins')), + new TextSpan( + text: '${/*model.patientMuseResultsModelList[index].orderNo?? */'3455'}', + style: TextStyle( + fontWeight: FontWeight.w600, + fontFamily: + 'Poppins', + fontSize: 14)), + ], + ), + ) + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts('${DateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime,isArabic: projectViewModel.isArabic)}',color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14,), + Texts('${DateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime)}',fontWeight: FontWeight.w600,color: Colors.grey[700],fontSize: 14,), + ], + ), + ), + ], + ), + SizedBox(height: 15,), + Align( + alignment: Alignment.topRight, + child: Icon(Icons.arrow_circle_up_rounded), + ) + ], + ), + ), + )), + + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart new file mode 100644 index 00000000..95f55e27 --- /dev/null +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -0,0 +1,429 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/InsuranceViewModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../base/base_view.dart'; + +class InsuranceApprovalScreenNew extends StatefulWidget { + final int appointmentNo; + + InsuranceApprovalScreenNew({this.appointmentNo}); + + @override + _InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState(); +} + +class _InsuranceApprovalScreenNewState extends State { + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return BaseView( + onModelReady: widget.appointmentNo != null + ? (model) => + model.getInsuranceApproval(patient,appointmentNo: widget.appointmentNo) + : (model) => model.getInsuranceApproval(patient), + builder: (BuildContext context, InsuranceViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: TranslationBase.of(context).approvals, + + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04, + ), + child: Column( + children: [ + Container( + width: double.infinity, + height: SizeConfig.screenHeight * 0.09, + color: Color(0xffEEEEEE), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Texts( + TranslationBase.of(context).totalApproval, + color: Color(0xff60688B), + fontSize: 19.0, + fontWeight: FontWeight.w600, + ), + if (model.insuranceApproval.length > 0) + Container( + width: 60, + height: 40, + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.circular(19.0)), + child: Center( + child: Texts( + model.insuranceApproval[0].unUsedCount + .toString(), + color: Colors.white, fontSize: 17.0, + ), + )) + ], + )), + ...List.generate( + model.insuranceApproval.length, + (index) => RoundedContainer( + backgroundColor: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + //height: 120.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + model.insuranceApproval[index].patientDescription == "In Patient" + ? Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: + BorderRadius.circular( + 16.0)), + width: 115.0, + padding: + EdgeInsets.only(left: 11.5), + child: Center( + child: Texts( + TranslationBase.of(context).inPatient, + color: Colors.white, + ), + ), + ) + : Container( + decoration: BoxDecoration( + color: Color(0xff505A5D), + borderRadius: + BorderRadius.circular( + 16.0)), + width: 115.0, + padding: + EdgeInsets.only(left: 11.5), + child: Center( + child: Texts( + TranslationBase.of(context).outpatient, + color: Colors.white, + ), + ), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0), + child: Texts( + model.insuranceApproval[index] + .clinicName, + fontSize: 20.0, + color: Color(0xff60686B), + fontWeight: FontWeight.w600, + ), + ), + Texts( + model.insuranceApproval[index] + .doctorName, + fontSize: 17.0, + ), + ], + ), + ), + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 12.0, horizontal: 12.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Texts( + TranslationBase.of(context).approvalNo, + fontSize: 18.0, + ), + Texts(model.insuranceApproval[index].approvalNo.toString(), + fontSize: 18.0, + fontWeight: FontWeight.w600,), + ], + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Row( + children: [ + Texts( + TranslationBase.of(context).procedureStatus , + fontSize: 17.5, + ), + SizedBox(width: 12,), + Expanded( + child: Texts( + model.insuranceApproval[index].approvalStatusDescption, + fontWeight: FontWeight.w600, + fontSize: 17.5, + ), + ), + ], + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Row( + children: [ + Texts( + TranslationBase.of(context).unusedCount, + fontSize: 17.5, + ), + Texts( + model.insuranceApproval[index].unUsedCount.toString(), + fontSize: 17.5, + fontWeight: FontWeight.w600, + ), + ], + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), +// Text( +// 'Company Name: ' + +// model.insuranceApproval[index] +// .companyName == +// null +// ? '000' +// : model +// .insuranceApproval[index].companyName, +// style: TextStyle( +// fontSize: 17.5, +// fontWeight: FontWeight.w600), +// ), + Texts( + TranslationBase.of(context).companyName, + fontWeight: FontWeight.w600, + fontSize: 17.5, + ), + + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Row( + children: [ + Texts( + TranslationBase.of(context).receiptOn , + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + Texts( + DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[index].rceiptOn).toString(), + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + ], + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Row( + children: [ + Texts( + TranslationBase.of(context).expiryDate, + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + Texts( + DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[index].expiryDate).toString(), + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + ], + ), + Divider( + color: Colors.black, + height: 55.0, + thickness: 1.2, + ), + IntrinsicHeight( + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Column( + children: [ + Text(TranslationBase.of( + context) + .procedureName), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .procedureName, + style: TextStyle( + fontWeight: + FontWeight.w600, + fontSize: 15.5), + ), + ), + ], + ), + ), + VerticalDivider( + width: 10.0, + thickness: 1.2, + color: Colors.black, + ), + Expanded( + flex: 1, + child: Column( + children: [ + Text(TranslationBase.of( + context) + .procedureStatus), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .status, + style: TextStyle( + fontSize: 17.5, + fontWeight: + FontWeight + .w600), + ), + ), + ], + ), + ), + VerticalDivider( + width: 2.3, + thickness: 1.2, + color: Colors.black, + ), + Expanded( + flex: 1, + child: Column( + children: [ + Text(TranslationBase.of( + context) + .usageStatus), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .isInvoicedDesc, + style: TextStyle( + fontWeight: + FontWeight.w600, + fontSize: 17.5), + ), + ), + ], + ), + ), + ], + ), + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + ], + ), + ), + ], + ), + ], + ), + )), + ], + ), + ), + ), + ), + ); + } + + convertDateFormat(String Date) { + const start = "/Date("; + const end = "+0300)"; + + final startIndex = Date.indexOf(start); + final endIndex = Date.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(Date.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "-" + + date.month.toString().padLeft(2, '0') + + "-" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } +} diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 204d2336..0ae5452b 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -1,7 +1,6 @@ -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -15,7 +14,6 @@ import 'package:provider/provider.dart'; import '../../config/config.dart'; import '../../config/size_config.dart'; import '../../lookups/patient_lookup.dart'; -import '../../models/doctor/doctor_profile_model.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../widgets/shared/app_buttons_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; @@ -39,11 +37,18 @@ class _PatientSearchScreenState extends State { String _selectedType = '1'; String _selectedLocation = '1'; String error = ''; - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; String itemText = ''; String itemText2 = ''; final GlobalKey _formKey = GlobalKey(); bool _autoValidate = false; + bool onlyArrived = true; + bool isView = false; + bool isFormSubmitted = false; + + FocusNode _nodeText1 = FocusNode(); + FocusNode _nodeText2 = FocusNode(); + FocusNode _nodeText3 = FocusNode(); var _patientSearchFormValues = PatientModel( FirstName: "0", @@ -65,47 +70,39 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { -//print("============== _selectedType============"+ _selectedType); + setState(() { + isFormSubmitted = true; + }); try { - //==================== - //_selectedType=='3'? - //===================== - - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); if (_formKey.currentState.validate()) { _formKey.currentState.save(); - sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); - print('************_selectedType*************'); - print('_selectedType${_selectedType}'); - String token = await sharedPref.getString(TOKEN); - - _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 - _patientSearchFormValues.DoctorID = doctorProfile.doctorID; - _patientSearchFormValues.ClinicID = doctorProfile.clinicID; - //===================== - // _patientSearchFormValues. - //===================== - - print("=============doctorProfile.clinicID=" + - doctorProfile.clinicID.toString()); - - Navigator.of(context).pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": _selectedType - }); + if ((_patientSearchFormValues.From == "0" || + _patientSearchFormValues.To == "0") && + _selectedType == "7" || + ((_patientSearchFormValues.From == "0" || + _patientSearchFormValues.To == "0") && + _selectedType == "6")) { + // helpers.showErrorToast("Please Choose The Dates"); + } else { + setState(() { + isFormSubmitted = false; + }); + Navigator.of(context).pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": _selectedType, + "isSearch": true, + "isView": isView + }); + } } else { setState(() { _autoValidate = true; }); } } catch (err) { - error = err; - // handelCatchErrorCase(err); + error = err.toString(); } } @@ -120,8 +117,13 @@ class _PatientSearchScreenState extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - return AppScaffold( + return GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( appBarTitle: TranslationBase.of(context).searchPatient, + isShowAppBar: false, body: ListView( children: [ RoundedContainer( @@ -129,32 +131,32 @@ class _PatientSearchScreenState extends State { children: [ Column( children: [ - Container( - child: Icon( - DoctorApp.search_patient, - size: 100, - color: Colors.black, - ), - margin: EdgeInsets.only(top: 10), - ), - Padding( - padding: const EdgeInsets.only(top: 12.0), - child: AppText( - TranslationBase.of(context) - .searchPatientImageCaptionTitle - .toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: SizeConfig.heightMultiplier * 2.5, - ), - ), - Padding( - padding: const EdgeInsets.only(top: 5.0), - child: AppText( - TranslationBase.of(context) - .searchPatientImageCaptionBody, - fontSize: SizeConfig.heightMultiplier * 2, - ), - ) + // Container( + // child: Icon( + // DoctorApp.search_patient_1, + // size: 100, + // color: Colors.black, + // ), + // margin: EdgeInsets.only(top: 10), + // ), + // Padding( + // padding: const EdgeInsets.only(top: 12.0), + // child: AppText( + // TranslationBase.of(context) + // .searchPatientImageCaptionTitle + // .toUpperCase(), + // fontWeight: FontWeight.bold, + // fontSize: SizeConfig.heightMultiplier * 2.5, + // ), + // ), + // Padding( + // padding: const EdgeInsets.only(top: 5.0), + // child: AppText( + // TranslationBase.of(context) + // .searchPatientImageCaptionBody, + // fontSize: SizeConfig.heightMultiplier * 2, + // ), + // ) ], ), Container( @@ -167,386 +169,416 @@ class _PatientSearchScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 5, - ), - Container( - height: 40.0, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1.0, - style: BorderStyle.solid, - color: HexColor("#CCCCCC")), - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - ), - ), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: _selectedType, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return PATIENT_TYPE.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text_ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (String newValue) => { - setState(() { - _selectedType = newValue; - selectedPatientType = - int.parse(_selectedType); - }) - }, - items: PATIENT_TYPE.map((item) { - !projectsProvider.isArabic - ? itemText = item['text'] - : itemText = item['text_ar']; - return DropdownMenuItem( - child: Text( - itemText, - textAlign: TextAlign.end, - ), - value: item['val'], - ); - }).toList(), - )), - ), - ], - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( - labelText: - TranslationBase.of(context).firstName, - borderColor: Colors.white, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setFirstName = - "0" - : _patientSearchFormValues.setFirstName = - value; - - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setFirstName = "0"; - } - }, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_LETTERS), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( - labelText: - TranslationBase.of(context).middleName, - borderColor: Colors.white, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setMiddleName = - "0" - : _patientSearchFormValues.setMiddleName = - value; - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setMiddleName = - "0"; - } - }, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_LETTERS), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( - labelText: TranslationBase.of(context).lastName, - borderColor: Colors.white, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setLastName = - "0" - : _patientSearchFormValues.setLastName = - value; - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setLastName = "0"; - } - }, - inputFormatter: ONLY_LETTERS), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( - labelText: - TranslationBase.of(context).phoneNumber, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - onSaved: (value) { - value == null - ? _patientSearchFormValues - .setPatientMobileNumber = "0" - : _patientSearchFormValues - .setPatientMobileNumber = value; - - if (value.toString().trim().isEmpty) { - _patientSearchFormValues - .setPatientMobileNumber = "0"; - } - }, - ), - ), - SizedBox( - height: 10, + height: 15, ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( + if (_selectedType != '7') + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( labelText: TranslationBase.of(context).patientID, borderColor: Colors.white, textInputType: TextInputType.number, + textInputAction: TextInputAction.done, inputFormatter: ONLY_NUMBERS, + focusNode: _nodeText1, onSaved: (value) { - value == null + value == null || value == '' ? _patientSearchFormValues.setPatientID = 0 : _patientSearchFormValues.setPatientID = int.parse(value); - if (value.toString().trim().isEmpty) { + + if (value != null && + value.toString().trim().isEmpty) { _patientSearchFormValues.setPatientID = 0; } - }), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.only(top: 5), - child: AppTextFormField( - labelText: - TranslationBase.of(context).patientFile, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - onSaved: (value) {}, + }, + ), ), - ), - (!(_selectedType == '2' || _selectedType == '4')) - ? DynamicElements(_patientSearchFormValues) - : SizedBox( - height: 0, - ), SizedBox( height: 10, ), - Container( - height: 40.0, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1.0, - style: BorderStyle.solid, - color: HexColor("#CCCCCC")), - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - ), - ), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: _selectedLocation, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return LOCATIONS.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text-ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - ], - ); - }).toList(); - }, - onChanged: (String newValue) => { - setState(() { - _selectedLocation = newValue; - }) - }, - items: LOCATIONS.map((item) { - !projectsProvider.isArabic - ? itemText2 = item['text'] - : itemText2 = item['text-ar']; - return DropdownMenuItem( - child: Text( - itemText2, - textAlign: TextAlign.end, + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: this.isView == false + ? AppText( + TranslationBase.of(context) + .searchWithOther, + color: Colors.red, + fontWeight: FontWeight.bold, + ) + : AppText( + TranslationBase.of(context) + .hideOtherCriteria, + color: Colors.red, + fontWeight: FontWeight.bold), + onTap: () { + setState(() { + this.isView = !this.isView; + }); + }, + ) + ], + ), + isView == true + ? Column(children: [ + SizedBox( + height: 10, + ), + Container( + height: 65.0, + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1.0, + style: BorderStyle.solid, + color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + ), + ), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: DropdownButton( + isExpanded: true, + value: _selectedType, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return PATIENT_TYPE_Des.map( + (item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + !projectsProvider.isArabic + ? AppText( + item['text'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ) + : AppText( + item['text_ar'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (String newValue) => { + setState(() { + _selectedType = newValue; + selectedPatientType = + int.parse(_selectedType); + }) + }, + items: + PATIENT_TYPE_Des.map((item) { + !projectsProvider.isArabic + ? itemText = item['text'] + : itemText = + item['text_ar']; + return DropdownMenuItem( + child: Text( + itemText, + textAlign: TextAlign.end, + ), + value: item['val'], + ); + }).toList(), + )), ), - value: item['val'], - ); - }).toList(), - )), + ], + ), + ), ), - ], - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - height: 25, - width: 25, - child: Checkbox( - value: true, - checkColor: HexColor("#2A930A"), - activeColor: Colors.white, - onChanged: (bool newValue) {}), - ), - SizedBox( - width: 12, + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .firstName, + borderColor: Colors.white, + onSaved: (value) { + value == null || value == '' + ? _patientSearchFormValues + .setFirstName = "0" + : _patientSearchFormValues + .setFirstName = value; + + if (value != null && + value.toString().trim().isEmpty) { + _patientSearchFormValues + .setFirstName = "0"; + } + }, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_LETTERS), + ), + SizedBox( + height: 10, + ), + if (_selectedType != '7') + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .phoneNumber, + borderColor: Colors.white, + textInputType: TextInputType.number, + textInputAction: TextInputAction.done, + inputFormatter: ONLY_NUMBERS, + focusNode: _nodeText1, + onSaved: (value) { + value == null || value == '' + ? _patientSearchFormValues + .setPatientMobileNumber = "0" + : _patientSearchFormValues + .setPatientMobileNumber = + value; + + if (value != null && + value.toString().trim().isEmpty) { + _patientSearchFormValues + .setPatientMobileNumber = "0"; + } + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .middleName, + borderColor: Colors.white, + onSaved: (value) { + value == null || value == '' + ? _patientSearchFormValues + .setMiddleName = "0" + : _patientSearchFormValues + .setMiddleName = value; + if (value != null && + value.toString().trim().isEmpty) { + _patientSearchFormValues + .setMiddleName = "0"; + } + }, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_LETTERS), + ), + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .lastName, + borderColor: Colors.white, + onSaved: (value) { + value == null || value == '' + ? _patientSearchFormValues + .setLastName = "0" + : _patientSearchFormValues + .setLastName = value; + if (value != null && + value.toString().trim().isEmpty) { + _patientSearchFormValues + .setLastName = "0"; + } + }, + inputFormatter: ONLY_LETTERS), + ), + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .patientID, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + focusNode: _nodeText2, + onSaved: (value) { + value == null || value == '' + ? _patientSearchFormValues + .setPatientID = 0 + : _patientSearchFormValues + .setPatientID = + int.parse(value); + if (value != null && + value.trim().toString().isEmpty) { + _patientSearchFormValues + .setPatientID = 0; + } + }), + ), + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + labelText: TranslationBase.of(context) + .patientFile, + borderColor: Colors.white, + textInputType: TextInputType.number, + focusNode: _nodeText3, + inputFormatter: ONLY_NUMBERS, + onSaved: (value) {}, + ), + ), + (!(_selectedType == '2' || + _selectedType == '4')) + ? DynamicElements( + _patientSearchFormValues, + isFormSubmitted) + : SizedBox( + height: 0, + ), + SizedBox( + height: 10, + ), + Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + height: 25, + width: 25, + child: Checkbox( + value: onlyArrived, + checkColor: HexColor("#2A930A"), + activeColor: Colors.white, + onChanged: (bool newValue) { + setState(() { + onlyArrived = newValue; + }); + }), + ), + SizedBox( + width: 12, + ), + AppText( + TranslationBase.of(context) + .onlyArrivedPatient, + fontSize: + SizeConfig.textMultiplier * 2), + ])), + SizedBox( + height: 10, + ), + ]) + : SizedBox( + height: SizeConfig.screenHeight * .45, ), - AppText( - TranslationBase.of(context) - .onlyArrivedPatient, - fontSize: SizeConfig.textMultiplier * 2), - ])), - SizedBox( - height: 10, - ), ], ), ), - ) + ), ], ), ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).search, - onPressed: () { - _validateInputs(); - }, + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).search, + onPressed: () { + _validateInputs(); + }, + ), + ], ), - ], - ), - ) + ), + ], + ), ], - )); + ), + ), + ); } } diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart index 70a84f03..df1427c2 100644 --- a/lib/screens/patients/patients_referred_screen.dart +++ b/lib/screens/patients/patients_referred_screen.dart @@ -46,6 +46,7 @@ class _PatientReferredScreenState extends State { Listlist=List(); return AppScaffold( + //TODO : add Translation appBarTitle: "My Referred Patients",//patientTypetitle, body: Center( diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 4ca3e587..286f206d 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,33 +1,47 @@ -/* - *@author: Amjad Amireh Merge to Elham rababah - *@Date:27/4/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ - import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/patients/clinic_list_dropdwon.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; class PatientsScreen extends StatefulWidget { + final patientSearchForm; + final selectedType; + final isAppbar; + final arrivalType; + final isView; + PatientsScreen( + {this.patientSearchForm, + this.selectedType, + this.isAppbar = true, + this.arrivalType, + this.isView}); @override _PatientsScreenState createState() => _PatientsScreenState(); } @@ -40,6 +54,9 @@ class _PatientsScreenState extends State { List date; List unFilterDate; + int clinicId; + AuthViewModel authProvider; + Color sideColor = Colors.black; List responseModelList; List responseModelList2; @@ -48,33 +65,25 @@ class _PatientsScreenState extends State { final String avatarFemale = 'user_female.svg'; final String assetName = 'assets/image.svg'; - // List _locations = ['Today', 'Old Date', 'YESTERDAY']; List _locations = []; //['All', 'Today', 'Tomorrow', 'Next Week']; int _activeLocation = 0; bool _isInit = true; String patientType; + bool isSearch = false; String patientTypeTitle; var _isLoading = true; - + var selectedFilter = 1; bool _isError = false; String error = ""; - ProjectProvider projectsProvider; - + String arrivalType; + ProjectViewModel projectsProvider; + var isView; final _controller = TextEditingController(); PatientModel patient; -/* - *@author: Amjad Amireh - *@Date:2/5/2020 - *@param: - *@return:PatientsScreen Search textbox filter - - *@desc: - */ - searchData(String str) { this.responseModelList = this.responseModelList2; var strExist = str.length > 0 ? true : false; @@ -84,8 +93,13 @@ class _PatientsScreenState extends State { for (var i = 0; i < responseModelList2.length; i++) { String firstName = responseModelList[i].firstName.toUpperCase(); String lastName = responseModelList[i].lastName.toUpperCase(); + String mobile = responseModelList[i].mobileNumber.toUpperCase(); + String patientID = responseModelList[i].patientId.toString(); + if (firstName.contains(str.toUpperCase()) || - lastName.contains(str.toUpperCase())) { + lastName.contains(str.toUpperCase()) || + mobile.contains(str) || + patientID.contains(str)) { filterData.add(responseModelList[i]); } } @@ -100,14 +114,6 @@ class _PatientsScreenState extends State { } } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date with time - - *@desc: - */ convertDate(String str) { String timeConvert; const start = "/Date("; @@ -136,14 +142,6 @@ class _PatientsScreenState extends State { return newDateformat.toString(); } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date - - *@desc: - */ convertDateFormat(String str) { String timeConvert; const start = "/Date("; @@ -163,25 +161,6 @@ class _PatientsScreenState extends State { return newDate.toString(); } - convertDateFormat2(String str) { - String timeConvert; - const start = "/Date("; - const end = "+0300)"; - - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - - return newDate.toString(); - } - filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -235,39 +214,35 @@ class _PatientsScreenState extends State { return TranslationBase.of(context).all; } -/* - *@author: Amjad Amireh Modified New design - *@Date:21/5/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ @override Widget build(BuildContext context) { + authProvider = Provider.of(context); _locations = [ - TranslationBase - .of(context) - .all, - TranslationBase - .of(context) - .today, - TranslationBase - .of(context) - .tomorrow, - TranslationBase - .of(context) - .nextWeek, + TranslationBase.of(context).all, + TranslationBase.of(context).today, + TranslationBase.of(context).tomorrow, + TranslationBase.of(context).nextWeek, ]; projectsProvider = Provider.of(context); - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; - - patient = routeArgs['patientSearchForm']; - - patientType = routeArgs['selectedType']; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + + patient = widget.patientSearchForm != null + ? widget.patientSearchForm + : routeArgs['patientSearchForm']; + + patientType = widget.selectedType != null + ? widget.selectedType + : routeArgs['selectedType']; + arrivalType = widget.arrivalType != null + ? widget.arrivalType + : routeArgs['arrivalType']; + if (routeArgs != null && routeArgs.containsKey("isSearch")) { + isSearch = routeArgs['isSearch']; + } + if (routeArgs != null && routeArgs.containsKey("isSearch")) { + isView = routeArgs['isView']; + patient.Searchtype = 1; + } if (!projectsProvider.isArabic) patientTypeTitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; @@ -277,425 +252,436 @@ class _PatientsScreenState extends State { return BaseView( onModelReady: (model) { // TODO : change all the logic here to make it work with the model and remove future - model.getPatientList(patient, patientType).then((res) { + int val2 = int.parse(patientType); + GetPatientArrivalListRequestModel getPatientArrivalListRequestModel; + if (val2 == 7) { + getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel( + from: patient.From, + to: patient.To, + pageIndex: 0, + pageSize: 0, + patientMRN: patient.getPatientID); + } + + model + .getPatientList( + val2 == 7 + ? getPatientArrivalListRequestModel.toJson() + : patient, + patientType, + isView: isView) + .then((res) { setState(() { - _isLoading = false; - if (res['MessageStatus'] == 1) { - int val2 = int.parse(patientType); - lItems = res[SERVICES_PATIANT2[val2]]; + if (res != null && res['MessageStatus'] == 1) { + if (val2 == 7) { + if (res[SERVICES_PATIANT2[val2]] == null) { + _isError = true; + _isLoading = false; + this.error = error.toString(); + } else { + var localList = []; + if (res["patientArrivalList"]["entityList"] == null) { + res["patientArrivalList"]["entityList"] = []; + } + res["patientArrivalList"]["entityList"].forEach((v) { + Map mergedPatient = { + ...v, + ...v["patientDetails"] + }; + localList.add(mergedPatient); + }); + lItems = localList; + } + } else { + if (isView == false && val2 == 1) { + lItems = res['GetPatientFileInformation_PRMList']; + } else { + lItems = res[SERVICES_PATIANT2[val2]]; + } + } parsed = lItems; responseModelList = new ModelResponse.fromJson(parsed).list; + //if (val2 == 7) { + responseModelList.sort((a, b) { + if (b.startTime != null && b.startTime != null) { + try { + DateTime now = DateTime.now(); + DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm"); + String formattedDate = + DateFormat('yyyy-MM-dd ' + a.startTime).format(now); + DateTime dateTimeA = dateFormat.parse(formattedDate); + String formattedDateB = + DateFormat('yyyy-MM-dd ' + b.startTime).format(now); + DateTime dateTimeB = dateFormat.parse(formattedDateB); + var adate = dateTimeA; //a.startTime; + var bdate = dateTimeB; + return adate.compareTo(bdate); + } on Exception catch (_) { + print('never reached'); + var adate = a.startTime; //a.startTime; + var bdate = b.startTime; + return adate.compareTo(bdate); + } + } else { + var adate = convertDateFormat(a.appointmentDate); + var bdate = convertDateFormat(b.appointmentDate); + return bdate.compareTo(adate); + } + }); + //} responseModelList2 = responseModelList; _isError = false; } else { _isError = true; - error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + error = model.error ?? + res['ErrorEndUserMessage'] ?? + res['ErrorMessage']; } + + _isLoading = false; }); }).catchError((error) { setState(() { _isError = true; _isLoading = false; - this.error = error; + this.error = error.toString(); }); }); }, - builder: (_, model, w) => - AppScaffold( - appBarTitle: patientTypeTitle, - body: _isLoading - ? DrAppCircularProgressIndeicator() - : _isError + builder: (_, model, w) => AppScaffold( + appBarTitle: patientTypeTitle, + isShowAppBar: widget.isAppbar, + isLoading: _isLoading, + body: _isLoading + ? Container() + : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .youDontHaveAnyPatient) - : Container( - child: ListView( - scrollDirection: Axis.vertical, - children: [ + ? Column( + children: [ + if (int.parse(patientType) == 7) + Container( + margin: EdgeInsets.only(top: 10), + child: ClinicList( + clinicId: clinicId, + onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + }, + ), + ), Container( - child: lItems == null - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Center( - child: Padding( - padding: const EdgeInsets.fromLTRB( - 0, 0, 0, 0), //250 - child: - DrAppCircularProgressIndeicator(), - )), - ), - ], - ) - : Column( - children: [ - Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context) - .size - .height * - 0.03), - child: SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient" - ? _locationBar(context) - : Container(), - ), - SizedBox(height: 18.5), - Container( - width: SizeConfig.screenWidth * 0.9, - height: SizeConfig.screenHeight * 0.05, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, - TranslationBase.of(context) - .searchPatient), + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.height * 0.35), + child: DrAppEmbeddedError( + error: TranslationBase.of(context) + .youDontHaveAnyPatient), + ), + ], + ) + : Container( + color: Colors.grey[200], + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: lItems == null + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Center( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 0, 0, 0, 0), //250 + child: + DrAppCircularProgressIndeicator(), + )), + ), + ], + ) + : Column( + children: [ + SizedBox(height: 18.5), + Container( + width: SizeConfig.screenWidth * 0.9, + height: + SizeConfig.screenHeight * 0.08, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: buildInputDecoration( + context, + TranslationBase.of(context) + .searchPatientName), + ), ), - ), - SizedBox( - height: 10.0, - ), - Divider( - thickness: 0.8, - color: Color(0xffCCCCCC), - ), - Container( - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: - BorderRadius.circular(20)), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - child: (responseModelList.length > 0) - ? Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: responseModelList.map( - (PatiantInformtion item) { - return Container( - decoration: - myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Padding( - padding: EdgeInsets - .only( - left: - 12.0), - child: - Container( - decoration: - BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO( - 0, - 0, - 0, - 0.08), - offset: Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular(35.0)), - color: Color( - 0xffCCCCCC), - ), - width: 70, - height: 70, - child: Icon( - item.genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 70, - color: Colors - .white, - ), - ), - ), - ], - ), - - SizedBox( - width: 10, - ), - - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Column( - children: [ - SizedBox( - height: - 10.0, - ), - Padding( - padding: EdgeInsets.symmetric( - vertical: - 5.5, - horizontal: - 22.5), - child: - AppText( - item.firstName + - " " + - item.lastName, - fontSize: - 2.0 * - SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Wrap( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.patientId.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - AppText( - 'NATIONALITY: ' + - item.nationalityName.toString(), - fontSize: - 1.8 * SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: - 15.5, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ) - : SizedBox( - height: 5, - ), - ], - ), - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).age2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.age.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], - ), - ], - ), - ], - ), - ), - // Divider(color: Colors.grey) - ], - ), + SizedBox( + height: 10.0, + ), + if (int.parse(patientType) == 7) + Container( + padding: EdgeInsets.all(5), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular( + 10)), + child: ClinicList( + clinicId: clinicId, + onClinicChange: (newValue) { + clinicId = newValue; + changeClinic( + newValue, context, model); + }, + )), + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context) + .size + .height * + 0.03), + child: SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient" + ? _locationBar(context) + : Container(), + ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceEvenly, + // children: [ + // AppButton( + // title: TranslationBase.of(context) + // .all, + // onPressed: () { + // setState(() { + // selectedFilter = 1; + // filterPatients(); + // }); + // }, + // color: selectedFilter == 1 + // ? Colors.red[800] + // : Colors.grey[300], + // fontColor: selectedFilter == 1 + // ? Colors.white + // : Colors.black, + // ), + // AppButton( + // title: TranslationBase.of(context) + // .today, + // onPressed: () { + // setState(() { + // selectedFilter = 2; + // filterPatients(); + // }); + // }, + // color: selectedFilter == 2 + // ? Colors.red[800] + // : Colors.grey[300], + // fontColor: selectedFilter == 2 + // ? Colors.white + // : Colors.black, + // ), + // AppButton( + // title: TranslationBase.of(context) + // .tomorrow, + // onPressed: () { + // setState(() { + // selectedFilter = 3; + // filterPatients(); + // }); + // }, + // color: selectedFilter == 3 + // ? Colors.red[800] + // : Colors.grey[300], + // fontColor: selectedFilter == 3 + // ? Colors.white + // : Colors.black, + // ), + // AppButton( + // title: TranslationBase.of(context) + // .nextWeek, + // onPressed: () { + // setState(() { + // selectedFilter = 4; + // // filterPatients(); + // }); + // }, + // color: selectedFilter == 4 + // ? Colors.red[800] + // : Colors.grey[300], + // fontColor: selectedFilter == 4 + // ? Colors.white + // : Colors.black, + // ), + // ], + // ), + SizedBox( + height: 10.0, + ), + // Divider( + // thickness: 0.8, + // color: Color(0xffCCCCCC), + // ), + Container( + // decoration: BoxDecoration( + // color: Color(0Xffffffff), + // borderRadius: + // BorderRadius.circular(20)), + child: (responseModelList.length > 0) + ? Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: responseModelList + .map((PatiantInformtion + item) { + return PatientCard( + patientInfo: item, + patientType: patientType, + arrivalType: arrivalType, onTap: () { Navigator.of(context) .pushNamed( PATIENTS_PROFILE, arguments: { - "patient": item + "patient": item, + "patientType": + patientType, + "from": patient + .getFrom, + "to": + patient.getTo, + "isSearch": + isSearch, + "arrivalType": + arrivalType, }); }, - ), - ); - }).toList(), - ) - : Center( - child: DrAppEmbeddedError( - error: TranslationBase.of( - context) - .youDontHaveAnyPatient), + ); + }).toList(), + ) + : Center( + child: DrAppEmbeddedError( + error: TranslationBase.of( + context) + .youDontHaveAnyPatient), + ), ), - ), - ], - ), - ) - ], - ), - ), - ),); + ], + ), + ) + ], + ), + ), + ), + ); + } + + changeClinic(clinicId, BuildContext context, model) async { + GifLoaderDialogUtils.showMyDialog(context); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: doctorProfile.doctorID, + clinicID: clinicId, + license: true, + projectID: doctorProfile.projectID, + tokenID: '', + languageID: 2); + + authProvider + .getDocProfiles(docInfo.toJson(), allowChangeProfile: false) + .then((profileList) async { + print(profileList['DoctorProfileList'][0]); + int val2 = int.parse(patientType); + + GetPatientArrivalListRequestModel getPatientArrivalListRequestModel = + GetPatientArrivalListRequestModel( + from: patient.From, + to: patient.To, + clinicID: profileList['DoctorProfileList'][0]['ClinicID'], + doctorID: + profileList['DoctorProfileList'][0]['DoctorID'].toString(), + patientMRN: patient.getPatientID, + pageIndex: 0, + pageSize: 0); + + model + .getPatientList( + getPatientArrivalListRequestModel.toJson(), patientType) + .then((res) { + setState(() { + if (res != null && res['MessageStatus'] == 1) { + if (val2 == 7) { + if (res[SERVICES_PATIANT2[val2]] == null) { + _isError = true; + _isLoading = false; + this.error = error.toString(); + } else { + var localList = []; + if (res["patientArrivalList"]["entityList"] == null) { + res["patientArrivalList"]["entityList"] = []; + } + res["patientArrivalList"]["entityList"].forEach((v) { + Map mergedPatient = { + ...v, + ...v["patientDetails"] + }; + localList.add(mergedPatient); + }); + lItems = localList; + } + } + parsed = lItems; + responseModelList = new ModelResponse.fromJson(parsed).list; + responseModelList.sort((a, b) { + DateTime now = DateTime.now(); + DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm"); + String formattedDate = + DateFormat('yyyy-MM-dd ' + a.startTime).format(now); + DateTime dateTimeA = dateFormat.parse(formattedDate); + String formattedDateB = + DateFormat('yyyy-MM-dd ' + b.startTime).format(now); + DateTime dateTimeB = dateFormat.parse(formattedDateB); + var adate = dateTimeA; //a.startTime; + var bdate = dateTimeB; + return adate.compareTo(bdate); + }); + responseModelList2 = responseModelList; + _isError = false; + } else { + _isError = true; + error = model.error ?? + res['ErrorEndUserMessage'] ?? + res['ErrorMessage']; + } + + _isLoading = false; + }); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((error) { + helpers.showErrorToast(error.toString()); + GifLoaderDialogUtils.hideDialog(context); + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + helpers.showErrorToast(err); + }); } InputDecoration buildInputDecoration(BuildContext context, hint) { return InputDecoration( - prefixIcon: Icon(Icons.search, color: Colors.grey), + suffixIcon: IconButton( + icon: Icon(DoctorApp.search_patient), + color: Colors.grey, + onPressed: () {}, + iconSize: 30, + ), filled: true, fillColor: Colors.white, hintText: hint, @@ -711,88 +697,71 @@ class _PatientsScreenState extends State { } Widget _locationBar(BuildContext _context) { - return Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.0619, - width: SizeConfig.screenWidth * 0.94, - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: BorderRadius.circular(12.5), - border: Border.all( - width: 0.5, - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _locations.map((item) { - bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.058, - width: SizeConfig.screenWidth * 0.2334, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12.5), - topRight: Radius.circular(12.5), - topLeft: Radius.circular(9.5), - bottomLeft: Radius.circular(9.5)), - color: - _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - - fontWeight: FontWeight.normal, - ), - ), - )), - ), - ), - onTap: () { - - filterBooking(item.toString()); - - setState(() { - _activeLocation = _locations.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10), - topRight: Radius.circular(10)), - color: Colors.white), - alignment: Alignment.center, - height: 1, - width: SizeConfig.screenWidth * 0.23, - ) - : Container() - ]); - }).toList(), - ), + return Container( + height: MediaQuery.of(context).size.height * 0.0619, + width: SizeConfig.screenWidth * 0.94, + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: BorderRadius.circular(12.5), + // border: Border.all( + // width: 0.5, + // ), ), - ); - } - - myBoxDecoration() { - return BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color(0xffCCCCCC), - width: 0.5, - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _locations.map((item) { + bool _isActive = _locations[_activeLocation] == item ? true : false; + return Column(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.058, + width: SizeConfig.screenWidth * 0.2334, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12.5), + topRight: Radius.circular(12.5), + topLeft: Radius.circular(9.5), + bottomLeft: Radius.circular(9.5)), + color: _isActive ? HexColor("#B8382B") : Colors.white, + ), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + + fontWeight: FontWeight.normal, + ), + ), + )), + ), + onTap: () { + filterBooking(item.toString()); + + setState(() { + _activeLocation = _locations.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10), + topRight: Radius.circular(10)), + color: Colors.white), + alignment: Alignment.center, + height: 1, + width: SizeConfig.screenWidth * 0.23, + ) + : Container() + ]); + }).toList(), ), ); } diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart new file mode 100644 index 00000000..f4b26f6a --- /dev/null +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -0,0 +1,570 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../../routes.dart'; + +class UcafDetailScreen extends StatefulWidget { + @override + _UcafDetailScreenState createState() => _UcafDetailScreenState(); +} + +class _UcafDetailScreenState extends State { + int _activeTap = 0; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + onModelReady: (model) async { + model.resetDataInFirst(); + await model.getLanguage(); + await model.getPatientAssessment(patient); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).ucaf, + body: Column( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientHeaderWidgetNoAvatar(patient), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar( + context, model, screenSize, patient), + SizedBox( + height: 16, + ), + ...getSelectedTreatmentStepItem( + context, model), + ], + ), + ), + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: BorderedButton( + TranslationBase.of(context).save, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: HexColor("#B8382B"), + backgroundColor: HexColor("#B8382B"), + textColor: Colors.white, + fontSize: SizeConfig.textMultiplier * 2.0, + handler: () async { + await model.postUCAF(patient); + if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).postUcafSuccessMsg); + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + } else { + DrAppToastMsg.showErrorToast(model.error); + } + }, + ), + ), + Container( + margin: EdgeInsets.only( + left: 16, right: 16, top: 0.0, bottom: 8), + child: BorderedButton( + TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Colors.white, + backgroundColor: Colors.white, + textColor: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.2, + handler: () { + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + }, + ), + ), + ], + ), + )); + } + + Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, + Size screenSize, PatiantInformtion patient) { + List __treatmentSteps = [ + TranslationBase.of(context).diagnosis.toUpperCase(), + TranslationBase.of(context).medications.toUpperCase(), + TranslationBase.of(context).procedures.toUpperCase(), + ]; + return Container( + height: screenSize.height * 0.070, + decoration: Helpers.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC)), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: __treatmentSteps.map((item) { + bool _isActive = __treatmentSteps[_activeTap] == item ? true : false; + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: Helpers.containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () async { + print(__treatmentSteps.indexOf(item)); + if (__treatmentSteps.indexOf(item) == 0) { + await model.getPatientAssessment(patient); + } else if (__treatmentSteps.indexOf(item) == 1) { + await model.getPrescription(patient); + } + if (__treatmentSteps.indexOf(item) == 2) { + await model.getOrderProcedures(patient); + } + setState(() { + _activeTap = __treatmentSteps.indexOf(item); + }); + }, + ), + ); + }).toList(), + ), + ); + } + + List getSelectedTreatmentStepItem( + BuildContext _context, UcafViewModel model) { + switch (_activeTap) { + case 0: + if (model.patientAssessmentList != null) { + return [ + ...List.generate( + model.patientAssessmentList.length, + (index) => DiagnosisWidget( + model, model.patientAssessmentList[index])).toList() + ]; + } else { + return [ + Container(), + ]; + } + break; + case 1: + return [ + ...List.generate( + model.prescriptionList != null + ? model.prescriptionList.entityList.length + : 0, + (index) => MedicationWidget( + model, model.prescriptionList.entityList[index])).toList() + ]; + break; + case 2: + if (model.orderProcedures != null) { + return [ + ...List.generate( + model.orderProcedures.length, + (index) => + ProceduresWidget(model, model.orderProcedures[index])) + .toList() + ]; + } else { + return [ + Container(), + ]; + } + break; + default: + return [ + Container(), + ]; + } + } +} + +class DiagnosisWidget extends StatelessWidget { + final UcafViewModel model; + final GetAssessmentResModel diagnosis; + + DiagnosisWidget(this.model, this.diagnosis); + + @override + Widget build(BuildContext context) { + MasterKeyModel diagnosisType = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisType, + id: diagnosis.diagnosisTypeID); + MasterKeyModel diagnosisCondition = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisCondition, + id: diagnosis.conditionID); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).diagnoseType}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + diagnosisType != null + ? model.selectedLanguage == 'ar' + ? diagnosisType.nameAr + : diagnosisType.nameEn + : "-", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + diagnosis.asciiDesc, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).icd}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${diagnosis.icdCode10ID}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} + +class MedicationWidget extends StatelessWidget { + final UcafViewModel model; + final EntityList prescription; + + MedicationWidget(this.model, this.prescription); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).id}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${prescription.medicineCode}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).price}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${prescription.medicationPrice}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${prescription.quantity}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).durDays}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${prescription.doseDurationDays}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "${prescription.medicationName}", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "${prescription.doseDetail}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} + +class ProceduresWidget extends StatelessWidget { + final UcafViewModel model; + final OrderProcedure procedure; + + ProceduresWidget(this.model, this.procedure); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).codeNo}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + procedure.achiCode, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${procedure.lineItemNo}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + procedure.procedureName, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).covered}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${procedure.isCovered}", + fontWeight: FontWeight.normal, + color: procedure.isCovered ? Colors.green : Colors.red, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).approvalRequired}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${procedure.isApprovalRequired}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).uncoveredByDoctor}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${procedure.isUncoveredByDoctor}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart new file mode 100644 index 00000000..d4c1b803 --- /dev/null +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -0,0 +1,403 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../../routes.dart'; +import '../../../QR_reader_screen.dart'; + +class UCAFInputScreen extends StatefulWidget { + @override + _UCAFInputScreenState createState() => _UCAFInputScreenState(); +} + +class _UCAFInputScreenState extends State { + bool _inPatient = false; + bool _emergencyCase = false; + final _durationOfIllnessController = TextEditingController(); + final _additionalComplaintsController = TextEditingController(); + final _otherController = TextEditingController(); + final _howController = TextEditingController(); + final _whenController = TextEditingController(); + final _whereController = TextEditingController(); + final _managementsLineController = TextEditingController(); + final _signsController = TextEditingController(); + List conditionsData = [ + {"name": "CHRONIC", "isChecked": false}, + {"name": "RTA", "isChecked": false}, + {"name": "PSYCHIATRIC", "isChecked": false}, + {"name": "WORK RELATED", "isChecked": false}, + {"name": "VACCINATION", "isChecked": false}, + {"name": "CONGENITAL", "isChecked": false}, + {"name": "INFERTILITY", "isChecked": false}, + {"name": "CHECK-UP", "isChecked": false}, + {"name": "PREGNANCY/INDICATE MP", "isChecked": false}, + {"name": "CLEANING", "isChecked": false}, + {"name": "ORTHO DONTICS", "isChecked": false}, + {"name": "SPORTS RELATED", "isChecked": false}, + {"name": "REGULAR DENTAL TREATMENT", "isChecked": false}, + {"name": "IS TRAUMA TREATMENT SPECIFY ETA", "isChecked": false}, + ]; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + onModelReady: (model) => model.getUCAFData(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).ucaf, + body: model.patientVitalSigns != null && + model.patientChiefComplaintList != null && + model.patientChiefComplaintList.length > 0 + ? SingleChildScrollView( + child: Column( + children: [ + PatientHeaderWidgetNoAvatar(patient), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CheckboxListTile( + title: AppText( + TranslationBase.of(context).inPatient, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _inPatient, + onChanged: (newValue) { + setState(() { + _inPatient = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).emergencyCase, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _emergencyCase, + onChanged: (newValue) { + setState(() { + _emergencyCase = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .durationOfIllness, + null, + false), + enabled: true, + controller: _durationOfIllnessController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "BP (H/L)", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bloodPressureHigher}/${model.patientVitalSigns.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + SizedBox( + width: 4, + ), + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${model.patientVitalSigns.temperatureCelcius}(C), ${(model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32).toStringAsFixed(2)}(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .chiefComplaintsAndSymptoms, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .patientFeelsPainInHisBackAndCough, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .additionalTextComplaints, + helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint), + false), + enabled: false, + controller: _additionalComplaintsController, + keyboardType: TextInputType.multiline, + minLines: 1, + maxLines: 20, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherConditions, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ...List.generate( + conditionsData.length, + (index) => CheckboxListTile( + title: AppText( + conditionsData[index]['name'], + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: conditionsData[index]['isChecked'], + onChanged: (newValue) { + setState(() { + conditionsData[index]['isChecked'] = + newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + )), + SizedBox( + height: 8, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).other, + null, + false), + enabled: true, + controller: _otherController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 8, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).how, + null, + false), + enabled: true, + controller: _howController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 8, + ), + Row( + children: [ + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).when, + null, + false), + enabled: true, + controller: _whenController, + keyboardType: TextInputType.text, + )), + ), + SizedBox( + width: 4, + ), + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).where, + null, + false), + enabled: true, + controller: _whereController, + keyboardType: TextInputType.text, + )), + ), + ], + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .specifyPossibleLineManagement, + null, + false), + enabled: true, + controller: _managementsLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).significantSigns, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).backAbdomen, + null, + false), + enabled: true, + controller: _signsController, + keyboardType: TextInputType.multiline, + minLines: null, + maxLines: null, + )), + SizedBox( + height: 16, + ), + AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_UCAF_DETAIL, + arguments: {'patient': patient}); + }, + ), + ], + ), + ), + ], + ), + ) + : Container( + child: Center( + child: AppText( + model.patientVitalSigns == null + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context).chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart new file mode 100644 index 00000000..23e33db3 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -0,0 +1,307 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestDetailScreen extends StatefulWidget { + @override + _AdmissionRequestDetailScreenState createState() => + _AdmissionRequestDetailScreenState(); +} + +class _AdmissionRequestDetailScreenState + extends State { + DateTime selectedDate; + dynamic _selectedSpeciality; + dynamic _selectedDoctor; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getSpecialityList(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: model.doctorsList != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + decoration: + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + "Pre Admission Number :01", + null, + false), + enabled: false, + // controller: _remarksController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => _selectDate(context, model), + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.speciality, + attributeName: + projectViewModel.isArabic + ? 'nameAr' + : 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedSpeciality = + selectedValue; + }); + }); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .speciality, + _selectedSpeciality != null + ? projectViewModel.isArabic + ? _selectedSpeciality[ + 'nameAr'] + : _selectedSpeciality[ + 'nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: + TranslationBase.of(context) + .doctorSearch, + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + decoration: Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), Color(0xFFCCCCCC), + borderWidth: 0.0), + child: InkWell( + onTap: () => null, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .referringDate, + null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Color(0xFFCCCCCC), + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + decoration: + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .referringDoctor, + null, + true, + dropDownColor: Color(0xFFCCCCCC)), + enabled: false, + // controller: _remarksController, + keyboardType: TextInputType.text, + )), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: {'patient': patient}); + }, + ), + ), + ], + ) + : Container(), + ), + ); + } + + _selectDate(BuildContext context, AdmissionRequestViewModel model) async { + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart new file mode 100644 index 00000000..1cf69da8 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -0,0 +1,520 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestFirstScreen extends StatefulWidget { + @override + _AdmissionRequestThirdScreenState createState() => + _AdmissionRequestThirdScreenState(); +} + +class _AdmissionRequestThirdScreenState + extends State { + final _dietTypeRemarksController = TextEditingController(); + final _sickLeaveCommentsController = TextEditingController(); + final _postMedicalHistoryController = TextEditingController(); + final _postSurgicalHistoryController = TextEditingController(); + + dynamic _selectedClinic; + dynamic _selectedDoctor; + dynamic _selectedDietType; + + bool _isSickLeaveRequired = false; + bool _patientPregnant = false; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: (){ + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + ), + AppText( + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.070, + hintText: "test field", + isDropDown: true, + controller: _sickLeaveCommentsController, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.clinicList != null && + model.clinicList.length > 0 + ? () { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getClinics().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.clinicList.length > 0) { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .clinic, + _selectedClinic != null + ? _selectedClinic[ + 'clinicGroupName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null + ? model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils + .showMyDialog(context); + await model + .getClinicDoctors( + _selectedClinic[ + 'clinicID']) + .then((_) => + GifLoaderDialogUtils + .hideDialog( + context)); + if (model.state == + ViewState.Idle && + model.doctorsList.length > + 0) { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + } + : null, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).patientPregnant, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _patientPregnant, + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .isSickLeaveRequired, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _isSickLeaveRequired, + onChanged: (newValue) { + setState(() { + _isSickLeaveRequired = newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .sickLeaveComments, + null, + false), + enabled: true, + controller: _sickLeaveCommentsController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.dietTypesList != null && + model.dietTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDietTypes().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.dietTypesList.length > + 0) { + openListDialogField('nameEn', + 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietType, + _selectedDietType != null + ? _selectedDietType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietTypeRemarks, + null, + false), + enabled: true, + controller: _dietTypeRemarksController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .pastMedicalHistory, + null, + false), + enabled: true, + controller: _postMedicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .pastSurgicalHistory, + null, + false), + enabled: true, + controller: _postSurgicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + model.admissionRequestData = AdmissionRequest(); + if (_selectedClinic != null && + _selectedDoctor != null && + _sickLeaveCommentsController.text != "" && + _postMedicalHistoryController.text != "" && + _postSurgicalHistoryController.text != "") { + model.admissionRequestData.patientMRN = + patient.patientMRN; + model.admissionRequestData.appointmentNo = + patient.appointmentNo; + model.admissionRequestData.episodeID = + patient.episodeNo; + model.admissionRequestData.admissionRequestNo = 0; + + model.admissionRequestData.admitToClinic = + _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = + _selectedDoctor['DoctorID']; + + model.admissionRequestData.isPregnant = + _patientPregnant; + model.admissionRequestData.isSickLeaveRequired = + _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = + _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = + _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = + _selectedDietType != null + ? _selectedDietType['id'] + : 0; + model.admissionRequestData.dietRemarks = + _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = + _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = + _postSurgicalHistoryController.text; + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + ), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart new file mode 100644 index 00000000..342d2e72 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -0,0 +1,448 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestThirdScreen extends StatefulWidget { + @override + _AdmissionRequestThirdScreenState createState() => + _AdmissionRequestThirdScreenState(); +} + +class _AdmissionRequestThirdScreenState + extends State { + final _treatmentLineController = TextEditingController(); + final _complicationsController = TextEditingController(); + final _otherProceduresController = TextEditingController(); + + dynamic _selectedAdmissionType; + dynamic _selectedDiagnosis; + dynamic _selectedIcd; + dynamic _selectedDiagnosisType; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + AdmissionRequest admissionRequest = routeArgs['admission-data']; + + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).treatmentLine, + null, + false), + enabled: true, + controller: _treatmentLineController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).complications, + null, + false), + enabled: true, + controller: _complicationsController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).otherProcedure, + null, + false), + enabled: true, + controller: _otherProceduresController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.admissionTypeList != null && + model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > 0) { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).admissionType, + _selectedAdmissionType != null + ? _selectedAdmissionType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).diagnosisDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.diagnosisTypesList != null && + model.diagnosisTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDiagnosis().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.diagnosisTypesList.length > 0) { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnosis, + _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.icdCodes != null && + model.icdCodes.length > 0 + ? () { + openListDialogField( + 'description', 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getICDCodes(patient.patientMRN) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.icdCodes.length > 0) { + openListDialogField( + 'description', + 'code', + model.icdCodes, (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).icd, + _selectedIcd != null + ? _selectedIcd['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisSelectionTypes != + null && + model.listOfDiagnosisSelectionTypes + .length > + 0 + ? () { + openListDialogField('description', 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .DiagnosisSelectionType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.listOfDiagnosisSelectionTypes + .length > + 0) { + openListDialogField( + 'description', + 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnoseType, + _selectedDiagnosisType != null + ? _selectedDiagnosisType['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ), + ], + ), + )), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () async { + if (_treatmentLineController.text != "" && + _complicationsController.text != "" && + _otherProceduresController.text != "" && + _selectedAdmissionType != null && + _selectedDiagnosis != null && + _selectedIcd != null && + _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; + + model.admissionRequestData.mainLineOfTreatment = + _treatmentLineController.text; + model.admissionRequestData.complications = + _complicationsController.text; + model.admissionRequestData.otherProcedures = + _otherProceduresController.text; + model.admissionRequestData.admissionType = + _selectedAdmissionType['id']; + + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription': _selectedDiagnosis['nameEn'], + 'diagnosisType': _selectedDiagnosis['id'], + 'icdCode': _selectedIcd['code'], + 'icdCodeDescription': _selectedIcd['description'], + 'type': _selectedDiagnosisType['code'], + 'remarks': "", + 'isActive': true, + } + ]; + model.admissionRequestData.admissionRequestDiagnoses = + admissionRequestDiagnoses; + + await model.makeAdmissionRequest(); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).admissionRequestSuccessMsg); + Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + ), + ), + ); + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart new file mode 100644 index 00000000..91885724 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -0,0 +1,476 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestSecondScreen extends StatefulWidget { + @override + _AdmissionRequestSecondScreenState createState() => + _AdmissionRequestSecondScreenState(); +} + +class _AdmissionRequestSecondScreenState + extends State { + final _postPlansEstimatedCostController = TextEditingController(); + final _estimatedCostController = TextEditingController(); + final _expectedDaysController = TextEditingController(); + final _otherDepartmentsInterventionsController = TextEditingController(); + + DateTime _expectedAdmissionDate; + + dynamic _selectedFloor; + dynamic _selectedWard; + dynamic _selectedRoomCategory; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + AdmissionRequest admissionRequest = routeArgs['admission-data']; + + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .postPlansEstimatedCost, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .estimatedCost, + null, + false), + enabled: true, + controller: _estimatedCostController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).postPlans, + null, + false), + enabled: true, + controller: _postPlansEstimatedCostController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .otherDepartmentsInterventions, + null, + false), + enabled: true, + controller: + _otherDepartmentsInterventionsController, + keyboardType: TextInputType.multiline, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context).otherInformation, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedDays, + null, + false), + enabled: true, + controller: _expectedDaysController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; + }); + }); + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.floorList != null && + model.floorList.length > 0 + ? () { + openListDialogField( + 'description', + 'floorID', + model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getFloors().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.floorList.length > 0) { + openListDialogField('description', + 'floorID', model.floorList, + (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).floor, + _selectedFloor != null + ? _selectedFloor['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, + (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).ward, + _selectedWard != null + ? _selectedWard['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.roomCategoryList != null && + model.roomCategoryList.length > 0 + ? () { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getRoomCategories().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.roomCategoryList.length > + 0) { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .roomCategory, + _selectedRoomCategory != null + ? _selectedRoomCategory[ + 'description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () async { + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != "" && + _selectedFloor != null && + _selectedRoomCategory != + null /*_selectedWard is not required*/) { + model.admissionRequestData = admissionRequest; + + model.admissionRequestData.estimatedCost = + int.parse(_estimatedCostController.text); + model.admissionRequestData.elementsForImprovement = + _postPlansEstimatedCostController.text; + + model.admissionRequestData.expectedDays = + int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = + _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData + .otherDepartmentInterventions = + _otherDepartmentsInterventionsController.text; + model.admissionRequestData.admissionLocationID = + _selectedFloor['floorID']; + model.admissionRequestData.wardID = + _selectedWard != null + ? _selectedWard['nursingStationID'] + : 0; + model.admissionRequestData.roomCategoryID = + _selectedRoomCategory['categoryID']; + + model.admissionRequestData.admissionRequestProcedures = + []; + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + )), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/FlowChartPage.dart b/lib/screens/patients/profile/lab_result/FlowChartPage.dart new file mode 100644 index 00000000..772391b0 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/FlowChartPage.dart @@ -0,0 +1,44 @@ +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; + +import 'package:flutter/cupertino.dart'; + +import 'lab_result_chart_and_detials.dart'; + +class FlowChartPage extends StatelessWidget { + final PatientLabOrders patientLabOrder; + final String filterName; + final PatiantInformtion patient; + FlowChartPage({this.patientLabOrder, this.filterName, this.patient}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPatientLabOrdersResults( + patientLabOrder: patientLabOrder, procedure: filterName,patient: patient), + builder: (context, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: filterName, + baseViewModel: model, + body: SingleChildScrollView( + child: model.labOrdersResultsList.isNotEmpty + ? Container( + child: LabResultChartAndDetails( + name: filterName, + labResult: model.labOrdersResultsList, + ), + ) + : Container( + child: Center( + child: Texts('no Data'), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart new file mode 100644 index 00000000..c20a48ae --- /dev/null +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -0,0 +1,192 @@ +import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/FlowChartPage.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + + +class LabResultWidget extends StatelessWidget { + + final List patientLabResultList; + final PatientLabOrders patientLabOrder; + final PatiantInformtion patient; + LabResultWidget({Key key, this.patientLabResultList, this.patientLabOrder, this.patient}) : super(key: key); + ProjectViewModel projectViewModel; + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).description, + color: Colors.black,bold: true, + ), + ), + ), + ), + Expanded( + child: Container( + child: Center( + child: Texts(TranslationBase.of(context).value, color: Colors.black,bold: true,), + ), + ), + ), + Expanded( + child: Container( + child: Center( + child: Texts(TranslationBase.of(context).range, color: Colors.black,bold: true,), + ), + ), + ) + ], + ), + SizedBox(height: 7,), + Divider(color: Colors.black,thickness: 1,), + SizedBox(height: 12,), + ...List.generate(patientLabResultList.length, (index) => Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${patientLabResultList[index].testCode}\n'+ + patientLabResultList[index].description, + textAlign: TextAlign.center, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + patientLabResultList[index].resultValue+" "+patientLabResultList[index].uOM, + textAlign: TextAlign.center, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + patientLabResultList[index].referanceRange, + textAlign: TextAlign.center, + ), + ), + ), + ) + ], + ), + Divider(), + ], + )) + // Table( + // border: TableBorder.symmetric( + // inside: BorderSide(width: 2.0, color: Colors.grey[300],style: BorderStyle.solid), + // ), + // children: fullData(patientLabResultList,context), + // ), + ], + ), + ); + } + List fullData(List labResultList,context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Container( + child: Center( + child: Texts( + TranslationBase.of(context).description, + color: Colors.black,bold: true, + ), + ), + ), + Container( + child: Center( + child: Texts(TranslationBase.of(context).value, color: Colors.black,bold: true,), + ), + ), + Container( + child: Center( + child: Texts(TranslationBase.of(context).range, color: Colors.black,bold: true,), + ), + ), + ], + ), + ); + labResultList.forEach((lab) { + tableRow.add( + TableRow( + children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + lab.description, + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + lab.resultValue+" "+lab.uOM, + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + lab.referanceRange, + textAlign: TextAlign.center, + ), + ), + ), + ), + ], + ), + ); + }); + return tableRow; + } + +} + + diff --git a/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart b/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart new file mode 100644 index 00000000..9da22707 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart @@ -0,0 +1,119 @@ +import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class LabResultDetailsWidget extends StatefulWidget { + final List labResult; + + LabResultDetailsWidget({ + this.labResult, + }); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), + border: Border.all(color: Colors.grey, width: 1), + ), + margin: EdgeInsets.all(20), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add(TableRow(children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), + ), + ), + child: Center( + child: Texts( + TranslationBase.of(context).date, + color: Colors.white, + ), + ), + height: 60, + ), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), + ), + ), + child: Center( + child: Texts(TranslationBase.of(context).labResult, color: Colors.white), + ), + height: 60), + ) + ])); + widget.labResult.forEach((vital) { + var date = DateUtils.convertStringToDate(vital.verifiedOnDateTime); + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${projectViewModel.isArabic? DateUtils.getWeekDayArabic(date.weekday): DateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic? DateUtils.getMonthArabic(date.month) : DateUtils.getMonth(date.month)} ${date.year}', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${vital.resultValue}', + textAlign: TextAlign.center, + ), + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/screens/patients/profile/lab_result/LineChartCurved.dart b/lib/screens/patients/profile/lab_result/LineChartCurved.dart new file mode 100644 index 00000000..f5558a61 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/LineChartCurved.dart @@ -0,0 +1,229 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +import '../../../../core/model/labs/LabOrderResult.dart'; + +class LineChartCurved extends StatefulWidget { + final String title; + final List labResult; + + LineChartCurved({this.title, this.labResult}); + + @override + State createState() => LineChartCurvedState(); +} + +class LineChartCurvedState extends State { + bool isShowingMainData; + List xAxixs = List(); + int indexes = 0; + + @override + void initState() { + super.initState(); + getXaxix(); + isShowingMainData = true; + } + + getXaxix() { + indexes = widget.labResult.length ~/ 3.5; + for (int index = 0; index < widget.labResult.length; index++) { + int mIndex = indexes * index; + if (mIndex < widget.labResult.length) { + xAxixs.add(mIndex); + } + } + } + + @override + Widget build(BuildContext context) { + return AspectRatio( + aspectRatio: 1.23, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Text( + widget.title, + style: TextStyle( + color: Colors.black, + fontSize: 32, + fontWeight: FontWeight.bold, + letterSpacing: 2), + textAlign: TextAlign.center, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 16.0, left: 6.0), + child: LineChart( + sampleData1(), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + LineChartData sampleData1() { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 12, + ), + margin: 22, + rotateAngle:-65, + getTitles: (value) { + print(value); + DateTime date = DateUtils.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime); + if (widget.labResult.length < 8) { + if (widget.labResult.length > value.toInt()) { + return '${date.day}/ ${date.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${date.day}/ ${date.year}'; + if (value.toInt() == widget.labResult.length - 1) + return '${date.day}/ ${date.year}'; + if (xAxixs.contains(value.toInt())) { + return '${date.day}/ ${date.year}'; + } + } + + + + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + return '${value.toInt()}'; + }, + margin: 8, + //reservedSize: 30, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (widget.labResult.length - 1).toDouble(), + maxY: getMaxY(), + minY: getMinY(), + lineBarsData: getData(), + ); + } + + double getMaxY() { + double max = 0; + widget.labResult.forEach((element) { + try{ + double resultValueDouble = double.parse(element.resultValue); + if (resultValueDouble > max) max = resultValueDouble;} + catch(e){ + print(e); + } + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = 0; + try{ + min = double.parse(widget.labResult[0].resultValue); + + widget.labResult.forEach((element) { + double resultValueDouble = double.parse(element.resultValue); + if (resultValueDouble < min) min = resultValueDouble; + });}catch(e){ + print(e); + } + int value = min.toInt(); + + return value.toDouble(); + } + + List getData() { + List spots = List(); + for (int index = 0; index < widget.labResult.length; index++) { + try{ + var resultValueDouble = double.parse(widget.labResult[index].resultValue); + spots.add(FlSpot(index.toDouble(), resultValueDouble)); + }catch(e){ + print(e); + spots.add(FlSpot(index.toDouble(), 0.0)); + + } + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 41f58564..75e4c33b 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -49,7 +49,7 @@ class _LabOrdersScreenState extends State { patientID: patient.patientId, projectID: patient.projectId, tokenID: token, - patientTypeID: patient.patientType, + patientTypeID: patient.patientType??1, languageID: 2); model.getLabResultOrders(labOrdersReqModel.toJson()); @@ -143,6 +143,9 @@ class _LabOrdersScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(model + .patientLabResultOrdersList[index] + .doctorName != null ) AppText( '${model .patientLabResultOrdersList[index] @@ -171,7 +174,7 @@ class _LabOrdersScreenState extends State { MainAxisAlignment.start, children: [ AppText( - ' Invoice No :', + TranslationBase.of(context).invoiceNo, fontSize: 2 * SizeConfig .textMultiplier, @@ -187,6 +190,30 @@ class _LabOrdersScreenState extends State { color: Colors.grey[800], ), ], + ),SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${model + .patientLabResultOrdersList[index] + .orderNo}', + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + ], ) ], ), diff --git a/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart b/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart new file mode 100644 index 00000000..6c4ebf36 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/lab_result_chart_and_detials.dart @@ -0,0 +1,41 @@ + +import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart'; +import 'package:flutter/material.dart'; + +import 'package:charts_flutter/flutter.dart' as charts; + +import 'Lab_Result_details_wideget.dart'; +import 'LineChartCurved.dart'; + + +class LabResultChartAndDetails extends StatelessWidget { + LabResultChartAndDetails({ + Key key, + @required this.labResult, + @required this.name, + }) : super(key: key); + + final List labResult; + final String name; + + + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppExpandableNotifier( + headerWidget: Padding( + padding: const EdgeInsets.all(8.0), + child: LineChartCurved(title: name,labResult:labResult,), + ), + bodyWidget: LabResultDetailsWidget( + labResult: labResult.reversed.toList(), + ), + isExpand: true, + ), + ], + ); + } + +} diff --git a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart index d41f388d..dd8ace01 100644 --- a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart +++ b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart @@ -37,19 +37,39 @@ class _LabResultState extends State { child: ListView( children: [ CardWithBgWidgetNew( - widget: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).invoiceNo, - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + widget: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.orderNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), - AppText( - ' ${widget.labOrders.invoiceNo}', - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).invoiceNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.invoiceNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), + ], ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart new file mode 100644 index 00000000..ddbbcd45 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -0,0 +1,71 @@ +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'laboratory_result_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; + +class LaboratoryResultPage extends StatefulWidget { + final PatientLabOrders patientLabOrders; + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + LaboratoryResultPage({Key key, this.patientLabOrders, this.patient, this.patientType, this.arrivalType}); + + @override + _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); +} + +class _LaboratoryResultPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getLaboratoryResult( + invoiceNo: widget.patientLabOrders.invoiceNo, + clinicID: widget.patientLabOrders.clinicID, + projectID: widget.patientLabOrders.projectID, + orderNo: widget.patientLabOrders.orderNo, + patient: widget.patient), + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // appBarTitle: TranslationBase.of(context).labResults, + baseViewModel: model, + body: Scaffold( + body: SingleChildScrollView( + child: Column( + children: [ + PatientProfileHeaderWhitAppointment(patient: widget.patient, + patientType: widget.patientType??"0", + arrivalType: widget.arrivalType??"0", + orderNo: widget.patientLabOrders.orderNo, + appointmentDate:widget.patientLabOrders.orderDate, + doctorName: widget.patientLabOrders.doctorName, + profileUrl: widget.patientLabOrders.doctorImageURL, + invoiceNO: widget.patientLabOrders.invoiceNo, + ), + ...List.generate(model.patientLabSpecialResult.length, (index) => LaboratoryResultWidget( + onTap: () async { + + }, + billNo: widget.patientLabOrders.invoiceNo, + details: model.patientLabSpecialResult[index].resultDataHTML, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, + patient: widget.patient, + )), + + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart new file mode 100644 index 00000000..a2c8411d --- /dev/null +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -0,0 +1,135 @@ +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/LabResultWidget.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; + +import 'package:provider/provider.dart'; + +class LaboratoryResultWidget extends StatefulWidget { + final GestureTapCallback onTap; + final String billNo; + final String details; + final String orderNo; + final PatientLabOrders patientLabOrder; + final PatiantInformtion patient; + const LaboratoryResultWidget( + {Key key, + this.onTap, + this.billNo, + this.details, + this.orderNo, + this.patientLabOrder, this.patient}) + : super(key: key); + + @override + _LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState(); +} + +class _LaboratoryResultWidgetState extends State { + bool _isShowMoreGeneral = true; + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder,patient: widget.patient), + builder: (_, model, w) => NetworkBaseView( + baseViewModel: model, + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + if (model.labResultLists.isNotEmpty) + Container( + child: Column( + children: [ + InkWell( + onTap: () { + setState( + () { + _isShowMoreGeneral = !_isShowMoreGeneral; + }, + ); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded(child: Container( + margin: EdgeInsets.only(left: 10, right: 10), + child: Texts(TranslationBase.of(context).generalResult,bold: true,))), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMoreGeneral + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), + ), + ), + if (_isShowMoreGeneral) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + ), + ), + duration: Duration(milliseconds: 7000), + child: Container( + width: double.infinity, + child: LabResultWidget( + patientLabOrder: widget.patientLabOrder, + patientLabResultList: model.labResultList, + patient:widget.patient, + ), + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart new file mode 100644 index 00000000..aeca5508 --- /dev/null +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -0,0 +1,128 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result_page.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class LabsHomePage extends StatelessWidget { + String patientType; + String arrivalType; + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + print(arrivalType); + return BaseView( + onModelReady: (model) => model.getLabs(patient), + builder: (context, LabsViewModel model, widget) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: FractionallySizedBox( + widthFactor: 1.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), + SizedBox(height: 12,), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Lab',style: "caption2",color: Colors.black,fontSize: 13,), + Texts('Result',bold: true,fontSize: 22,), + ], + ), + ), + if(patientType!=null && patientType=='7') + InkWell( + onTap: (){ + //TODO Hussam call the add page here + }, + child: Container( + width: double.maxFinite, + height: 140, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Container( + height: 90, + child: Column( + children: [ + Container( + height: 40, + width: 40, + decoration: BoxDecoration( + color: Colors.grey[600], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Icon(Icons.add,color: Colors.white,), + ), + ), + SizedBox(height: 10,), + Texts('Apply for New Lab Order',color: Colors.grey[600],fontWeight: FontWeight.w600,) + ], + ), + ), + ), + ), + ), + ...List.generate( + model.patientLabOrdersList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: model + .patientLabOrdersList[index].patientLabOrdersList + .map((labOrder) { + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: labOrder, + patient: patient, + arrivalType: arrivalType, + patientType: patientType, + ), + ), + ), + doctorName: labOrder.doctorName, + invoiceNO: ' ${labOrder.invoiceNo}', + profileUrl: labOrder.doctorImageURL, + branch: labOrder.projectName, + appointmentDate: labOrder.orderDate, + orderNo: labOrder.orderNo, + ); + }).toList(), + ), + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index 09834d50..a7182546 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -117,6 +117,12 @@ class _PatientsOrdersState extends State { marginBottom: 5, fontWeight: FontWeight.bold, ), + AppText( + notesList[index] + ["AdmissionNo"], + marginLeft: 10, + color: Colors.grey[600], + ), AppText( convertDateFormat( notesList[index] @@ -128,18 +134,24 @@ class _PatientsOrdersState extends State { ), ), children: [ - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - AppText( - notesList[index]["Notes"], - margin: 5, - ) - ], + Divider( + color: Colors.black, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + notesList[index]["Notes"], + margin: 5, + ), + ], + ) + ], ), ], )); diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index d95eb766..70c9f5b9 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -1,17 +1,691 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_search.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; -import '../../../widgets/patients/profile/patient_profile_widget.dart'; -import '../../../widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import '../../../routes.dart'; +// ignore: must_be_immutable class PatientProfileScreen extends StatelessWidget { - const PatientProfileScreen({Key key}) : super(key: key); + PatiantInformtion patient; + bool isFromSearch = false; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + ProjectViewModel projectViewModel = Provider.of(context); + + patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + String from = routeArgs['from']; + String to = routeArgs['to']; + if (routeArgs.containsKey("isSearch")) { + isFromSearch = routeArgs['isSearch']; + } + + return BaseView( + onModelReady: (model) async { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: patient.patientMRN ?? patient.patientId, + doctorID: '', + editedBy: ''); + await model.getPatientAllergy(generalGetReqForSOAP); + if (model.allergiesList.length == 0) { + await model.getMasterLookup(MasterKeysService.Allergies); + } + if (model.allergySeverityList.length == 0) { + await model.getMasterLookup(MasterKeysService.AllergySeverity); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).patientProfile, + isShowAppBar: false, + body: Container( + color: Color(0XFFF2F2F2), + child: Stack( + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), + Expanded( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + children: [ + isFromSearch + ? ProfileMedicalInfoWidgetSearch( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + ) + : ProfileMedicalInfoWidget( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + ), + ], + ), + ), + ), + ) + ], + ), + ), + if (int.parse(patientType) == 7 || + int.parse(patientType) == 6) + Positioned( + top: 175, + left: 20, + right: 20, + child: Row( + children: [ + Expanded(child: Container()), + if (patient.episodeNo == 0) + BorderedButton( + "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", + backgroundColor: patient.patientStatusType == 43 + ? Colors.red.shade700 + : Colors.grey.shade700, + textColor: Colors.white, + vPadding: 8, + radius: 30, + hPadding: 20, + fontWeight: FontWeight.normal, + fontSize: 12, + fontFamily: 'Poppins', + icon: Image.asset( + "assets/images/create-episod.png", + color: Colors.white, + height: 30, + ), + handler: () async { + if (patient.patientStatusType == 43) { + PostEpisodeReqModel postEpisodeReqModel = + PostEpisodeReqModel( + appointmentNo: + patient.appointmentNo, + patientMRN: patient.patientMRN); + GifLoaderDialogUtils.showMyDialog(context); + await model + .postEpisode(postEpisodeReqModel); + GifLoaderDialogUtils.hideDialog(context); + patient.episodeNo = model.episodeID; + Navigator.of(context).pushNamed( + CREATE_EPISODE, + arguments: {'patient': patient}); + } + }, + ), + if (patient.episodeNo != 0) + BorderedButton( + "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", + backgroundColor: Colors.red.shade700, + textColor: Colors.white, + vPadding: 8, + radius: 30, + hPadding: 20, + fontWeight: FontWeight.normal, + fontSize: 12, + fontFamily: 'Poppins', + icon: Image.asset( + "assets/images/modilfy-episode.png", + color: Colors.white, + height: 30, + ), + handler: () { + Navigator.of(context).pushNamed( + UPDATE_EPISODE, + arguments: {'patient': patient}); + }, + ), + ], + ), + ), + ], + ), + ), + )); + } +} + +class AvatarWidget extends StatelessWidget { + final Widget avatarIcon; + + AvatarWidget(this.avatarIcon); @override Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).patientProfile, - body: PatientProfileWidget(), + return Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.08), + offset: Offset(0.0, 5.0), + blurRadius: 16.0) + ], + borderRadius: BorderRadius.all(Radius.circular(35.0)), + color: Color(0xffCCCCCC), + ), + child: avatarIcon, ); } } + +/* Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: Colors.grey.shade300, + blurRadius: 10.0, + spreadRadius: 0, + offset: Offset(0, 10)), + ], color: Colors.white), + child: Column(children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + + ' ' + + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .fileNo, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 4, + ), + AppText( + patient.patientId.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + model.patientAllergiesList + .isNotEmpty && + model.getAllergicNames( + projectViewModel + .isArabic) != + '' + ? Container( + width: MediaQuery.of(context) + .size + .width * + 0.65, + child: Padding( + padding: const EdgeInsets + .symmetric(vertical: 8), + child: AppText( + TranslationBase.of( + context) + .allergicTO + + " : " + + model.getAllergicNames( + projectViewModel + .isArabic), + color: Color(0xFFB9382C), + fontWeight: + FontWeight.bold, + ), + ), + ) + : AppText(''), + ], + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + Container( + height: 11 * SizeConfig.textMultiplier, + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age, + fontWeight: FontWeight.bold, + fontSize: 2 * + SizeConfig.textMultiplier, + ), + SizedBox( + height: 4, + ), + AppText( + "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + fontWeight: FontWeight.normal, + fontSize: 1.6 * + SizeConfig.textMultiplier, + ), + ], + ), + ), + ), + Container( + width: 1, + color: Color(0xffCCCCCC), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .nationality, + fontWeight: FontWeight.bold, + fontSize: 2 * + SizeConfig.textMultiplier, + ), + SizedBox( + height: 4, + ), + AppText( + patient.nationalityName ?? + patient.nationality, + fontWeight: FontWeight.normal, + fontSize: 1.7 * + SizeConfig.textMultiplier, + ), + ], + ), + ), + ), + Container( + width: 1, + color: Color(0xffCCCCCC), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .gender, + fontWeight: FontWeight.bold, + fontSize: 2 * + SizeConfig.textMultiplier, + ), + SizedBox( + height: 4, + ), + AppText( + patient.gender.toString() == '1' + ? 'Male' + : 'Female', + fontWeight: FontWeight.normal, + fontSize: 1.8 * + SizeConfig.textMultiplier, + ), + ], + ), + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ]), + ), + if (patient.admissionNo != null) + Container( + margin: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .admissionDetail, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 1.8 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 4, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.fromBorderSide(BorderSide( + color: Color(0xffBBBBBB), + width: 1, + )), + ), + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(16), + child: Column( + children: [ + Row( + children: [ + Container( + width: 14 * + SizeConfig + .textMultiplier, + child: AppText( + TranslationBase.of( + context) + .dateTime, + color: Colors.black, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ), + Expanded( + child: AppText( + patient.createdOn != + null + ? "${DateUtils.convertDateFromServerFormat(patient.createdOn, 'EEEE dd, MMMM yyyy hh:mm a')}" + : "", + color: Colors.black, + fontWeight: + FontWeight.normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Container( + width: 14 * + SizeConfig + .textMultiplier, + child: AppText( + TranslationBase.of( + context) + .admissionNo, + color: Colors.black, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ), + AppText( + patient.admissionNo != + null + ? patient.admissionNo + : '', + color: Colors.black, + fontWeight: + FontWeight.normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Container( + width: 14 * + SizeConfig + .textMultiplier, + child: AppText( + TranslationBase.of( + context) + .losNo, + color: Colors.black, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ), + AppText( + patient.createdOn != null + ? DateUtils + .differenceBetweenServerDateAndCurrent( + patient + .createdOn, + context) + : "", + color: Colors.black, + fontWeight: + FontWeight.normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ], + ), + ], + ), + ), + const Divider( + color: Color(0xffCCCCCC), + height: 5, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + height: + 10 * SizeConfig.textMultiplier, + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets + .fromLTRB( + 16.0, 8.0, 8.0, 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .area, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + SizedBox( + height: 4, + ), + AppText( + patient + .clinicDescription, + fontWeight: + FontWeight.normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ], + ), + ), + ), + Container( + width: 1, + color: Color(0xffCCCCCC), + ), + Expanded( + child: Padding( + padding: const EdgeInsets + .fromLTRB( + 16.0, 8.0, 8.0, 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Expanded( + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .room, + fontWeight: + FontWeight + .bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + SizedBox( + width: 4, + ), + Expanded( + child: AppText( + "${patient.nursingStationName}\n${patient.roomId}", + fontWeight: + FontWeight + .normal, + fontSize: 1.4 * + SizeConfig + .textMultiplier, + ), + ), + ], + ), + ), + SizedBox( + height: 4, + ), + Expanded( + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + TranslationBase.of( + context) + .bed, + fontWeight: + FontWeight + .bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + SizedBox( + width: 4, + ), + AppText( + "${patient.bedId}", + fontWeight: + FontWeight + .normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ) + ], + ), + ) + ], + ), + ), + ], + ),*/ diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index 88e34cdb..56a5cd5e 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -141,9 +141,13 @@ class _ProgressNoteState extends State { indent: 0, endIndent: 0, ), - AppText( - notesList[index]["Notes"], - margin: 5, + Row(mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + notesList[index]["Notes"], + margin: 5, + ), + ], ) ], ), diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart new file mode 100644 index 00000000..8d27e704 --- /dev/null +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -0,0 +1,89 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class RadiologyDetailsPage extends StatelessWidget { + final FinalRadiology finalRadiology; + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + RadiologyDetailsPage({Key key, this.finalRadiology, this.patient, this.patientType, this.arrivalType}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getRadImageURL( + patient: patient, + projectId: finalRadiology.projectID, + lineItem: finalRadiology.invoiceLineItemNo, + invoiceNo: finalRadiology.invoiceNo), + builder: (_, model, widget) => AppScaffold( + + isShowAppBar: false, + baseViewModel: model, + body: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + PatientProfileHeaderWhitAppointment(patient: patient, + patientType: patientType??"0", + arrivalType: arrivalType??"0", + orderNo: finalRadiology.orderNo.toString(), + appointmentDate:finalRadiology.orderDate, + doctorName: finalRadiology.doctorName, + profileUrl: finalRadiology.doctorImageURL, + invoiceNO: finalRadiology.invoiceNo.toString(), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.2, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 5,), + Texts(TranslationBase.of(context).generalResult), + SizedBox(height: 5,), + Texts( + '${finalRadiology.reportData}', + textAlign: TextAlign.start, + fontSize: 17, + color: Colors.grey, + ), + SizedBox(height: 25,), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + color: Colors.red, + onTap: () { + launch(model.radImageURL); + }, + title: TranslationBase.of(context).openRad, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart new file mode 100644 index 00000000..6db06be5 --- /dev/null +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -0,0 +1,125 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_details_page.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class RadiologyHomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + return BaseView( + onModelReady: (model) => model.getPatientRadOrders(patient), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).radiology, + baseViewModel: model, + body: FractionallySizedBox( + widthFactor: 1.0, + child: ListView( + physics: BouncingScrollPhysics(), + children: [ + PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), + SizedBox(height: 12,), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Radiology',style: "caption2",color: Colors.black,fontSize: 13,), + Texts('Result',bold: true,fontSize: 22,), + ], + ), + ), + if(patientType!=null && patientType=='7') + InkWell( + onTap: (){ + //TODO Hussam call the add page here + }, + child: Container( + width: double.maxFinite, + height: 140, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Container( + height: 90, + child: Column( + children: [ + Container( + height: 40, + width: 40, + decoration: BoxDecoration( + color: Colors.grey[600], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Icon(Icons.add,color: Colors.white,), + ), + ), + SizedBox(height: 10,), + Texts('Apply for Radiology Order',color: Colors.grey[600],fontWeight: FontWeight.w600,) + ], + ), + ), + ), + ), + ), + ...List.generate( + model.finalRadiologyList.length, + (index) => AppExpandableNotifier( + title: model.finalRadiologyList[index].filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: model + .finalRadiologyList[index].finalRadiologyList + .map((radiology) { + return InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: RadiologyDetailsPage( + finalRadiology: radiology, + patient: patient, + ), + ), + ), + child: DoctorCard( + doctorName: radiology.doctorName, + profileUrl: radiology.doctorImageURL, + invoiceNO: '${radiology.invoiceNo}', + branch: '${radiology.projectName}', + appointmentDate: radiology.orderDate, + orderNo: radiology.orderNo.toString(), + ), + ); + }).toList(), + )), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/radiology/radiology_report_screen.dart b/lib/screens/patients/profile/radiology/radiology_report_screen.dart index 29544cdf..75be23e8 100644 --- a/lib/screens/patients/profile/radiology/radiology_report_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_report_screen.dart @@ -1,37 +1,76 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:url_launcher/url_launcher.dart'; class RadiologyReportScreen extends StatelessWidget { final String reportData; + final String url; - RadiologyReportScreen({Key key, this.reportData}); + RadiologyReportScreen({Key key, this.reportData, this.url}); @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).radiologyReport, - body: Container( - padding: EdgeInsets.all(10), - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10)), - color: Colors.white, - border: Border( - bottom: BorderSide(color: Colors.grey, width: 0.5), - top: BorderSide(color: Colors.grey, width: 0.5), - left: BorderSide(color: Colors.grey, width: 0.5), - right: BorderSide(color: Colors.grey, width: 0.5), + appBarTitle: TranslationBase.of(context).radiologyReport, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + padding: EdgeInsets.all(10), + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10)), + color: Colors.white, + border: Border( + bottom: BorderSide(color: Colors.grey, width: 0.5), + top: BorderSide(color: Colors.grey, width: 0.5), + left: BorderSide(color: Colors.grey, width: 0.5), + right: BorderSide(color: Colors.grey, width: 0.5), + ), + ), + child: AppText( + reportData, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + ), + SizedBox(height:MediaQuery.of(context).size.height * 0.13 ,) + ], ), ), - child: AppText( - reportData, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ); + bottomSheet: url == null + ? Container( + height: MediaQuery.of(context).size.height * 0, + ) + : Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Wrap( + alignment: WrapAlignment.center, + children: [ + // TODO change it secondary button and add loading + AppButton( + title: TranslationBase.of(context).openRad, + onPressed: () async { + launch(url); + }, + ), + ], + ), + ), + ), + ], + ), + )); } } diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index cdab5bca..0bce886a 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -102,6 +102,8 @@ class _RadiologyScreenState extends State { reportData: model .patientRadiologyList[index] .reportData, + url: model + .patientRadiologyList[index].imageURL, )), ); }, diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index ffef05e6..9b56003b 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -6,9 +6,11 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; @@ -34,427 +36,275 @@ class ReferPatientScreen extends StatefulWidget { } class _ReferPatientState extends State { - var doctorsList; - final _remarksController = TextEditingController(); + dynamic _selectedClinic; + dynamic _selectedDoctor; final _extController = TextEditingController(); - var _isInit = true; - bool isValid; - - var clinicId; - var doctorId; - var freqId; - - String _selectedClinic; - String _selectedDoctor; - String _selectedReferralFrequancy; - int _activePriority = 1; - - FocusNode myFocusNode = FocusNode(); + dynamic _selectedFrequency; + final _remarksController = TextEditingController(); + bool isValid; @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).myReferralPatient, + appBarTitle: TranslationBase.of(context).referralPatient, body: model.clinicsList == null ? DrAppEmbeddedError(error: 'Something Wrong!') : SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).clinic, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedClinic, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = null; - _selectedClinic = newValue; - var clinicInfo = model - .clinicsList - .where((i) => - i['ClinicDescription'] - .toString() - .contains( - _selectedClinic)) - .toList(); - - clinicId = clinicInfo[0]['ClinicID'] - .toString(); - - model.getDoctorsList(clinicId); - }) - }, - items: model - .getClinicNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), - ), - //--------------------------------------------------------------------// - AppText( - TranslationBase.of(context).doctor, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedDoctor, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getDoctorNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = newValue; - doctorsList = - model.doctorsList; - - var doctorInfo = doctorsList - .where((i) => i['DoctorName'] - .toString() - .contains(_selectedDoctor)) - .toList(); - doctorId = doctorInfo[0]['DoctorID'] - .toString(); - }) - }, - items: model - .getDoctorNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), - ), //-----------------------------/// - AppText( - TranslationBase.of(context).ext, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).ext, - controller: _extController, - inputFormatter: ONLY_NUMBERS, - textInputType: TextInputType.number, - onChanged: (value) => {}, - ), - ), - AppText( - TranslationBase.of(context).priority, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - - priorityBar(context), - - AppText( - TranslationBase.of(context).referralFrequency + - getPriority(), - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, + child: Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.clinicsList != null && + model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = null; + _selectedClinic = selectedValue; + model.getDoctorsList( + _selectedClinic['ClinicID'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).clinicSelect, + _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, + true), + enabled: false, ), - - AppText( - TranslationBase.of(context).referralFrequency, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doctorSelect, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedReferralFrequancy, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getReferralNamesList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedReferralFrequancy = newValue; - var freqInfo = model - .referalFrequancyList - .singleWhere((i) => i[ - 'Description'] - .toString() - .contains( - _selectedReferralFrequancy)); - freqId = freqInfo['ParameterCode'] - .toString(); - myFocusNode.requestFocus(); - }) - }, - items: model - .getReferralNamesList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).ext, null, false), + enabled: true, + controller: _extController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + priorityBar(context, screenSize), + SizedBox( + height: 20, + ), + AppText( + "${TranslationBase.of(context).referralFrequency} ${getPriority()}", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.referralFrequencyList != null && + model.referralFrequencyList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.referralFrequencyList, + attributeName: 'Description', + attributeValueId: 'ParameterCode', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedFrequency = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .selectReferralFrequency, + _selectedFrequency != null + ? _selectedFrequency['Description'] + : null, + true), + enabled: false, ), - AppText( + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: textFieldSelectorDecoration( TranslationBase.of(context).clinicDetailsandRemarks, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).remarks, - focusNode: myFocusNode, - controller: _remarksController, - inputFormatter: ONLY_LETTERS, - textInputType: TextInputType.text, - onChanged: (value) => {}, + null, + false), + enabled: true, + controller: _remarksController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_LETTERS)) + ], + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: Column( + children: [ + AppText( + TranslationBase.of(context).pleaseFill, + color: HexColor("#B8382B"), + fontWeight: FontWeight.bold, + margin: 10, + visibility: isValid == null ? false : !isValid, ), - ), - Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - children: [ - AppText( - TranslationBase.of(context).pleaseFill, - color: Colors.red, - fontWeight: FontWeight.bold, - margin: 10, - visibility: - isValid == null ? false : !isValid, - ), - // TODO replace AppButton with secondary button and add loading - AppButton( - title: TranslationBase - .of(context) - .send, - color: Color(PRIMARY_COLOR), - onPressed: () => - { - referToDoctor(context, model) - }, - ) - ], - )) - ], + // TODO replace AppButton with secondary button and add loading + AppButton( + title: TranslationBase.of(context).send, + color: HexColor("#B8382B"), + onPressed: () => {referToDoctor(context, model)}, + ) + ], + ), + ), + ], + ), + ), ), - ), - ),); + ), + ); } - Widget priorityBar(BuildContext _context) { + Widget priorityBar(BuildContext _context, Size screenSize) { List _priorities = [ - TranslationBase.of(context).veryUrgent, - TranslationBase.of(context).urgent, - TranslationBase.of(context).routine, + TranslationBase.of(context).veryUrgent.toUpperCase(), + TranslationBase.of(context).urgent.toUpperCase(), + TranslationBase.of(context).routine.toUpperCase(), ]; return Container( - height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.9, - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), + height: screenSize.height * 0.070, + decoration: + containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: _priorities.map((item) { bool _isActive = _priorities[_activePriority] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Container( - height: 40, - width: 90, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - // backgroundColor:_isActive - // ? Hexcolor("#B8382B") - // : Colors.white,//sideColor, - - fontWeight: FontWeight.bold, - ), + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, ), - )), - ), - onTap: () { - print(_priorities.indexOf(item)); - setState(() { - _activePriority = _priorities.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - alignment: Alignment.center, - height: 3, - width: 90, - ) - : Container() - ]); + ), + )), + ), + onTap: () { + print(_priorities.indexOf(item)); + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }, + ), + ); }).toList(), ), ); @@ -484,10 +334,7 @@ class _ReferPatientState extends State { return; } - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; try { @@ -495,17 +342,16 @@ class _ReferPatientState extends State { extension: _extController.value.text, admissionNo: int.parse(patient.admissionNo), referringDoctorRemarks: _remarksController.value.text, - frequency: freqId, + frequency: _selectedFrequency['ParameterCode'].toString(), patientID: patient.patientId, patientTypeID: patient.patientType, priority: (_activePriority + 1).toString(), roomID: patient.roomId, - selectedClinicID: clinicId.toString(), - selectedDoctorID: doctorId.toString(), + selectedClinicID: _selectedClinic['ClinicID'].toString(), + selectedDoctorID: _selectedDoctor['DoctorID'].toString(), projectID: patient.projectId); // TODO: Add Translation - DrAppToastMsg.showSuccesToast( - 'Reply Successfully'); + DrAppToastMsg.showSuccesToast('Reply Successfully'); Navigator.pop(context); } catch (e) { DrAppToastMsg.showErrorToast(e); @@ -516,10 +362,47 @@ class _ReferPatientState extends State { setState(() { isValid = !_extController.value.text.isNullOrEmpty() && !_remarksController.value.text.isNullOrEmpty() && - freqId != null && - clinicId != null && - doctorId != null; + _selectedClinic != null && + _selectedDoctor != null && + _selectedFrequency != null; }); return isValid; } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 2.0, + )), + ); + } } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart new file mode 100644 index 00000000..d6d9e8b6 --- /dev/null +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -0,0 +1,220 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_search.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class MyReferralDetailScreen extends StatelessWidget { + PendingReferral pendingReferral; + + @override + Widget build(BuildContext context) { + final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; + + AuthViewModel authProvider = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + pendingReferral = routeArgs['referral']; + + return BaseView( + onModelReady: (model) => model.getPatientDetails( + DateUtils.convertStringToDateFormat( + DateTime.now()/*.subtract(Duration(days: 350))*/.toString(), + "yyyy-MM-dd"), + DateUtils.convertStringToDateFormat( + DateTime.now().toString(), "yyyy-MM-dd"), + pendingReferral.patientID, + pendingReferral.sourceAppointmentNo), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + isShowAppBar: false, + body: model.patientArrivalList != null && + model.patientArrivalList.length > 0 + ? Column( + children: [ + Container( + padding: EdgeInsets.only( + left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Container( + padding: EdgeInsets.only( + left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + AppText( + (Helpers.capitalize(model.patientArrivalList[0].patientDetails.fullName)), + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + model.patientArrivalList[0].patientDetails.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + ), + ], + ), + ), + ), + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + /*ProfileWelcomeWidget( + AppText( + authProvider.selectedClinicName != null + ? authProvider.selectedClinicName + : authProvider + .doctorProfile.clinicDescription, + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.white, + textAlign: TextAlign.center, + ), + height: 100, + ),*/ + SizedBox( + height: 16, + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: AppText( + TranslationBase.of(context).myReferralPatient, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + PatientReferralItemWidget( + "${pendingReferral.patientID}", + patientName: pendingReferral.patientName, + referralStatus: pendingReferral.referralStatus, + isReferredTo: false, + isSameBranch: + pendingReferral.isReferralDoctorSameBranch, + referralDoctorName: + pendingReferral.referredByDoctorInfo, + clinicDescription: null, + remark: pendingReferral.remarksFromSource, + referredOn: pendingReferral.referredOn, + patientInfo: pendingReferral, + ), + SizedBox( + child: ProfileMedicalInfoWidgetSearch( + patient: model.patientArrivalList[0], + patientType: "7", + from: null, + to: null, + ), + ), + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Row( + children: [ + Expanded( + child: BorderedButton( + TranslationBase.of(context).accept, + backgroundColor: Color(0xFF4BA821), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: () async { + await model.responseReferral( + pendingReferral, true); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + Navigator.pop(context); + Navigator.pop(context); + } + }, + ), + ), + SizedBox( + height: 8, + ), + Expanded( + child: BorderedButton( + TranslationBase.of(context).reject, + backgroundColor: Color(0xFFB9382C), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: () async { + await model.responseReferral( + pendingReferral, true); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + Navigator.pop(context); + Navigator.pop(context); + } + }, + ), + ), + ], + ), + ), + ], + ) + : Container( + child: Center( + child: AppText( + TranslationBase.of(context).patientNoDetailErrMsg, + color: HexColor("#B8382B"), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart new file mode 100644 index 00000000..e6cccf48 --- /dev/null +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -0,0 +1,93 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class MyReferralPatientScreen extends StatelessWidget { + // previous design page is: MyReferralPatient + @override + Widget build(BuildContext context) { + AuthViewModel authProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getPendingReferralPatients(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).referPatient, + body: model.pendingReferral == null || model.pendingReferral.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + : SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(top: 70), + // color: Colors.white, + // height: MediaQuery.of(context).size.height, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SizedBox(height: 50), + ...List.generate( + model.pendingReferral.length, + (index) => InkWell( + onTap: () { + Navigator.of(context).pushNamed(MY_REFERRAL_DETAIL, + arguments: { + 'referral': model.pendingReferral[index] + }); + }, + child: PatientReferralItemWidget( + "${model.pendingReferral[index].patientID}", + patientInfo: model.pendingReferral[index], + patientName: + model.pendingReferral[index].patientName, + referralStatus: + model.pendingReferral[index].referralStatus, + isReferredTo: false, + isSameBranch: model.pendingReferral[index] + .isReferralDoctorSameBranch, + referralDoctorName: model + .pendingReferral[index].referredByDoctorInfo, + clinicDescription: null, + remark: + model.pendingReferral[index].remarksFromSource, + referredOn: model.pendingReferral[index].referredOn, + answerFromTarget: + model.pendingReferral[index].answerFromTarget, + infoIcon: InkWell( + onTap: () { + Navigator.of(context) + .pushNamed(MY_REFERRAL_DETAIL, arguments: { + 'referral': model.pendingReferral[index] + }); + }, + child: Icon( + Icons.info_outline, + color: Colors.black, + size: 30, + ), + ), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart new file mode 100644 index 00000000..adea0247 --- /dev/null +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -0,0 +1,104 @@ +import 'dart:ui'; +import 'package:doctor_app_flutter/screens/doctor/my_referral_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/my_referred_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PatientReferralScreen extends StatefulWidget { + @override + _PatientReferralScreen createState() => _PatientReferralScreen(); +} + +class _PatientReferralScreen extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).patientsreferral, + body: Scaffold( + extendBodyBehindAppBar: true, + // backgroundColor: Colors.white, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.92, // 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.9), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorColor: Colors.red[800], + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: + AppText(TranslationBase.of(context).myReferral), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText( + TranslationBase.of(context).myReferredPatient), + ), + ), + ], + ), + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + MyReferralPatientScreen(), + ReferredPatientScreen(), + // MyReferredPatient(), + ], + ), + ) + ], + ), + )); + } +} diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart new file mode 100644 index 00000000..6f053089 --- /dev/null +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -0,0 +1,425 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class PatientMakeReferralScreen extends StatefulWidget { + // previous design page is: ReferPatientScreen + @override + _PatientMakeReferralScreenState createState() => + _PatientMakeReferralScreenState(); +} + +class _PatientMakeReferralScreenState extends State { + PatiantInformtion patient; + List referToList; + dynamic _referTo; + dynamic _selectedBranch; + dynamic _selectedClinic; + dynamic _selectedDoctor; + DateTime appointmentDate; + final _remarksController = TextEditingController(); + + @override + void initState() { + super.initState(); + + appointmentDate = DateTime.now(); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + + referToList = List(); + dynamic sameBranch = { + "id": 1, + "name": TranslationBase.of(context).sameBranch + }; + dynamic otherBranch = { + "id": 2, + "name": TranslationBase.of(context).otherBranch + }; + referToList.add(sameBranch); + referToList.add(otherBranch); + + final screenSize = MediaQuery.of(context).size; + + return BaseView( + onModelReady: (model) => model.getPatientReferral(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + body: SingleChildScrollView( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + /*if (model.state == ViewState.BusyLocal) + Container( + color: Colors.white, + width: 50, + height: 50, + child: AppLoaderWidget( + containerColor: Colors.white, + )),*/ + Column( + children: [ + PatientPageHeaderWidget(patient), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + model.patientReferral.length == 0 + ? ReferralForm(model, screenSize) + : PatientReferralItemWidget( + "${model.patientReferral[model.patientReferral.length -1].patientID}", + patientName: model.patientReferral[model.patientReferral.length -1].patientName, + referralStatus: + "${model.patientReferral[model.patientReferral.length -1].referralStatus}", + isReferredTo: true, + isSameBranch: model + .patientReferral[model.patientReferral.length -1].isReferralDoctorSameBranch, + referralDoctorName: + model.patientReferral[model.patientReferral.length -1].referredByDoctorInfo, + clinicDescription: null, + remark: model.patientReferral[model.patientReferral.length -1].remarksFromSource, + referredOn: model.patientReferral[model.patientReferral.length -1].referredOn, + answerFromTarget: + model.patientReferral[model.patientReferral.length -1].answerFromTarget, + ), + ], + ), + if (model.patientReferral.length == 0) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).refer, + color: HexColor("#B8382B"), + onPressed: () { + if (appointmentDate == null || + _selectedBranch == null || + _selectedClinic == null || + _selectedDoctor == null || + _remarksController.text == null) return; + model + .makeReferral( + patient, + appointmentDate.toIso8601String(), + _selectedBranch['facilityId'], + _selectedClinic['ClinicID'], + _selectedDoctor['DoctorID'], + _remarksController.text) + .then((_) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).referralSuccessMsg); + Navigator.pop(context); + }); + }, + ), + ) + ], + ), + ), + ), + ), + ); + } + + Widget ReferralForm(PatientReferralViewModel model, Size screenSize) { + return Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).referPatient, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: referToList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: referToList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + model.getDoctorBranch().then((value) async { + _selectedBranch = value; + if (_referTo['id'] == 1) { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getClinics(_selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + } + }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).referTo, + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.branchesList != null && + model.branchesList.length > 0 && + _referTo != null && + _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.branchesList, + attributeName: 'facilityName', + attributeValueId: 'facilityId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() async { + _selectedBranch = selectedValue; + _selectedClinic = null; + _selectedDoctor = null; + GifLoaderDialogUtils.showMyDialog(context); + await model + .getClinics(_selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).branch, + _selectedBranch != null + ? _selectedBranch['facilityName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedBranch != null && + model.clinicsList != null && + model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + usingSearch: true, + hintSearchText: + TranslationBase.of(context).clinicSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() async { + _selectedDoctor = null; + _selectedClinic = selectedValue; + GifLoaderDialogUtils.showMyDialog(context); + await model + .getClinicDoctors( + _selectedClinic['ClinicID'].toString()) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).clinic, + _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null && + model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: + TranslationBase.of(context).doctorSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).doctor, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => _selectDate(context, model), + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).chooseAppointment, + appointmentDate != null + ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).remarks, null, false), + enabled: true, + controller: _remarksController, + // inputFormatters: [ + // FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) + // ], + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + ], + ), + ); + } + + _selectDate(BuildContext context, PatientReferralViewModel model) async { + // https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference + // https://stackoverflow.com/a/63147062/6246772 to customize a date picker + final DateTime picked = await showDatePicker( + context: context, + initialDate: appointmentDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != appointmentDate) { + setState(() { + appointmentDate = picked; + }); + } + } +} diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart new file mode 100644 index 00000000..d6a81603 --- /dev/null +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -0,0 +1,83 @@ +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class ReferredPatientScreen extends StatelessWidget { + // previous design page is: MyReferredPatient + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getMyReferredPatient(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).referredPatient, + body: model.listMyReferredPatientModel == null || + model.listMyReferredPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + /*Container( + height: 75, + child: AppText( + "This is where upper view for avatar.. etc placed", + fontWeight: FontWeight.normal, + fontSize: 16, + ), + ),*/ + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + ...List.generate( + model.listMyReferredPatientModel.length, + (index) => PatientReferralItemWidget( + "${model.getReferredPatientItem(index).patientId}", + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + referralStatus: + "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", + isReferredTo: true, + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + referralDoctorName: model + .getReferredPatientItem(index) + .referralDoctorName, + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + referredOn: model + .getReferredPatientItem(index) + .referralDate != + null + ? DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy") + : null, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/vital_sign/LineChartCurved.dart b/lib/screens/patients/profile/vital_sign/LineChartCurved.dart new file mode 100644 index 00000000..2f0eafcb --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/LineChartCurved.dart @@ -0,0 +1,217 @@ +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartCurved extends StatelessWidget { + final String title; + final List timeSeries; + final int indexes; + + LineChartCurved({this.title, this.timeSeries, this.indexes}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + getYaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Text( + title, + style: TextStyle( + color: Colors.black, + fontSize: 15, + letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox(height: 10,), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 18.0, left: 16.0), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries.length) { + xAxixs.add(mIndex); + } + } + } + getYaxix() { + int indexess= (timeSeries.length*0.30).toInt(); + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexess * index; + if (mIndex < timeSeries.length) { + yAxixs.add(timeSeries[mIndex].sales); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + rotateAngle:-65, + //rotateAngle:-65, + margin: 22, + getTitles: (value) { + if (timeSeries.length < 15) { + if (timeSeries.length > value.toInt()) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + // if (timeSeries.length < 10) { + // return '${value.toInt()}'; + // } else { + // if (value == getMinY()) + // return '${value.toInt()}'; + // if (value == getMaxY()) + // return '${value.toInt()}'; + // if (yAxixs.contains(value)) { + // return '${value.toInt()}'; + // } + // return ''; + // } + return '${value.toInt()}'; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries.length - 1).toDouble(), + maxY: getMaxY()+0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble() ; + } + + double getMinY() { + double min = timeSeries[0].sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart new file mode 100644 index 00000000..e816c145 --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart @@ -0,0 +1,257 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartCurvedBloodPressure extends StatelessWidget { + final String title; + final List timeSeries1; + final List timeSeries2; + final int indexes; + + LineChartCurvedBloodPressure( + {this.title, this.timeSeries1, this.indexes, this.timeSeries2}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 15, + ), + Text( + title, + style: TextStyle( + color: Colors.black, fontSize: 15, letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + SizedBox( + height: 10, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Theme.of(context).primaryColor), + ), + SizedBox(width: 5,), + AppText(TranslationBase.of(context).systolicLng) + ], + ), + SizedBox(width: 15,), + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.grey), + ), + SizedBox(width: 5,), + AppText(TranslationBase.of(context).diastolicLng) + ], + ), + ], + ) + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries1.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries1.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + rotateAngle: -65, + //rotateAngle:-65, + margin: 22, + getTitles: (value) { + if (timeSeries1.length < 15) { + if (timeSeries1.length > value.toInt()) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + return '${value.toInt()}'; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries1.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries1[0].sales; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries1.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + } + + List spots2 = List(); + for (int index = 0; index < timeSeries2.length; index++) { + spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Colors.grey], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [lineChartBarData1, lineChartBarData2]; + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart new file mode 100644 index 00000000..6b2543be --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -0,0 +1,1076 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class PatientVitalSignScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String from = routeArgs['from']; + String to = routeArgs['to']; + + return BaseView( + onModelReady: (model) => model.getPatientVitalSign(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).vitalSign, + body: model.patientVitalSigns != null + ? SingleChildScrollView( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + SizedBox( + height: 16, + ), + Container( + margin: + EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).weight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.weightKg} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).idealBodyWeight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.idealBodyWeightLbs} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).height} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.heightCm} ${TranslationBase.of(context).cm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + /*Row( + children: [ + AppText( + "${TranslationBase.of(context).waistSize} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.waistSizeInch} ${TranslationBase.of(context).inch}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ),*/ + Row( + children: [ + AppText( + "${TranslationBase.of(context).headCircum} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.headCircumCm} ${TranslationBase.of(context).cm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).leanBodyWeight} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.leanBodyWeightLbs} ${TranslationBase.of(context).kg}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).bodyMassIndex} :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bodyMassIndex}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + SizedBox( + width: 8, + ), + Container( + color: Colors.green, + child: Padding( + padding: EdgeInsets.symmetric( + vertical: 2, horizontal: 8), + child: AppText( + "${model.getBMI(model.patientVitalSigns.bodyMassIndex)}", + fontSize: + SizeConfig.textMultiplier * 2, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "G.C.S :", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 8, + ), + AppText( + "N/A", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + TemperatureWidget(model, model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + PulseWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + RespirationWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + BloodPressureWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + OxygenationWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + PainScaleWidget(model.patientVitalSigns), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ), + ) + ], + ), + ), + ) + : Center( + child: AppText( + "${TranslationBase.of(context).vitalSignEmptyMsg}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: HexColor("#B8382B"), + fontWeight: FontWeight.normal, + ), + ), + ), + ); + } +} + +class TemperatureWidget extends StatefulWidget { + final VitalSignsViewModel model; + final VitalSignData vitalSign; + + TemperatureWidget(this.model, this.vitalSign); + + @override + _TemperatureWidgetState createState() => _TemperatureWidgetState(); +} + +class _TemperatureWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (C):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (F):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).method} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.model.getTempratureMethod(widget.vitalSign.temperatureCelciusMethod)}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class PulseWidget extends StatefulWidget { + final VitalSignData vitalSign; + + PulseWidget(this.vitalSign); + + @override + _PulseWidgetState createState() => _PulseWidgetState(); +} + +class _PulseWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).pulse}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).pulseBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).rhythm}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseRhythm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class RespirationWidget extends StatefulWidget { + final VitalSignData vitalSign; + + RespirationWidget(this.vitalSign); + + @override + _RespirationWidgetState createState() => _RespirationWidgetState(); +} + +class _RespirationWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).respiration}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).respBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patternOfRespiration}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationPattern}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class BloodPressureWidget extends StatefulWidget { + final VitalSignData vitalSign; + + BloodPressureWidget(this.vitalSign); + + @override + _BloodPressureWidgetState createState() => _BloodPressureWidgetState(); +} + +class _BloodPressureWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).bloodPressure}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).cuffLocation}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureCuffLocation}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patientPosition}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressurePatientPosition}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffSize}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffSize}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class OxygenationWidget extends StatefulWidget { + final VitalSignData vitalSign; + + OxygenationWidget(this.vitalSign); + + @override + _OxygenationWidgetState createState() => _OxygenationWidgetState(); +} + +class _OxygenationWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).oxygenation}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).sao2}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.sao2}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).fio2}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.fio2}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} + +class PainScaleWidget extends StatefulWidget { + final VitalSignData vitalSign; + + PainScaleWidget(this.vitalSign); + + @override + _PainScaleWidgetState createState() => _PainScaleWidgetState(); +} + +class _PainScaleWidgetState extends State { + bool isExpand = false; + + @override + Widget build(BuildContext context) { + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.black, + fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, + ), + InkWell( + onTap: () { + setState(() { + isExpand = !isExpand; + }); + }, + child: Icon(isExpand ? Icons.remove : Icons.add), + ), + ], + ), + ), + bodyWidget: Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.painScore}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painManagement}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.isPainManagementDone}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + ], + ), + ], + ), + ), + isExpand: isExpand, + ), + ); + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart new file mode 100644 index 00000000..693507bb --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -0,0 +1,148 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class VitalSignBloodPressureWidget extends StatefulWidget { + final List vitalList; + final String title1; + final String title2; + final String title3; + final String viewKey1; + final String viewKey2; + + VitalSignBloodPressureWidget( + {Key key, this.vitalList, this.title1, this.title2, this.viewKey1, this.title3, this.viewKey2}); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), + border: Border.all(color: Colors.grey, width: 1), + ), + margin: EdgeInsets.all(20), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add(TableRow(children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft:projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) + ), + ), + child: Center( + child: AppText( + TranslationBase.of(context).date, + color: Colors.white, + ), + ), + height: 60, + ), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + + ), + child: Center( + child: AppText(widget.title2, color: Colors.white), + ), + height: 60), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) + ), + ), + child: Center( + child: AppText(widget.title3, color: Colors.white), + ), + height: 60), + ), + ])); + widget.vitalList.forEach((vital) { + var data = vital.toJson()[widget.viewKey1]; + DateTime elementDate = + DateUtils.getDateTimeFromServerFormat(vital.createdOn); + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${vital.toJson()[widget.viewKey1]}', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${vital.toJson()[widget.viewKey2]}', + textAlign: TextAlign.center, + ), + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index cf8ee839..3dd45782 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -1,246 +1,417 @@ -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_req_model.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_item.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; -import '../../../../config/shared_pref_kay.dart'; -import '../../../../config/size_config.dart'; -import '../../../../lookups/patient_lookup.dart'; -import '../../../../models/patient/patiant_info_model.dart'; -import '../../../../models/patient/vital_sign/vital_sign_res_model.dart'; -import '../../../../routes.dart'; -import '../../../../screens/patients/profile/vital_sign/vital_sign_item.dart'; -import '../../../../util/dr_app_shared_pref.dart'; -import '../../../../widgets/shared/app_scaffold_widget.dart'; +class VitalSignDetailsScreen extends StatelessWidget { + int appointmentNo; + int projectID; + bool isNotOneAppointment; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + VitalSignDetailsScreen( + {this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); -class VitalSignDetailsScreen extends StatefulWidget { - // VitalSignDetailsScreen({Key key, this.vitalSing}) : super(key: key); @override - _VitalSignDetailsScreenState createState() => _VitalSignDetailsScreenState(); -} - -class _VitalSignDetailsScreenState extends State { - VitalSignResModel vitalSing; - String url = "assets/images/"; - - - /* - *@author: Elham Rababah - *@Date:28/4/2020 - *@param: context - *@return: - *@desc: getVitalSignList Function - */ - getVitalSignList(BuildContext context, PatientViewModel model) async { + Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - String token = await sharedPref.getString(TOKEN); - String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); - int inOutpatientType = 1; - if (type == '0') { - inOutpatientType = 2; - } - print(type); - VitalSignReqModel vitalSignReqModel = VitalSignReqModel( - patientID: patient.patientId, - projectID: patient.projectId, - tokenID: token, - patientTypeID: patient.patientType, - inOutpatientType: inOutpatientType, - languageID: 2, - transNo: - patient.admissionNo != null ? int.parse(patient.admissionNo) : 0); - model.getPatientVitalSign(vitalSignReqModel.toJson()); - } - - - - final double contWidth = SizeConfig.realScreenWidth * 0.70; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + String from = routeArgs['from']; + String to = routeArgs['to']; + String imageBasePath = 'assets/images/'; + String assetBasePath = "${imageBasePath}patient/vital_signs/"; - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - vitalSing = routeArgs['vitalSing']; - return BaseView( - onModelReady: (model) => getVitalSignList(context, model), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, + return BaseView( + onModelReady: (model) => + model.getPatientVitalSignHistory(patient, from, to), + builder: (_, mode, widget) => AppScaffold( + isShowAppBar: false, + baseViewModel: mode, appBarTitle: TranslationBase.of(context).vitalSign, - body: model.patientVitalSignOrderdSubList.length == 0 - ? DrAppEmbeddedError( - error: 'You don\'t have any vital Sings') - : Container( - child: Column( - children: [ - Row( - children: [ - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .bodyMeasurements, - 'key': - vitalSignDetails.bodyMeasurements - }); - }, - child: Container( - child: VitalSignItem( - des: TranslationBase.of(context) - .bodyMeasurements, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0] - .heightCm - .toString(), - unit: 'Cm', - ), - ), - ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .temperature, - 'key': vitalSignDetails.temperature, - }); - }, - child: Container( - child: VitalSignItem( - des: TranslationBase.of(context) - .temperature, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0] - .temperatureCelcius - .toString(), - unit: 'C', - ), - ), + body: mode.patientVitalSignsHistory.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${patient.firstName ?? patient.patientDetails.firstName}'s", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + ), + AppText( + TranslationBase.of(context).vitalSign, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.21, + width: double.infinity, + padding: EdgeInsets.all(12.0), + margin: EdgeInsets.symmetric(horizontal: 16.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(16), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).yourBodyMassIndex} ${mode.bodyMax}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + fontWeight: FontWeight.w700, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + mode.getBMIStatus() != 1 + ? '${assetBasePath}underweight_BMI.png' + : '${assetBasePath}underweight_BMI-r.png', + height: + MediaQuery.of(context).size.height * 0.10, + ), + const SizedBox( + height: 4, + ), + AppText( + "${TranslationBase.of(context).bmiUnderWeight}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + color: mode.getBMIStatus() == 1 + ? Color(0XFFD02127) + : null, + fontWeight: FontWeight.w700, + ), + AppText( + "(1-10)", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + color: mode.getBMIStatus() == 1 + ? Color(0XFFD02127) + : null, + fontWeight: FontWeight.w700, ), ], - ), - Row( - children: [ - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': - TranslationBase.of(context).pulse, - 'key': vitalSignDetails.pulse - }); - }, - child: VitalSignItem( - des: TranslationBase.of(context).pulse, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0] - .pulseBeatPerMinute - .toString(), - unit: 'M', - ), - ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .respiration, - 'key': vitalSignDetails.pespiration - }); - }, - child: VitalSignItem( - des: - TranslationBase.of(context).respiration, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0] - .respirationBeatPerMinute - .toString(), - unit: 'M', - ), + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + mode.getBMIStatus() != 2 + ? '${assetBasePath}health_BMI.png' + : '${assetBasePath}health_BMI-r.png', + height: + MediaQuery.of(context).size.height * 0.10, + ), + const SizedBox( + height: 4, + ), + AppText( + "${TranslationBase.of(context).bmiHealthy}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 2 + ? Color(0XFFD02127) + : null, + ), + AppText( + "(11-20)", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 2 + ? Color(0XFFD02127) + : null, ), ], - ), - Row( - children: [ - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .bloodPressure, - 'key': vitalSignDetails.bloodPressure - }); - }, - child: VitalSignItem( - des: TranslationBase.of(context) - .bloodPressure, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0] - .bloodPressure - .toString(), - unit: '', - ), - ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .oxygenation, - 'key': vitalSignDetails.oxygenation - }); - }, - child: VitalSignItem( - des: - TranslationBase.of(context).oxygenation, - url: url + 'heartbeat.png', - lastVal: model - .patientVitalSignOrderdSubList[0].fIO2 - .toString(), - unit: '', - ), + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + mode.getBMIStatus() != 3 + ? '${assetBasePath}ovrweight_BMI.png' + : '${assetBasePath}ovrweight_BMI-r.png', + height: + MediaQuery.of(context).size.height * 0.10, + ), + const SizedBox( + height: 4, + ), + AppText( + "${TranslationBase.of(context).bmiOverWeight}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 3 + ? Color(0XFFD02127) + : null, + ), + AppText( + "(21-30)", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 3 + ? Color(0XFFD02127) + : null, ), ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - Navigator.of(context).pushNamed( - BODY_MEASUREMENTS, - arguments: { - 'title': TranslationBase.of(context) - .painScale, - 'key': vitalSignDetails.painScale - }); - }, - child: VitalSignItem( - des: TranslationBase - .of(context) - .painScale, - url: url + 'heartbeat.png', - ), + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + mode.getBMIStatus() != 4 + ? '${assetBasePath}Obese_BMI.png' + : '${assetBasePath}Obese_BMI-r.png', + height: + MediaQuery.of(context).size.height * 0.10, + ), + const SizedBox( + height: 4, + ), + AppText( + "${TranslationBase.of(context).bmiObese}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 4 + ? Color(0XFFD02127) + : null, + ), + AppText( + "(31-40>)", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w700, + color: mode.getBMIStatus() == 4 + ? Color(0XFFD02127) + : null, ), ], - ), + )), ], + ) + ], + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 8.0), + child : GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 4, + mainAxisSpacing: 4, + childAspectRatio: 1 / 1.0, + crossAxisCount: 3, + children: [ + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Height, + pageTitle: + TranslationBase.of(context) + .height, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: Container( + child: VitalSignItem( + des: TranslationBase.of(context).height, + imagePath: + "${assetBasePath}height.png", + lastVal: mode.heightCm, + unit: TranslationBase.of(context).cm, + ), + ), + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Weight, + pageTitle: + TranslationBase.of(context) + .weight, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context).weight, + imagePath: "${assetBasePath}weight.png", + unit: TranslationBase.of(context).kg, + lastVal: mode.weightKg, + ), + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: + vitalSignDetails.Temperature, + pageTitle: + TranslationBase.of(context) + .temperature, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: Container( + child: VitalSignItem( + des: + TranslationBase.of(context).temperature, + imagePath: + "${assetBasePath}temperature.png", + lastVal: mode.temperatureCelcius, + unit: TranslationBase.of(context).tempC, + ), + ), + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.heart, + pageTitle: + TranslationBase.of(context) + .heart, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context).heart, + imagePath: + "${assetBasePath}heart_rate.png", + lastVal: mode.hartRat, + unit: TranslationBase.of(context).bpm, + ), + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: + vitalSignDetails.Respiration, + pageTitle: + TranslationBase.of(context) + .respirationRate, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: VitalSignItem( + des: TranslationBase.of(context) + .respirationRate, + imagePath: + "${assetBasePath}respiration_rate.png", + lastVal: mode.respirationBeatPerMinute, + unit: TranslationBase.of(context) + .respirationSigns, + ), + ), + InkWell( + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: + vitalSignDetails.BloodPressure, + pageTitle: + TranslationBase.of(context) + .bloodPressure, + vitalList: + mode.patientVitalSignsHistory, + ), + ), + ) + : null, + child: VitalSignItem( + des: + TranslationBase.of(context).bloodPressure, + imagePath: + "${assetBasePath}blood_pressure.png", + lastVal: mode.bloodPressure, + unit: TranslationBase.of(context).sysDias, + ), + ), + ], + ), + ), + ), + ], + ) + : Center( + child: AppText( + TranslationBase.of(context).vitalSignEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), ), - ),),); + ), + ); } } diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart new file mode 100644 index 00000000..11a24e42 --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart @@ -0,0 +1,124 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class VitalSignDetailsWidget extends StatefulWidget { + final List vitalList; + final String title1; + final String title2; + final String viewKey; + + VitalSignDetailsWidget( + {Key key, this.vitalList, this.title1, this.title2, this.viewKey}); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), + border: Border.all(color: Colors.grey, width: 1), + ), + margin: EdgeInsets.all(20), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add(TableRow(children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft:projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) + ), + ), + child: Center( + child: AppText( + TranslationBase.of(context).date, + color: Colors.white, + ), + ), + height: 60, + ), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) + ), + ), + child: Center( + child: AppText(widget.title2, color: Colors.white), + ), + height: 60), + ) + ])); + widget.vitalList.forEach((vital) { + var data = vital.toJson()[widget.viewKey]; + DateTime elementDate = + DateUtils.getDateTimeFromServerFormat(vital.createdOn); + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${projectViewModel.isArabic ? DateUtils.getWeekDayArabic(elementDate.weekday) : DateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? DateUtils.getMonthArabic(elementDate.month) : DateUtils.getMonth(elementDate.month)}, ${elementDate.year} ', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${vital.toJson()[widget.viewKey]}', + textAlign: TextAlign.center, + ), + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart index 1e0ce2cf..e99e7bad 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart @@ -1,85 +1,96 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import '../../../../config/size_config.dart'; -import '../../../../widgets/shared/rounded_container_widget.dart'; - -/* - *@author: Elham Rababah - *@Date:03/6/2020 - *@param: - *@return: - *@desc: VitalSignItem - */ class VitalSignItem extends StatelessWidget { + final String des; + final String lastVal; + final String unit; + final String imagePath; + final double height; + final double width; + const VitalSignItem( {Key key, - @required this.url, @required this.des, this.lastVal = 'N/A', this.unit = '', this.height, - this.width}) + this.width, + @required this.imagePath}) : super(key: key); - final String url; - final String des; - final String lastVal; - final String unit; - - final double height; - final double width; - @override Widget build(BuildContext context) { return RoundedContainer( - margin: 0.025 * SizeConfig.realScreenWidth, - height: 0.14 * SizeConfig.realScreenHeight, - width: 0.45 * SizeConfig.realScreenWidth, + // margin: 0.025 * SizeConfig.realScreenWidth, + // height: 0.15 * SizeConfig.realScreenHeight, + // width: 0.45 * SizeConfig.realScreenWidth, child: Container( padding: EdgeInsets.all(5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( - flex: 2, - child: Text( - des, - style: TextStyle( - fontSize: 1.7 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), - fontWeight: FontWeight.bold), + child: Container( + padding: EdgeInsets.only(top: 8), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8, right: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + "$lastVal", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w800, + margin: 0, + ), + AppText( + "$unit", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.3, + fontWeight: FontWeight.w700, + color: HexColor('#B8382C'), + margin: 0, + ), + ], + ), + ), + ), + Container( + child: Image.asset( + imagePath, + width: 40, + height: 40, + )) + ], + ), ), ), - Expanded( - flex: 1, - child: Column( - children: [ - Expanded( - child: Image.asset( - url, - height: SizeConfig.heightMultiplier * 7, - ), + Container( + width: double.infinity, + child: Align( + alignment: Alignment.topLeft, + child: Container( + margin: EdgeInsets.only(left: 5, right: 5), + child: AppText( + "$des", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.w600, ), - Expanded( - child: RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - new TextSpan(text: lastVal), - new TextSpan( - text: ' ${unit}', - style: TextStyle( - color: HexColor('#B8382C'), - ), - ), - ], - ), - )) - ], + ), ), - ) + ), ], ), ), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart index 853bec15..bd828138 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart @@ -1 +1,196 @@ -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; import '../../../../lookups/patient_lookup.dart'; import '../../../../models/patient/vital_sign/vital_sign_res_model.dart'; import '../../../../screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; /* *@author: Elham Rababah *@Date:03/6/2020 *@param: *@return: *@desc: VitalSignItemDetailsScreen */ class VitalSignItemDetailsScreen extends StatelessWidget { VitalSignItemDetailsScreen(); List vitalList = []; String pageTitle; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; pageTitle = routeArgs['title']; var pageKey = routeArgs['key']; List VSchart; switch (pageKey) { case vitalSignDetails.bodyMeasurements: VSchart = [ { 'name': 'Highet', 'title1': 'Date', 'title2': 'Cm', 'viewKey': 'HeightCm', }, { 'name': 'Weight Kg', 'title1': 'Date', 'title2': 'Kg', 'viewKey': 'WeightKg', }, { 'name': 'BodyMassIndex', 'title1': 'Date', 'title2': 'BodyMass', 'viewKey': 'BodyMassIndex', }, { 'name': 'HeadCircumCm', 'title1': 'Date', 'title2': 'Cm', 'viewKey': 'HeadCircumCm', }, { 'name': 'Ideal Body Weight (Lbs)', 'title1': 'Date', 'title2': 'Ideal Weight', 'viewKey': 'IdealBodyWeightLbs', }, { 'name': 'LeanBodyWeightLbs (Lbs)', 'title1': 'Date', 'title2': 'Lean Weight', 'viewKey': 'LeanBodyWeightLbs', } ]; break; case vitalSignDetails.temperature: VSchart = [ { 'name': 'Temperature In Celcius', 'title1': 'Date', 'title2': 'C', 'viewKey': 'TemperatureCelcius', }, ]; break; case vitalSignDetails.pulse: VSchart = [ { 'name': 'Pulse Beat Per Minute', 'title1': 'Date', 'title2': 'Minute', 'viewKey': 'PulseBeatPerMinute', }, ]; break; case vitalSignDetails.pespiration: VSchart = [ { 'name': 'Respiration Beat Per Minute', 'title1': 'Date', 'title2': 'Beat Per Minute', 'viewKey': 'RespirationBeatPerMinute', }, ]; break; case vitalSignDetails.bloodPressure: VSchart = [ { 'name': 'Blood Pressure Higher', 'title1': 'Date', 'title2': 'Minute', 'viewKey': 'BloodPressureHigher', }, { 'name': 'Blood Pressure Lower', 'title1': 'Date', 'title2': 'Minute', 'viewKey': 'BloodPressureLower', } ]; break; case vitalSignDetails.oxygenation: VSchart = [ { 'name': 'FIO2', 'title1': 'Date', 'title2': 'Cm', 'viewKey': 'FIO2', }, { 'name': 'SAO2', 'title1': 'Date', 'title2': 'Cm', 'viewKey': 'SAO2', }, ]; break; case vitalSignDetails.painScale: VSchart = [ { 'name': 'PainScore', 'title1': 'Date', 'title2': 'Cm', 'viewKey': 'PainScore', }, ]; break; default: } return BaseView( onModelReady: (model) { vitalList = model.patientVitalSignOrderdSubList; }, builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: pageTitle, body: ListView( children: VSchart.map((chartInfo) { var vitalListTemp = vitalList.where( (element) => element.toJson()[chartInfo['viewKey']] != null, ); return vitalListTemp.length != 0 ? VitalSingChartAndDetials( vitalList: vitalList, name: chartInfo['name'], title1: chartInfo['title1'], title2: chartInfo['title2'], viewKey: chartInfo['viewKey']) : Center( child: Container( margin: EdgeInsets.only( top: MediaQuery.of(context).size.height * 0.45), child: Center( child: DrAppEmbeddedError( error: TranslationBase.of(context).youDoNotHaveAnyItem), ), )); }).toList(), ), ), ); } } \ No newline at end of file +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class VitalSignItemDetailsScreen extends StatelessWidget { + final vitalSignDetails pageKey; + final String pageTitle; + List VSchart; + + VitalSignItemDetailsScreen({this.vitalList, this.pageKey, this.pageTitle}); + + final List vitalList; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + switch (pageKey) { + case vitalSignDetails.BodyMeasurements: + VSchart = [ + { + 'name': 'BMI', + 'nameAr': 'مؤشر الكتلة', + 'title1': 'Date', + 'title2': 'BMI', + 'title2Ar': 'الكتلة', + 'viewKey': 'BodyMassIndex', + }, + + ]; + + break; + + case vitalSignDetails.Temperature: + VSchart = [ + { + 'name': 'Temperature In Celsius', + 'nameAr': 'درجة الحرارة بالدرجة المئوية', + 'title1': 'Date', + 'title2': 'C', + 'title2Ar': 'ْس', + 'viewKey': 'TemperatureCelcius', + }, + ]; + + break; + case vitalSignDetails.Pulse: + VSchart = [ + { + 'name': 'Pulse Beat Per Minute', + 'nameAr': 'نبضة نبضة في الدقيقة', + 'title1': 'Date', + 'title2': 'Minute', + 'title2Ar': 'دقيقة', + 'viewKey': 'PulseBeatPerMinute', + }, + ]; + + break; + case vitalSignDetails.Prescriptions: + VSchart = [ + { + 'name': 'Respiration Beat Per Minute', + 'nameAr': 'ضربات التنفس في الدقيقة', + 'title1': 'Date', + 'title2': 'Beat Per Minute', + 'title2Ar': 'نفس في الدقيقة', + 'viewKey': 'RespirationBeatPerMinute', + }, + ]; + + break; + case vitalSignDetails.BloodPressure: + VSchart = [ + { + 'name': 'Blood Pressure Systolic Diastolic', + 'nameAr': 'ضغط الدم الإنقباض الإنبساط', + 'title1': 'Date', + 'title2': 'systolic', + 'title3': 'Diastolic', + 'title2Ar': 'الإنقباض', + 'title3Ar': 'الإنبساط', + 'viewKey': 'BloodPressure', + }, + + ]; + + break; + case vitalSignDetails.Respiration: + VSchart = [ + { + 'name': 'Respiration Rate', + 'nameAr': 'معدل التنفس', + 'title1': 'Date', + 'title2': 'bpm', + 'title2Ar': 'نفس', + 'viewKey': 'RespirationBeatPerMinute', + }, + ]; + + break; + case vitalSignDetails.heart: + VSchart = [ + { + 'name': 'Heart rate', + 'nameAr': 'معدل النبض بالدقيقة', + 'title1': 'Date', + 'title2': 'bpm', + 'title2Ar': 'نبضة', + 'viewKey': 'PulseBeatPerMinute', + }, + ]; + + break; + case vitalSignDetails.PainScale: + VSchart = [ + { + 'name': 'PainScore', + 'nameAr': 'نقاط الألم', + 'title1': 'Date', + 'title2': 'Cm', + 'title2Ar': 'سم', + 'viewKey': 'PainScore', + }, + ]; + + break; + case vitalSignDetails.Weight: + VSchart = [ + { + 'name': 'Weight Kg', + 'nameAr': 'الوزن كجم', + 'title1': 'Date', + 'title2': 'Kg', + 'title2Ar': 'كجم', + 'viewKey': 'WeightKg', + }, + ]; + + break; + + case vitalSignDetails.Height: + VSchart = [ + { + 'name': 'Height Cm', + 'nameAr': 'الطول سم', + 'title1': 'Date', + 'title2': 'Cm', + 'title2Ar': 'سم', + 'viewKey': 'HeightCm', + }, + ]; + + break; + default: + } + return AppScaffold( + appBarTitle: pageTitle, + isShowAppBar: true, + body: ListView( + children: VSchart.map((chartInfo) { + var vitalListTemp = vitalList.where( + (element) => element.toJson()[chartInfo['viewKey']] != null, + ); + + if(vitalListTemp.length != 0 && chartInfo['viewKey']=='BloodPressure'){ + return VitalSingChartBloodPressure( + vitalList: vitalList, + name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], + title1: chartInfo['title1'], + title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], + title3:projectViewModel.isArabic?chartInfo['title3Ar']: chartInfo['title3'], + viewKey1: 'BloodPressureHigher', + viewKey2: 'BloodPressureLower', + + ); + } + + return vitalListTemp.length != 0 + ? VitalSingChartAndDetials( + vitalList: vitalList, + name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], + title1: chartInfo['title1'], + title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], + viewKey: chartInfo['viewKey']) + : Container(); + }).toList(), + ), + ); + } +} diff --git a/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart b/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart index 7ae4937a..fbc0f3e1 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart @@ -1,16 +1,17 @@ -import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; -import 'package:doctor_app_flutter/widgets/patients/vital_sign_details_wideget.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier.dart'; -import 'package:doctor_app_flutter/widgets/shared/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -/* - *@author: Elham Rababah - *@Date:03/6/2020 - *@param: - *@return: - *@desc: VitalSingChartAndDetials - */ +import 'package:charts_flutter/flutter.dart' as charts; + +import 'LineChartCurved.dart'; + class VitalSingChartAndDetials extends StatelessWidget { VitalSingChartAndDetials({ Key key, @@ -21,30 +22,53 @@ class VitalSingChartAndDetials extends StatelessWidget { @required this.title2, }) : super(key: key); - final List vitalList; + final List vitalList; final String name; final String viewKey; final String title1; final String title2; + List timeSeriesData = []; @override Widget build(BuildContext context) { - return Column( + generateData(); + return timeSeriesData.length != 0 ? Column( children: [ AppExpandableNotifier( - headerWid: AppTimeSeriesChart( + // isExpand: true, + headerWid: LineChartCurved(title: name,timeSeries:timeSeriesData,indexes: timeSeriesData.length~/5.5,), + bodyWid: VitalSignDetailsWidget( vitalList: vitalList, - chartName: name, + title1: title1, + title2: title2, viewKey: viewKey, ), - bodyWid: VitalSignDetailsWidget( - vitalList: vitalList.reversed.toList(), - title1: '${title1}', - title2: '${title2}', - viewKey: '${viewKey}', - ), ), ], + ) : Container( + width: double.infinity, + height: MediaQuery.of(context).size.height, + child: Center( + child: AppText(TranslationBase.of(context).vitalSignDetailEmpty), + ), ); } + + generateData() { + if (vitalList.length > 0) { + vitalList.reversed.toList().forEach( + (element) { + DateTime elementDate = DateUtils.getDateTimeFromServerFormat(element.createdOn); + if(element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0) + timeSeriesData.add( + TimeSeriesSales2( + new DateTime(elementDate.year, elementDate.month, elementDate.day), + element.toJson()[viewKey].toDouble(), + ), + ); + }, + ); + } + return timeSeriesData.reversed.toList(); + } } diff --git a/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart b/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart new file mode 100644 index 00000000..dd9f940f --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart @@ -0,0 +1,88 @@ +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier.dart'; +import 'package:flutter/material.dart'; + +import 'package:charts_flutter/flutter.dart' as charts; + +import 'LineChartCurved.dart'; +import 'LineChartCurvedBloodPressure.dart'; + +class VitalSingChartBloodPressure extends StatelessWidget { + VitalSingChartBloodPressure({ + Key key, + @required this.vitalList, + @required this.name, + @required this.viewKey1, + @required this.viewKey2, + @required this.title1, + @required this.title2, + @required this.title3, + }) : super(key: key); + + final List vitalList; + final String name; + final String viewKey1; + final String viewKey2; + final String title1; + final String title2; + final String title3; + List timeSeriesData1 = []; + List timeSeriesData2 = []; + + @override + Widget build(BuildContext context) { + generateData(); + return Column( + children: [ + AppExpandableNotifier( + // isExpand: true, + headerWid: LineChartCurvedBloodPressure( + title: name, + timeSeries1: timeSeriesData1, + timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), + bodyWid: VitalSignBloodPressureWidget( + vitalList: vitalList, + title1: title1, + title2: title2, + title3: title3, + viewKey1: viewKey1, + viewKey2: viewKey2, + ), + ), + ], + ); + } + + generateData() { + if (vitalList.length > 0) { + vitalList.reversed.toList().forEach( + (element) { + DateTime elementDate = + DateUtils.getDateTimeFromServerFormat(element.createdOn); + if (element.toJson()[viewKey1]?.toInt() != 0) + timeSeriesData1.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.toJson()[viewKey1].toDouble(), + ), + ); + if (element.toJson()[viewKey2]?.toInt() != 0) + timeSeriesData2.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.toJson()[viewKey2].toDouble(), + ), + ); + }, + ); + } + } +} diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart new file mode 100644 index 00000000..a7e10f25 --- /dev/null +++ b/lib/screens/prescription/add_prescription_form.dart @@ -0,0 +1,1253 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:flutter/services.dart'; + +addPrescriptionForm(context, PrescriptionViewModel model, + PatiantInformtion patient, prescription) { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext bc) { + return PrescriptionFormWidget(model, patient, prescription); + }); +} + +postProcedure( + {String duration, + String doseTimeIn, + String dose, + String drugId, + String strength, + String route, + String frequency, + String indication, + String instruction, + PrescriptionViewModel model, + DateTime doseTime, + String doseUnit, + String icdCode, + PatiantInformtion patient}) async { + PostPrescriptionReqModel postProcedureReqModel = + new PostPrescriptionReqModel(); + List sss = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.clinicID = patient.clinicId; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + sss.add(PrescriptionRequestModel( + covered: true, + dose: double.parse(dose), + itemId: drugId.isEmpty ? 1 : int.parse(drugId), + doseUnitId: int.parse(doseUnit), + route: route.isEmpty ? 1 : int.parse(route), + frequency: frequency.isEmpty ? 1 : int.parse(frequency), + remarks: instruction, + approvalRequired: true, + icdcode10Id: icdCode.toString(), + doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), + duration: duration.isEmpty ? 1 : int.parse(duration), + doseStartDate: doseTime.toIso8601String())); + postProcedureReqModel.prescriptionRequestModel = sss; + //postProcedureReqModel.procedures = controlsProcedure; + + await model.postPrescription(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('Medication has been added'); + } +} + +class PrescriptionFormWidget extends StatefulWidget { + final PrescriptionViewModel model; + PatiantInformtion patient; + List prescriptionList; + PrescriptionFormWidget(this.model, this.patient, this.prescriptionList); + + @override + _PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState(); +} + +class _PrescriptionFormWidgetState extends State { + int selectedType; + TextEditingController durationController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + TextEditingController indicationController = TextEditingController(); + TextEditingController instructionController = TextEditingController(); + DateTime selectedDate; + dynamic selectedDrug; + int strengthChar; + GetMedicationResponseModel _selectedMedication; + GlobalKey key = + new GlobalKey>(); + + TextEditingController drugIdController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + final searchController = TextEditingController(); + + var notesList; + var filteredNotesList; + String textSeartch = "Amoxicillin"; + + final GlobalKey formKey = GlobalKey(); + final double spaceBetweenTextFileds = 12; + List referToList; + dynamic type; + dynamic strength; + dynamic route; + dynamic frequency; + dynamic duration; + dynamic doseTime; + dynamic indication; + dynamic units; + dynamic uom; + dynamic box; + dynamic x; + + List indicationList; + String routeInatial = 'By Mouth'; + + //PatiantInformtion patient; + @override + void initState() { + super.initState(); + selectedType = 1; + referToList = List(); + + indicationList = List(); + + dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; + dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; + dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; + dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; + dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; + dynamic indication6 = { + "id": 550, + "name": "Phenytoin Hypersensitivity Syndrome" + }; + dynamic indication7 = {"id": 551, "name": "Asterixis"}; + dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; + dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; + dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; + + indicationList.add(indication1); + indicationList.add(indication2); + indicationList.add(indication3); + indicationList.add(indication4); + indicationList.add(indication5); + indicationList.add(indication6); + indicationList.add(indication7); + indicationList.add(indication8); + indicationList.add(indication9); + indicationList.add(indication10); + } + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + ListSelectDialog drugDialog; + final screenSize = MediaQuery.of(context).size; + + // final routeArgs = ModalRoute.of(context).settings.arguments as Map; + // patient = routeArgs['patient']; + + return BaseView( + onModelReady: (model) async { + x = model.patientAssessmentList.map((element) { + return element.icdCode10ID; + }); + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patient.patientMRN, + episodeID: widget.patient.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: widget.patient.appointmentNo); + await model.getMedicationList(); + await model.getMedicationStrength(); + await model.getMedicationDuration(); + await model.getMedicationRoute(); + await model.getMedicationFrequency(); + await model.getMedicationDoseTime(); + //await model.getMedicationIndications(); + await model.getPatientAssessment(getAssessmentReqModel); + //await model.getItem(); + }, + builder: ( + BuildContext context, + MedicineViewModel model, + Widget child, + ) => + NetworkBaseView( + baseViewModel: model, + child: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.9, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.45, + color: Color(0xffF8F8F8), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Row( + children: [ + AppText( + 'New Prescription Order', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.32, + ), + InkWell( + child: Icon( + Icons.close, + size: 23.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ], + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + height: MediaQuery.of(context).size.height * + 0.070, + color: Colors.white, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + Helpers.hideKeyboard(context); + setState(() { + _selectedMedication = null; + model.getItem( + itemID: _selectedMedication + .itemId); + }); + } + : null, + child: _selectedMedication == null + ? AutoCompleteTextField< + GetMedicationResponseModel>( + onFocusChanged: (__) { + if (_selectedMedication != + null) { + model.getItem( + itemID: + _selectedMedication + .itemId); + uom = _selectedMedication.uom; + } else { + null; + } + if (_selectedMedication != + null && + duration != null && + frequency != null && + strengthController.text != + null) { + model.getBoxQuantity( + freq: frequency[ + 'parameterCode'], + duration: duration['id'], + itemCode: + _selectedMedication + .itemId, + strength: double.parse( + strengthController + .text)); + box = model.boxQuintity; + + return; + } + }, + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication + .genericName + : null, + true, + ), + itemSubmitted: (item) => setState( + () => _selectedMedication = + item), + key: key, + suggestions: + model.allMedicationList, + itemBuilder: (context, + suggestion) => + new Padding( + child: Texts(suggestion + .description + + '/' + + suggestion + .genericName), + padding: + EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.genericName.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input + .toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith( + input.toLowerCase()), + ) + : TextField( + onEditingComplete: () { + model.getItem( + itemID: _selectedMedication + .itemId); + }, + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication + .description + + ('${_selectedMedication.genericName}') + : null, + false, + suffixIcon: + Icon(Icons.search)), + enabled: false, + ), + ), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Row( + children: [ + AppText( + 'Order Type', + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFB9382C), + value: 1, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text('Regular'), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.550, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter( + 5), + // WhitelistingTextInputFormatter + // .digitsOnly + ], + hintText: + TranslationBase.of(context) + .strength, + controller: strengthController, + keyboardType: + TextInputType.numberWithOptions( + decimal: true, + ), + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 5) { + DrAppToastMsg.showErrorToast( + "Only 5 Digits allowed for strength"); + } + }, + onSubmit: (_) { + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != + null) { + model.getBoxQuantity( + freq: frequency[ + 'parameterCode'], + duration: duration['id'], + itemCode: + _selectedMedication + .itemId, + strength: double.parse( + strengthController + .text)); + box = model.boxQuintity; + + return; + } + }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + width: 10.0, + ), + Container( + color: Colors.white, + width: MediaQuery.of(context) + .size + .width * + 0.350, + child: InkWell( + onTap: model.itemMedicineListUnit != + null + ? () { + Helpers.hideKeyboard( + context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .itemMedicineListUnit, + attributeName: + 'description', + attributeValueId: + 'parameterCode', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = selectedValue; + units['isDefault'] = + true; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext + context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'UNIT', + units != null + ? units['description'] + : null, + true), + enabled: false, + ), + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.itemMedicineListRoute != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: + model.itemMedicineListRoute, + attributeName: 'description', + attributeValueId: + 'parameterCode', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + route['isDefault'] = true; + }); + if (route == null) { + helpers.showErrorToast( + 'plase fill'); + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).route, + route != null + ? route['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.itemMedicineList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model.itemMedicineList, + attributeName: 'description', + attributeValueId: + 'parameterCode', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + frequency['isDefault'] = + true; + if (_selectedMedication != + null && + duration != null && + frequency != null && + strengthController + .text != + null) { + model.getBoxQuantity( + freq: frequency[ + 'parameterCode'], + duration: + duration['id'], + itemCode: + _selectedMedication + .itemId, + strength: double.parse( + strengthController + .text)); + + return; + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .frequency, + frequency != null + ? frequency['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.medicationDoseTimeList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .doseTime, + doseTime != null + ? doseTime['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + if (model.patientAssessmentList.isNotEmpty) + Container( + height: screenSize.height * 0.070, + width: double.infinity, + color: Colors.white, + child: Row( + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.29, + child: InkWell( + onTap: indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString(), + indication != null + ? indication['name'] + : null, + false), + enabled: true, + readOnly: true, + ), + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.65, + color: Colors.white, + child: InkWell( + onTap: indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + maxLines: 5, + decoration: + textFieldSelectorDecoration( + model + .patientAssessmentList[ + 0] + .asciiDesc + .toString(), + indication != null + ? indication['name'] + : null, + false), + enabled: true, + readOnly: true, + ), + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: () => + selectDate(context, widget.model), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.medicationDurationList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDurationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + if (_selectedMedication != + null && + duration != null && + frequency != null && + strengthController + .text != + null) { + model.getBoxQuantity( + freq: frequency[ + 'parameterCode'], + duration: + duration['id'], + itemCode: + _selectedMedication + .itemId, + strength: double.parse( + strengthController + .text), + ); + box = model.boxQuintity; + + return; + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .duration, + duration != null + ? duration['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "UOM", + uom != null ? uom : null, + false), + //enabled: false, + readOnly: true, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Box Quantity", + box != null + ? "Box Quantity: " + + model.boxQuintity.toString() + : null, + false), + //enabled: false, + readOnly: true, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of(context) + .instruction, + controller: instructionController, + //keyboardType: TextInputType.number, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + color: Color(0xff359846), + title: TranslationBase.of(context) + .addMedication, + fontWeight: FontWeight.w600, + onPressed: () { + // formKey.currentState.save(); + // Navigator.pop(context); + // openDrugToDrug(); + if (route == null || + frequency == null || + doseTime == null || + duration == null || + selectedDate == null || + units == null) { + DrAppToastMsg.showErrorToast( + "Please Fill All Fields"); + return; + } + if (_selectedMedication + .isNarcotic == + true) { + DrAppToastMsg.showErrorToast( + "Narcotic medicine can only be prescribed from VIDA"); + Navigator.pop(context); + return; + } + + if (double.parse( + strengthController.text) > + 1000.0) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } + if (double.parse( + strengthController.text) < + 0.0) { + DrAppToastMsg.showErrorToast( + "strength can't be zero"); + return; + } + + if (formKey.currentState + .validate()) { + Navigator.pop(context); + openDrugToDrug(model); + { + /*// var x = model + // .patientAssessmentList + // .map((value) => + // value.icdCode10ID) + // .toList() + // .join(','); + + postProcedure( + icdCode: model + .patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : "TEST", + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: strengthController.text, + doseUnit: + units['parameterCode'] + .toString(), + patient: widget.patient, + doseTimeIn: + doseTime['id'].toString(), + model: widget.model, + duration: + duration['id'].toString(), + frequency: + frequency['parameterCode'] + .toString(), + route: route['parameterCode'] + .toString(), + drugId: _selectedMedication + .itemId + .toString(), + strength: + strengthController.text, + indication: + indicationController.text, + instruction: + instructionController + .text, + doseTime: selectedDate, + ); + */ + } + } + + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + }), + ), + ), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + Helpers.hideKeyboard(context); + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + : null, + hintStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + labelText: selectedText != null ? '$hintText\n$selectedText' : null, + labelStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + ); + } + + openDrugToDrug(model) { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: SizeConfig.realScreenHeight * .5, + width: SizeConfig.realScreenWidth, + child: SingleChildScrollView( + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + DrugToDrug( + widget.patient, + getPriscriptionforDrug(widget.prescriptionList), + model.patientAssessmentList), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3), + child: AppButton( + title: TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + postProcedure( + icdCode: model.patientAssessmentList.isNotEmpty + ? model.patientAssessmentList[0].icdCode10ID + .isEmpty + ? "test" + : model.patientAssessmentList[0].icdCode10ID + .toString() + : "test", + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: strengthController.text, + doseUnit: units['parameterCode'].toString(), + patient: widget.patient, + doseTimeIn: doseTime['id'].toString(), + model: widget.model, + duration: duration['id'].toString(), + frequency: frequency['parameterCode'].toString(), + route: route['parameterCode'].toString(), + drugId: _selectedMedication.itemId.toString(), + strength: strengthController.text, + indication: indicationController.text, + instruction: instructionController.text, + doseTime: selectedDate, + ); + }, + )) + ], + )), + + //], + //) + ); + }); + } + + getPriscriptionforDrug(List prescriptionList) { + var prescriptionDetails = []; + prescriptionList[0].entityList.forEach((element) { + if (element.mediSpanGPICode != null) { + prescriptionDetails.add({ + 'DrugId': element.mediSpanGPICode, + 'DrugName': element.medicationName, + 'Dose': element.doseDailyQuantity, + 'DoseType': element.doseDailyUnitID, + 'Unit': element.uom, + 'FrequencyType': element.frequencyID, + 'Duration': element.doseDurationDays, + 'RouteID': element.routeID, + 'IsScreen': element.isSIG + }); + } + }); + if (_selectedMedication.mediSpanGPICode != null) { + prescriptionDetails.add({ + 'DrugId': _selectedMedication.mediSpanGPICode, + 'DrugName': _selectedMedication.description, + 'Dose': strengthController.text, + 'DoseType': units['parameterCode'].toString(), + 'Unit': units['description'], + 'FrequencyType': frequency['parameterCode'].toString(), + 'Duration': duration['id'].toString(), + 'RouteID': route['parameterCode'].toString(), + 'IsScreen': true + }); + } + return prescriptionDetails; + } +} diff --git a/lib/screens/prescription/drugtodrug.dart b/lib/screens/prescription/drugtodrug.dart new file mode 100644 index 00000000..ec2bda43 --- /dev/null +++ b/lib/screens/prescription/drugtodrug.dart @@ -0,0 +1,131 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/model/prescription_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_req_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class DrugToDrug extends StatefulWidget { + final PatiantInformtion patient; + final prescription; + final List listAssessment; + DrugToDrug(this.patient, this.prescription, this.listAssessment); + @override + _DrugToDrug createState() => _DrugToDrug(); +} + +class _DrugToDrug extends State { + int typeID = 1; + bool isLoaded = false; + List> expandableList = [ + {'name': 'CRITICAL', 'level': 'LEVEL_4'}, + {'name': 'HIGH', 'level': 'LEVEL_3'}, + {'name': 'MODERATE', 'level': 'LEVEL_2'}, + {'name': 'LOW', 'level': 'LEVEL_1'}, + {'name': 'INFO', 'level': 'INFO'}, + ]; + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: 2954208, //widget.patient.patientMRN, + episodeId: 210011002, //widget.patient.episodeNo, + appointmentNo: 2016055308, //widget.patient.appointmentNo, + doctorID: '', + editedBy: ''); + + VitalSignsViewModel model = new VitalSignsViewModel(); + SOAPViewModel model2 = new SOAPViewModel(); + + @override + void initState() { + getTypeID(); + getRequestedData(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return isLoaded == true + ? BaseView( + onModelReady: (model3) => model3.getDrugToDrug( + model.patientVitalSigns, + widget.listAssessment, + model2.patientAllergiesList, + widget.patient, + widget.prescription), + builder: (BuildContext context, PrescriptionViewModel model3, + Widget child) => + NetworkBaseView( + baseViewModel: model3, + child: Container( + height: SizeConfig.realScreenHeight * .4, + child: new ListView.builder( + itemCount: expandableList.length, + itemBuilder: (context, i) { + return new ExpansionTile( + title: new AppText( + expandableList[i]['name'] + + ' ' + + '(' + + getDrugInfo(expandableList[i]['level'], + model3) + .length + .toString() + + ')', + fontSize: 20, + fontWeight: FontWeight.bold, + ), + children: getDrugInfo( + expandableList[i]['level'], model3) + .map((item) { + return Container( + padding: EdgeInsets.all(10), + child: AppText( + item['comment'], + color: Colors.red[900], + )); + }).toList()); + })))) + : Container( + height: SizeConfig.realScreenHeight * .45, + child: Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.black), + ))); + } + + getTypeID() async { + var type = await sharedPref.getString(SLECTED_PATIENT_TYPE) == '0' ? 2 : 1; + setState(() { + typeID = type; + }); + } + + getRequestedData() async { + await model.getPatientVitalSign(widget.patient); + await model2.getPatientAllergy(generalGetReqForSOAP); + await model2.getMasterLookup(MasterKeysService.DiagnosisType); + if (model.state == ViewState.Idle && model2.state == ViewState.Idle) { + setState(() { + isLoaded = true; + }); + } + } + + List getDrugInfo(level, model3) { + return model3.drugToDrug.where((i) => i['Severity'] == level).toList(); + } +} diff --git a/lib/screens/prescription/prescription_authorazation_form.dart b/lib/screens/prescription/prescription_authorazation_form.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/prescription/prescription_details_page.dart b/lib/screens/prescription/prescription_details_page.dart new file mode 100644 index 00000000..e5d9ef7d --- /dev/null +++ b/lib/screens/prescription/prescription_details_page.dart @@ -0,0 +1,168 @@ +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionDetailsPage extends StatelessWidget { + final PrescriptionReport prescriptionReport; + + PrescriptionDetailsPage({Key key, this.prescriptionReport}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescriptions, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + prescriptionReport.itemDescription.isNotEmpty + ? prescriptionReport.itemDescription + : prescriptionReport.itemDescriptionN), + ), + ), + ) + ], + ), + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + child: Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + outside: BorderSide(width: 0.5)), + children: [ + TableRow( + children: [ + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center( + child: Texts( + TranslationBase.of(context).route, + fontSize: 14, + ))), + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center( + child: Texts( + TranslationBase.of(context).frequency, + fontSize: 14, + ))), + Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 4), + child: Center( + child: Texts( + "${TranslationBase.of(context).dailyDoses}", + fontSize: 14, + ))), + Container( + color: Colors.white, + height: 30, + width: double.infinity, + child: Center( + child: Texts( + TranslationBase.of(context).duration, + fontSize: 14, + ))), + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: + Center(child: Text(prescriptionReport.routeN))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: Center( + child: + Text(prescriptionReport.frequencyN ?? ''))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: Center( + child: Text( + '${prescriptionReport.doseDailyQuantity}'))), + Container( + color: Colors.white, + height: 50, + width: double.infinity, + child: + Center(child: Text('${prescriptionReport.days}'))) + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(5), + child: Center( + child: Column( + children: [ + Texts(TranslationBase.of(context).notes), + SizedBox( + height: 5, + ), + Divider( + height: 0.5, + color: Colors.grey[300], + ), + SizedBox( + height: 5, + ), + Texts(prescriptionReport.remarks ?? ''), + ], + ), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart new file mode 100644 index 00000000..031ee85f --- /dev/null +++ b/lib/screens/prescription/prescription_items_page.dart @@ -0,0 +1,227 @@ +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescriptions_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_details_page.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionItemsPage extends StatelessWidget { + final Prescriptions prescriptions; + final PatiantInformtion patient; + PrescriptionItemsPage({Key key, this.prescriptions, this.patient}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => + model.getPrescriptionReport(prescriptions: prescriptions,patient: patient), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescriptions, + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 18,right: 18), + child: Texts('Name ',bold: true,)), + Row( + children: [ + SizedBox(width: 18,), + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 0.5,color: Colors.grey) + ), + height: 45, + width: 45, + ), + SizedBox(width: 10,), + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Route: Monthly'), + Texts('Does: 2 Time a day with 1 hour gap'), + SizedBox(height: 12,), + Texts('Note: 2 Time a day with 1 hour gap'), + ], + ),) + + + ], + ) + ], + ), + ), + ), + + if (!prescriptions.isInOutPatient) + ...List.generate( + model.prescriptionReportList.length, + (index) => InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: + model.prescriptionReportList[index], + ), + ), + ), + child: Container( + width: double.infinity, + margin: + EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.prescriptionReportList[index] + .imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(model + .prescriptionReportList[index] + .itemDescription + .isNotEmpty + ? model.prescriptionReportList[index] + .itemDescription + : model.prescriptionReportList[index] + .itemDescriptionN)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + ), + )) + else + ...List.generate( + model.prescriptionReportEnhList.length, + (index) => InkWell( + onTap: () { + PrescriptionReport prescriptionReport = + PrescriptionReport( + imageSRCUrl: model + .prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model + .prescriptionReportEnhList[index] + .itemDescription, + itemDescriptionN: model + .prescriptionReportEnhList[index] + .itemDescription, + routeN: + model.prescriptionReportEnhList[index].route, + frequency: model + .prescriptionReportEnhList[index].frequency, + frequencyN: model + .prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model + .prescriptionReportEnhList[index] + .doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: + model.prescriptionReportEnhList[index].itemID, + remarks: model + .prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + ), + ), + ); + }, + child: Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model + .prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(model.prescriptionReportEnhList[index] + .itemDescription), + ], + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + ), + ), + ), + + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart new file mode 100644 index 00000000..18655e65 --- /dev/null +++ b/lib/screens/prescription/prescription_screen.dart @@ -0,0 +1,746 @@ +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class NewPrescriptionScreen extends StatefulWidget { + @override + _NewPrescriptionScreenState createState() => _NewPrescriptionScreenState(); +} + +class _NewPrescriptionScreenState extends State { + PersistentBottomSheetController _controller; + final _scaffoldKey = GlobalKey(); + TextEditingController strengthController = TextEditingController(); + int testNum = 0; + int strengthChar; + PatiantInformtion patient; + + @override + void initState() { + super.initState(); + } + + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getPrescription(mrn: patient.patientId), + builder: + (BuildContext context, PrescriptionViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescription, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + color: Colors.white, + child: Column( + children: [ + PatientPageHeaderWidget(patient), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + (model.prescriptionList.length != 0) + ? SizedBox( + height: + model.prescriptionList[0].rowcount == 0 + ? 200.0 + : 10.0) + : SizedBox(height: 200.0), + //model.prescriptionList == null + (model.prescriptionList.length != 0) + ? model.prescriptionList[0].rowcount == 0 + ? Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm( + context, + model, + patient, + model.prescriptionList); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: + Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(14.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular( + 10.0), + ), + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + ' Add more medication', + fontWeight: + FontWeight.w100, + fontSize: 12.5, + ), + Icon( + Icons.add, + color: + Color(0XFFB8382C), + ) + ], + ), + ), + ), + onTap: () { + addPrescriptionForm( + context, + model, + patient, + model.prescriptionList); + //model.postPrescription(); + }, + ), + SizedBox( + height: 10.0, + ), + ...List.generate( + model.prescriptionList[0] + .rowcount, + (index) => Container( + color: Colors.white, + child: Column( + children: [ + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.022, + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + // crossAxisAlignment: + // CrossAxisAlignment.start, + children: [ + Container( + color: Colors.white, + height: MediaQuery.of( + context) + .size + .height * + 0.21, + width: MediaQuery.of( + context) + .size + .width * + 0.1, + child: Column( + children: [ + AppText( + (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) + .toString() + : DateTime.now() + .year) + .toString(), + color: Colors + .green, + fontSize: + 13.5, + ), + AppText( + Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) + .month) + : DateTime.now() + .month) + .toUpperCase(), + color: Colors + .green, + ), + AppText( + DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn) + .day + .toString(), + color: Colors + .green, + ), + AppText( + Helpers.getTimeFormated(DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn)) + .toString(), + color: Colors + .green, + ), + ], + ), + ), + Container( + color: Colors.white, + // height: MediaQuery.of( + // context) + // .size + // .height * + // 0.3499, + width: MediaQuery.of( + context) + .size + .width * + 0.77, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Start Date:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + Helpers.getDateFormatted(DateTime.parse(model + .prescriptionList[0] + .entityList[index] + .startDate)), + fontSize: + 13.5, + ), + ), + SizedBox( + width: + 6.0, + ), + AppText( + 'Order Type:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .orderTypeDescription, + fontSize: + 13.0, + ), + ), + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Container( + color: Colors + .white, + child: + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .medicationName, + fontWeight: + FontWeight.w700, + fontSize: + 15.0, + ), + ), + ) + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doseDetail, + fontSize: + 15.0, + ), + ) + ], + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + AppText( + 'Indication: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].indication), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'UOM: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].uom), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'BOX Quantity: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'pharmacy Intervention ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), + ), + ), + ], + ), + SizedBox( + height: + 5.0), + Row( + children: [ + AppText( + 'pharmacist Remarks : ', + fontWeight: + FontWeight + .w700, + fontSize: + 15.0, + ), + Expanded( + child: AppText( + // commening below code because there is an error coming in the model please fix it before pushing it + model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, + fontSize: 15.0), + ) + ], + ), + SizedBox( + height: 20.0, + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .doctorName + + ": ", + fontWeight: + FontWeight + .w600, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doctorName, + fontWeight: + FontWeight.w700, + ), + ) + ], + ), + SizedBox( + height: 8.0, + ), + Row( + children: [ + AppText( + 'Doctor Remarks : ', + fontWeight: + FontWeight + .w700, + fontSize: + 13.0, + ), + Expanded( + child: + Container( + color: Colors + .white, + // height: MediaQuery.of(context).size.height * + // 0.038, + child: + RichText( + // maxLines: + // 2, + // overflow: + // TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 10.0), + text: + TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].remarks != null + ? model.prescriptionList[0].entityList[index].remarks + : "", + ), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + + // SizedBox( + // height: 40, + // ), + ], + ), + ), + Container( + color: Colors.white, + height: MediaQuery.of( + context) + .size + .height * + 0.16, + width: MediaQuery.of( + context) + .size + .width * + 0.06, + child: Column( + children: [ + InkWell( + child: Icon( + Icons + .edit), + onTap: () { + updatePrescriptionForm( + box: model + .prescriptionList[ + 0] + .entityList[ + index] + .quantity, + uom: model + .prescriptionList[ + 0] + .entityList[ + index] + .uom, + drugNameGeneric: model + .prescriptionList[ + 0] + .entityList[ + index] + .medicationName, + doseUnit: model.prescriptionList[0].entityList[index].doseDailyUnitID + .toString(), + doseStreangth: model.prescriptionList[0].entityList[index].doseDailyQuantity + .toString(), + duration: + model.prescriptionList[0].entityList[index].doseDurationDays + .toString(), + startDate: + model.prescriptionList[0].entityList[index].startDate + .toString(), + dose: model + .prescriptionList[ + 0] + .entityList[ + index] + .doseTimingID + .toString(), + frequency: + model.prescriptionList[0].entityList[index].frequencyID + .toString(), + rouat: model + .prescriptionList[0] + .entityList[index] + .routeID + .toString(), + patient: patient, + drugId: model.prescriptionList[0].entityList[index].medicineCode, + drugName: model.prescriptionList[0].entityList[index].medicationName, + remarks: model.prescriptionList[0].entityList[index].remarks, + model: model, + enteredRemarks: model.prescriptionList[0].entityList[index].remarks, + context: context); + //model.postPrescription(); + }, + ), + ], + ), + ), + ], + ), + Divider( + height: 0, + thickness: 1.0, + color: Colors.grey, + ), + ], + ), + ), + ), + ], + ), + ), + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm(context, model, + patient, model.prescriptionList); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + ], + ), + ), + ), + )), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } + } +} diff --git a/lib/screens/prescription/prescription_screen_history.dart b/lib/screens/prescription/prescription_screen_history.dart new file mode 100644 index 00000000..940cfc2a --- /dev/null +++ b/lib/screens/prescription/prescription_screen_history.dart @@ -0,0 +1,519 @@ +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class NewPrescriptionHistoryScreen extends StatefulWidget { + @override + _NewPrescriptionHistoryScreenState createState() => + _NewPrescriptionHistoryScreenState(); +} + +class _NewPrescriptionHistoryScreenState + extends State { + PersistentBottomSheetController _controller; + final _scaffoldKey = GlobalKey(); + TextEditingController strengthController = TextEditingController(); + int testNum = 0; + int strengthChar; + PatiantInformtion patient; + + @override + void initState() { + super.initState(); + } + + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getPrescription(mrn: patient.patientId), + builder: + (BuildContext context, PrescriptionViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescription, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + color: Colors.white, + child: Column( + children: [ + PatientPageHeaderWidget(patient), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + (model.prescriptionList.length != 0) + ? SizedBox( + height: + model.prescriptionList[0].rowcount == 0 + ? 200.0 + : 10.0) + : SizedBox(height: 200.0), + //model.prescriptionList == null + (model.prescriptionList.length != 0) + ? model.prescriptionList[0].rowcount == 0 + ? Container( + child: AppText( + 'Sorry , Theres no prescriptions for this patient', + color: Color(0xFFB9382C), + ), + ) + : Padding( + padding: EdgeInsets.all(14.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + ...List.generate( + model.prescriptionList[0] + .rowcount, + (index) => Container( + color: Colors.white, + child: Column( + children: [ + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.022, + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + // crossAxisAlignment: + // CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of( + context) + .size + .height * + 0.21, + width: MediaQuery.of( + context) + .size + .width * + 0.1, + child: Column( + children: [ + AppText( + (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) + .toString() + : DateTime.now() + .year) + .toString(), + color: Colors + .green, + fontSize: + 13.5, + ), + AppText( + Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) + .month) + : DateTime.now() + .month) + .toUpperCase(), + color: Colors + .green, + ), + AppText( + DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn) + .day + .toString(), + color: Colors + .green, + ), + AppText( + Helpers.getTimeFormated(DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn)) + .toString(), + color: Colors + .green, + ), + ], + ), + ), + Container( + // height: MediaQuery.of( + // context) + // .size + // .height * + // 0.3499, + width: MediaQuery.of( + context) + .size + .width * + 0.77, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Start Date:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + Helpers.getDateFormatted(DateTime.parse(model + .prescriptionList[0] + .entityList[index] + .startDate)), + fontSize: + 13.5, + ), + ), + SizedBox( + width: + 6.0, + ), + AppText( + 'Order Type:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .orderTypeDescription, + fontSize: + 13.0, + ), + ), + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Container( + child: + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .medicationName, + fontWeight: + FontWeight.w700, + fontSize: + 15.0, + ), + ), + ) + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doseDetail, + fontSize: + 15.0, + ), + ) + ], + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + AppText( + 'Indication: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].indication), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'UOM: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].uom), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'BOX Quantity: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'pharmacy Intervention ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), + ), + ), + ], + ), + SizedBox( + height: + 5.0), + Row( + children: [ + AppText( + 'pharmacist Remarks : ', + fontWeight: + FontWeight + .w700, + fontSize: + 15.0, + ), + Expanded( + child: AppText( + // commening below code because there is an error coming in the model please fix it before pushing it + model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, + fontSize: 15.0), + ) + ], + ), + SizedBox( + height: 20.0, + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .doctorName + + ": ", + fontWeight: + FontWeight + .w600, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doctorName, + fontWeight: + FontWeight.w700, + ), + ) + ], + ), + SizedBox( + height: 8.0, + ), + Row( + children: [ + AppText( + 'Doctor Remarks : ', + fontWeight: + FontWeight + .w700, + fontSize: + 13.0, + ), + Expanded( + child: + Container( + // height: MediaQuery.of(context).size.height * + // 0.038, + child: + RichText( + // maxLines: + // 2, + // overflow: + // TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 10.0), + text: + TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].remarks != null + ? model.prescriptionList[0].entityList[index].remarks + : "", + ), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + + // SizedBox( + // height: 40, + // ), + ], + ), + ), + ], + ), + Divider( + height: 0, + thickness: 1.0, + color: Colors.grey, + ), + ], + ), + ), + ), + ], + ), + ), + ) + : Container( + child: AppText( + 'Sorry , theres no prescriptions listed for this patient', + color: Color(0xFFB9382C), + ), + ) + ], + ), + ), + ), + )), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } + } +} diff --git a/lib/screens/prescription/prescription_warnings.dart b/lib/screens/prescription/prescription_warnings.dart new file mode 100644 index 00000000..44bcab0c --- /dev/null +++ b/lib/screens/prescription/prescription_warnings.dart @@ -0,0 +1,168 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +void prescriptionWarning(context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + height: 600, + child: Column( + children: [ + ...List.generate( + 5, + (index) => Container( + child: ExpansionTile( + title: AppText('Prescription warning and alerts(0)'), + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + 'DOSESCREENINGRESULTFORETCETC', + color: Color(0XFFB8382C), + ) + ], + ) + ], + ), + ), + ), + SizedBox( + height: 10.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: + Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Remarks', + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox( + height: 95.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'CONTINUE', + onPressed: () { + Navigator.pop(context); + authorizationForm(context); + }, + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + color: Colors.white, + title: 'remove', + fontColor: Colors.red, + onPressed: () { + Navigator.pop(context); + prescriptionWarning(context); + }, + ), + ], + ), + ), + ], + ), + ), + )); + }); +} + +void authorizationForm(context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return Container( + height: 500, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Prescription authorization'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 30.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Auth ID', + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Password', + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + obscureText: true, + ), + ), + SizedBox( + height: 190.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'CONTINUE', + onPressed: () { + Navigator.pop(context); + authorizationForm(context); + }, + ), + ], + ), + ), + ], + ), + ), + )); + }); +} diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart new file mode 100644 index 00000000..9f7e7f2f --- /dev/null +++ b/lib/screens/prescription/prescriptions_page.dart @@ -0,0 +1,114 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescriptions_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class PrescriptionsPage extends StatelessWidget { + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getPrescriptions(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: FractionallySizedBox( + widthFactor: 1.0, + child: ListView( + physics: BouncingScrollPhysics(), + children: [ + PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), + SizedBox(height: 12,), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Order',style: "caption2",color: Colors.black,fontSize: 13,), + Texts('Prescriptions',bold: true,fontSize: 22,), + ], + ), + ), + if(patientType!=null && patientType=='7') + InkWell( + onTap: (){ + //TODO Hussam call the add page here + }, + child: Container( + width: double.maxFinite, + height: 140, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Container( + height: 90, + child: Column( + children: [ + Container( + height: 40, + width: 40, + decoration: BoxDecoration( + color: Colors.grey[600], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Icon(Icons.add,color: Colors.white,), + ), + ), + SizedBox(height: 10,), + Texts('Apply for New Prescriptions Order',color: Colors.grey[600],fontWeight: FontWeight.w600,) + ], + ), + ), + ), + ), + ), + ...List.generate(model.prescriptionsList.length, (index) => InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage( + prescriptions: model.prescriptionsList[index], + patient: patient, + ), + ), + ), + child: DoctorCard( + doctorName: model.prescriptionsList[index].doctorName, + profileUrl: model.prescriptionsList[index].doctorImageURL, + branch: model.prescriptionsList[index].name, + appointmentDate: DateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,), + orderNo: model.prescriptionsList[index].appointmentNo.toString(), + invoiceNO:model.prescriptionsList[index].appointmentNo.toString(), + + ) + + )) + + ], + ), + ), + )); + } +} diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart new file mode 100644 index 00000000..7c1bc88e --- /dev/null +++ b/lib/screens/prescription/update_prescription_form.dart @@ -0,0 +1,1060 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class UpdatePrescriptionForm extends StatefulWidget { + final String drugName; + final String doseStreangth; + final int drugId; + final String remarks; + final PatiantInformtion patient; + final String duration; + final String route; + final String dose; + final String doseUnit; + final String enteredRemarks; + final String startDate; + final String frequency; + final String drugNameGeneric; + final String uom; + final int box; + + final PrescriptionViewModel model; + + UpdatePrescriptionForm( + {this.drugName, + this.doseStreangth, + this.drugId, + this.remarks, + this.patient, + this.duration, + this.route, + this.dose, + this.startDate, + this.doseUnit, + this.enteredRemarks, + this.frequency, + this.model, + this.drugNameGeneric, + this.uom, + this.box}); + @override + _UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState(); +} + +class _UpdatePrescriptionFormState extends State { + TextEditingController strengthController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + int testNum = 0; + int strengthChar; + PatiantInformtion patient; + dynamic route; + dynamic doseTime; + dynamic frequencyUpdate; + dynamic updatedDuration; + dynamic units; + GetMedicationResponseModel newSelectedMedication; + GlobalKey key = + new GlobalKey>(); + List indicationList; + dynamic indication; + DateTime selectedDate; + @override + void initState() { + super.initState(); + strengthController.text = widget.doseStreangth; + remarksController.text = widget.remarks; + indicationList = List(); + + dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; + dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; + dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; + dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; + dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; + dynamic indication6 = { + "id": 550, + "name": "Phenytoin Hypersensitivity Syndrome" + }; + dynamic indication7 = {"id": 551, "name": "Asterixis"}; + dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; + dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; + dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; + + indicationList.add(indication1); + indicationList.add(indication2); + indicationList.add(indication3); + indicationList.add(indication4); + indicationList.add(indication5); + indicationList.add(indication6); + indicationList.add(indication7); + indicationList.add(indication8); + indicationList.add(indication9); + indicationList.add(indication10); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return StatefulBuilder(builder: + (BuildContext context, StateSetter setState /*You can rename this!*/) { + return BaseView( + onModelReady: (model) async { + await model.getMedicationList(); + await model.getMedicationStrength(); + await model.getMedicationDuration(); + await model.getMedicationRoute(); + await model.getMedicationFrequency(); + await model.getMedicationDoseTime(); + await model.getItem(itemID: widget.drugId); + //await model.getMedicationIndications(); + route = model.getLookupByIdFilter( + model.itemMedicineListRoute, widget.route); + doseTime = + model.getLookupById(model.medicationDoseTimeList, widget.dose); + updatedDuration = model.getLookupById( + model.medicationDurationList, widget.duration); + units = model.getLookupByIdFilter( + model.itemMedicineListUnit, widget.doseUnit); + frequencyUpdate = model.getLookupById( + model.medicationFrequencyList, widget.frequency); + }, + builder: + (BuildContext context, MedicineViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: DraggableScrollableSheet( + initialChildSize: 0.98, + maxChildSize: 0.99, + minChildSize: 0.6, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.5, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.drugName.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 10.0, + ), + Column( + children: [ + // Container( + // height: MediaQuery.of(context).size.height * + // 0.070, + // child: InkWell( + // onTap: model.allMedicationList != null + // ? () { + // setState(() { + // newSelectedMedication = null; + // }); + // } + // : null, + // child: newSelectedMedication == null + // ? AutoCompleteTextField< + // GetMedicationResponseModel>( + // decoration: + // textFieldSelectorDecoration( + // widget.drugNameGeneric, + // newSelectedMedication != null + // ? newSelectedMedication + // .genericName + // : null, + // true, + // ), + // itemSubmitted: (item) => setState( + // () => newSelectedMedication = + // item), + // key: key, + // suggestions: + // model.allMedicationList, + // itemBuilder: (context, + // suggestion) => + // new Padding( + // child: Texts(suggestion + // .description + + // '/' + + // suggestion.genericName), + // padding: + // EdgeInsets.all(8.0)), + // itemSorter: (a, b) => 1, + // itemFilter: (suggestion, input) => + // suggestion.genericName + // .toLowerCase() + // .startsWith( + // input.toLowerCase()) || + // suggestion.description + // .toLowerCase() + // .startsWith( + // input.toLowerCase()) || + // suggestion.keywords + // .toLowerCase() + // .startsWith( + // input.toLowerCase()), + // ) + // : TextField( + // decoration: + // textFieldSelectorDecoration( + // TranslationBase.of(context) + // .searchMedicineNameHere, + // newSelectedMedication != null + // ? newSelectedMedication + // .description + + // ('${newSelectedMedication.genericName}') + // : null, + // true, + // ), + // enabled: false, + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + Container( + height: + MediaQuery.of(context).size.height * + 0.060, + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.4900, + height: MediaQuery.of(context) + .size + .height * + 0.55, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter( + 5), + // WhitelistingTextInputFormatter + // .digitsOnly + ], + + hintText: widget.doseStreangth, + fontSize: 15.0, + controller: strengthController, + keyboardType: TextInputType + .numberWithOptions( + decimal: true, + ), + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 5) { + DrAppToastMsg.showErrorToast( + "Only 5 Digits allowed for strength"); + } + }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + width: 10.0, + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.3700, + child: InkWell( + onTap: + model.itemMedicineListUnit != + null + ? () { + Helpers.hideKeyboard( + context); + ListSelectDialog + dialog = + ListSelectDialog( + list: model + .itemMedicineListUnit, + attributeName: + 'description', + attributeValueId: + 'parameterCode', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: + (BuildContext + context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'UNIT Type', + units != null + ? units[ + 'description'] + : null, + true), + enabled: false, + ), + ), + ), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.itemMedicineListRoute != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .itemMedicineListRoute, + attributeName: 'description', + attributeValueId: + 'parameterCode', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'Route', + route != null + ? route['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDoseTimeList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .doseTime, + doseTime != null + ? doseTime['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationFrequencyList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationFrequencyList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .frequency, + frequencyUpdate != null + ? frequencyUpdate[ + 'nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDurationList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDurationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .duration, + updatedDuration != null + ? updatedDuration[ + 'nameEn'] + .toString() + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: model.patientAssessmentList + .isNotEmpty + ? screenSize.height * 0.070 + : 0.0, + width: model.patientAssessmentList + .isNotEmpty + ? double.infinity + : 0.0, + child: model.patientAssessmentList + .isNotEmpty + ? Row( + children: [ + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.29, + child: InkWell( + onTap: + indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : '', + indication != null + ? indication[ + 'name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.61, + child: InkWell( + onTap: + indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + maxLines: 3, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .asciiDesc + .toString() + : '', + indication != null + ? indication[ + 'name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + ], + ) + : null), + SizedBox( + height: 12.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => + selectDate(context, widget.model), + child: TextField( + decoration: Helpers + .textFieldSelectorDecoration( + Helpers.getDateFormatted( + DateTime.parse( + widget.startDate)), + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + // duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + "UOM", + widget.uom != null + ? widget.uom + : null, + true), + // enabled: false, + readOnly: true, + ), + ), + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + // duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'Box Quantity', + widget.box != null + ? "Box Quantity: " + + widget.box.toString() + : null, + true), + // enabled: false, + readOnly: true, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + controller: remarksController, + maxLines: 7, + minLines: 4, + ), + ), + SizedBox( + height: 10.0, + ), + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.08, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'update prescription' + .toUpperCase(), + onPressed: () { + if (double.parse( + strengthController.text) > + 1000.0) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } + if (double.parse( + strengthController + .text) == + 0.0) { + DrAppToastMsg.showErrorToast( + "strength can't be zero"); + return; + } + if (strengthController + .text.length > + 4) { + DrAppToastMsg.showErrorToast( + "strength can't be more then 4 digits "); + return; + } + // if(units==null&& updatedDuration==null&&frequencyUpdate==null&&) + updatePrescription( + newStartDate: selectedDate, + newDoseStreangth: + strengthController + .text.isNotEmpty + ? strengthController + .text + : widget + .doseStreangth, + newUnit: units != null + ? units['parameterCode'] + .toString() + : widget.doseUnit, + doseUnit: widget.doseUnit, + doseStreangth: + widget.doseStreangth, + duration: widget.duration, + startDate: widget.startDate, + doseId: widget.dose, + frequencyId: widget.frequency, + routeId: widget.route, + patient: widget.patient, + model: widget.model, + newDuration: + updatedDuration != null + ? updatedDuration['id'] + .toString() + : widget.duration, + drugId: widget.drugId, + remarks: remarksController + .text, + route: route != null + ? route['parameterCode'] + .toString() + : widget.route, + frequency: + frequencyUpdate != null + ? frequencyUpdate[ + 'id'] + .toString() + : widget.frequency, + dose: doseTime != null + ? doseTime['id'] + .toString() + : widget.dose, + enteredRemarks: + widget.enteredRemarks); + Navigator.pop(context); + }, + ), + ], + ), + ), + ], + ), + ], + ), + ), + )), + ); + }), + ), + ), + ); + }); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + Helpers.hideKeyboard(context); + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + updatePrescription( + {PrescriptionViewModel model, + int drugId, + String newDrugId, + String frequencyId, + String remarks, + String dose, + String doseId, + String frequency, + String route, + String routeId, + String startDate, + DateTime newStartDate, + String doseUnit, + String doseStreangth, + String newDoseStreangth, + String duration, + String newDuration, + String newUnit, + String enteredRemarks, + PatiantInformtion patient}) async { + //PrescriptionViewModel model = PrescriptionViewModel(); + PostPrescriptionReqModel updatePrescriptionReqModel = + new PostPrescriptionReqModel(); + List sss = List(); + + updatePrescriptionReqModel.appointmentNo = patient.appointmentNo; + updatePrescriptionReqModel.clinicID = patient.clinicId; + updatePrescriptionReqModel.episodeID = patient.episodeNo; + updatePrescriptionReqModel.patientMRN = patient.patientMRN; + + sss.add(PrescriptionRequestModel( + covered: true, + dose: newDoseStreangth.isNotEmpty + ? double.parse(newDoseStreangth) + : double.parse(doseStreangth), + //frequency.isNotEmpty ? int.parse(dose) : 1, + itemId: drugId, + doseUnitId: + newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), + route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), + frequency: frequency.isNotEmpty + ? int.parse(frequency) + : int.parse(frequencyId), + remarks: remarks.isEmpty ? enteredRemarks : remarks, + approvalRequired: true, + icdcode10Id: "test2", + doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), + duration: newDuration.isNotEmpty + ? int.parse(newDuration) + : int.parse(duration), + doseStartDate: + newStartDate != null ? newStartDate.toIso8601String() : startDate)); + updatePrescriptionReqModel.prescriptionRequestModel = sss; + //postProcedureReqModel.procedures = controlsProcedure; + + await model.updatePrescription( + updatePrescriptionReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('Medication has been updated'); + } + } +} + +void updatePrescriptionForm( + {context, + String drugName, + String drugNameGeneric, + int drugId, + String remarks, + PrescriptionViewModel model, + PatiantInformtion patient, + String rouat, + String frequency, + String dose, + String duration, + String doseStreangth, + String doseUnit, + String enteredRemarks, + String uom, + int box, + String startDate}) { + TextEditingController remarksController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext context) { + return UpdatePrescriptionForm( + box: box, + uom: uom, + drugName: drugName, + patient: patient, + doseStreangth: doseStreangth, + remarks: remarks, + drugId: drugId, + enteredRemarks: enteredRemarks, + duration: duration, + dose: dose, + doseUnit: doseUnit, + frequency: frequency, + route: rouat, + startDate: startDate, + model: model, + drugNameGeneric: drugNameGeneric, + ); + }); +} diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart new file mode 100644 index 00000000..605bb61c --- /dev/null +++ b/lib/screens/procedures/add-procedure-form.dart @@ -0,0 +1,398 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'entity_list_checkbox_search_widget.dart'; +import 'entity_list_procedure_widget.dart'; + +valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, + List entityList) async { + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + + procedureValadteRequestModel.patientMRN = patient.appointmentNo; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; +} + +postProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + PatiantInformtion patient, + List entityList}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls(code: "ordertype", controlValue: "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await model.valadteProcedure(procedureValadteRequestModel); + if (model.state == ViewState.Idle) { + if (model.valadteProcedureList[0].entityList.length == 0) { + await model.postProcedure(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + helpers.showErrorToast( + model.valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + helpers.showErrorToast(model.error); + } +} + +void addSelectedProcedure( + context, ProcedureViewModel model, PatiantInformtion patient) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return AddSelectedProcedure( + model: model, + patient: patient, + ); + }); +} + +class AddSelectedProcedure extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddSelectedProcedure({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddSelectedProcedureState createState() => + _AddSelectedProcedureState(patient: patient, model: model); +} + +class _AddSelectedProcedureState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + _AddSelectedProcedureState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + List entityListProcedure = List(); + + dynamic selectedCategory; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Please Select Category', + fontWeight: FontWeight.w900, + fontSize: 15.0, + ), + SizedBox( + height: 10.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = selectedValue; + model.getProcedureCategory( + categoryName: selectedCategory[ + 'categoryName'], + categoryID: selectedCategory[ + 'categoryId'] <= + 9 + ? "0" + + selectedCategory[ + 'categoryId'] + .toString() + : selectedCategory[ + 'categoryId'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: selectedCategory != null + ? selectedCategory['categoryId'] == 02 || + selectedCategory['categoryId'] == 03 + ? EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : ProcedureListWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : null), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addSelectedProcedures, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart new file mode 100644 index 00000000..ada0641b --- /dev/null +++ b/lib/screens/procedures/add_lab_orders.dart @@ -0,0 +1,319 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'entity_list_checkbox_search_widget.dart'; +import 'entity_list_procedure_widget.dart'; + +valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, + List entityList) async { + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + + procedureValadteRequestModel.patientMRN = patient.appointmentNo; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; +} + +postProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + PatiantInformtion patient, + List entityList}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls(code: "ordertype", controlValue: "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await model.valadteProcedure(procedureValadteRequestModel); + if (model.state == ViewState.Idle) { + if (model.valadteProcedureList[0].entityList.length == 0) { + await model.postProcedure(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + helpers.showErrorToast( + model.valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + helpers.showErrorToast(model.error); + } +} + +void addSelectedLabOrder( + context, ProcedureViewModel model, PatiantInformtion patient) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return AddSelectedLabOrder( + model: model, + patient: patient, + ); + }); +} + +class AddSelectedLabOrder extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddSelectedLabOrder({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddSelectedLabOrderState createState() => + _AddSelectedLabOrderState(patient: patient, model: model); +} + +class _AddSelectedLabOrderState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + _AddSelectedLabOrderState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + List entityListProcedure = List(); + + dynamic selectedCategory; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) => model.getProcedureCategory( + categoryName: "Laboratory", categoryID: "02"), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'New Lab Order', + fontWeight: FontWeight.w900, + fontSize: 18.0, + ), + SizedBox( + height: 10.0, + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + widget.model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + )), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addSelectedProcedures, + color: Color(0xff359846), + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart new file mode 100644 index 00000000..c523c2b0 --- /dev/null +++ b/lib/screens/procedures/add_radiology_order.dart @@ -0,0 +1,319 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'entity_list_checkbox_search_widget.dart'; +import 'entity_list_procedure_widget.dart'; + +valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, + List entityList) async { + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + + procedureValadteRequestModel.patientMRN = patient.appointmentNo; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; +} + +postProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + PatiantInformtion patient, + List entityList}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls(code: "ordertype", controlValue: "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await model.valadteProcedure(procedureValadteRequestModel); + if (model.state == ViewState.Idle) { + if (model.valadteProcedureList[0].entityList.length == 0) { + await model.postProcedure(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + helpers.showErrorToast( + model.valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + helpers.showErrorToast(model.error); + } +} + +void addSelectedRadiologyOrder( + context, ProcedureViewModel model, PatiantInformtion patient) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return AddSelectedRadiologyOrder( + model: model, + patient: patient, + ); + }); +} + +class AddSelectedRadiologyOrder extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddSelectedRadiologyOrder({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddSelectedRadiologyOrderState createState() => + _AddSelectedRadiologyOrderState(patient: patient, model: model); +} + +class _AddSelectedRadiologyOrderState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + _AddSelectedRadiologyOrderState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + List entityListProcedure = List(); + + dynamic selectedCategory; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) => model.getProcedureCategory( + categoryName: "Radiology", categoryID: "03"), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'New Radiology Order', + fontWeight: FontWeight.w900, + fontSize: 18.0, + ), + SizedBox( + height: 10.0, + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + widget.model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + )), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addSelectedProcedures, + color: Color(0xff359846), + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart new file mode 100644 index 00000000..3426e4cd --- /dev/null +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -0,0 +1,237 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class EntityListCheckboxSearchWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(EntityList) removeHistory; + final Function(EntityList) addHistory; + final Function(EntityList) addRemarks; + + final bool Function(EntityList) isEntityListSelected; + final List masterList; + + EntityListCheckboxSearchWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected, + this.addRemarks}) + : super(key: key); + + @override + _EntityListCheckboxSearchWidgetState createState() => + _EntityListCheckboxSearchWidgetState(); +} + +class _EntityListCheckboxSearchWidgetState + extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.55, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: TranslationBase.of(context).searchProcedures, + suffixIcon: EvaIcons.search, + onChanged: (value) { + filterSearchResults(value); + }, + ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + ExpansionTile( + title: Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget.removeHistory( + historyInfo); + } else { + widget + .addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts( + historyInfo.procedureName, + variant: "bodyText", + bold: true, + color: Color(0xff575757)), + ), + ), + ], + ), + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12), + child: Row( + children: [ + AppText( + TranslationBase.of(context) + .orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + historyInfo.type = + setSelectedType(value) + .toString(); + + historyInfo.type = + value.toString(); + }, + ), + Text('routine'), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + historyInfo.type = + setSelectedType(value) + .toString(); + + historyInfo.type = + value.toString(); + }, + ), + Text(TranslationBase.of(context) + .urgent), + ], + ), + ), + ), + SizedBox( + height: 15.0, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12), + child: TextFields( + hintText: TranslationBase.of(context) + .remarks, + //controller: remarksController, + onChanged: (value) { + historyInfo.remarks = value; + }, + minLines: 3, + maxLines: 5, + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText( + "There's no procedures for this category", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/procedures/entity_list_procedure_widget.dart b/lib/screens/procedures/entity_list_procedure_widget.dart new file mode 100644 index 00000000..2f5c6ea2 --- /dev/null +++ b/lib/screens/procedures/entity_list_procedure_widget.dart @@ -0,0 +1,171 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProcedureListWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(EntityList) removeHistory; + final Function(EntityList) addHistory; + final Function(EntityList) addRemarks; + + final bool Function(EntityList) isEntityListSelected; + final List masterList; + + ProcedureListWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected, + this.addRemarks}) + : super(key: key); + + @override + _ProcedureListWidgetState createState() => _ProcedureListWidgetState(); +} + +class _ProcedureListWidgetState extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.55, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: TranslationBase.of(context).searchProcedures, + suffixIcon: EvaIcons.search, + onChanged: (value) { + filterSearchResults(value); + }, + ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts( + historyInfo.procedureName, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText( + "There's no procedures for this category", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart new file mode 100644 index 00000000..a03e1348 --- /dev/null +++ b/lib/screens/procedures/procedure_screen.dart @@ -0,0 +1,607 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class ProcedureScreen extends StatefulWidget { + @override + _ProcedureScreenState createState() => _ProcedureScreenState(); +} + +class _ProcedureScreenState extends State { + int selectedType = 0; + int testNum = 1; + PatiantInformtion patient; + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + TextEditingController procedureController = TextEditingController(); + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getProcedure(mrn: 0), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).orderProcedure, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + color: Colors.white, + child: Column( + children: [ + PatientPageHeaderWidget(patient), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + (model.procedureList.length != 0) + ? SizedBox( + height: model.procedureList[0].rowcount == 0 + ? 200.0 + : 10.0) + : SizedBox(height: 200.0), + //model.prescriptionList == null + (model.procedureList.length != 0) + ? model.procedureList[0].rowcount == 0 + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + model + .getProcedureCategory() + .then((value) { + addSelectedProcedure( + context, model, patient); + }); + + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + 'NO ORDER FOR PROCEDURE LISTED', + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(16.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + TranslationBase.of( + context) + .addMoreProcedure, + fontWeight: + FontWeight.w100, + fontSize: 12.5, + ), + Icon( + Icons.add, + color: Color(0XFFB8382C), + ) + ], + ), + ), + ), + onTap: () { + model + .getProcedureCategory() + .then((value) { + addSelectedProcedure( + context, model, patient); + }); + + //model.postPrescription(); + }, + ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // child: AppTextFormField( + // labelText: 'Add more procedure', + // borderColor: Colors.white, + // //suffixIcon: Icons.search, + // + // //textInputType: TextInputType.number, + // inputFormatter: ONLY_NUMBERS, + // onTap: () { + // addSelectedProcedure(context); + // }, + // ), + // ), + SizedBox( + height: 10.0, + ), + ...List.generate( + model.procedureList[0].rowcount, + (index) => Container( + color: Colors.white, + child: Column( + children: [ + SizedBox( + height: + MediaQuery.of(context) + .size + .height * + 0.022, + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Container( + height: MediaQuery.of( + context) + .size + .height * + 0.18, + width: MediaQuery.of( + context) + .size + .width * + 0.135, + child: Column( + children: [ + AppText( + DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .year + .toString(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 1 + ? Color( + 0xFFB9382C) + : Colors + .green), + AppText( + Helpers.getMonth(model.procedureList[0].entityList[index].orderDate != + null + ? (DateTime.parse(model.procedureList[0].entityList[index].orderDate) + .month) + : DateTime.now() + .month) + .toUpperCase(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 1 + ? Color( + 0xFFB9382C) + : Colors + .green), + AppText( + DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .day + .toString(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 1 + ? Color( + 0xFFB9382C) + : Colors + .green), + ], + ), + ), + Expanded( + child: Container( + width: MediaQuery.of( + context) + .size + .width * + 0.05, + child: Column( + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context) + .codeNo + + " : ", + fontWeight: + FontWeight + .w700, + fontSize: + 13.0, + ), + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .procedureId + .toString(), + fontSize: + 12.0, + ), + SizedBox( + width: 12.0, + ), + AppText( + TranslationBase.of(context) + .orderType + + " : ", + fontWeight: + FontWeight + .w700, + fontSize: + 13.0, + ), + Expanded( + child: AppText( + model.procedureList[0].entityList[index].orderType == + 0 + ? 'Routine' + : 'Urgent', + fontSize: + 13.5, + color: model.procedureList[0].entityList[index].orderType == + 1 + ? Color(0xFFB9382C) + : Colors.green), + ), + ], + ), + Row( + children: [ + AppText( + 'Order.NO' + + " : ", + fontWeight: + FontWeight + .w700, + fontSize: + 15.0, + ), + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .orderNo + .toString(), + fontSize: + 13.0, + ), + ], + ), + Row( + children: [ + Container( + child: + Expanded( + child: + AppText( + model + .procedureList[0] + .entityList[index] + .procedureName, + fontWeight: + FontWeight.w800, + ), + ), + ) + ], + ), + + Row( + children: [ + // AppText( + // TranslationBase.of(context) + // .price + + // " : ", + // fontWeight: + // FontWeight + // .w700, + // ), + // Expanded( + // child: AppText( + // model + // .procedureList[ + // 0] + // .entityList[ + // index] + // .price + // .toString(), + // fontSize: + // 13.0), + // ) + ], + ), + SizedBox( + height: 10.0, + ), + + Row( + children: [ + Expanded( + child: + Container( + height: MediaQuery.of(context) + .size + .height * + 0.047, + width: MediaQuery.of(context) + .size + .width * + 0.10, + child: + AppText( + model.procedureList[0].entityList[index].remarks != + null + ? model.procedureList[0].entityList[index].remarks.toString() + : "", + fontSize: + 11.5, + ), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + + // SizedBox( + // height: 40, + // ), + ], + ), + ), + ), + Container( + child: Column( + children: [ + InkWell( + child: Icon( + Icons.edit), + onTap: () { + // model + // .updateProcedure(); + if (model.procedureList[0].entityList[index].categoryID == 02 || + model + .procedureList[ + 0] + .entityList[ + index] + .categoryID == + 03 || + model + .procedureList[0] + .entityList[index] + .categoryID == + 55) { + updateProcedureForm( + context, + limetNo: model + .procedureList[ + 0] + .entityList[ + index] + .lineItemNo, + model: + model, + orderNo: model + .procedureList[ + 0] + .entityList[ + index] + .orderNo, + remarks: model + .procedureList[ + 0] + .entityList[ + index] + .remarks, + procedureName: model + .procedureList[ + 0] + .entityList[ + index] + .procedureName, + patient: + patient, + procedureId: model + .procedureList[ + 0] + .entityList[ + index] + .procedureId, + categoreId: model + .procedureList[ + 0] + .entityList[ + index] + .categoryID + .toString()); + } else { + helpers.showErrorToast( + 'You cant Update this Procedure'); + } + }, + ) + ], + ), + ), + ], + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + ], + ), + ), + ), + ], + ), + ), + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + model + .getProcedureCategory() + .then((value) { + addSelectedProcedure( + context, model, patient); + }); + + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + 'NO ORDER FOR PROCEDURE LISTED', + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ) + ], + ), + ), + ), + )), + ); + } +} diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart new file mode 100644 index 00000000..873e8bcf --- /dev/null +++ b/lib/screens/procedures/update-procedure.dart @@ -0,0 +1,455 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_procedure_widget.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +void updateProcedureForm(context, + {String procedureName, + int orderNo, + int limetNo, + PatiantInformtion patient, + String orderType, + String procedureId, + String remarks, + ProcedureViewModel model, + String categoreId}) { + //ProcedureViewModel model2 = ProcedureViewModel(); + TextEditingController remarksController = TextEditingController(); + TextEditingController orderController = TextEditingController(); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return UpdateProcedureWidget( + procedureName: procedureName, + remarks: remarks, + remarksController: remarksController, + patient: patient, + model: model, + procedureId: procedureId, + categoryId: categoreId, + orderNo: orderNo, + limetNo: limetNo, + ); + }); +} + +class UpdateProcedureWidget extends StatefulWidget { + final PatiantInformtion patient; + final ProcedureViewModel model; + final String procedureName; + final String remarks; + final TextEditingController remarksController; + final String procedureId; + final String categoryId; + final int orderNo; + final int limetNo; + + UpdateProcedureWidget( + {this.model, + this.procedureName, + this.remarks, + this.remarksController, + this.patient, + this.procedureId, + this.categoryId, + this.orderNo, + this.limetNo}); + @override + _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); +} + +class _UpdateProcedureWidgetState extends State { + int selectedType = 0; + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + void initState() { + super.initState(); + widget.remarksController.text = widget.remarks; + } + + List entityList = List(); + dynamic selectedCategory; + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return StatefulBuilder(builder: + (BuildContext context, StateSetter setState /*You can rename this!*/) { + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: + (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.procedureName.toUpperCase(), + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 30.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = + selectedValue; + model.getProcedureCategory( + categoryName: + selectedCategory[ + 'categoryName'], + categoryID: selectedCategory[ + 'categoryId'] <= + 9 + ? "0" + + selectedCategory[ + 'categoryId'] + .toString() + : selectedCategory[ + 'categoryId'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: selectedCategory != null + ? selectedCategory['categoryId'] == + 02 || + selectedCategory[ + 'categoryId'] == + 03 || + selectedCategory[ + 'categoryId'] == + 55 + ? EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget + .model + .categoriesList[0] + .entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + : ProcedureListWidget( + model: widget.model, + masterList: widget + .model + .categoriesList[0] + .entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + : null), + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text('routine'), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + fontSize: 15.0, + controller: widget.remarksController, + maxLines: 3, + minLines: 2, + onChanged: (value) {}, + ), + ), + SizedBox( + height: 50.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .updateProcedure + .toUpperCase(), + onPressed: () { + // if (entityList.isEmpty == true && + // widget.remarksController.text == + // widget.remarks) { + // DrAppToastMsg.showErrorToast( + // "Fill the mandatory procedure details"); + // return; + // } + Navigator.pop(context); + updateProcedure( + limetNO: widget.limetNo, + orderNo: widget.orderNo, + orderType: selectedType.toString(), + categorieId: widget.categoryId, + procedureId: widget.procedureId, + entityList: entityList, + patient: widget.patient, + model: widget.model, + remarks: + widget.remarksController.text); + // authorizationForm(context); + }, + ), + ], + ), + ), + ], + ), + ), + )), + ); + }), + ), + ); + }); + } + + updateProcedure( + {ProcedureViewModel model, + String remarks, + int limetNO, + int orderNo, + String newProcedureId, + String newCategorieId, + List entityList, + String orderType, + String procedureId, + PatiantInformtion patient, + String categorieId}) async { + UpdateProcedureRequestModel updateProcedureReqModel = + new UpdateProcedureRequestModel(); + List controls = List(); + ProcedureDetail controlsProcedure = new ProcedureDetail(); + + updateProcedureReqModel.appointmentNo = patient.appointmentNo; + + updateProcedureReqModel.episodeID = patient.episodeNo; + updateProcedureReqModel.patientMRN = patient.patientMRN; + updateProcedureReqModel.lineItemNo = limetNO; + updateProcedureReqModel.orderNo = orderNo; + + if (entityList.isNotEmpty) { + entityList.forEach((element) { + controls.add( + Controls(code: "remarks", controlValue: element.remarks ?? ''), + ); + controls.add( + Controls(code: "ordertype", controlValue: '1'), + ); + + controlsProcedure.procedure = element.procedureId; + controlsProcedure.category = int.parse(element.categoryID) > 9 + ? element.categoryID + : "0" + element.categoryID; + controlsProcedure.controls = controls; + }); + } else { + controls.add( + Controls( + code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""), + ); + controls.add( + Controls(code: "ordertype", controlValue: orderType), + ); + + controlsProcedure.procedure = procedureId; + controlsProcedure.category = '0' + categorieId; + + controlsProcedure.controls = controls; + } + // controlsProcedure.add(ProcedureDetail( + // category: categorieId, procedure: procedureId, controls: controls)); + updateProcedureReqModel.procedureDetail = controlsProcedure; + + await model.updateProcedure( + updateProcedureRequestModel: updateProcedureReqModel, + mrn: patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been updated'); + model.getProcedure(mrn: patient.patientMRN); + } + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart new file mode 100644 index 00000000..aaafa380 --- /dev/null +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -0,0 +1,295 @@ +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; + +class AddRescheduleLeavScreen extends StatelessWidget { + ProjectViewModel projectsProvider; + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + return BaseView( + onModelReady: (model) => + {model.getRescheduleLeave(), model.getCoveringDoctors()}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves, + body: SingleChildScrollView( + child: Column(children: [ + Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.all(10), + padding: + EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20), + decoration: BoxDecoration( + color: HexColor('#EAEAEA'), + borderRadius: BorderRadius.all(Radius.circular(20))), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10)), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + color: Colors.white, + ), + onPressed: () { + openLeave( + context, + false, + ); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).applyForReschedule, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 18, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + ), + ), + Column( + children: model.getReschduleLeave + .map((GetRescheduleLeavesResponse item) { + return RoundedContainer( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? HexColor('#CC9B14') + : Colors.red[800], + width: 5.0, + ))), + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.all(3), + margin: + EdgeInsets.only(top: 10), + child: AppText( + item.status == 1 + ? TranslationBase.of( + context) + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .pending + : TranslationBase.of( + context) + .rejected, + fontWeight: FontWeight.bold, + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? HexColor('#CC9B14') + : Colors.red[800], + fontSize: 14, + ), + ), + Padding( + padding: + EdgeInsets.only(top: 10), + child: AppText( + DateUtils + .convertStringToDateFormat( + item.dateTimeTo, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + )) + ]), + SizedBox( + height: 5, + ), + Container( + child: AppText( + item.requisitionType == 1 + ? TranslationBase.of(context) + .offTime + : TranslationBase.of(context) + .holiday + + ' ', + fontWeight: FontWeight.bold, + )), + SizedBox( + height: 5, + ), + Row(children: [ + AppText(TranslationBase.of(context) + .startDate), + AppText( + DateUtils.convertStringToDateFormat( + item.dateTimeFrom, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + ) + + // overflow: + // TextOverflow.ellipsis, + ]), + + // overflow: + // TextOverflow.ellipsis, + + SizedBox( + height: 5, + ), + Row( + children: [ + AppText(TranslationBase.of(context) + .endDate), + AppText( + DateUtils + .convertStringToDateFormat( + item.dateTimeTo, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + ) + ], + ), + + SizedBox( + height: 5, + ), + model.coveringDoctors.length > 0 + ? Row(children: [ + AppText( + TranslationBase.of(context) + .coveringDoctor, + ), + AppText( + getDoctor( + model.coveringDoctors, + item.coveringDoctorId), + fontWeight: FontWeight.bold, + ) + ]) + : SizedBox(), + // AppText( + // TranslationBase.of(context) + // .reasons, + // fontWeight: FontWeight.bold, + // ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 5), + child: AppText(getReasons( + model.allReasons, + item.reasonId))), + (item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + // color: Colors.green, //Colors.black, + onPressed: () => { + openLeave(context, true, + extendedData: item) + }, + ) + : SizedBox(), + ]), + ], + ), + SizedBox( + width: 10, + ), + ], + ), + ), + ], + )), + ], + ), + ); + }).toList(), + ) + ]))), + ); + } + + openLeave(BuildContext context, isExtend, {extendedData}) { + // showModalBottomSheet( + // context: context, + // builder: (context) { + // return new Container( + // child: RescheduleLeaveScreen( + // isExtend, + // extendedData, + // )); + // }); + + Navigator.push( + context, + FadePage( + page: RescheduleLeaveScreen( + isExtend, + extendedData, + ), + ), + ); + } + + getDoctor(model, doctorId) { + var obj; + obj = model.where((i) => i['doctorID'].toString() == doctorId).toList(); + //print(obj); + + return obj.length > 0 ? obj[0]['doctorName'] : ""; + } + + getReasons(model, reasonID) { + var obj; + obj = model.where((i) => i['id'] == reasonID).toList(); + //print(obj); + + return obj.length > 0 + ? projectsProvider.isArabic == true + ? obj[0]['nameAr'] + : obj[0]['nameEn'] + : ""; + } +} diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart new file mode 100644 index 00000000..7af6b72c --- /dev/null +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -0,0 +1,1068 @@ +import 'package:date_time_picker/date_time_picker.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/text_validator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; +import 'package:dropdown_search/dropdown_search.dart'; + +Helpers helpers = Helpers(); + +class RescheduleLeaveScreen extends StatefulWidget { + final isUpdate; + final updateData; + RescheduleLeaveScreen(this.isUpdate, this.updateData); + @override + _RescheduleLeaveScreen createState() => _RescheduleLeaveScreen(); +} + +class _RescheduleLeaveScreen extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + TextEditingController _toDateController2 = new TextEditingController(); + ProjectViewModel projectsProvider; + SickLeaveViewModel sickLeaveViewModel; + String _selectedClinic; + Map profile = {}; + var offTime = '1'; + var date; + var doctorID; + var reason; + var fromDate; + var toDate; + var clinicID; + String fromTime; + String toTime; + TextEditingController _controller4 = new TextEditingController(); + TextEditingController _controller5 = new TextEditingController(); + void _presentDatePicker(id) { + var date = new DateTime.now(); + var initialDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); + var firstDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); + showDatePicker( + context: context, + initialDate: initialDate, + firstDate: firstDate, + lastDate: DateTime(2050), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + if (id == 'fromDate') { + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + } else { + toDate = pickedDate; // + _toDateController2.text = df.format(pickedDate); + } + }); + + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + toDate = pickedDate; + }); + }); + } + + @override + void initState() { + getProfile(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => { + model2.getOffTime(), + model2.getReasons(18), + model2.getCoveringDoctors() + }, + builder: (_, model2, w) => GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // width: double.infinity, + // child: Padding( + // padding: EdgeInsets.only( + // top: SizeConfig.widthMultiplier * 0.9, + // bottom: + // SizeConfig.widthMultiplier * 0.9, + // right: SizeConfig.widthMultiplier * 3, + // left: SizeConfig.widthMultiplier * 3), + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.max, + // children: [ + // Expanded( + // // add Expanded to have your dropdown button fill remaining space + // child: + // DropdownButtonHideUnderline( + // child: new IgnorePointer( + // ignoring: true, + // child: DropdownButton( + // focusColor: + // Colors.grey, + // isExpanded: true, + // dropdownColor: + // Colors.grey, + // value: getClinicName( + // model) ?? + // "", + // iconSize: 0, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext + // context) { + // return model + // .getClinicNameList() + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize + // .max, + // children: < + // Widget>[ + // AppText( + // item, + // fontSize: + // SizeConfig.textMultiplier * + // 2.1, + // color: Colors + // .grey[ + // 500], + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: + // (newValue) => + // {}, + // items: model + // .getClinicNameList() + // .map((item) { + // return DropdownMenuItem( + // value: item + // .toString(), + // child: Text( + // item, + // textAlign: + // TextAlign + // .end, + // ), + // ); + // }).toList(), + // ))), + // ), + // ], + // ) + // ], + // ), + // )), + + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.all(Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // padding: EdgeInsets.all(5), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // new IgnorePointer( + // ignoring: true, + // child: AppTextFormField( + // readOnly: true, + // hintText: profile != null + // ? profile['DoctorName'] + // : "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS)) + // ], + // ), + // ), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + // focusColor: Colors.grey, + isExpanded: true, + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allOffTime + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item[ + 'description'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + offTime = newValue; + }), + if (offTime == '1') + { + model2 + .getReasons(18) + } + else if (offTime == '2') + { + model2 + .getReasons(19) + } + else if (offTime == + '3' || + offTime == '5') + { + model2 + .getReasons(102) + } + }, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + offTime == '1' + ? Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) + ], + )), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, + type: DateTimePickerType + .time, + controller: _controller4, + onChanged: (val) => + fromTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + fromTime = val, + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .toTime, + type: DateTimePickerType + .time, + controller: _controller5, + onChanged: (val) => + toTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + toTime = val, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: + _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase + .of(context) + .toDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], + ), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: reason == null + ? model2.allReasons[0] + ['id'] + .toString() + : reason, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allReasons + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'nameAr'] + : item[ + 'nameEn'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, + items: model2.allReasons + .map((item) { + return DropdownMenuItem< + String>( + value: item['id'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item['nameAr'] + : item[ + 'nameEn'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.coveringDoctors.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: + InputDecoration( + contentPadding: + EdgeInsets + .all(0), + border: + InputBorder + .none), + //maxHeight: 300, + items: model2 + .coveringDoctors + .map((item) { + return projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors + .forEach( + (newVal) => { + if (newVal['doctorName'] == + item || + newVal['doctorName'] == + item) + { + doctorID = + newVal['DoctorID'] + } + }); + }, + selectedItem: + getSelectedDoctor( + model2), + showSearchBox: true, + searchBoxDecoration: + InputDecoration( + border: + OutlineInputBorder(), + contentPadding: + EdgeInsets.fromLTRB( + 12, 12, 8, 0), + labelText: + "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: + BoxDecoration( + color: Theme.of( + context) + .primaryColorDark, + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 20), + topRight: + Radius.circular( + 20), + ), + ), + child: Center( + child: Text( + '', + style: TextStyle( + fontSize: 24, + fontWeight: + FontWeight + .bold, + color: + Colors.white, + ), + ), + ), + ), + popupShape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 24), + topRight: + Radius.circular( + 24), + ), + ), + ), + // DropdownButtonHideUnderline( + // child: DropdownButton( + // focusColor: Colors.grey, + // isExpanded: true, + // value: doctorID == null + // ? model2 + // .coveringDoctors[0] + // ['doctorID'] + // .toString() + // : doctorID, + // iconSize: 40, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext context) { + // return model2 + // .coveringDoctors + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize.max, + // children: [ + // AppText( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // fontSize: SizeConfig + // .textMultiplier * + // 2.1, + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: (newValue) => { + // setState(() { + // doctorID = newValue; + // }) + // }, + // items: model2 + // .coveringDoctors + // .map((item) { + // return DropdownMenuItem< + // String>( + // value: item['doctorID'] + // .toString(), + // child: Text( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // textAlign: + // TextAlign.start, + // ), + // ); + // }).toList(), + // )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + SizedBox(height: SizeConfig.screenHeight * .3), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context) + .updateReschedule + : TranslationBase.of(context) + .addReschedule, + color: HexColor('#359846'), + onPressed: () { + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .onlyOfftimeHoliday); + } + }, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], + ), + ), + ), + ), + ), + ))); + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + + setState(() { + this.profile = p; + if (widget.updateData != null) { + this.clinicID = widget.updateData.clinicId; + final df = new DateFormat('HH:mm:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + this.offTime = widget.updateData.requisitionType.toString(); + _toDateController.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); + //df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = + df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = this.fromTime.substring(0, this.fromTime.length - 3); + this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo)); + this.toTime = this.toTime.substring(0, this.toTime.length - 3); + _toDateController2.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); + _controller5.text = toTime; + _controller4.text = fromTime; + toDate = _toDateController2.text; + fromDate = _toDateController.text; + this.reason = widget.updateData.reasonId.toString(); + doctorID = widget.updateData.coveringDoctorId; + } + }); + } + + getClinicName(model) { + var clinicID = this.profile['ClinicID'] ?? 1; + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; + } + + addRecheduleLeave(model) async { + final df = new DateFormat('yyyy-MM-ddTHH:MM:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + var fromDates = fromDate; + var toDates = toDate; + if (offTime == '1') { + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); + } else { + fromDate = df.format(fromDates); + toDate = df.format(toDates); + } + Map request = { + "Requisition": { + "requisitionNo": 0, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['DoctorID'], + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, + "date": offTime == '1' ? fromDate : df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": fromTime, + "timeTo": toTime, + "timeFromstr": "", + "timeTostr": "" + } + ] + } + }; + + await model.addReschedule(request).then((value) { + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } + }); + } + + updateRecheduleLeave(model) { + // final df = new DateFormat('yyyy-MM-ddTHH:MM:ss'); + final df = new DateFormat('yyyy-MM-dd'); + var fromDates = fromDate; + var toDates = toDate; + if (offTime == '1') { + fromDate = df.format(DateTime.parse(_toDateController.text)) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString(); + toDate = df.format(DateTime.parse(_toDateController.text)) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString(); + } else { + fromDate = df.format(fromDates); + toDate = df.format(toDates); + } + + Map request = { + "Requisition": { + "requisitionNo": widget.updateData.requisitionNo, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['DoctorID'], + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, + "date": offTime == '1' ? fromDate : df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": "", + "timeTo": "", + "timeFromstr": fromTime, + "timeTostr": toTime + } + ] + } + }; + + model.updateReschedule(request).then((response) { + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } + }); + } + + getSelectedDoctor(model2) { + var doctorName; + if (doctorID == null) + return projectsProvider.isArabic + ? model2.coveringDoctors[0]['doctorNameN'] + : model2.coveringDoctors[0]['doctorName']; + else { + model2.coveringDoctors.forEach((newVal) => { + if (newVal['doctorID'].toString() == doctorID) + {doctorName = newVal['doctorName']} + }); + return doctorName; + } + } +} diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 79cd827e..16d53831 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -8,7 +9,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class SettingsScreen extends StatelessWidget { - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); @@ -34,7 +35,7 @@ class SettingsScreen extends StatelessWidget { child: AnimatedContainer( duration: Duration(milliseconds: 350), decoration: BoxDecoration( - color: !projectsProvider.isArabic ? HexColor('#58434F') : Colors.transparent, + color: !projectsProvider.isArabic ? AppGlobal.appPrimaryColor : Colors.transparent, border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0)) ), child: Center(child: AppText(TranslationBase.of(context).lanEnglish, color: !projectsProvider.isArabic ? Colors.white : Colors.grey[500])) @@ -47,7 +48,7 @@ class SettingsScreen extends StatelessWidget { child: AnimatedContainer( duration: Duration(milliseconds: 350), decoration: BoxDecoration( - color: projectsProvider.isArabic ? HexColor('#58434F') : Colors.transparent, + color: projectsProvider.isArabic ? AppGlobal.appPrimaryColor : Colors.transparent, border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0)) ), child: Center(child: AppText(TranslationBase.of(context).lanArabic, color: projectsProvider.isArabic ? Colors.white : Colors.grey[500],)) diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart new file mode 100644 index 00000000..1297a673 --- /dev/null +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -0,0 +1,327 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AddSickLeavScreen extends StatelessWidget { + PatiantInformtion patient; + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getSickLeave(patient.patientMRN), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).sickleave, + body: SingleChildScrollView( + child: Column(children: [ + PatientProfileHeaderNewDesign( + patient, routeArgs['patientType'], routeArgs['arrivalType']), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).sickLeave, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ], + )), + Container( + width: SizeConfig.screenWidth, + margin: EdgeInsets.only( + left: 20, right: 20, top: 10, bottom: 10), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10)), + padding: EdgeInsets.all(3), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + color: Colors.white, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), + )), + Padding( + child: AppText( + TranslationBase.of(context).noSickLeaveApplied, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 16, + textAlign: TextAlign.center, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + )), + ], + ), + model.getAllSIckLeave.length > 0 + ? Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return RoundedContainer( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + width: 5.0, + ))), + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( + context) + .hold + : item.status == 2 + ? TranslationBase.of( + context) + .active + : TranslationBase.of( + context) + .all, + fontWeight: FontWeight.bold, + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + ), + ), + Row( + children: [ + AppText(TranslationBase.of( + context) + .daysSickleave), + AppText( + item.noOfDays.toString(), + fontWeight: FontWeight.bold, + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .startDate + + ' ', + ), + Flexible( + child: AppText( + DateUtils + .convertStringToDateFormat( + item.startDate, + 'dd-MMM-yyyy'), + fontWeight: FontWeight.bold, + )) + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + item.remarks ?? "", + ), + (item.status == 1 || + item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + + // color: Colors.green, //Colors.black, + onPressed: () => { + if (item.status == + 1) + { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .sickleaveonhold) + } + else + { + openSickLeave( + context, + true, + extendedData: + item) + } + }, + ) + : SizedBox() + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + ], + )), + ], + )); + }).toList(), + ) + : new Builder(builder: (context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).sickLeave, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ], + )), + Container( + width: SizeConfig.screenWidth, + margin: EdgeInsets.only( + left: 20, right: 20, top: 20, bottom: 20), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: + BorderRadius.circular(10)), + padding: EdgeInsets.all(3), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + color: Colors.white, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), + )), + Padding( + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 16, + textAlign: TextAlign.center, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + )), + SizedBox( + height: SizeConfig.screenHeight * .6, + ) + ], + ); + }), + ])))); + } + + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { + // showModalBottomSheet( + // context: context, + // builder: (context) { + // return new Container( + // child: + Navigator.push( + context, + FadePage( + page: SickLeaveScreen( + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, + isExtended: isExtend, + extendedData: extendedData, + patient: patient))); + } +} diff --git a/lib/screens/sick-leave/show-sickleave.dart b/lib/screens/sick-leave/show-sickleave.dart new file mode 100644 index 00000000..52ec7094 --- /dev/null +++ b/lib/screens/sick-leave/show-sickleave.dart @@ -0,0 +1,172 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class ShowSickLeaveScreen extends StatelessWidget { + PatiantInformtion patient; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => + model.getSickLeave(patient.patientMRN ?? patient.patientId), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: SingleChildScrollView( + child: Column( + children: [ + PatientProfileHeaderNewDesign( + patient, routeArgs['patientType'], routeArgs['arrivalType']), + Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return RoundedContainer( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + width: 5.0, + ))), + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of(context) + .hold + : item.status == 2 + ? TranslationBase.of( + context) + .active + : TranslationBase.of( + context) + .all, + fontWeight: FontWeight.bold, + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + ), + ), + Row( + children: [ + AppText(TranslationBase.of(context) + .daysSickleave), + AppText( + item.noOfDays.toString(), + fontWeight: FontWeight.bold, + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .startDate + + ' ', + ), + Flexible( + child: AppText( + DateUtils + .convertStringToDateFormat( + item.startDate, + 'dd-MMM-yyyy'), + fontWeight: FontWeight.bold, + )) + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + item.remarks ?? "", + ), + (item.status == 1 || + item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + + // color: Colors.green, //Colors.black, + onPressed: () => { + if (item.status == 1) + { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .sickleaveonhold) + } + // else + // { + // openSickLeave( + // context, + // true, + // extendedData: + // item) + // } + }, + ) + : SizedBox() + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + ], + )), + ], + )); + }).toList(), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart new file mode 100644 index 00000000..12f157c2 --- /dev/null +++ b/lib/screens/sick-leave/sick_leave.dart @@ -0,0 +1,483 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/text_validator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; + +Helpers helpers = Helpers(); + +class SickLeaveScreen extends StatefulWidget { + final bool isExtended; + final GetAllSickLeaveResponse extendedData; + final appointmentNo; + final patientMRN; + final patient; + SickLeaveScreen( + {this.appointmentNo, + this.patientMRN, + this.isExtended = false, + this.extendedData, + this.patient}); + @override + _SickLeaveScreenState createState() => _SickLeaveScreenState(); +} + +class _SickLeaveScreenState extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + String _selectedClinic; + Map profile = {}; + AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); + void _presentDatePicker(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2019), + lastDate: DateTime(2050), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + // var selectedDate = DateFormat.yMd().format(pickedDate); + final df = new DateFormat('yyyy-MM-dd'); + addSickLeave.startDate = df.format(pickedDate); + + _toDateController.text = addSickLeave.startDate; + //addSickLeave.startDate = selectedDate; + }); + }); + } + + @override + void initState() { + getProfile(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => model2.preSickLeaveStatistics( + widget.appointmentNo, widget.patientMRN), + builder: (_, model2, w) => GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + appBarTitle: widget.isExtended == true + ? TranslationBase.of(context).extendSickLeave + : TranslationBase.of(context).addSickLeave, + isShowAppBar: true, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + // Padding( + // child: AppText( + // widget.isExtended == true + // ? TranslationBase.of(context) + // .extendSickLeave + // : TranslationBase.of(context) + // .addSickLeave, + // fontWeight: FontWeight.bold, + // ), + // padding: EdgeInsets.all(10)), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .sickLeave + + ' ' + + TranslationBase.of(context) + .days)), + AppTextFormField( + borderColor: Colors.white, + onChanged: (value) { + addSickLeave.noOfDays = value; + if (widget.extendedData != null) { + widget.extendedData.noOfDays = + int.parse(value); + } + }, + hintText: widget.extendedData != null + ? widget.extendedData.noOfDays + .toString() + : '', + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ]), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .sickLeaveDate, + )), + AppTextFormField( + hintText: widget.extendedData != null + ? widget.extendedData.startDate + : '', + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + '_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + addSickLeave.startDate = value; + if (widget.extendedData != null) { + widget.extendedData.startDate = + value; + } + }), + ], + )), + Container( + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 5), + child: AppText( + TranslationBase.of(context) + .clinicName, + )), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + isExpanded: true, + value: getClinicName( + model) ?? + "", + iconSize: 0, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: < + Widget>[ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * + 2.1, + color: Colors + .grey, + ), + ], + ); + }).toList(); + }, + onChanged: + (newValue) => + {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: item + .toString(), + child: Text( + item, + textAlign: + TextAlign + .end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'] != + null + ? Padding( + child: AppText( + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'], + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + padding: EdgeInsets.all(10), + ) + : SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .doctorName, + )), + new IgnorePointer( + ignoring: true, + child: AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS)) + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context).remarks, + )), + TextField( + maxLines: 3, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(20.0), + border: InputBorder.none, + hintText: widget.extendedData != null + ? widget.extendedData.remarks + : ''), + onChanged: (value) { + addSickLeave.remarks = value; + if (widget.extendedData != null) { + widget.extendedData.remarks = value; + } + }, + ) + ], + ), + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isExtended == true + ? TranslationBase.of(context).extend + : TranslationBase.of(context) + .addSickLeaverequest, + color: Colors.green, + onPressed: () async { + if (widget.isExtended) { + await model2.extendSickLeave( + widget.extendedData); + + DrAppToastMsg.showSuccesToast( + model2.sickleaveResponse[ + 'ListSickLeavesToExtent'] + ['success']); + Navigator.of(context) + .popUntil((route) { + return route.settings.name == + PATIENTS_PROFILE; + }); + Navigator.of(context).pushNamed( + ADD_SICKLEAVE, + arguments: { + 'patient': widget.patient + }); + //print(value); + //}); + } else { + _validateInputs(model2); + } + }, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], + ), + ), + ), + ), + ), + ))); + } + + void _validateInputs(model2) async { + try { + if (addSickLeave.noOfDays == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterNoOfDays); + } else if (addSickLeave.remarks == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterRemarks); + } else if (addSickLeave.startDate == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterDate); + } else { + addSickLeave.patientMRN = widget.patient.patientMRN.toString(); + addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); + await model2.addSickLeave(addSickLeave).then((value) => print(value)); + + DrAppToastMsg.showSuccesToast( + model2.sickleaveResponse['ListSickLeavesToExtent']['success']); + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + Navigator.of(context) + .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); + } + } catch (err) { + print(err); + } + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; + }); + } + + getClinicName(model) { + var clinicInfo = model.clinicsList + .where((i) => i['ClinicID'] == this.profile['ClinicID']) + .toList(); + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; + } +} diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index f0f03ed8..ef292220 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -1,28 +1,45 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; class DateUtils { + static String convertDateToFormat(DateTime dateTime, String dateFormat) { + return DateFormat(dateFormat).format(dateTime); + } static String convertStringToDateFormat(String date, String dateFormat) { DateTime dateTime = DateTime.parse(date); - return DateFormat(dateFormat).format(dateTime); + return convertDateToFormat(dateTime, dateFormat); } static convertDateFromServerFormat(String str, dateFormat) { - const start = "/Date("; + var date = getDateTimeFromServerFormat(str); - const end = "+0300)"; + return DateFormat(dateFormat).format(date); + } - final startIndex = str.indexOf(start); + static DateTime getDateTimeFromServerFormat(String str) { + DateTime date= DateTime.now(); + if (str!=null) { + const start = "/Date("; - final endIndex = str.indexOf(end, startIndex + start.length); + const end = "+0300)"; - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); + final startIndex = str.indexOf(start); - return DateFormat(dateFormat).format(date); + final endIndex = str.indexOf(end, startIndex + start.length); + + date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + } else { + date = DateTime.now(); + } + + return date; } - static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate) { + static String differenceBetweenDateAndCurrentInYearMonthDay( + DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // now = now.add(Duration(days: 400, minutes: 0)); var difference = firstDate.difference(now); @@ -39,28 +56,29 @@ class DateUtils { final monthAgo = new DateTime(now.year, now.month - 1, firstDate.day); days = now.difference(monthAgo).inDays + 1; } - - - return "$days Days, $months Months, $years Years"; + return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}"; } - static String differenceBetweenDateAndCurrent(DateTime firstDate) { + static String differenceBetweenDateAndCurrent( + DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // DateTime now = nows.add(Duration(days: 400, minutes: 25, hours: 0)); var difference = now.difference(firstDate); int minutesInDays = difference.inMinutes; - int hoursInDays = minutesInDays ~/ 60; + int hoursInDays = + minutesInDays ~/ 60; // ~/ : truncating division to make the result int int minutes = minutesInDays % 60; int days = hoursInDays ~/ 24; int hours = hoursInDays % 24; double hoursInOneDay = difference.inHours / difference.inDays; - return "$days Days, $hours HR, $minutes Min"; + return "$days ${TranslationBase.of(context).days}, $hours ${TranslationBase.of(context).hr}, $minutes ${TranslationBase.of(context).min}"; } - static String differenceBetweenServerDateAndCurrent(String str) { + static String differenceBetweenServerDateAndCurrent( + String str, BuildContext context) { const start = "/Date("; const end = "+0300)"; @@ -71,7 +89,227 @@ class DateUtils { var date = new DateTime.fromMillisecondsSinceEpoch( int.parse(str.substring(startIndex + start.length, endIndex))); - return differenceBetweenDateAndCurrent(date); + return differenceBetweenDateAndCurrent(date, context); + } + + /// get month by + /// [weekDay] convert week day in int to week day name + static getWeekDay(int weekDay) { + switch (weekDay) { + case 1: + return "Monday"; + case 2: + return "Tuesday"; + case 3: + return "Wednesday"; + case 4: + return "Thursday"; + case 5: + return "Friday"; + case 6: + return "Saturday "; + case 7: + return "Sunday"; + } + } + + /// get month by + /// [weekDay] convert week day in int to week day name arabic + static getWeekDayArabic(int weekDay) { + switch (weekDay) { + case 1: + return "الاثنين"; + case 2: + return "الثلاثاء"; + case 3: + return "الاربعاء"; + case 4: + return "الخميس"; + case 5: + return "الجمعه"; + case 6: + return "السبت "; + case 7: + return "الاحد"; + } + } + + /// get month by + /// [month] convert month number in to month name + static getMonth(int month) { + switch (month) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + } + } + + /// get month by + /// [month] convert month number in to month name in Arabic + static getMonthArabic(int month) { + switch (month) { + case 1: + return "يناير"; + case 2: + return " فبراير"; + case 3: + return "مارس"; + case 4: + return "أبريل"; + case 5: + return "مايو"; + case 6: + return "يونيو"; + case 7: + return "يوليو"; + case 8: + return "أغسطس"; + case 9: + return "سبتمبر"; + case 10: + return " اكتوبر"; + case 11: + return " نوفمبر"; + case 12: + return "ديسمبر"; + } + } + + static getMonthByName(String month) { + switch (month.toLowerCase()) { + case 'january': + return 1; + case 'february': + return 2; + case 'march': + return 3; + case 'april': + return 4; + case 'may': + return 5; + case 'june': + return 6; + case 'july': + return 7; + case 'august': + return 8; + case 'september': + return 9; + case 'october': + return 10; + case 'november': + return 11; + case 'december': + return 12; + } + } + + static DateTime convertStringToDate(String date) { + // /Date(1585774800000+0300)/ + if (date != null) { + const start = "/Date("; + const end = "+0300)"; + final startIndex = date.indexOf(start); + final endIndex = date.indexOf(end, startIndex + start.length); + return DateTime.fromMillisecondsSinceEpoch( + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + ); + } else + return DateTime.now(); + } + + /// get data formatted like Apr 26,2020 + /// [dateTime] convert DateTime to data formatted Arabic + static String getMonthDayYearDateFormattedAr(DateTime dateTime) { + if (dateTime != null) + return getMonthArabic(dateTime.month) + + " " + + dateTime.day.toString() + + ", " + + dateTime.year.toString(); + else + return ""; + } + + /// get data formatted like Apr 26,2020 + /// [dateTime] convert DateTime to data formatted + static String getMonthDayYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + if (dateTime != null) + return isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) + + " " + + dateTime.day.toString() + + ", " + + dateTime.year.toString(); + else + return ""; + } + + /// get data formatted like 26 Apr 2020 + /// [dateTime] convert DateTime to data formatted + static String getDayMonthYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + if (dateTime != null) + return dateTime.day.toString()+" "+ "${isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) }"+ + " " + + + dateTime.year.toString(); + else + return ""; + } + + /// get data formatted like 10:45 PM + /// [dateTime] convert DateTime to data formatted + static String getHour(DateTime dateTime) { + return DateFormat('hh:mm a').format(dateTime); } -} + static String getAgeByBirthday(dynamic birthday, BuildContext context) { + // https://leechy.dev/calculate-dates-diff-in-dart + DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday); + final now = DateTime.now(); + int years = now.year - birthDate.year; + int months = now.month - birthDate.month; + int days = now.day - birthDate.day; + if (months < 0 || (months == 0 && days < 0)) { + years--; + months += (days < 0 ? 11 : 12); + } + if (days < 0) { + final monthAgo = new DateTime(now.year, now.month - 1, birthDate.day); + days = now.difference(monthAgo).inDays + 1; + } + return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; + } + + static bool isToday(DateTime dateTime){ + + DateTime todayDate = DateTime.now().toUtc(); + if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { + return true; + } + return false; + + } +} diff --git a/lib/util/dr_app_shared_pref.dart b/lib/util/dr_app_shared_pref.dart index 54c8cc45..2f6f3232 100644 --- a/lib/util/dr_app_shared_pref.dart +++ b/lib/util/dr_app_shared_pref.dart @@ -37,6 +37,13 @@ class DrAppSharedPreferances { return prefs.getString(key); } + /// Get String [key] the key was saved + getStringWithDefaultValue(String key, String defaultVal) async { + final SharedPreferences prefs = await _prefs; + String value = prefs.getString(key); + return value == null ? defaultVal : value; + } + setObj(String key, value) async { final SharedPreferences prefs = await _prefs; diff --git a/lib/util/dr_app_toast_msg.dart b/lib/util/dr_app_toast_msg.dart index fd1baa01..bf91a11f 100644 --- a/lib/util/dr_app_toast_msg.dart +++ b/lib/util/dr_app_toast_msg.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; - class DrAppToastMsg { + +class DrAppToastMsg { void showLongToast(msg) { FlutterFlexibleToast.showToast( message: msg, @@ -8,7 +9,7 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; ); } - static void showSuccesToast(msg) { + static void showSuccesToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_SHORT, @@ -19,7 +20,6 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; textColor: Colors.white); } - static void showErrorToast(msg) { FlutterFlexibleToast.showToast( message: msg, @@ -29,7 +29,7 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; icon: ICON.CLOSE, fontSize: 16, imageSize: 35, - timeInSeconds: 110, + timeInSeconds: 912, textColor: Colors.white); } @@ -41,7 +41,7 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; timeInSeconds: 1); } - void showTopShortToast(msg) { + static void showTopShortToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_SHORT, @@ -75,4 +75,4 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; void cancelToast(msg) { FlutterFlexibleToast.cancel(); } -} \ No newline at end of file +} diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 41c0b4f7..8a4cfbd0 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:html/parser.dart'; import '../config/size_config.dart'; import '../util/dr_app_toast_msg.dart'; @@ -108,7 +109,7 @@ class Helpers { itemExtent: 25, //height of each item - looping: true, + looping: false, onSelectedItemChanged: (int index) { // selectitem =index; cupertinoPickerIndex = index; @@ -302,6 +303,14 @@ class Helpers { return ""; } + static String getTimeFormated(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return dateTime.hour.toString() + ":" + dateTime.minute.toString(); + else + return ""; + } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 @@ -316,7 +325,7 @@ class Helpers { listOfHours.forEach((element) { WorkingHours workingHours = WorkingHours(); var from = element.substring( - element.indexOf('m ') + 2, element.indexOf('To') - 2); + element.indexOf('m ') + 2, element.indexOf('To') - 1); workingHours.from = from.trim(); var to = element.substring(element.indexOf('To') + 2); workingHours.to = to.trim(); @@ -345,9 +354,75 @@ class Helpers { } logout() async { + DEVICE_TOKEN = ""; String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); sharedPref.setString(APP_Language, lang); Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + + // TODO Fix it + // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); + } + + String parseHtmlString(String htmlString) { + final document = parse(htmlString); + final String parsedString = parse(document.body.text).documentElement.text; + + return parsedString; + } + + static InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon, Color dropDownColor}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: dropDownColor != null ? dropDownColor : Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + static BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor, + {double borderWidth = -1}) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: borderWidth == -1 ? 2.0 : borderWidth, + )), + ); + } + + /// hides the keyboard if its already open + static hideKeyboard(BuildContext context) { + FocusScope.of(context).unfocus(); + } + + static String capitalize(str) { + return "${str[0].toUpperCase()}${str.substring(1).toLowerCase()}"; } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 3bea8990..7ff65bb1 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -25,6 +25,7 @@ class TranslationBase { String get lanArabic => localizedValues['lanArabic'][locale.languageCode]; String get theDoctor => localizedValues['theDoctor'][locale.languageCode]; + String get reply => localizedValues['reply'][locale.languageCode]; String get time => localizedValues['time'][locale.languageCode]; @@ -33,7 +34,8 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode]; + String get replySuccessfully => + localizedValues['replySuccessfully'][locale.languageCode]; String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; @@ -44,214 +46,392 @@ class TranslationBase { localizedValues['errorNoSchedule'][locale.languageCode]; String get verify => localizedValues['verify'][locale.languageCode]; + String get referralDoctor => localizedValues['referralDoctor'][locale.languageCode]; + String get referringClinic => localizedValues['referringClinic'][locale.languageCode]; + String get frequency => localizedValues['frequency'][locale.languageCode]; + String get priority => localizedValues['priority'][locale.languageCode]; + String get maxResponseTime => localizedValues['maxResponseTime'][locale.languageCode]; + String get clinicDetailsandRemarks => localizedValues['clinicDetailsandRemarks'][locale.languageCode]; + String get answerSuggestions => localizedValues['answerSuggestions'][locale.languageCode]; + String get outPatients => localizedValues['outPatients'][locale.languageCode]; + String get searchPatient => localizedValues['searchPatient'][locale.languageCode]; + String get searchPatientName => + localizedValues['searchPatient-name'][locale.languageCode]; + String get searchAbout => localizedValues['searchAbout'][locale.languageCode]; + String get patient => localizedValues['patient'][locale.languageCode]; + String get labResult => localizedValues['labResult'][locale.languageCode]; + String get todayStatistics => localizedValues['todayStatistics'][locale.languageCode]; + String get familyMedicine => localizedValues['familyMedicine'][locale.languageCode]; + String get arrived => localizedValues['arrived'][locale.languageCode]; + String get er => localizedValues['er'][locale.languageCode]; + String get walkIn => localizedValues['walkIn'][locale.languageCode]; + String get notArrived => localizedValues['notArrived'][locale.languageCode]; + String get radiology => localizedValues['radiology'][locale.languageCode]; + String get service => localizedValues['service'][locale.languageCode]; + String get referral => localizedValues['referral'][locale.languageCode]; + String get inPatient => localizedValues['inPatient'][locale.languageCode]; + String get operations => localizedValues['operations'][locale.languageCode]; + String get patientServices => localizedValues['patientServices'][locale.languageCode]; + String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; + + String get myReferralPatient => + localizedValues['myReferralPatient'][locale.languageCode]; + + String get referPatient => + localizedValues['referPatient'][locale.languageCode]; + String get myReferral => localizedValues['myReferral'][locale.languageCode]; + String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; + String get referredPatient => + localizedValues['referredPatient'][locale.languageCode]; + String get referredOn => localizedValues['referredOn'][locale.languageCode]; + String get firstName => localizedValues['firstName'][locale.languageCode]; + String get middleName => localizedValues['middleName'][locale.languageCode]; + String get lastName => localizedValues['lastName'][locale.languageCode]; + String get phoneNumber => localizedValues['phoneNumber'][locale.languageCode]; + String get patientID => localizedValues['patientID'][locale.languageCode]; + String get patientFile => localizedValues['patientFile'][locale.languageCode]; + String get search => localizedValues['search'][locale.languageCode]; + String get onlyArrivedPatient => localizedValues['onlyArrivedPatient'][locale.languageCode]; + String get searchMedicineNameHere => localizedValues['searchMedicineNameHere'][locale.languageCode]; + String get youCanFind => localizedValues['youCanFind'][locale.languageCode]; + String get itemsInSearch => localizedValues['itemsInSearch'][locale.languageCode]; + String get qr => localizedValues['qr'][locale.languageCode]; + String get reader => localizedValues['reader'][locale.languageCode]; + String get startScanning => localizedValues['startScanning'][locale.languageCode]; + String get scanQrCode => localizedValues['scanQrCode'][locale.languageCode]; + String get scanQr => localizedValues['scanQr'][locale.languageCode]; + String get profile => localizedValues['profile'][locale.languageCode]; + String get gender => localizedValues['gender'][locale.languageCode]; + String get clinic => localizedValues['clinic'][locale.languageCode]; + + String get clinicSelect => + localizedValues['clinicSelect'][locale.languageCode]; + + String get doctorSelect => + localizedValues['doctorSelect'][locale.languageCode]; + String get hospital => localizedValues['hospital'][locale.languageCode]; + String get speciality => localizedValues['speciality'][locale.languageCode]; + String get errorMessage => localizedValues['errorMessage'][locale.languageCode]; + String get patientProfile => localizedValues['patientProfile'][locale.languageCode]; + String get vitalSign => localizedValues['vitalSign'][locale.languageCode]; + String get vital => localizedValues['vital'][locale.languageCode]; + String get signs => localizedValues['signs'][locale.languageCode]; + String get labOrder => localizedValues['labOrder'][locale.languageCode]; + String get lab => localizedValues['lab'][locale.languageCode]; + String get result => localizedValues['result'][locale.languageCode]; + String get medicines => localizedValues['medicines'][locale.languageCode]; - String get prescription => localizedValues['prescription'][locale.languageCode]; - String get insuranceApprovals => localizedValues['insuranceApprovals'][locale.languageCode]; + + String get prescription => + localizedValues['prescription'][locale.languageCode]; + + String get insuranceApprovals => + localizedValues['insuranceApprovals'][locale.languageCode]; + String get insurance => localizedValues['insurance'][locale.languageCode]; + String get approvals => localizedValues['approvals'][locale.languageCode]; + String get bodyMeasurements => localizedValues['bodyMeasurements'][locale.languageCode]; + String get temperature => localizedValues['temperature'][locale.languageCode]; + String get pulse => localizedValues['pulse'][locale.languageCode]; + String get respiration => localizedValues['respiration'][locale.languageCode]; + String get bloodPressure => localizedValues['bloodPressure'][locale.languageCode]; + String get oxygenation => localizedValues['oxygenation'][locale.languageCode]; + String get painScale => localizedValues['painScale'][locale.languageCode]; + String get errorNoVitalSign => localizedValues['errorNoVitalSign'][locale.languageCode]; + String get labOrders => localizedValues['labOrders'][locale.languageCode]; + String get errorNoLabOrders => localizedValues['errorNoLabOrders'][locale.languageCode]; + String get answerThePatient => localizedValues['answerThePatient'][locale.languageCode]; + String get pleaseEnterAnswer => localizedValues['pleaseEnterAnswer'][locale.languageCode]; + String get replay => localizedValues['replay'][locale.languageCode]; - String get progressNote => localizedValues['progressNote'][locale.languageCode]; + + String get progressNote => + localizedValues['progressNote'][locale.languageCode]; + String get progress => localizedValues['progress'][locale.languageCode]; + String get note => localizedValues['note'][locale.languageCode]; + String get searchNote => localizedValues['searchNote'][locale.languageCode]; + String get errorNoProgressNote => localizedValues['errorNoProgressNote'][locale.languageCode]; + String get invoiceNo => localizedValues['invoiceNo:'][locale.languageCode]; + String get orderNo => localizedValues['orderNo'][locale.languageCode]; + String get generalResult => localizedValues['generalResult'][locale.languageCode]; + String get description => localizedValues['description'][locale.languageCode]; + String get value => localizedValues['value'][locale.languageCode]; + String get range => localizedValues['range'][locale.languageCode]; + String get enterId => localizedValues['enterId'][locale.languageCode]; + String get pleaseEnterYourID => localizedValues['pleaseEnterYourID'][locale.languageCode]; + String get enterPassword => localizedValues['enterPassword'][locale.languageCode]; + String get pleaseEnterPassword => localizedValues['pleaseEnterPassword'][locale.languageCode]; + String get selectYourProject => localizedValues['selectYourProject'][locale.languageCode]; + String get pleaseEnterYourProject => localizedValues['pleaseEnterYourProject'][locale.languageCode]; + String get login => localizedValues['login'][locale.languageCode]; + String get drSulaimanAlHabib => localizedValues['drSulaimanAlHabib'][locale.languageCode]; + String get welcomeTo => localizedValues['welcomeTo'][locale.languageCode]; + String get welcomeBackTo => localizedValues['welcomeBackTo'][locale.languageCode]; + String get home => localizedValues['home'][locale.languageCode]; + String get services => localizedValues['services'][locale.languageCode]; + String get sms => localizedValues['sms'][locale.languageCode]; + String get fingerprint => localizedValues['fingerprint'][locale.languageCode]; + String get faceId => localizedValues['faceId'][locale.languageCode]; + String get whatsApp => localizedValues['whatsApp'][locale.languageCode]; + String get whatsAppBy => localizedValues['whatsAppBy'][locale.languageCode]; + String get pleaseChoose => localizedValues['pleaseChoose'][locale.languageCode]; + String get choose => localizedValues['choose'][locale.languageCode]; + String get verification => localizedValues['verification'][locale.languageCode]; + String get firstStep => localizedValues['firstStep'][locale.languageCode]; + String get yourAccount => localizedValues['yourAccount!'][locale.languageCode]; + String get verify1 => localizedValues['verify1'][locale.languageCode]; + String get youWillReceiveA => localizedValues['youWillReceiveA'][locale.languageCode]; + String get loginCode => localizedValues['loginCode'][locale.languageCode]; + String get smsBy => localizedValues['smsBy'][locale.languageCode]; + String get pleaseEnterTheCode => localizedValues['pleaseEnterTheCode'][locale.languageCode]; + String get youDontHaveAnyPatient => localizedValues['youDon\'tHaveAnyPatient'][locale.languageCode]; + String get youDoNotHaveAnyItem => localizedValues['youDoNotHaveAnyItem'][locale.languageCode]; + String get age => localizedValues['age'][locale.languageCode]; + String get nationality => localizedValues['nationality'][locale.languageCode]; + String get today => localizedValues['today'][locale.languageCode]; + String get tomorrow => localizedValues['tomorrow'][locale.languageCode]; + String get all => localizedValues['all'][locale.languageCode]; + String get nextWeek => localizedValues['nextWeek'][locale.languageCode]; + String get yesterday => localizedValues['yesterday'][locale.languageCode]; + String get errorNoInsuranceApprovals => localizedValues['errorNoInsuranceApprovals'][locale.languageCode]; + String get searchInsuranceApprovals => localizedValues['searchInsuranceApprovals'][locale.languageCode]; + String get status => localizedValues['status'][locale.languageCode]; + String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; + String get producerName => localizedValues['producerName'][locale.languageCode]; + String get receiptOn => localizedValues['receiptOn'][locale.languageCode]; + String get approvalNo => localizedValues['approvalNo'][locale.languageCode]; + String get doctor => localizedValues['doctor'][locale.languageCode]; + String get ext => localizedValues['ext'][locale.languageCode]; + String get veryUrgent => localizedValues['veryUrgent'][locale.languageCode]; + String get urgent => localizedValues['urgent'][locale.languageCode]; + String get routine => localizedValues['routine'][locale.languageCode]; + String get send => localizedValues['send'][locale.languageCode]; + String get referralFrequency => localizedValues['referralFrequency'][locale.languageCode]; + + String get selectReferralFrequency => + localizedValues['selectReferralFrequency'][locale.languageCode]; + String get clinicalDetailsAndRemarks => localizedValues['clinicalDetailsAndRemarks'][locale.languageCode]; + String get remarks => localizedValues['remarks'][locale.languageCode]; + String get pleaseFill => localizedValues['pleaseFill'][locale.languageCode]; + String get replay2 => localizedValues['replay2'][locale.languageCode]; - String get outPatient => localizedValues['outPatient'][locale.languageCode]; + + String get outPatient => localizedValues['outPatients'][locale.languageCode]; + String get logout => localizedValues['logout'][locale.languageCode]; + String get pharmaciesList => localizedValues['pharmaciesList'][locale.languageCode]; + String get price => localizedValues['price'][locale.languageCode]; + String get youCanFindItIn => localizedValues['youCanFindItIn'][locale.languageCode]; + String get radiologyReport => localizedValues['radiologyReport'][locale.languageCode]; + String get orders => localizedValues['orders'][locale.languageCode]; + String get list => localizedValues['list'][locale.languageCode]; + String get searchOrders => localizedValues['searchOrders'][locale.languageCode]; + String get prescriptionDetails => localizedValues['prescriptionDetails'][locale.languageCode]; + String get prescriptionInfo => localizedValues['prescriptionInfo'][locale.languageCode]; + String get errorNoOrders => localizedValues['errorNoOrders'][locale.languageCode]; + String get livecare => localizedValues['livecare'][locale.languageCode]; + String get beingBad => localizedValues['beingBad'][locale.languageCode]; + String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; String get cancel => localizedValues['cancel'][locale.languageCode]; + String get ok => localizedValues['ok'][locale.languageCode]; + String get done => localizedValues['done'][locale.languageCode]; String get searchMedicineImageCaption => @@ -269,10 +449,14 @@ class TranslationBase { String get transfertoadmin => localizedValues['transfertoadmin'][locale.languageCode]; - String get fromDate => localizedValues['toDate'][locale.languageCode]; + String get fromDate => localizedValues['fromDate'][locale.languageCode]; String get toDate => localizedValues['toDate'][locale.languageCode]; + String get fromTime => localizedValues['fromTime'][locale.languageCode]; + + String get toTime => localizedValues['toTime'][locale.languageCode]; + String get searchPatientImageCaptionTitle => localizedValues['searchPatientImageCaptionTitle'][locale.languageCode]; @@ -280,19 +464,735 @@ class TranslationBase { localizedValues['searchPatientImageCaptionBody'][locale.languageCode]; String get welcome => localizedValues['welcome'][locale.languageCode]; + String get typeMedicineName => localizedValues['typeMedicineName'][locale.languageCode]; + String get moreThan3Letter => localizedValues['moreThan3Letter'][locale.languageCode]; + String get gender2 => localizedValues['gender2'][locale.languageCode]; + String get age2 => localizedValues['age2'][locale.languageCode]; - String get admissionDetail => localizedValues['admissionDetail'][locale.languageCode]; + + String get sickleave => localizedValues['sick-leaves'][locale.languageCode]; + + String get patientSick => + localizedValues['patient-sick'][locale.languageCode]; + + String get leave => localizedValues['leave'][locale.languageCode]; + + String get submit => localizedValues['submit'][locale.languageCode]; + + String get doctorName => localizedValues['doc-name'][locale.languageCode]; + + String get clinicName => localizedValues['clinicname'][locale.languageCode]; + + String get sickLeaveDate => + localizedValues['sick-leave-date'][locale.languageCode]; + + String get sickLeaveDays => + localizedValues['sick-leave-days'][locale.languageCode]; + + String get admissionDetail => + localizedValues['admissionDetail'][locale.languageCode]; + String get dateTime => localizedValues['dateTime'][locale.languageCode]; + + String get date => localizedValues['date'][locale.languageCode]; + String get admissionNo => localizedValues['admissionNo'][locale.languageCode]; + String get losNo => localizedValues['losNo'][locale.languageCode]; + String get area => localizedValues['area'][locale.languageCode]; + String get room => localizedValues['room'][locale.languageCode]; + String get bed => localizedValues['bed'][locale.languageCode]; + + String get previousSickLeaveIssue => + localizedValues['prevoius-sickleave-issed'][locale.languageCode]; + + String get noSickLeaveApplied => + localizedValues['no-sickleve-applied'][locale.languageCode]; + + String get applyNow => localizedValues['applynow'][locale.languageCode]; + + String get addSickLeave => + localizedValues['add-sickleave'][locale.languageCode]; + + String get add => localizedValues['add'][locale.languageCode]; + String get addSickLeaverequest => + localizedValues['addSickLeaveRequest'][locale.languageCode]; + String get extendSickLeaverequest => + localizedValues['extendSickLeaveRequest'][locale.languageCode]; + String get approved => localizedValues['approved'][locale.languageCode]; + + String get extended => localizedValues['extended'][locale.languageCode]; + + String get pending => localizedValues['pending'][locale.languageCode]; + + String get leaveStartDate => + localizedValues['leave-start-date'][locale.languageCode]; + + String get daysSickleave => + localizedValues['days-sick-leave'][locale.languageCode]; + + String get extend => localizedValues['extend'][locale.languageCode]; + + String get extendSickLeave => + localizedValues['extend-sickleave'][locale.languageCode]; + + String get targetPatient => + localizedValues['patient-target'][locale.languageCode]; + + String get noPrescription => + localizedValues['no-priscription-listed'][locale.languageCode]; + + String get next => localizedValues['next'][locale.languageCode]; + + String get emptyMessage => + localizedValues['empty-message'][locale.languageCode]; + + String get healthRecordInformation => + localizedValues['healthRecordInformation'][locale.languageCode]; + + String get chiefComplaintLength => + localizedValues['chiefComplaintLength'][locale.languageCode]; + + String get referTo => localizedValues['referTo'][locale.languageCode]; + + String get referredFrom => + localizedValues['referredFrom'][locale.languageCode]; + + String get branch => localizedValues['branch'][locale.languageCode]; + + String get chooseAppointment => + localizedValues['chooseAppointment'][locale.languageCode]; + + String get appointmentNo => + localizedValues['appointmentNo'][locale.languageCode]; + + String get refer => localizedValues['refer'][locale.languageCode]; + + String get rejected => localizedValues['rejected'][locale.languageCode]; + + String get sameBranch => localizedValues['sameBranch'][locale.languageCode]; + + String get otherBranch => localizedValues['otherBranch'][locale.languageCode]; + + String get dr => localizedValues['dr'][locale.languageCode]; + + String get previewHealth => + localizedValues['previewHealth'][locale.languageCode]; + + String get summaryReport => + localizedValues['summaryReport'][locale.languageCode]; + + String get accept => localizedValues['accept'][locale.languageCode]; + + String get reject => localizedValues['reject'][locale.languageCode]; + + String get noAppointmentsErrorMsg => + localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; + + String get referralPatient => + localizedValues['referralPatient'][locale.languageCode]; + + String get noPrescriptionListed => + localizedValues['noPrescriptionListed'][locale.languageCode]; + + String get addNow => localizedValues['addNow'][locale.languageCode]; + + String get orderType => localizedValues['orderType'][locale.languageCode]; + + String get strength => localizedValues['strength'][locale.languageCode]; + + String get doseTime => localizedValues['doseTime'][locale.languageCode]; + + String get indication => localizedValues['indication'][locale.languageCode]; + + String get duration => localizedValues['duration'][locale.languageCode]; + + String get instruction => localizedValues['instruction'][locale.languageCode]; + + String get rescheduleLeaves => + localizedValues['reschedule-leave'][locale.languageCode]; + + String get addMedication => + localizedValues['addMedication'][locale.languageCode]; + + String get route => localizedValues['route'][locale.languageCode]; + + String get noReScheduleLeave => + localizedValues['no-reschedule-leave'][locale.languageCode]; + + String get weight => localizedValues['weight'][locale.languageCode]; + + String get kg => localizedValues['kg'][locale.languageCode]; + + String get height => localizedValues['height'][locale.languageCode]; + + String get cm => localizedValues['cm'][locale.languageCode]; + + String get idealBodyWeight => + localizedValues['idealBodyWeight'][locale.languageCode]; + + String get waistSize => localizedValues['waistSize'][locale.languageCode]; + + String get inch => localizedValues['inch'][locale.languageCode]; + + String get headCircum => localizedValues['headCircum'][locale.languageCode]; + + String get leanBodyWeight => + localizedValues['leanBodyWeight'][locale.languageCode]; + + String get bodyMassIndex => localizedValues['bodyMassIndex'][locale.languageCode]; + + String get yourBodyMassIndex => localizedValues['yourBodyMassIndex'][locale.languageCode]; + String get bmiUnderWeight => localizedValues['bmiUnderWeight'][locale.languageCode]; + String get bmiHealthy => localizedValues['bmiHealthy'][locale.languageCode]; + String get bmiOverWeight => localizedValues['bmiOverWeight'][locale.languageCode]; + String get bmiObese => localizedValues['bmiObese'][locale.languageCode]; + + String get method => localizedValues['method'][locale.languageCode]; + + String get pulseBeats => localizedValues['pulseBeats'][locale.languageCode]; + + String get rhythm => localizedValues['rhythm'][locale.languageCode]; + + String get respBeats => localizedValues['respBeats'][locale.languageCode]; + + String get patternOfRespiration => + localizedValues['patternOfRespiration'][locale.languageCode]; + + String get bloodPressureDiastoleAndSystole => + localizedValues['bloodPressureDiastoleAndSystole'][locale.languageCode]; + + String get cuffLocation => + localizedValues['cuffLocation'][locale.languageCode]; + + String get cuffSize => localizedValues['cuffSize'][locale.languageCode]; + + String get patientPosition => + localizedValues['patientPosition'][locale.languageCode]; + + String get fio2 => localizedValues['fio2'][locale.languageCode]; + + String get sao2 => localizedValues['sao2'][locale.languageCode]; + + String get painManagement => + localizedValues['painManagement'][locale.languageCode]; + + String get holiday => localizedValues['holiday'][locale.languageCode]; + + String get to => localizedValues['to'][locale.languageCode]; + + String get coveringDoctor => + localizedValues['coveringDoctor'][locale.languageCode]; + + String get requestLeave => + localizedValues['requestLeave'][locale.languageCode]; + + String get pleaseEnterDate => + localizedValues['pleaseEnterDate'][locale.languageCode]; + + String get pleaseEnterNoOfDays => + localizedValues['pleaseEnterNoOfDays'][locale.languageCode]; + + String get pleaseEnterRemarks => + localizedValues['pleaseEnterRemarks'][locale.languageCode]; + + String get update => localizedValues['update'][locale.languageCode]; + + String get admission => localizedValues['admission'][locale.languageCode]; + + String get request => localizedValues['request'][locale.languageCode]; + + String get admissionRequest => + localizedValues['admissionRequest'][locale.languageCode]; + + String get patientDetails => + localizedValues['patientDetails'][locale.languageCode]; + + String get specialityAndDoctorDetail => + localizedValues['specialityAndDoctorDetail'][locale.languageCode]; + + String get referringDate => + localizedValues['referringDate'][locale.languageCode]; + + String get referringDoctor => + localizedValues['referringDoctor'][locale.languageCode]; + + String get otherInformation => + localizedValues['otherInformation'][locale.languageCode]; + + String get expectedDays => + localizedValues['expectedDays'][locale.languageCode]; + + String get expectedAdmissionDate => + localizedValues['expectedAdmissionDate'][locale.languageCode]; + + String get emergencyAdmission => + localizedValues['emergencyAdmission'][locale.languageCode]; + String get isSickLeaveRequired => + localizedValues['isSickLeaveRequired'][locale.languageCode]; + + String get patientPregnant => + localizedValues['patientPregnant'][locale.languageCode]; + + String get treatmentLine => + localizedValues['treatmentLine'][locale.languageCode]; + + String get ward => localizedValues['ward'][locale.languageCode]; + + String get preAnesthesiaReferred => + localizedValues['preAnesthesiaReferred'][locale.languageCode]; + + String get admissionType => + localizedValues['admissionType'][locale.languageCode]; + + String get diagnosis => localizedValues['diagnosis'][locale.languageCode]; + + String get allergies => localizedValues['allergies'][locale.languageCode]; + + String get preOperativeOrders => + localizedValues['preOperativeOrders'][locale.languageCode]; + + String get elementForImprovement => + localizedValues['elementForImprovement'][locale.languageCode]; + + String get dischargeDate => + localizedValues['dischargeDate'][locale.languageCode]; + + String get dietType => localizedValues['dietType'][locale.languageCode]; + + String get dietTypeRemarks => + localizedValues['dietTypeRemarks'][locale.languageCode]; + + String get save => localizedValues['save'][locale.languageCode]; + + String get postPlansEstimatedCost => + localizedValues['postPlansEstimatedCost'][locale.languageCode]; + String get postPlans => localizedValues['postPlans'][locale.languageCode]; + + String get ucaf => localizedValues['ucaf'][locale.languageCode]; + + String get emergencyCase => + localizedValues['emergencyCase'][locale.languageCode]; + + String get durationOfIllness => + localizedValues['durationOfIllness'][locale.languageCode]; + + String get chiefComplaintsAndSymptoms => + localizedValues['chiefComplaintsAndSymptoms'][locale.languageCode]; + + String get patientFeelsPainInHisBackAndCough => + localizedValues['patientFeelsPainInHisBackAndCough'][locale.languageCode]; + + String get additionalTextComplaints => + localizedValues['additionalTextComplaints'][locale.languageCode]; + + String get otherConditions => + localizedValues['otherConditions'][locale.languageCode]; + + String get other => localizedValues['other'][locale.languageCode]; + + String get how => localizedValues['how'][locale.languageCode]; + + String get when => localizedValues['when'][locale.languageCode]; + + String get where => localizedValues['where'][locale.languageCode]; + + String get specifyPossibleLineManagement => + localizedValues['specifyPossibleLineManagement'][locale.languageCode]; + + String get significantSigns => + localizedValues['significantSigns'][locale.languageCode]; + + String get backAbdomen => localizedValues['backAbdomen'][locale.languageCode]; + + String get reasons => localizedValues['reasons'][locale.languageCode]; + + String get createNew => localizedValues['createNew'][locale.languageCode]; + + String get episode => localizedValues['episode'][locale.languageCode]; + + String get medications => localizedValues['medications'][locale.languageCode]; + + String get procedures => localizedValues['procedures'][locale.languageCode]; + + String get chiefComplaints => + localizedValues['chiefComplaints'][locale.languageCode]; + + String get histories => localizedValues['histories'][locale.languageCode]; + + String get allergiesSoap => + localizedValues['allergiesSoap'][locale.languageCode]; + + String get addChiefComplaints => + localizedValues['addChiefComplaints'][locale.languageCode]; + + String get historyOfPresentIllness => + localizedValues['historyOfPresentIllness'][locale.languageCode]; + + String get requiredMsg => localizedValues['requiredMsg'][locale.languageCode]; + + String get addHistory => localizedValues['addHistory'][locale.languageCode]; + + String get searchHistory => + localizedValues['searchHistory'][locale.languageCode]; + + String get addSelectedHistories => + localizedValues['addSelectedHistories'][locale.languageCode]; + + String get addAllergies => + localizedValues['addAllergies'][locale.languageCode]; + + String get itemExist => localizedValues['itemExist'][locale.languageCode]; + + String get selectAllergy => + localizedValues['selectAllergy'][locale.languageCode]; + + String get selectSeverity => + localizedValues['selectSeverity'][locale.languageCode]; + + String get leaveCreated => + localizedValues['leaveCreated'][locale.languageCode]; + + String get vitalSignEmptyMsg => + localizedValues['vitalSignEmptyMsg'][locale.languageCode]; + + String get referralEmptyMsg => + localizedValues['referralEmptyMsg'][locale.languageCode]; + + String get referralSuccessMsg => + localizedValues['referralSuccessMsg'][locale.languageCode]; + + String get diagnoseType => + localizedValues['diagnoseType'][locale.languageCode]; + + String get condition => localizedValues['condition'][locale.languageCode]; + + String get id => localizedValues['id'][locale.languageCode]; + + String get quantity => localizedValues['quantity'][locale.languageCode]; + + String get durDays => localizedValues['durDays'][locale.languageCode]; + + String get codeNo => localizedValues['codeNo'][locale.languageCode]; + + String get covered => localizedValues['covered'][locale.languageCode]; + + String get approvalRequired => + localizedValues['approvalRequired'][locale.languageCode]; + + String get uncoveredByDoctor => + localizedValues['uncoveredByDoctor'][locale.languageCode]; + + String get chiefComplaintEmptyMsg => + localizedValues['chiefComplaintEmptyMsg'][locale.languageCode]; + + String get moreVerification => + localizedValues['more-verify'][locale.languageCode]; + + String get welcomeBack => + localizedValues['welcome-back'][locale.languageCode]; + + String get accountInfo => + localizedValues['account-info'][locale.languageCode]; + + String get useAnotherAccount => + localizedValues['another-acc'][locale.languageCode]; + + String get verifyLoginWith => + localizedValues['verify-login-with'][locale.languageCode]; + + String get register => localizedValues['register-user'][locale.languageCode]; + + String get verifyFingerprint => + localizedValues['verify-with-fingerprint'][locale.languageCode]; + + String get verifyFaceID => + localizedValues['verify-with-faceid'][locale.languageCode]; + + String get verifySMS => + localizedValues['verify-with-sms'][locale.languageCode]; + + String get verifyWhatsApp => + localizedValues['verify-with-whatsapp'][locale.languageCode]; + + String get lastLoginAt => localizedValues['last-login'][locale.languageCode]; + + String get lastLoginWith => + localizedValues['last-login-with'][locale.languageCode]; + + String get verifyFingerprint2 => + localizedValues['verify-fingerprint'][locale.languageCode]; + + String get verificationMessage => + localizedValues['verification_message'][locale.languageCode]; + + String get validationMessage => + localizedValues['validation_message'][locale.languageCode]; + + String get addAssessment => + localizedValues['addAssessment'][locale.languageCode]; + + String get assessment => localizedValues['assessment'][locale.languageCode]; + + String get physicalSystemExamination => + localizedValues['physicalSystemExamination'][locale.languageCode]; + + String get searchExamination => + localizedValues['searchExamination'][locale.languageCode]; + + String get addExamination => + localizedValues['addExamination'][locale.languageCode]; + + String get doc => localizedValues['doc'][locale.languageCode]; + + String get allergicTO => localizedValues['allergicTO'][locale.languageCode]; + + String get normal => localizedValues['normal'][locale.languageCode]; + String get notExamined => localizedValues['notExamined'][locale.languageCode]; + + String get abnormal => localizedValues['abnormal'][locale.languageCode]; + + String get patientNoDetailErrMsg => + localizedValues['patientNoDetailErrMsg'][locale.languageCode]; + + String get systolicLng => + localizedValues['systolic-lng'][locale.languageCode]; + + String get diastolicLng => + localizedValues['diastolic-lng'][locale.languageCode]; + + String get mass => localizedValues['mass'][locale.languageCode]; + + String get tempC => localizedValues['temp-c'][locale.languageCode]; + + String get bpm => localizedValues['bpm'][locale.languageCode]; + + String get respirationSigns => + localizedValues['respiration-signs'][locale.languageCode]; + + String get sysDias => localizedValues['sys-dias'][locale.languageCode]; + + String get body => localizedValues['body'][locale.languageCode]; + + String get respirationRate => + localizedValues['respirationRate'][locale.languageCode]; + + String get heart => localizedValues['heart'][locale.languageCode]; + + String get medicalReport => + localizedValues['medicalReport'][locale.languageCode]; + + String get visitDate => localizedValues['visitDate'][locale.languageCode]; + + String get test => localizedValues['test'][locale.languageCode]; + + String get addMoreProcedure => + localizedValues['addMoreProcedure'][locale.languageCode]; + + String get regular => localizedValues['regular'][locale.languageCode]; + + String get searchProcedures => + localizedValues['searchProcedures'][locale.languageCode]; + + String get procedureCategorise => + localizedValues['procedureCategorise'][locale.languageCode]; + + String get selectProcedures => + localizedValues['selectProcedures'][locale.languageCode]; + + String get addSelectedProcedures => + localizedValues['addSelectedProcedures'][locale.languageCode]; + + String get updateProcedure => + localizedValues['updateProcedure'][locale.languageCode]; + + String get orderProcedure => + localizedValues['orderProcedure'][locale.languageCode]; + + String get nameOrICD => localizedValues['nameOrICD'][locale.languageCode]; + + String get dType => localizedValues['dType'][locale.languageCode]; + + String get addAssessmentDetails => + localizedValues['addAssessmentDetails'][locale.languageCode]; + + String get progressNoteSOAP => + localizedValues['progressNoteSOAP'][locale.languageCode]; + + String get addProgressNote => + localizedValues['addProgressNote'][locale.languageCode]; + + String get createdBy => localizedValues['createdBy'][locale.languageCode]; + + String get editedBy => localizedValues['editedBy'][locale.languageCode]; + + String get currentMedications => + localizedValues['currentMedications'][locale.languageCode]; + + String get noItem => localizedValues['noItem'][locale.languageCode]; + + String get postUcafSuccessMsg => + localizedValues['postUcafSuccessMsg'][locale.languageCode]; + + String get vitalSignDetailEmpty => + localizedValues['vitalSignDetailEmpty'][locale.languageCode]; + + String get onlyOfftimeHoliday => + localizedValues['onlyOfftimeHoliday'][locale.languageCode]; + + String get active => localizedValues['active'][locale.languageCode]; + + String get hold => localizedValues['hold'][locale.languageCode]; + + String get loading => localizedValues['loading'][locale.languageCode]; + + String get assessmentErrorMsg => + localizedValues['assessmentErrorMsg'][locale.languageCode]; + + String get examinationErrorMsg => + localizedValues['examinationErrorMsg'][locale.languageCode]; + + String get progressNoteErrorMsg => + localizedValues['progressNoteErrorMsg'][locale.languageCode]; + + String get chiefComplaintErrorMsg => + localizedValues['chiefComplaintErrorMsg'][locale.languageCode]; + String get ICDName => localizedValues['ICDName'][locale.languageCode]; + + String get referralStatus => + localizedValues['referralStatus'][locale.languageCode]; + + String get referralRemark => + localizedValues['referralRemark'][locale.languageCode]; + String get offTime => localizedValues['offTime'][locale.languageCode]; + + String get icd => localizedValues['icd'][locale.languageCode]; + String get days => localizedValues['days'][locale.languageCode]; + String get hr => localizedValues['hr'][locale.languageCode]; + String get min => localizedValues['min'][locale.languageCode]; + String get months => localizedValues['months'][locale.languageCode]; + String get years => localizedValues['years'][locale.languageCode]; + String get referralStatusHold => + localizedValues['referralStatusHold'][locale.languageCode]; + String get referralStatusActive => + localizedValues['referralStatusActive'][locale.languageCode]; + String get referralStatusCancelled => + localizedValues['referralStatusCancelled'][locale.languageCode]; + String get referralStatusCompleted => + localizedValues['referralStatusCompleted'][locale.languageCode]; + String get referralStatusNotSeen => + localizedValues['referralStatusNotSeen'][locale.languageCode]; + String get clinicSearch => + localizedValues['clinicSearch'][locale.languageCode]; + String get doctorSearch => + localizedValues['doctorSearch'][locale.languageCode]; + String get referralResponse => + localizedValues['referralResponse'][locale.languageCode]; + String get estimatedCost => + localizedValues['estimatedCost'][locale.languageCode]; + String get diagnosisDetail => + localizedValues['diagnosisDetail'][locale.languageCode]; + String get referralSuccessMsgAccept => + localizedValues['referralSuccessMsgAccept'][locale.languageCode]; + String get referralSuccessMsgReject => + localizedValues['referralSuccessMsgReject'][locale.languageCode]; + + String get patientName => + localizedValues['patient-name'][locale.languageCode]; + + String get appointmentNumber => + localizedValues['appointmentNumber'][locale.languageCode]; + String get sickLeaveComments => + localizedValues['sickLeaveComments'][locale.languageCode]; + String get pastMedicalHistory => + localizedValues['pastMedicalHistory'][locale.languageCode]; + String get pastSurgicalHistory => + localizedValues['pastSurgicalHistory'][locale.languageCode]; + String get complications => + localizedValues['complications'][locale.languageCode]; + String get floor => localizedValues['floor'][locale.languageCode]; + String get roomCategory => + localizedValues['roomCategory'][locale.languageCode]; + String get otherDepartmentsInterventions => + localizedValues['otherDepartmentsInterventions'][locale.languageCode]; + String get otherProcedure => + localizedValues['otherProcedure'][locale.languageCode]; + String get admissionRequestSuccessMsg => + localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; + String get infoStatus => localizedValues['infoStatus'][locale.languageCode]; + String get doctorResponse => + localizedValues['doctorResponse'][locale.languageCode]; + String get sickleaveonhold => + localizedValues['sickleaveonhold'][locale.languageCode]; + String get noClinic => localizedValues['no-clinic'][locale.languageCode]; + + String get otherStatistic => + localizedValues['otherStatistic'][locale.languageCode]; + + String get patientsreferral => + localizedValues['ptientsreferral'][locale.languageCode]; + String get arrivalpatient => + localizedValues['arrivalpatient'][locale.languageCode]; + String get searchmedicinepatient => + localizedValues['searchmedicinepatient'][locale.languageCode]; + String get appointmentDate => + localizedValues['appointmentDate'][locale.languageCode]; + String get arrivedP => localizedValues['arrived_p'][locale.languageCode]; + + String get details => localizedValues['details'][locale.languageCode]; + String get liveCare => localizedValues['liveCare'][locale.languageCode]; + String get outpatient => localizedValues['out-patient'][locale.languageCode]; + String get billNo => localizedValues['BillNo'][locale.languageCode]; + String get labResults => localizedValues['labResults'][locale.languageCode]; + String get sendSuc => localizedValues['sendSuc'][locale.languageCode]; + String get specialResult => + localizedValues['SpecialResult'][locale.languageCode]; + String get noDataAvailable => + localizedValues['noDataAvailable'][locale.languageCode]; + String get showMoreBtn => + localizedValues['show-more-btn'][locale.languageCode]; + + String get fileNumber => localizedValues['fileNumber'][locale.languageCode]; + String get reschedule => localizedValues['reschedule'][locale.languageCode]; + String get leaves => localizedValues['leaves'][locale.languageCode]; + String get openRad => localizedValues['open-rad'][locale.languageCode]; + + String get totalApproval => + localizedValues['totalApproval'][locale.languageCode]; + String get procedureStatus => + localizedValues['procedureStatus'][locale.languageCode]; + String get unusedCount => localizedValues['unusedCount'][locale.languageCode]; + String get companyName => localizedValues['companyName'][locale.languageCode]; + String get procedureName => + localizedValues['procedureName'][locale.languageCode]; + String get usageStatus => localizedValues['usageStatus'][locale.languageCode]; + String get prescriptions => + localizedValues['prescriptions'][locale.languageCode]; + String get notes => localizedValues['notes'][locale.languageCode]; + String get dailyDoses => localizedValues['dailyDoses'][locale.languageCode]; + String get searchWithOther => + localizedValues['searchWithOther'][locale.languageCode]; + String get hideOtherCriteria => + localizedValues['hideOtherCriteria'][locale.languageCode]; + String get applyForReschedule => + localizedValues['applyForReschedule'][locale.languageCode]; + + String get startDate => localizedValues['startDate'][locale.languageCode]; + String get endDate => localizedValues['endDate'][locale.languageCode]; + + String get addReschedule => + localizedValues['add-reschedule'][locale.languageCode]; + String get updateReschedule => + localizedValues['update-reschedule'][locale.languageCode]; + String get sickLeave => localizedValues['sick_leave'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/known_user_login.dart b/lib/widgets/auth/known_user_login.dart index 4df37d66..b181aed8 100644 --- a/lib/widgets/auth/known_user_login.dart +++ b/lib/widgets/auth/known_user_login.dart @@ -70,8 +70,8 @@ class _KnownUserLoginState extends State { @override Widget build(BuildContext context) { AuthViewModel authProv = Provider.of(context); - var imeiModel = {'IMEI': _platformImei}; - _loginTypeFuture = authProv.selectDeviceImei(imeiModel); + // var imeiModel = {'IMEI': _platformImei}; + // _loginTypeFuture = authProv.selectDeviceImei(imeiModel); return FutureBuilder( future: Future.wait([_loggedUserFuture, _loginTypeFuture]), builder: (BuildContext context, AsyncSnapshot snapshot) { diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 8cf5f3d4..c52e9a77 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -40,7 +42,7 @@ class _LoginFormState extends State { bool _isInit = true; FocusNode focusPass = FocusNode(); FocusNode focusProject = FocusNode(); - + HospitalViewModel projectsProv; var userInfo = UserModel( userID: '', password: '', @@ -55,24 +57,13 @@ class _LoginFormState extends State { @override void initState() { super.initState(); - initPlatformState(); } @override - void didChangeDependencies() { - super.didChangeDependencies(); + Widget build(BuildContext context) { authProv = Provider.of(context); + projectsProv = Provider.of(context); - if (_isInit) { - if (projectsList.length == 0) { - getProjectsList(); - } - } - _isInit = false; - } - - @override - Widget build(BuildContext context) { return Form( key: loginFormKey, child: Container( @@ -97,9 +88,13 @@ class _LoginFormState extends State { onSaved: (value) { userInfo.userID = value.trim(); }, + onChanged: (value) { + userInfo.userID = value.trim(); + }, onFieldSubmitted: (_) { focusPass.nextFocus(); }, + onEditingComplete: () {}, autofocus: false, ), buildSizedBox(), @@ -123,29 +118,40 @@ class _LoginFormState extends State { onFieldSubmitted: (_) { focusPass.nextFocus(); helpers.showCupertinoPicker( - context, projectsList, 'Name', onSelectProject); + context, projectsList, 'facilityName', onSelectProject); + }, + onTap: () { + this.getProjects(userInfo.userID); }, ), buildSizedBox(), - TextFormField( - focusNode: focusProject, - controller: projectIdController, - onTap: () { - helpers.showCupertinoPicker( - context, projectsList, 'Name', onSelectProject); - }, - showCursor: false, - readOnly: true, - decoration: buildInputDecoration( - context, - TranslationBase.of(context).selectYourProject, - 'assets/images/password_icon.png'), - validator: (value) { - if (value.isEmpty) { - return TranslationBase.of(context).pleaseEnterYourProject; - } - return null; - }), + projectsList.length > 0 + ? TextFormField( + focusNode: focusProject, + controller: projectIdController, + onTap: () { + helpers.showCupertinoPicker(context, projectsList, + 'facilityName', onSelectProject); + }, + showCursor: false, + //readOnly: true, + decoration: buildInputDecoration( + context, + TranslationBase.of(context).selectYourProject, + 'assets/images/password_icon.png'), + validator: (value) { + if (value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterYourProject; + } + return null; + }) + : TextFormField( + readOnly: true, + decoration: buildInputDecoration( + context, + TranslationBase.of(context).pleaseEnterYourProject, + 'assets/images/password_icon.png')), buildSizedBox(), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -223,33 +229,29 @@ class _LoginFormState extends State { } login(context, AuthViewModel authProv, Function changeLoadingStata) { - FocusScopeNode currentFocus = FocusScope.of(context); - - // if (!currentFocus.hasPrimaryFocus) { - // currentFocus.unfocus(); - // } - changeLoadingStata(true); + showLoading(); if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); sharedPref.setInt(PROJECT_ID, userInfo.projectID); authProv.login(userInfo).then((res) { - changeLoadingStata(false); - + //changeLoadingStata(false); + hideLoading(); if (res['MessageStatus'] == 1) { // insertDeviceImei(res, authProv); saveObjToString(LOGGED_IN_USER, res); + sharedPref.remove(LAST_LOGIN_USER); sharedPref.setString(TOKEN, res['LogInTokenID']); print("token" + res['LogInTokenID']); - - Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); + Navigator.of(context).pushReplacement(MaterialPageRoute( + builder: (BuildContext context) => VerificationMethodsScreen( + password: userInfo.password, + ))); } else { // handel error - // widget.showCenterShortLoadingToast("watting"); helpers.showErrorToast(res['ErrorEndUserMessage']); } - // Navigator.of(context).pushNamed(HOME); }).catchError((err) { - print('$err'); + hideLoading(); changeLoadingStata(false); helpers.showErrorToast(err); }); @@ -279,7 +281,12 @@ class _LoginFormState extends State { if (res['MessageStatus'] == 1) { setSharedPref('platformImei', _platformImei); saveObjToString(LOGGED_IN_USER, preRes); - Navigator.of(context).pushNamed(VERIFICATION_METHODS); + + Navigator.of(context).pushReplacement(MaterialPageRoute( + builder: (BuildContext context) => VerificationMethodsScreen( + password: userInfo.password, + ))); + // save imei on shared preferance } else { // handel error @@ -322,22 +329,26 @@ class _LoginFormState extends State { }); } - getProjectsList() { - HospitalViewModel projectsProv = Provider.of(context); - projectsProv.getProjectsList().then((res) { + getProjectsList(memberID) { + //showLoading(); + projectsProv.getProjectsList(memberID).then((res) { + //hideLoading(); if (res['MessageStatus'] == 1) { + projectsList = res['ProjectInfo']; setState(() { - projectsList = res['ListProject']; + userInfo.projectID = projectsList[0]["facilityId"]; + projectIdController.text = projectsList[0]['facilityName']; }); } else { + print(res); // handel error - setState(() { - projectsList = ListProject; - }); + // setState(() { + // projectsList = ListProject; + // }); } }).catchError((err) { setState(() { - projectsList = ListProject; + print(err); }); print(err); }); @@ -349,10 +360,33 @@ class _LoginFormState extends State { onSelectProject(index) { setState(() { - userInfo.projectID = projectsList[index]["ID"]; - projectIdController.text = projectsList[index]['Name']; + userInfo.projectID = projectsList[index]["facilityId"]; + projectIdController.text = projectsList[index]['facilityName']; }); primaryFocus.unfocus(); } + + showLoading() { + showDialog( + context: context, + builder: (BuildContext context) { + return Center( + child: CircularProgressIndicator(), + ); + }); + } + + hideLoading() { + Navigator.pop(context); + } + + getProjects(value) { + if (value != null && value != '') { + if (projectsList.length == 0) { + getProjectsList(value); + } + } + //_isInit = false; + } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 43e9e988..587c248c 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; @@ -362,8 +363,18 @@ class _VerifyAccountState extends State { "IsLoginForDoctorApp": true, "IsSilentLogIN": false }; + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = + new CheckActivationCodeRequestModel( + zipCode: _loggedUser['ZipCode'], + mobileNumber: _loggedUser['MobileNumber'], + projectID: await sharedPref.getInt(PROJECT_ID), + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), + activationCode: activationCode, + generalid: "Cs2020@2016\$2958"); - authProv.memberCheckActivationCodeNew(model).then((res) async{ + authProv + .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) + .then((res) async { if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { @@ -394,12 +405,19 @@ class _VerifyAccountState extends State { */ loginProcessCompleted( Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); + var doctor = DoctorProfileModel.fromJson(profile); + authProv.setDoctorProfile(doctor); + sharedPref.setObj(DOCTOR_PROFILE, profile); + this.getDashboard(doctor, changeLoadingStata); + } + getDashboard(doctor, Function changeLoadingStata) { + // authProv.getDashboard(doctor).then((value) { + // print(value); changeLoadingStata(false); - sharedPref.setObj(DOCTOR_PROFILE, profile); + // sharedPref.setObj(DASHBOARD_DATA, value); Navigator.of(context).pushReplacementNamed(HOME); + // }); } Future _asyncSimpleDialog( diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 2102a125..5e8d7674 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -1,8 +1,25 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/imei_details.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/otp/sms-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'package:local_auth/auth_strings.dart'; +import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; @@ -11,7 +28,6 @@ import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/helpers.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -24,8 +40,11 @@ Helpers helpers = Helpers(); *@desc: Verification Methods widget */ class VerificationMethods extends StatefulWidget { - VerificationMethods({this.changeLoadingStata}); + VerificationMethods({this.changeLoadingStata, this.password}); + + final password; final Function changeLoadingStata; + @override _VerificationMethodsState createState() => _VerificationMethodsState(); } @@ -35,16 +54,39 @@ class _VerificationMethodsState extends State { Future _loggedUserFuture; var _loggedUser; var verificationMethod; + GetIMEIDetailsModel user; + final LocalAuthentication auth = LocalAuthentication(); + var _availableBiometrics; + ProjectViewModel projectsProvider; + var isMoreOption = false; + var onlySMSBox = false; + static BuildContext _context; + var loginTokenID; + + bool authenticated; + + var fingrePrintBefore; + + var selectedOption; + @override void initState() { super.initState(); _loggedUserFuture = getSharedPref(); + _getAvailableBiometrics(); } Future getSharedPref() async { sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { _loggedUser = userInfo; }); + sharedPref.getObj(LAST_LOGIN_USER).then((lastLogin) { + if (lastLogin != null) { + user = GetIMEIDetailsModel.fromJson(lastLogin); + } + }); + + print(user); } @override @@ -58,6 +100,7 @@ class _VerificationMethodsState extends State { @override Widget build(BuildContext context) { AuthViewModel authProv = Provider.of(context); + projectsProvider = Provider.of(context); return FutureBuilder( future: Future.wait([_loggedUserFuture]), builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -69,188 +112,201 @@ class _VerificationMethodsState extends State { helpers.showErrorToast('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}'); } else { - return Container( - width: SizeConfig.realScreenWidth * 0.80, + return SingleChildScrollView( + child: Container( + height: SizeConfig.realScreenHeight, + width: SizeConfig.realScreenWidth, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - hideSilentMethods() - ? TranslationBase.of(context).firstStep - : TranslationBase.of(context).pleaseChoose, - style: TextStyle( - fontSize: 3.5 * SizeConfig.textMultiplier, - ), - ), - SizedBox( - height: 20, - ), Container( - height: SizeConfig.realScreenHeight * 0.6, - child: CustomScrollView( - primary: false, - slivers: [ - SliverPadding( - padding: const EdgeInsets.all(0), - sliver: SliverGrid.count( - // childAspectRatio: 0.7, - crossAxisSpacing: 0, - mainAxisSpacing: 5, - crossAxisCount: 2, - children: [ - Visibility( - visible: hideSilentMethods() ? false : true, - child: buildFingerprintMethod( - context, authProv), - replacement: - buildWhatsAppMethod(context, authProv), - ), - Visibility( - visible: hideSilentMethods() ? false : true, - child: buildFaceIDMethod(context, authProv), - replacement: - buildSMSMethod(context, authProv), - ), - Visibility( - visible: - hideSilentMethods() ? false : true, - child: buildWhatsAppMethod( - context, authProv)), - Visibility( - visible: hideSilentMethods() ? false : true, - child: buildSMSMethod(context, authProv), - ), - ], - ), - ), + // height: SizeConfig.realScreenHeight * 0.6, + child: Column( + children: [ + user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .welcomeBack + + ' ' + + user.doctorName, + fontSize: + SizeConfig.textMultiplier * 3.5, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: + SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 20, + ), + Card( + color: Colors.grey[300], + child: Row( + children: [ + Flexible( + child: ListTile( + title: Text( + TranslationBase.of(context) + .lastLoginAt, + textAlign: TextAlign.center, + overflow: + TextOverflow.ellipsis, + ), + subtitle: Text( + user.editedOn != null + ? formatDate(Helpers + .convertStringToDate( + user.editedOn)) + : user.createdOn != null + ? formatDate(Helpers + .convertStringToDate(user + .createdOn)) + : '--', + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center), + )), + Flexible( + child: ListTile( + title: Text( + TranslationBase.of(context) + .lastLoginWith, + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center), + subtitle: Text( + getType(user.logInTypeID, + context), + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center), + )) + ], + )), + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: + SizeConfig.textMultiplier * + 3.5, + textAlign: TextAlign.left, + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * + 2.5, + textAlign: TextAlign.start, + ), + ]), + user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => { + authenticateUser(3, + true, authProv) + }, + child: getButton( + user.logInTypeID, + authProv))), + Expanded( + child: getButton(5, authProv)) + ]) + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: getButton( + 3, authProv)), + Expanded( + child: getButton( + 4, authProv)) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: getButton(1, authProv)), + Expanded( + child: getButton(2, authProv)) + ], + ), + ]), + + // ) ], ), - // height: 500, ), - SizedBox( - // height: 20, - ) + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + user != null + ? Row( + children: [ + Expanded( + child: Button( + title: TranslationBase.of(context) + .useAnotherAccount, + onTap: () { + Navigator.of(context).pushNamed(LOGIN); + }, + )), + ], + ) + : SizedBox(), + ], + ), ], ), - ); + )); } } }); } - /* - *@author: Elham Rababah - *@Date:28/5/2020 - *@param: BuildContext context, AuthProvider authProv - *@return: Center widget - *@desc: buildSMSMethod Methods widget - */ - Center buildSMSMethod(BuildContext context, AuthViewModel authProv) { - return buildVerificationMethod( - context, - 'assets/images/verification_sms_icon.png', - TranslationBase.of(context).sms, () { - sendActivationCodeByOtpNotificationType(1, authProv); - }); - } - - /* - *@author: Elham Rababah - *@Date:28/5/2020 - *@param: BuildContext context, AuthProvider authProv - *@return: Center widget - *@desc: build WhatsApp Methods widget - */ - Center buildWhatsAppMethod(BuildContext context, AuthViewModel authProv) { - return buildVerificationMethod( - context, - 'assets/images/verification_whatsapp_icon.png', - TranslationBase.of(context).whatsApp, () { - sendActivationCodeByOtpNotificationType(2, authProv); - }); - } - -/* - *@author: Elham Rababah - *@Date:28/5/2020 - *@param: BuildContext context, AuthProvider authProv - *@return: Center widget - *@desc: build FaceID Methods widget - */ - Center buildFaceIDMethod(BuildContext context, AuthViewModel authProv) { - return buildVerificationMethod( - context, - 'assets/images/verification_faceid_icon.png', - TranslationBase.of(context).faceId, () { - sendActivationCodeByOtpNotificationType(3, authProv); - }); - } - -/* - *@author: Elham Rababah - *@Date:28/5/2020 - *@param: BuildContext context, AuthProvider authProv - *@return: Center widget - *@desc: build Fingerprint Methods widget - */ - Center buildFingerprintMethod(BuildContext context, AuthViewModel authProv) { - return buildVerificationMethod( - context, - 'assets/images/verification_fingerprint_icon.png', - TranslationBase.of(context).fingerprint, () { - sendActivationCodeByOtpNotificationType(4, authProv); - }); - } - - /* - *@author: Elham Rababah - *@Date:28/5/2020 - *@param: BuildContext context, AuthProvider authProv - *@return: Center widget - *@desc: build Verification Methods widget - */ - Center buildVerificationMethod(context, url, dec, Function fun) { - return Center( - child: InkWell( - onTap: fun, - child: Container( - // height: SizeConfig.heightMultiplier *2, - height: SizeConfig.heightMultiplier * 19, - width: SizeConfig.widthMultiplier * 37, - - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 1, - color: HexColor( - '#CCCCCC') // <--- border width here - ), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Column( - children: [ - Container( - margin: EdgeInsetsDirectional.only( - top: SizeConfig.heightMultiplier * 0.5), - child: Image.asset( - url, - height: SizeConfig.heightMultiplier * 10, - fit: BoxFit.cover, - ), - ), - SizedBox( - height: 10, - ), - Text( - dec, - style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), - ) - ], - ), - ), - ), - ); - } - bool hideSilentMethods() { return verificationMethod == 4 || verificationMethod == 3 ? true : false; } @@ -262,28 +318,90 @@ class _VerificationMethodsState extends State { *@return: *@desc: send Activation Code By Otp Notification Type */ - sendActivationCodeByOtpNotificationType(oTPSendType, AuthViewModel authProv) { + sendActivationCodeByOtpNotificationType( + oTPSendType, AuthViewModel authProv) async { // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); + int projectID = await sharedPref.getInt(PROJECT_ID); + ActivationCodeModel activationCodeModel = ActivationCodeModel( + facilityId: projectID, + memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], + zipCode: _loggedUser['ZipCode'], + mobileNumber: _loggedUser['MobileNumber'], + otpSendType: oTPSendType.toString(), + password: widget.password); - Map model = { - "LogInTokenID": _loggedUser['LogInTokenID'], - "Channel": 9, - "MobileNumber": _loggedUser['MobileNumber'], - "IPAdress": "11.11.11.11", - "LanguageID": 2, - "ProjectID": 15, //TODO : this should become daynamci - "ZipCode": _loggedUser['ZipCode'], - "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'], - "OTP_SendType": oTPSendType - }; - authProv.sendActivationCodeByOtpNotificationType(model).then((res) { - widget.changeLoadingStata(false); + try { + authProv + .sendActivationCodeForDoctorApp(activationCodeModel) + .then((res) { + if (res['MessageStatus'] == 1) { + print("VerificationCode : " + res["VerificationCode"]); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); + sharedPref.setString( + VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); + sharedPref.setString(PASSWORD, widget.password); + this.startSMSService(oTPSendType, authProv); + } else { + print(res['ErrorEndUserMessage']); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }).catchError((err) { + print('$err'); + widget.changeLoadingStata(false); + helpers.showErrorToast(); + }); + } catch (e) {} + } else { + // TODO route to this page with parameters to inicate we should present 2 option + if (Platform.isAndroid && oTPSendType == 3) { + helpers.showErrorToast('Your device not support this feature'); + } else { + // Navigator.of(context).push(MaterialPageRoute( + // builder: (BuildContext context) => + // VerificationMethodsScreen(password: widget.password,))); + + // Navigator.of(context).pushNamed(VERIFICATION_METHODS, + // arguments: {'verificationMethod': oTPSendType}); + } + } + } + + sendActivationCodeVerificationScreen( + oTPSendType, AuthViewModel authProv) async { + // TODO : build enum for verfication method + //if (oTPSendType == 1 || oTPSendType == 2) { + widget.changeLoadingStata(true); + ActivationCodeModel2 activationCodeModel = ActivationCodeModel2( + iMEI: user.iMEI, + facilityId: user.projectID, + memberID: user.doctorID, + zipCode: user.outSA == true ? '971' : '966', + mobileNumber: user.mobile, + oTPSendType: oTPSendType, + isMobileFingerPrint: 1, + vidaAuthTokenID: user.vidaAuthTokenID, + vidaRefreshTokenID: user.vidaRefreshTokenID); + + try { + authProv + .sendActivationCodeVerificationScreen(activationCodeModel) + .then((res) { if (res['MessageStatus'] == 1) { - Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, - arguments: {'model': model}); + print("VerificationCode : " + res["VerificationCode"]); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); + sharedPref.setString( + VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); + if (oTPSendType == 1 || oTPSendType == 2) { + widget.changeLoadingStata(false); + this.startSMSService(oTPSendType, authProv); + } else { + checkActivationCode(authProv); + } } else { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); @@ -294,14 +412,392 @@ class _VerificationMethodsState extends State { helpers.showErrorToast(); }); + } catch (e) {} + // } + // else { + // checkActivationCode(authProv); + // } + } + + Widget getButton(flag, authProv) { + switch (flag) { + case 2: + return InkWell( + onTap: () => {authenticateUser(2, true, authProv)}, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(30, 15, 30, 15), + child: Column( + children: [ + Image.asset( + 'assets/images/login/104.png', + height: SizeConfig.imageSizeMultiplier * 13, + width: SizeConfig.imageSizeMultiplier * 16, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).verifyWhatsApp, + fontSize: SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + ) + ], + ), + ))); + break; + case 1: + return InkWell( + onTap: () => {authenticateUser(1, true, authProv)}, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/login/103.png', + height: SizeConfig.imageSizeMultiplier * 13, + width: SizeConfig.imageSizeMultiplier * 16, + ), + projectsProvider.isArabic + ? SizedBox( + height: 20, + ) + : SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).verifySMS, + fontSize: projectsProvider.isArabic + ? SizeConfig.textMultiplier * 1.8 + : SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + ) + ], + ), + ))); + break; + case 3: + return InkWell( + onTap: () => { + if (checkIfBiometricAvailable(BiometricType.fingerprint)) + {authenticateUser(3, true, authProv)} + }, + child: RoundedContainer( + backgroundColor: + checkIfBiometricAvailable(BiometricType.fingerprint) + ? Colors.white + : Colors.white.withOpacity(.7), + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), + child: Column( + children: [ + Image.asset( + 'assets/images/login/102.png', + height: SizeConfig.imageSizeMultiplier * 13, + width: SizeConfig.imageSizeMultiplier * 16, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).verifyFingerprint, + fontSize: SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + ) + ], + ), + ))); + break; + case 4: + return InkWell( + onTap: () { + if (checkIfBiometricAvailable(BiometricType.face)) { + authenticateUser(4, true, authProv); + } + }, + child: RoundedContainer( + backgroundColor: checkIfBiometricAvailable(BiometricType.face) + ? Colors.white + : Colors.white.withOpacity(.7), + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/login/101.png', + height: SizeConfig.imageSizeMultiplier * 13, + width: SizeConfig.imageSizeMultiplier * 16, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).verifyFaceID, + fontSize: SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + ) + ], + ), + ))); + break; + + default: + return InkWell( + onTap: () => { + setState(() { + isMoreOption = true; + }) + }, + child: RoundedContainer( + backgroundColor: Colors.white, + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(5, 0, 5, 5), + child: Column( + children: [ + Image.asset( + 'assets/images/login/more_icon.png', + height: SizeConfig.imageSizeMultiplier * 13, + width: SizeConfig.imageSizeMultiplier * 16, + ), + projectsProvider.isArabic + ? SizedBox( + height: 15, + ) + : SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context).moreVerification, + fontSize: SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + ) + ], + ), + ))); + } + } + + getType(type, context) { + switch (type) { + case 1: + return TranslationBase.of(context).verifySMS; + break; + case 3: + return TranslationBase.of(context).verifyFingerprint; + break; + case 4: + return TranslationBase.of(context).verifyFaceID; + break; + case 2: + return TranslationBase.of(context).verifyWhatsApp; + break; + default: + return TranslationBase.of(context).verifySMS; + break; + } + } + + bool checkIfBiometricAvailable(BiometricType biometricType) { + bool isAvailable = false; + if (_availableBiometrics != null) { + for (var i = 0; i < _availableBiometrics.length; i++) { + if (biometricType == _availableBiometrics[i]) isAvailable = true; + } + } + return isAvailable; + } + + formatDate(date) { + return DateFormat('MMM dd, yyy, kk:mm').format(date); + } + + authenticateUser(type, isActive, authProv) { + //GifLoaderDialogUtils.showMyDialog(context); + if (type == 3 || type == 4) { + fingrePrintBefore = type; + } + this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type; + + switch (type) { + case 1: + this.loginWithSMS(1, isActive, authProv); + break; + case 2: + this.loginWithSMS(2, isActive, authProv); + + break; + case 3: + this.loginWithFingurePrintFace(3, isActive, authProv); + break; + case 4: + this.loginWithFingurePrintFace(4, isActive, authProv); + break; + default: + break; + } + sharedPref.setInt(OTP_TYPE, selectedOption); + // sharedPref.setInt(LAST_LOGIN), + } + + loginWithSMS(type, isActive, authProv) { + this.sendActivationCode(type, authProv); + } + + Future _getAvailableBiometrics() async { + var availableBiometrics; + try { + availableBiometrics = await auth.getAvailableBiometrics(); + } on PlatformException catch (e) { + print(e); + } + if (!mounted) return; + + setState(() { + _availableBiometrics = availableBiometrics; + }); + } + + sendActivationCode(type, authProv) async { + if (user != null) { + sendActivationCodeVerificationScreen(type, authProv); } else { - // TODO route to this page with parameters to inicate we should present 2 option - if (Platform.isAndroid && oTPSendType == 3) { - helpers.showErrorToast('Your device not support this feature'); + sendActivationCodeByOtpNotificationType(type, authProv); + } + } + + startSMSService(type, authProv) { + new SMSOTP( + context, + type, + _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, + (value) { + showDialog( + context: context, + builder: (BuildContext context) { + return Center( + child: CircularProgressIndicator(), + ); + }); + + this.checkActivationCode(authProv, value: value); + }, + () => { + widget.changeLoadingStata(false), + print('Faild..'), + }, + ).displayDialog(context); + } + + loginWithFingurePrintFace(type, isActive, authProv) async { + if (isActive) { + // this.startBiometricLoginIfAvailable(); + + const iosStrings = const IOSAuthMessages( + cancelButton: 'cancel', + goToSettingsButton: 'settings', + goToSettingsDescription: 'Please set up your Touch ID.', + lockOut: 'Please reenable your Touch ID'); + + try { + authenticated = await auth.authenticateWithBiometrics( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true, + iOSAuthStrings: iosStrings); + } on PlatformException catch (e) { + DrAppToastMsg.showErrorToast(e); + } + if (!mounted) return; + if (user != null && (user.logInTypeID == 3 || user.logInTypeID == 4)) { + this.sendActivationCode(type, authProv); + // this.checkActivationCode(authProv); } else { - Navigator.of(context).pushNamed(VERIFICATION_METHODS, - arguments: {'verificationMethod': oTPSendType}); + setState(() { + this.onlySMSBox = true; + }); } } } + + checkActivationCode(AuthViewModel authProv, {value}) async { + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = + new CheckActivationCodeRequestModel( + zipCode: + _loggedUser != null ? _loggedUser['ZipCode'] : user.zipCode, + mobileNumber: + _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, + projectID: await sharedPref.getInt(PROJECT_ID) != null + ? await sharedPref.getInt(PROJECT_ID) + : user.projectID, + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), + activationCode: value ?? '0000', + oTPSendType: await sharedPref.getInt(OTP_TYPE), + generalid: "Cs2020@2016\$2958"); + + authProv + .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) + .then((res) async { + widget.changeLoadingStata(false); + if (res['MessageStatus'] == 1) { + sharedPref.setString(TOKEN, res['AuthenticationTokenID']); + if (res['List_DoctorProfile'] != null) { + loginProcessCompleted(res['List_DoctorProfile'][0], authProv); + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); + } else { + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); + ClinicModel clinic = + ClinicModel.fromJson(res['List_DoctorsClinic'][0]); + getDocProfiles(clinic, authProv); + } + } else { + Navigator.pop(context); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }).catchError((err) { + Navigator.pop(context); + helpers.showErrorToast(err); + }); + } + + loginProcessCompleted(Map profile, authProv) { + var doctor = DoctorProfileModel.fromJson(profile); + authProv.setDoctorProfile(doctor); + sharedPref.setObj(DOCTOR_PROFILE, profile); + projectsProvider.isLogin = true; + Navigator.of(context).pushReplacementNamed(HOME); + } + + getDocProfiles(ClinicModel clinicInfo, authProv) { + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: clinicInfo.doctorID, + clinicID: clinicInfo.clinicID, + license: true, + projectID: clinicInfo.projectID, + tokenID: '', + languageID: 2); + authProv.getDocProfiles(docInfo.toJson()).then((res) { + if (res['MessageStatus'] == 1) { + loginProcessCompleted(res['DoctorProfileList'][0], authProv); + } else { + // changeLoadingStata(false); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }).catchError((err) { + // changeLoadingStata(false); + helpers.showErrorToast(err); + }); + } } diff --git a/lib/widgets/charts/app_bar_chart.dart b/lib/widgets/charts/app_bar_chart.dart new file mode 100644 index 00000000..98ef3cfa --- /dev/null +++ b/lib/widgets/charts/app_bar_chart.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:charts_flutter/flutter.dart' as charts; + +class AppBarChart extends StatelessWidget { + const AppBarChart({ + Key key, + @required this.seriesList, + }) : super(key: key); + + final List seriesList; + + @override + Widget build(BuildContext context) { + return Container( + height: 400, + margin: EdgeInsets.only(top: 60), + child: charts.BarChart( + seriesList, + // animate: animate, + + /// Customize the primary measure axis using a small tick renderer. + /// Use String instead of num for ordinal domain axis + /// (typically bar charts). + primaryMeasureAxis: new charts.NumericAxisSpec( + renderSpec: new charts.GridlineRendererSpec( + // Display the measure axis labels below the gridline. + // + // 'Before' & 'after' follow the axis value direction. + // Vertical axes draw 'before' below & 'after' above the tick. + // Horizontal axes draw 'before' left & 'after' right the tick. + labelAnchor: charts.TickLabelAnchor.before, + + // Left justify the text in the axis. + // + // Note: outside means that the secondary measure axis would right + // justify. + labelJustification: + charts.TickLabelJustification.outside, + )), + ), + ); + } +} diff --git a/lib/widgets/charts/app_line_chart.dart b/lib/widgets/charts/app_line_chart.dart new file mode 100644 index 00000000..553afec8 --- /dev/null +++ b/lib/widgets/charts/app_line_chart.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; +import 'package:charts_flutter/flutter.dart' as charts; + +/// chart line +/// [seriesList] charts series +/// [chartTitle] the charts title +/// [animate] enable and disable animate on create chart +/// [includeArea] chart include Area +/// [stacked] stacked chart over the design +class AppLineChart extends StatelessWidget { + final List seriesList; + final String chartTitle; + final bool animate; + final bool includeArea; + final bool stacked; + + AppLineChart( + {Key key, + @required this.seriesList, + this.chartTitle, + this.animate = true, + this.includeArea = false, + this.stacked = true}); + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Text( + chartTitle, + style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), + ), + Expanded( + child: charts.LineChart(seriesList, + defaultRenderer: charts.LineRendererConfig( + includeArea: false, stacked: true), + animate: animate), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/charts/app_time_series_chart.dart b/lib/widgets/charts/app_time_series_chart.dart new file mode 100644 index 00000000..670284a1 --- /dev/null +++ b/lib/widgets/charts/app_time_series_chart.dart @@ -0,0 +1,71 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:charts_flutter/flutter.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/data_display/list/flexible_container.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +/// App Time Series Chart +/// [seriesList] the series list +/// [chartName] the name of the chart +/// [startDate] the start date +/// [endDate] the end date +class AppTimeSeriesChart extends StatelessWidget { + AppTimeSeriesChart({ + Key key, + @required this.seriesList, + this.chartName = '', + this.startDate, + this.endDate, + }); + + final String chartName; + final List> seriesList; + final DateTime startDate; + final DateTime endDate; + + @override + Widget build(BuildContext context) { + return FlexibleContainer( + heightFactor: 0.47, + child: Column( + children: [ + AppText(chartName, fontSize: SizeConfig.textMultiplier * 3), + Container( + height: SizeConfig.realScreenHeight * 0.37, + child: Center( + child: Container( + child: charts.TimeSeriesChart( + seriesList, + animate: true, + behaviors: [ + charts.RangeAnnotation( + [ + charts.RangeAnnotationSegment(startDate, endDate, + charts.RangeAnnotationAxisType.domain ), + ], + ), + ], + ), + ), + ), + ), + ], + ), + ); + } +} + +class TimeSeriesSales { + final DateTime time; + final int sales; + + TimeSeriesSales(this.time, this.sales); +} + +class TimeSeriesSales2 { + final DateTime time; + final double sales; + + TimeSeriesSales2(this.time, this.sales); +} diff --git a/lib/widgets/dashboard/dashboard_item_texts_widget.dart b/lib/widgets/dashboard/dashboard_item_texts_widget.dart index c3e4986d..80b0aa17 100644 --- a/lib/widgets/dashboard/dashboard_item_texts_widget.dart +++ b/lib/widgets/dashboard/dashboard_item_texts_widget.dart @@ -26,7 +26,7 @@ class DashboardItemTexts extends StatefulWidget { } class _DashboardItemTextsState extends State { - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); diff --git a/lib/widgets/dashboard/guage_chart.dart b/lib/widgets/dashboard/guage_chart.dart new file mode 100644 index 00000000..ddd649d1 --- /dev/null +++ b/lib/widgets/dashboard/guage_chart.dart @@ -0,0 +1,54 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:flutter/material.dart'; +import 'dart:math'; + +class GaugeChart extends StatelessWidget { + final List seriesList; + final bool animate; + + GaugeChart(this.seriesList, {this.animate}); + + /// Creates a [PieChart] with sample data and no transition. + factory GaugeChart.withSampleData() { + return new GaugeChart( + _createSampleData(), + // Disable animations for image tests. + animate: false, + ); + } + @override + Widget build(BuildContext context) { + return new charts.PieChart(seriesList, + animate: animate, + defaultRenderer: new charts.ArcRendererConfig(arcWidth: 10)); + //); + } + + static List> _createSampleData() { + final data = [ + new GaugeSegment('Low', 75, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment( + 'Acceptable', 100, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment('High', 50, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment( + 'Highly Unusual', 55, charts.MaterialPalette.blue.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + ) + ]; + } +} + +/// Sample data type. +class GaugeSegment { + final String segment; + final int size; + final charts.Color color; + GaugeSegment(this.segment, this.size, this.color); +} diff --git a/lib/widgets/data_display/list/custom_Item.dart b/lib/widgets/data_display/list/custom_Item.dart new file mode 100644 index 00000000..c11af999 --- /dev/null +++ b/lib/widgets/data_display/list/custom_Item.dart @@ -0,0 +1,93 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +/// Custom Item widget +/// [startIcon] icon at the start of the widget +/// [startIconSize] icon size of start icon +/// [startIconColor] icon color of start icon +/// [endIcon] icon at the end of the widget +/// [endIconSize] icon size of end icon +/// [endIconColor] icon color of end icon +/// [disabled] disabled on tap function +/// [onTap] opTap function +/// [padding] padding of the widget +/// [child] child of the widget +/// [decoration] decoration of the widget +class CustomItem extends StatelessWidget { + final IconData startIcon; + final double startIconSize; + final Color startIconColor; + final IconData endIcon; + final double endIconSize; + final Color endIconColor; + final bool disabled; + final Function onTap; + final EdgeInsets padding; + final Widget child; + final BoxDecoration decoration; + + CustomItem( + {Key key, + this.startIcon, + this.disabled: false, + this.onTap, + this.startIconColor, + this.endIcon = EvaIcons.chevronRight, + this.padding, + this.child, + this.endIconColor, + this.endIconSize = 20, + this.decoration, + this.startIconSize = 19}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return IgnorePointer( + ignoring: disabled, + child: Container( + decoration: decoration != null ? decoration : BoxDecoration(), + child: InkWell( + onTap: () { + if (onTap != null) onTap(); + }, + child: Padding( + padding: padding != null + ? padding + : const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), + child: Row( + children: [ + if (startIcon != null) + Expanded( + flex: 1, + child: Icon( + startIcon, + color: startIconColor ?? Theme.of(context).primaryColor, + size: startIconSize, + ), + ), + if (startIcon != null) SizedBox(width: 18.0), + Expanded( + child: child, + flex: 10, + ), + endIcon == null + ? Expanded(child: Container()) + : Expanded( + flex: 1, + child: Icon( + endIcon, + color: endIconColor != null + ? endIconColor + : Colors.grey[500], + size: endIconSize, + ), + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/data_display/list/flexible_container.dart b/lib/widgets/data_display/list/flexible_container.dart new file mode 100644 index 00000000..a35fa279 --- /dev/null +++ b/lib/widgets/data_display/list/flexible_container.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +/// Flexible container widget +/// [widthFactor] If non-null, the fraction of the incoming width given to the child. +/// If non-null, the child is given a tight width constraint that is the max +/// incoming width constraint multiplied by this factor. +/// If null, the incoming width constraints are passed to the child + +/// [heightFactor]If non-null, the fraction of the incoming height given to the child. +/// If non-null, the child is given a tight height constraint that is the max +/// incoming height constraint multiplied by this factor. +/// If null, the incoming height constraints are passed to the child +/// [padding] add padding to the container +/// [child] child widget inside the container +class FlexibleContainer extends StatelessWidget { + final double widthFactor; + final double heightFactor; + final EdgeInsets padding; + final Widget child; + + FlexibleContainer({ + Key key, + this.widthFactor = 0.9, + this.heightFactor = 1, + this.padding, + this.child, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( +// widthFactor: widthFactor, +// heightFactor: heightFactor, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Material( + color: Theme.of(context).backgroundColor, + child: Container( + padding: padding, + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + color: Theme.of(context).dividerColor, width: 2.0), + borderRadius: BorderRadius.circular(8.0)), + child: child, + ), + ), + ), + ); + } +} diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index e9126ba3..5660fde6 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -1,13 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class DoctorReplyWidget extends StatefulWidget { final ListGtMyPatientsQuestions reply; @@ -22,178 +22,434 @@ class DoctorReplyWidget extends StatefulWidget { class _DoctorReplyWidgetState extends State { @override Widget build(BuildContext context) { - return Stack( - children: [ - Container( - margin: EdgeInsets.symmetric(vertical: 10.0), - width: double.infinity, - decoration: BoxDecoration( - color: HexColor('#FFFFFF'), - borderRadius: BorderRadius.all( - Radius.circular(20.0), - ), - ), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - children: [ - SizedBox(height: 18,), - Container( - margin: EdgeInsets.only(right: 15), - child: Row( + return Container( + child: CardWithBgWidget( + bgColor: + widget.reply.status == 1 + ? Color(0xffc4aa54) + : Colors.red[700], + hasBorder: false, + widget: Container( + // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), + child: InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: widget.reply.infoStatus!=null ? widget.reply.infoStatus :'', + style: TextStyle( + color: widget.reply.status != null + ? widget.reply.status == 1 + ? Color(0xffc4aa54) + : widget.reply.status == 2 + ? Colors.green[700] + : Colors.red[700] + : Colors.grey[500], + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 2.0 * SizeConfig.textMultiplier)), + ], + ), + ), + AppText( + DateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .day + .toString() + + " " + + DateUtils.getMonth( + DateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .month) + .toString() + .substring(0, 3) + + ' ' + + DateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .year + .toString(), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + ], + ), + Row( + children: [ + Expanded( + child: AppText( + Helpers.capitalize( widget.reply.patientName), + fontSize: SizeConfig.textMultiplier * 2.5, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + ), + SizedBox( + width: 4, + ), + widget.reply.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ], + ), + SizedBox( + height: 20, + ), + + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - SizedBox(width: 5,), - //LargeAvatar(icon: widget.reply.gender == 0 ? DoctorApp.male : DoctorApp.femaleicon ,), Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment(-1, -1), - end: Alignment(1, 1), - colors: [ - Colors.grey[100], - Colors.grey[200], - ]), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], - borderRadius: BorderRadius.all(Radius.circular(50.0)), - ), - width: 80, - height: 80, - child: Icon(widget.reply.gender == 1 ? DoctorApp.male : DoctorApp.female_icon,size: 80,)), + margin: EdgeInsets.only(top: 5), + width: 60, + height: 60, + child: Image.asset( + widget.reply.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), - SizedBox(width: 15,), - Expanded( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.reply.patientName, - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), + ], + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - Container( - margin: EdgeInsets.only(left: 5), - child: AppText( - '${widget.reply.patientID}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), + children: [ + + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).fileNumber, + style: TextStyle( + fontSize: 14,color: Color(0xFF575757),fontWeight: FontWeight.bold, fontFamily: 'Poppins')), + new TextSpan( + text: widget.reply.patientID.toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), ], ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).mobileNo, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - Container( - margin: EdgeInsets.only(left: 5), - child: AppText( - widget.reply.mobileNumber, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), + ), + Container( + width: MediaQuery.of(context).size.width*0.45, + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', ), - ], - ), - SizedBox( - height: 5, + children: [ + new TextSpan( + text: TranslationBase.of(context).age + + " : ", + style: TextStyle(fontSize: 14,color: Color(0xFF575757),fontWeight: FontWeight.bold)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15)), + ], + ), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 70, - height: 20, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(60.0)), - color: Colors.green[600] - ), - child: Center( - child: AppText( - widget.reply.requestTime, - fontSize: 1.5 * SizeConfig.textMultiplier, - color: Colors.white, - ), - ), - ), - Container( - - child: AppText( - '${Helpers.getDate(widget.reply.requestDate)}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - ], - ), - - ], - ), + ) + ], ), - ) - ], - ), - ), - !widget.isShowMore ? SizedBox(height: 18,) : - AnimatedContainer( - duration: Duration(milliseconds: 200), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Divider(color: Colors.grey), - SizedBox(height: 5,), - AppText( - widget.reply.remarks, - fontSize: 2.5 * SizeConfig.textMultiplier, - //fontWeight: FontWeight.bold, + ], ), - SizedBox(height: 10,) - ], - ), + Container( + width: MediaQuery.of(context).size.width * 0.5, + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).doctorResponse + " : ", + style: + TextStyle(fontSize: 14, fontFamily: 'Poppins', color: Color(0xFF575757),fontWeight: FontWeight.bold)), + new TextSpan( + text: widget.reply.remarks, + style: TextStyle( + fontFamily: 'Poppins', + color: Color(0xFF575757), + fontSize: 15)), + ], + ), + ), + ), + ],) + ], ), - ], - ), + SizedBox( + height: 20, + ), + ], ), - ), - Positioned( - right: 5, - top: 20, - child: InkWell( - onTap: (){ - setState(() { - widget.isShowMore = !widget.isShowMore; - }); - }, - child: Icon(widget.isShowMore? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down)), - ) - ], - + // onTap: onTap, + )), + ), ); + // Stack( + // children: [ + // Container( + // margin: EdgeInsets.symmetric(vertical: 10.0), + // width: double.infinity, + // decoration: BoxDecoration( + // color: HexColor('#FFFFFF'), + // borderRadius: BorderRadius.all( + // Radius.circular(20.0), + // ), + // ), + // child: Container( + // margin: EdgeInsets.all(5), + // child: Column( + // children: [ + // SizedBox(height: 18,), + // Container( + // margin: EdgeInsets.only(right: 15), + // child: Row( + // children: [ + // SizedBox(width: 5,), + // //LargeAvatar(icon: widget.reply.gender == 0 ? DoctorApp.male : DoctorApp.femaleicon ,), + // Container( + // decoration: BoxDecoration( + // gradient: LinearGradient( + // begin: Alignment(-1, -1), + // end: Alignment(1, 1), + // colors: [ + // Colors.grey[100], + // Colors.grey[200], + // ]), + // boxShadow: [ + // BoxShadow( + // color: Color.fromRGBO(0, 0, 0, 0.08), + // offset: Offset(0.0, 5.0), + // blurRadius: 16.0) + // ], + // borderRadius: BorderRadius.all(Radius.circular(50.0)), + // ), + // width: 80, + // height: 80, + // child: Icon(widget.reply.gender == 1 ? DoctorApp.male : DoctorApp.female_icon,size: 80,)), + // + // SizedBox(width: 15,), + // Expanded( + // child: Container( + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // widget.reply.patientName, + // fontSize: 1.5 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // ), + // SizedBox( + // height: 5, + // ), + // + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).fileNo, + // fontSize: 1.7 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // ), + // Container( + // margin: EdgeInsets.only(left: 5), + // child: AppText( + // '${widget.reply.patientID}', + // fontSize: 1.7 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ), + // SizedBox( + // height: 5, + // ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).mobileNo, + // fontSize: 1.7 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // ), + // Container( + // margin: EdgeInsets.only(left: 5), + // child: AppText( + // widget.reply.mobileNumber, + // fontSize: 1.7 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ), + // SizedBox( + // height: 5, + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Container( + // width: 70, + // height: 20, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all(Radius.circular(60.0)), + // color: Colors.green[600] + // ), + // child: Center( + // child: AppText( + // widget.reply.requestTime, + // fontSize: 1.5 * SizeConfig.textMultiplier, + // color: Colors.white, + // ), + // ), + // ), + // Container( + // + // child: AppText( + // '${Helpers.getDate(widget.reply.requestDate)}', + // fontSize: 1.7 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold, + // color: Colors.black, + // ), + // ), + // ], + // ), + // + // ], + // ), + // ), + // ) + // + // ], + // ), + // ), + // + // !widget.isShowMore ? SizedBox(height: 18,) : + // AnimatedContainer( + // duration: Duration(milliseconds: 200), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Divider(color: Colors.grey), + // SizedBox(height: 5,), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // TranslationBase.of(context).remarks + " : ", + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ),Expanded( + // child: AppText( + // widget.reply.remarks, + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ), + // SizedBox(height: 10,), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // TranslationBase.of(context).doctorResponse + " : ", + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ),Expanded( + // child: AppText( + // widget.reply.doctorResponse, + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ),SizedBox(height: 10,), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // TranslationBase.of(context).infoStatus + " : ", + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ),Expanded( + // child: AppText( + // widget.reply.infoStatus, + // fontSize: 2.5 * SizeConfig.textMultiplier, + // //fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ) + // ], + // ), + // ), + // + // ], + // ), + // ), + // ), + // Positioned( + // right: 5, + // top: 20, + // child: InkWell( + // onTap: (){ + // setState(() { + // widget.isShowMore = !widget.isShowMore; + // }); + // }, + // child: Icon(widget.isShowMore? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down)), + // ) + // ], + // + // ); } } diff --git a/lib/widgets/doctor/lab_result_widget.dart b/lib/widgets/doctor/lab_result_widget.dart index 8b2ab0c4..5ca50864 100644 --- a/lib/widgets/doctor/lab_result_widget.dart +++ b/lib/widgets/doctor/lab_result_widget.dart @@ -27,7 +27,7 @@ class _LabResultWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( @@ -59,9 +59,58 @@ class _LabResultWidgetState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10)), ), - child: Column( - children: widget.labResult.map((result) { + child: Column(children: [ + Container( + child: Row( + children: [ + Expanded( + child: Container( + decoration: BoxDecoration( + color: HexColor('#515B5D'), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + ), + ), + child: Center( + child: Texts( + TranslationBase.of(context).description, + color: Colors.white, + ), + ), + height: 60, + ), + ), + Expanded( + child: Container( + color: HexColor('#515B5D'), + child: Center( + child: Texts( + TranslationBase.of(context).value, + color: Colors.white), + ), + height: 60), + ), + Expanded( + child: Container( + decoration: BoxDecoration( + color: HexColor('#515B5D'), + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.0), + ), + ), + child: Center( + child: Texts( + TranslationBase.of(context).range, + color: Colors.white), + ), + height: 60), + ), + ], + ), + ), + ...widget.labResult.map((result) { return Container( + padding: EdgeInsets.symmetric(horizontal: 4), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10)), border: Border( @@ -76,53 +125,6 @@ class _LabResultWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Expanded( - child: Container( - decoration: BoxDecoration( - color: HexColor('#515B5D'), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context) - .description, - color: Colors.white, - ), - ), - height: 60, - ), - ), - Expanded( - child: Container( - color: HexColor('#515B5D'), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white), - ), - height: 60), - ), - Expanded( - child: Container( - decoration: BoxDecoration( - color: HexColor('#515B5D'), - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).range, - color: Colors.white), - ), - height: 60), - ), - ], - ), Row( children: [ Expanded( @@ -164,7 +166,7 @@ class _LabResultWidgetState extends State { ), ); }).toList(), - ), + ]), ), ) ], diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 68194a31..c28cc8d3 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -1,8 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -13,69 +14,86 @@ class MyScheduleWidget extends StatelessWidget { @override Widget build(BuildContext context) { - List workingHours = Helpers.getWorkingHours(workingHoursTable.workingHours); - return CardWithBgWidgetNew( - widget: Container( - child: Column( + List workingHours = Helpers.getWorkingHours( + workingHoursTable.workingHours, + ); + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText(workingHoursTable.dayName, - fontSize: 2.5 * SizeConfig.textMultiplier), - AppText( - ' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}', - fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,), - ], + children: [ + SizedBox( + height: 10, + ), + AppText( + workingHoursTable.dayName, + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + // fontSize: 18 ), SizedBox( - height: 8, + height: 10, ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: workingHours.map((work) { - return Container( - child: Column( - children: [ - Divider(color: Colors.grey), - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('From',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), - SizedBox(height: 5,), - AppText(work.from,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) - ], - ), - ), - Container(height: SizeConfig.realScreenWidth * 0.1 ,width: 0.8,color: Colors.grey, - margin: EdgeInsets.only(left: 15,right: 15),), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText('To',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), - SizedBox(height: 5,), - AppText(work.to,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) - ], - ), - ), - ], - ) + AppText( + ' ${workingHoursTable.date.day} ${(DateUtils.getMonth(workingHoursTable.date.month).toString().substring(0, 3))}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, - ], - ), - ); - }).toList(), + fontFamily: 'Poppins', + // fontSize: 18 ), - SizedBox( - width: 8, - ) ], ), - ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + child: CardWithBgWidget( + bgColor: DateUtils.isToday(workingHoursTable.date) + ? Colors.green[500] + : Colors.transparent, + // hasBorder: false, + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (DateUtils.isToday(workingHoursTable.date)) + AppText( + "Today", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Colors.green[500], + // fontSize: 18 + ), + SizedBox( + height: 10, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: workingHours.map((work) { + return Container( + child: Column( + children: [ + SizedBox( + height: 5, + ), + AppText( + work.from + ' - ' + work.to, + fontSize: 2.0 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ); + }).toList(), + ), + ], + ), + ), + ), + ), + ], ); } } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart new file mode 100644 index 00000000..fb5a9a0c --- /dev/null +++ b/lib/widgets/otp/sms-popup.dart @@ -0,0 +1,347 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +import 'package:provider/provider.dart'; + +class SMSOTP { + final type; + final mobileNo; + final Function onSuccess; + final Function onFailure; + final context; + + int remainingTime = 600; + + Future timer; + + static BuildContext _context; + + static bool _loading; + + SMSOTP( + this.context, + this.type, + this.mobileNo, + this.onSuccess, + this.onFailure, + ); + + final verifyAccountForm = GlobalKey(); + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + + Map verifyAccountFormValue = { + 'digit1': '', + 'digit2': '', + 'digit3': '', + 'digit4': '', + }; + final focusD1 = FocusNode(); + final focusD2 = FocusNode(); + final focusD3 = FocusNode(); + final focusD4 = FocusNode(); + String errorMsg; + ProjectViewModel projectProvider; + String displayTime = ''; + bool isClosed = false; + displayDialog(BuildContext context) async { + return showDialog( + context: context, + builder: (context) { + projectProvider = Provider.of(context); + return AlertDialog( + title: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + icon: Icon(Icons.close), + onPressed: () { + this.isClosed = true; + Navigator.pop(context); + this.onFailure(); + }, + ) + ], + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0))), + content: StatefulBuilder(builder: (context, setState) { + if (displayTime == '') { + startTimer(setState); + } + return Container( + color: Colors.white, + height: SizeConfig.realScreenHeight * 0.5, + width: SizeConfig.realScreenWidth * 0.8, + child: Center( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + type == 1 + ? Image.asset('assets/images/login/103.png') + : Image.asset('assets/images/login/104.png'), + Padding( + padding: EdgeInsets.only(top: 5), + child: AppText( + TranslationBase.of(context).verificationMessage + + ' XXXXXX' + + mobileNo + .toString() + .substring(mobileNo.toString().length - 3), + textAlign: TextAlign.center, + )), + Form( + key: verifyAccountForm, + child: Padding( + padding: EdgeInsets.only(top: 20), + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + textInputAction: TextInputAction.next, + style: buildTextStyle(), + autofocus: true, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) {}, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD2); + verifyAccountFormValue['digit1'] = + val.trim(); + checkValue(); + } + }, + ), + ), + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + focusNode: focusD2, + textInputAction: TextInputAction.next, + maxLength: 1, + controller: digit2, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD3); + verifyAccountFormValue['digit2'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit), + ), + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + focusNode: focusD3, + textInputAction: TextInputAction.next, + maxLength: 1, + controller: digit3, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType.number, + decoration: + buildInputDecoration(context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + verifyAccountFormValue['digit3'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + focusNode: focusD4, + maxLength: 1, + textAlign: TextAlign.center, + style: buildTextStyle(), + controller: digit4, + keyboardType: TextInputType.number, + decoration: + buildInputDecoration(context), + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + verifyAccountFormValue['digit4'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + ], + )), + ), + ), + Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + TranslationBase.of(context).validationMessage + + ' ' + + displayTime, + color: Colors.red, + textAlign: TextAlign.center, + )) + ], + ))), + ); + }), + ); + }); + } + + TextStyle buildTextStyle() { + return TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ); + } + + InputDecoration buildInputDecoration(BuildContext context) { + return InputDecoration( + counterText: " ", + // ts/images/password_icon.png + // contentPadding: EdgeInsets.only(top: 20, bottom: 20), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); + } + + String validateCodeDigit(value) { + if (value.isEmpty) { + return ' '; + } else if (value.length == 3) { + print(value); + } else { + return null; + } + } + + checkValue() { + //print(verifyAccountFormValue); + if (verifyAccountForm.currentState.validate()) { + onSuccess(digit1.text.toString() + + digit2.text.toString() + + digit3.text.toString() + + digit4.text.toString()); + } + } + + getSecondsAsDigitalClock(int inputSeconds) { + var sec_num = + int.parse(inputSeconds.toString()); // don't forget the second param + var hours = (sec_num / 3600).floor(); + var minutes = ((sec_num - hours * 3600) / 60).floor(); + var seconds = sec_num - hours * 3600 - minutes * 60; + var minutesString = ""; + var secondsString = ""; + minutesString = + minutes < 10 ? "0" + minutes.toString() : minutes.toString(); + secondsString = + seconds < 10 ? "0" + seconds.toString() : seconds.toString(); + return minutesString + ":" + secondsString; + } + + startTimer(setState) { + this.remainingTime--; + setState(() { + displayTime = this.getSecondsAsDigitalClock(this.remainingTime); + }); + + timer = Future.delayed(Duration(seconds: 1), () { + if (this.remainingTime > 0) { + if (isClosed == false) startTimer(setState); + } else { + Navigator.pop(context); + } + }); + } + + static void showLoadingDialog(BuildContext context, bool _loading) async { + _context = context; + + if (_loading == false) { + Navigator.of(context).pop(); + return; + } + _loading = true; + await showDialog( + context: _context, + barrierDismissible: false, + builder: (BuildContext context) { + return SimpleDialog( + elevation: 0.0, + backgroundColor: Colors.transparent, + children: [ + Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.black), + ), + ) + ], + ); + }); + } + + static void hideSMSBox(context) { + Navigator.pop(context); + } +} diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart new file mode 100644 index 00000000..c53a38d7 --- /dev/null +++ b/lib/widgets/patients/PatientCard.dart @@ -0,0 +1,363 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; + +class PatientCard extends StatelessWidget { + final PatiantInformtion patientInfo; + final Function onTap; + final String patientType; + final String arrivalType; + const PatientCard( + {Key key, + this.patientInfo, + this.onTap, + this.patientType, + this.arrivalType}) + : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + width: SizeConfig.screenWidth * 0.9, + margin: EdgeInsets.all(6), + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + ), + child: Stack(children: [ + Container( + height: MediaQuery.of(context).size.height * .20, + width: 5, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + bottomLeft: Radius.circular(10)), + color: patientInfo.patientStatusType == 43 + ? Colors.green[500] + : Colors.red[800], + )), + Container( + padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), + child: InkWell( + child: Column( + children: [ + SizedBox( + height: 10, + ), + SERVICES_PATIANT2[int.parse(patientType)] == + "patientArrivalList" + ? Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + patientInfo.patientStatusType == 43 + ? AppText( + TranslationBase.of(context).arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + this.arrivalType == '1' + ? AppText( + patientInfo.startTime != null + ? patientInfo.startTime + : '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + : patientInfo.arrivedOn != null + ? AppText( + DateUtils.convertStringToDateFormat( + patientInfo.arrivedOn, + 'MM-dd-yyyy HH:mm'), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + : SizedBox() + ], + )) + : SizedBox(), + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row(children: [ + AppText( + (Helpers.capitalize(patientInfo.firstName) + + " " + + Helpers.capitalize(patientInfo.lastName)), + fontSize: SizeConfig.textMultiplier * 2, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + patientInfo.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + Row( + children: [ + AppText( + patientInfo.nationalityName != null + ? patientInfo.nationalityName + : patientInfo.nationality != null + ? patientInfo.nationality + : "", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + patientInfo.nationality != null + ? ClipRRect( + borderRadius: + BorderRadius.circular(20.0), + child: Image.network( + patientInfo.nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : SizedBox() + ], + ) + ], + )), + Row(children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + patientInfo.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + ], + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .fileNumber, + style: TextStyle( + fontSize: 14, + fontFamily: 'Poppins')), + new TextSpan( + text: patientInfo.patientId.toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of(context).age + + " : ", + style: TextStyle(fontSize: 14)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15)), + ], + ), + ), + ), + if (SERVICES_PATIANT2[int.parse(patientType)] == + "List_MyOutPatient") + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .appointmentDate + + " : ", + fontSize: 14, + ), + patientInfo.startTimes != null + ? Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + patientInfo.startTimes, + color: Colors.white, + fontSize: 1.5 * + SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ) + : SizedBox(), + SizedBox( + width: 3.5, + ), + Container( + child: patientInfo.appointmentDate != null + ? AppText( + DateUtils + .convertDateFromServerFormat( + patientInfo + .appointmentDate + .toString(), + 'yyyy-MM-dd'), + fontSize: 1.5 * + SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ) + : SizedBox(), + ), + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only( + top: 8, + ), + ) + ])) + ]), + SERVICES_PATIANT2[int.parse(patientType)] == + "patientArrivalList" + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(4), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only( + // bottomRight: Radius.circular(8), + // topLeft: Radius.circular(8), + // ), + // color: patientInfo.appointmentType == + // 'Regular' && + // patientInfo.visitTypeId == 100 + // ? HexColor('#D02127') + // : patientInfo.appointmentType == + // 'Walkin' + // ? HexColor('#28323A') + // : HexColor('#6C7379'), + // ), + child: Image.asset( + patientInfo.appointmentType == + 'Regular' && + patientInfo.visitTypeId == 100 + ? 'assets/images/livecare.png' + : patientInfo.appointmentType == + 'Walkin' + ? 'assets/images/walkin.png' + : 'assets/images/booked.png', + height: 25, + width: 35, + )), + ]) + : SizedBox() + ], + ), + onTap: onTap, + )), + ])); + } + + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } + + isToday(date) { + DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); + return DateFormat("yyyy-MM-dd").format(tempDate) == + DateFormat("yyyy-MM-dd").format(DateTime.now()); + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.green, + width: 5, + ), + ), + borderRadius: BorderRadius.circular(10)); + } +} diff --git a/lib/widgets/patients/clinic_list_dropdwon.dart b/lib/widgets/patients/clinic_list_dropdwon.dart new file mode 100644 index 00000000..c903bd7b --- /dev/null +++ b/lib/widgets/patients/clinic_list_dropdwon.dart @@ -0,0 +1,99 @@ +// ignore: must_be_immutable +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ClinicList extends StatelessWidget { + + ProjectViewModel projectsProvider; + final int clinicId; + final Function (int value) onClinicChange; + + ClinicList({Key key, this.clinicId, this.onClinicChange}) : super(key: key); + + @override + Widget build(BuildContext context) { + // authProvider = Provider.of(context); + + projectsProvider = Provider.of(context); + return Container( + child: + projectsProvider + .doctorClinicsList.length > + 0 + ? FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width *0.8, + child: Center( + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: + Colors.white, + iconEnabledColor: + Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[ + 0] + .clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item.clinicName, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: Colors + .black, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue){ + onClinicChange(newValue); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: + TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + ), + ), + ], + ), + ) + : AppText( + TranslationBase + .of(context) + .noClinic), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 25d196d0..a6a492ca 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -1,13 +1,16 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/custom_validation_error.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; class DynamicElements extends StatefulWidget { final PatientModel _patientSearchFormValues; - DynamicElements(this._patientSearchFormValues); + final bool isFormSubmitted; + DynamicElements(this._patientSearchFormValues, this.isFormSubmitted); @override _DynamicElementsState createState() => _DynamicElementsState(); } @@ -30,20 +33,15 @@ class _DynamicElementsState extends State { var selectedDate = DateFormat.yMd().format(pickedDate); if (id == '_selectedFromDate') { - // _fromDateController.text = selectedDate; + // _fromDateController.text = selectedDate; selectedDate = pickedDate.year.toString() + "-" + pickedDate.month.toString().padLeft(2, '0') + "-" + pickedDate.day.toString().padLeft(2, '0'); - _fromDateController.text = selectedDate; - - - + _fromDateController.text = selectedDate; } else { - - selectedDate = pickedDate.year.toString() + "-" + pickedDate.month.toString().padLeft(2, '0') + @@ -51,7 +49,7 @@ class _DynamicElementsState extends State { pickedDate.day.toString().padLeft(2, '0'); _toDateController.text = selectedDate; - // _toDateController.text = selectedDate; + // _toDateController.text = selectedDate; } }); }); @@ -59,6 +57,34 @@ class _DynamicElementsState extends State { @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + {String hintText, + String selectedText, + bool isDropDown, + IconData icon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + return LayoutBuilder( builder: (ctx, constraints) { return Column( @@ -67,46 +93,67 @@ class _DynamicElementsState extends State { SizedBox( height: 10, ), - AppTextFormField( - textInputType: TextInputType.number, - hintText: TranslationBase.of(context).fromDate, - controller: _fromDateController, - inputFormatter: ONLY_DATE, - onTap: () { - _presentDatePicker('_selectedFromDate'); - }, - onSaved: (value) { - if (_fromDateController.text.toString().trim().isEmpty) { - widget._patientSearchFormValues.From = "0"; - } else { - widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); - } - }, + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + borderColor: Colors.white, + onTap: () => _presentDatePicker('_selectedFromDate'), + hintText: TranslationBase.of(context).fromDate, + controller: _fromDateController, + inputFormatter: ONLY_DATE, + onSaved: (value) { + if (_fromDateController.text.toString().trim().isEmpty) { + widget._patientSearchFormValues.From = "0"; + } else { + widget._patientSearchFormValues.From = + _fromDateController.text.replaceAll("/", "-"); + } + }, + readOnly: true, + )), + SizedBox( + height: 5, ), + if (widget._patientSearchFormValues.From == "0" && + widget.isFormSubmitted) + CustomValidationError(), SizedBox( height: 10, ), - AppTextFormField( - textInputType: TextInputType.number, - hintText: TranslationBase - .of(context) - .toDate, - controller: _toDateController, - onTap: () { - _presentDatePicker('_selectedToDate'); - }, - inputFormatter: ONLY_DATE, - onSaved: (value) { - if (_toDateController.text - .toString() - .trim() - .isEmpty) { - widget._patientSearchFormValues.To = "0"; - } else { - widget._patientSearchFormValues.To = - _toDateController.text.replaceAll("/", "-"); - } - }, + Container( + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6.0))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + readOnly: true, + borderColor: Colors.white, + hintText: TranslationBase.of(context).toDate, + controller: _toDateController, + onTap: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onSaved: (value) { + if (_toDateController.text.toString().trim().isEmpty) { + widget._patientSearchFormValues.To = "0"; + } else { + widget._patientSearchFormValues.To = + _toDateController.text.replaceAll("/", "-"); + } + }, + )), + if (widget._patientSearchFormValues.To == "0" && + widget.isFormSubmitted) + CustomValidationError(), + SizedBox( + height: 10, ), ], ); diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart new file mode 100644 index 00000000..14afa5b6 --- /dev/null +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -0,0 +1,491 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class PatientReferralItemWidget extends StatelessWidget { + final String patientName; + final String patientID; + final String referralStatus; + final isReferredTo; + final isSameBranch; + final String referralDoctorName; + final String clinicDescription; + final String remark; + final String referredOn; + final String answerFromTarget; + final Widget infoIcon; + final PendingReferral patientInfo; + + PatientReferralItemWidget( + this.patientID, { + this.patientName, + this.referralStatus, + this.isReferredTo = false, + this.isSameBranch, + this.referralDoctorName, + this.clinicDescription, + this.remark, + this.referredOn, + this.answerFromTarget, + this.infoIcon, + this.patientInfo, + }); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0), + child: Column( + children: [ + // TODO should be removed by mousa + // Row( + // children: [ + // Expanded( + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // if (referralStatus != null) + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).referralStatus, + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // Container( + // color: Color(0xFF4BA821), + // padding: EdgeInsets.all(4), + // child: AppText( + // referralStatus + // /*referralStatus == "46" + // ? TranslationBase.of(context).approved + // : TranslationBase.of(context).rejected*/ + // , + // color: Colors.white, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // children: [ + // AppText( + // isReferredTo + // ? "${TranslationBase.of(context).referTo}: " + // : "${TranslationBase.of(context).referredFrom}: ", + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // isSameBranch + // ? TranslationBase.of(context).sameBranch + // : TranslationBase.of(context).otherBranch, + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // "${TranslationBase.of(context).referralDoctor} : ", + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // Expanded( + // child: AppText( + // referralDoctorName != null + // ? "${TranslationBase.of(context).dr} $referralDoctorName" + // : "-", + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // if (clinicDescription != null) + // Row( + // children: [ + // AppText( + // "${TranslationBase.of(context).clinic}: ", + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // clinicDescription, + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // children: [ + // AppText( + // "${TranslationBase.of(context).patientID}: ", + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // patientID ?? '-', + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // children: [ + // AppText( + // "${TranslationBase.of(context).patientName}: ", + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // patientName ?? '-', + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // TranslationBase.of(context).referralRemark, + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // Expanded( + // child: AppText( + // remark, + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ), + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).referredOn, + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // referredOn ?? '-', + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // if (answerFromTarget != null) + // SizedBox( + // height: 8, + // ), + // if (answerFromTarget != null) + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).referralResponse, + // color: Colors.grey, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // AppText( + // answerFromTarget != "" ? answerFromTarget : '-', + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 12, + // ), + // ], + // ), + // SizedBox( + // height: 16, + // ), + // ], + // ), + // ), + // if (infoIcon != null) infoIcon, + // ], + // ), + // const Divider( + // color: Color(0xffCCCCCC), + // height: 1, + // thickness: 1, + // indent: 0, + // endIndent: 0, + // ), + // SizedBox( + // height: 8, + // ), + Container( + child: CardWithBgWidget( + bgColor: referralStatus != null + ? referralStatus == 'Pending' + ? Color(0xffc4aa54) + : Colors.red[800] + : Colors.grey[500], + hasBorder: false, + widget: Container( + // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), + child: InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: referralStatus != null + ? referralStatus + : "", + style: TextStyle( + color: referralStatus != null + ? referralStatus == 'Pending' + ? Color(0xffc4aa54) + : referralStatus == 'Accepted' + ? Colors.green[700] + : Colors.red[700] + : Colors.grey[500], + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 2.0 * SizeConfig.textMultiplier)), + ], + ), + ), + //TODO :ask backend to return in the standard format + AppText( + referredOn, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 2.1 * SizeConfig.textMultiplier, + ) + ], + ), + Row( + children: [ + Expanded( + child: AppText( + patientInfo.patientName, + fontSize: SizeConfig.textMultiplier * 2.5, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + ), + SizedBox( + width: 4, + ), + /*patient.gender*/1 == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ], + ), + SizedBox( + width: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).fileNumber, + style: TextStyle( + fontSize: 14, fontFamily: 'Poppins')), + new TextSpan( + text: patientInfo.patientID.toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).referredFrom, + style: TextStyle( + fontSize: 14, fontFamily: 'Poppins')), + new TextSpan( + text: isSameBranch + ? TranslationBase.of(context).sameBranch + : TranslationBase.of(context).otherBranch, + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ), + ), + ], + ), + Row( + children: [ + AppText( + /*patient.nationalityName ?? + patient.nationality*/ "Saudi", + fontWeight: FontWeight.bold, + fontSize: 12, + ), + /* patient.nationality != null + ? ClipRRect( + borderRadius: + BorderRadius + .circular( + 20.0), + child: Image.network( + patient + .nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: + (BuildContext + context, + Object + exception, + StackTrace + stackTrace) { + return Text( + 'No Image'); + }, + ))*/ + /*:*/ SizedBox() + ], + ) + ], + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: + TranslationBase.of(context).remarks + " : ", + style: TextStyle( + fontSize: 14, fontFamily: 'Poppins')), + new TextSpan( + text: patientInfo.remarksFromSource, + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ), + ), + SizedBox( + height: 20, + ), + Column( + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + TextSpan( + text: TranslationBase.of(context) + .referralDoctor + + " : ", + style: TextStyle( + fontSize: 14, fontFamily: 'Poppins')), + TextSpan( + text: referralDoctorName, + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 15)), + ], + ), + ) + ], + ), + Container( + width: double.infinity, + alignment: Alignment.centerRight, + child: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black)) + ], + ), + // onTap: onTap, + )), + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart new file mode 100644 index 00000000..aef7a161 --- /dev/null +++ b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart @@ -0,0 +1,73 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientHeaderWidgetNoAvatar extends StatelessWidget { + final PatiantInformtion patient; + + PatientHeaderWidgetNoAvatar(this.patient); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + Row( + children: [ + AppText( + "VIP", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + SizedBox( + width: 8, + ), + AppText( + " ${patient.age}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + AppText( + patient.visitType ?? "", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${patient.companyName != null ? patient.companyName : ""}", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + Icon( + Icons.info_outline, + color: Colors.black, + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart new file mode 100644 index 00000000..ebac98b5 --- /dev/null +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -0,0 +1,130 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; + +class PatientProfileButton extends StatelessWidget { + final String nameLine1; + final String nameLine2; + final String icon; + final dynamic route; + final PatiantInformtion patient; + final String patientType; + String arrivalType; + String from; + String to; + final String url = "assets/images/"; + final bool isDisable; + final bool isLoading; + final Function onTap; + + PatientProfileButton( + {Key key, + this.patient, + this.patientType, + this.arrivalType, + this.nameLine1, + this.nameLine2, + this.icon, + this.route, + this.isDisable = false, + this.onTap, + this.isLoading = false, + this.from, + this.to}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return new Container( + margin: new EdgeInsets.symmetric(horizontal: 4.0), + padding: EdgeInsets.fromLTRB(10, 10, 10, 5), + child: InkWell( + onTap: isDisable + ? null + : onTap != null + ? onTap + : () { + navigator(context, this.route); + }, + child: Column(children: [ + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: new Image.asset( + url + icon, + width: 50, + height: 50, + )) + ], + )), + Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + this.nameLine1, + color: Colors.black, + /*Color(0xFFB9382C),*/ + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 1.5, + ), + AppText( + this.nameLine2, + color: Colors.black, + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 1.5, + ), + if (isLoading) DrAppCircularProgressIndeicator() + ], + ), + ), + ]), + ), + decoration: BoxDecoration( + // border: Border.all(), + color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10)), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffBBBBBB), + width: 1, + )), + /*boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + spreadRadius: 5, + blurRadius: 7, + offset: Offset(0, 3), // changes position of shadow + ), + ],*/ + ), + ); + } + + void navigator(BuildContext context, route) { + if (from == null) { + from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + if (to == null) { + to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + if(arrivalType == null){ + arrivalType = "0"; + } + Navigator.of(context).pushNamed(route, arguments: { + 'patient': patient, + 'from': from, + 'to': to, + 'patientType': patientType, + 'arrivalType': arrivalType + }); + } +} diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index d18fdf3d..e98c2de4 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,16 +25,20 @@ class LargeAvatar extends StatelessWidget { Widget _getAvatar() { if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) { - return Center( + return CircleAvatar( + radius: + SizeConfig.imageSizeMultiplier * 12, + // radius: (52) child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius:BorderRadius.circular(50), + child: Image.network( - url.trim(), - fit: BoxFit.cover, - width: width, - height: height, + url, + fit: BoxFit.fill, + width: 700, ), ), + backgroundColor: Colors.transparent, ); } else if (name == null || name.isEmpty) { return Center( diff --git a/lib/widgets/patients/profile/medication.dart b/lib/widgets/patients/profile/medication.dart new file mode 100644 index 00000000..62494d8e --- /dev/null +++ b/lib/widgets/patients/profile/medication.dart @@ -0,0 +1,13 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class MedicationDetails extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppText('MEDICATION'), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart new file mode 100644 index 00000000..ffb297b1 --- /dev/null +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -0,0 +1,115 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/patient_profile_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class PatientPageHeaderWidget extends StatelessWidget { + + final PatiantInformtion patient; + PatientPageHeaderWidget(this.patient); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: patient.patientMRN??patient.patientId, + doctorID: '', + editedBy: ''); + await model.getPatientAllergy(generalGetReqForSOAP); + if (model.allergiesList.length == 0) { + await model.getMasterLookup(MasterKeysService.Allergies); + } + if (model.allergySeverityList.length == 0) { + await model.getMasterLookup(MasterKeysService.AllergySeverity); + } + + }, + builder: (_, model, w) => Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + patient.patientDetails.fullName != null ? patient.patientDetails.fullName : patient.firstName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age , + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + model.patientAllergiesList.isNotEmpty && model.getAllergicNames(projectViewModel.isArabic)!='' ?AppText( + TranslationBase.of(context).allergicTO +" : "+model.getAllergicNames(projectViewModel.isArabic), + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ) : AppText(''), + ], + ), + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + width: 20, + ), + ], + ), + )); + } +} diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart new file mode 100644 index 00000000..b50a191b --- /dev/null +++ b/lib/widgets/patients/profile/patient-profile-header-new-design.dart @@ -0,0 +1,351 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; + +class PatientProfileHeaderNewDesign extends StatelessWidget { + + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + + PatientProfileHeaderNewDesign(this.patient, this.patientType, this.arrivalType); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.only( + left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + height: 200, + child: Container( + padding: EdgeInsets.only( + left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + AppText( + (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize( + patient.lastName)), + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + patient.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + ), + Row(children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + patient.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SERVICES_PATIANT2[ + int.parse(patientType)] == + "patientArrivalList" + ? Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + patient.patientStatusType == + 43 + ? AppText( + TranslationBase.of( + context) + .arrivedP, + color: Colors.green, + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of( + context) + .notArrived, + color: + Colors.red[800], + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ), + arrivalType == '1' + ? AppText( + patient.startTime != + null + ? patient + .startTime + : '', + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + : AppText( + DateUtils.convertStringToDateFormat( + patient + .arrivedOn, + 'MM-dd-yyyy HH:mm'), + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + ], + )) + : SizedBox(), + if (SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient") + Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .appointmentDate + + " : ", + fontSize: 14, + ), + patient.startTime != null + ? Container( + height: 15, + width: 60, + decoration: + BoxDecoration( + borderRadius: + BorderRadius + .circular( + 25), + color: HexColor( + "#20A169"), + ), + child: AppText( + patient.startTime, + color: Colors.white, + fontSize: 1.5 * + SizeConfig + .textMultiplier, + textAlign: TextAlign + .center, + fontWeight: + FontWeight.bold, + ), + ) + : SizedBox(), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(patient + .appointmentDate + .toString()), + fontSize: 1.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + ), + ), + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only( + top: 8, + ), + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig + .textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: + TranslationBase.of( + context) + .fileNumber, + style: TextStyle( + fontSize: 12, + fontFamily: + 'Poppins')), + new TextSpan( + text: patient.patientId + .toString(), + style: TextStyle( + fontWeight: + FontWeight.w700, + fontFamily: + 'Poppins', + fontSize: 14)), + ], + ), + ), + Row( + children: [ + AppText( + patient.nationalityName ?? + patient.nationality, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + patient.nationality != null + ? ClipRRect( + borderRadius: + BorderRadius + .circular( + 20.0), + child: Image.network( + patient + .nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: + (BuildContext + context, + Object + exception, + StackTrace + stackTrace) { + return Text( + 'No Image'); + }, + )) + : SizedBox() + ], + ) + ], + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .age + + " : ", + style: TextStyle( + fontSize: 14)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + style: TextStyle( + fontWeight: + FontWeight.w700, + fontSize: 14)), + ], + ), + ), + ), + ], + ), + ), + ]), + ], + ), + ), + ); + } + + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } + + isToday(date) { + DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); + return DateFormat("yyyy-MM-dd").format(tempDate) == + DateFormat("yyyy-MM-dd").format(DateTime.now()); + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.green, + width: 5, + ), + ), + borderRadius: BorderRadius.circular(10)); + } +} diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart new file mode 100644 index 00000000..26f474e2 --- /dev/null +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart @@ -0,0 +1,460 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; + +import 'large_avatar.dart'; + +class PatientProfileHeaderWhitAppointment extends StatelessWidget { + + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + final String doctorName; + final String branch; + final DateTime appointmentDate; + final String profileUrl; + final String invoiceNO; + final String orderNo; + + PatientProfileHeaderWhitAppointment( + {this.patient, + this.patientType, + this.arrivalType, + this.doctorName, + this.branch, + this.appointmentDate, + this.profileUrl, + this.invoiceNO, + this.orderNo}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + padding: EdgeInsets.only( + left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + height: 300, + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + AppText( + (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize( + patient.lastName)), + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + patient.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + ), + Row(children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + patient.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SERVICES_PATIANT2[ + int.parse(patientType)] == + "patientArrivalList" + ? Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + patient.patientStatusType == + 43 + ? AppText( + TranslationBase.of( + context) + .arrivedP, + color: Colors.green, + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of( + context) + .notArrived, + color: + Colors.red[800], + fontWeight: + FontWeight.bold, + fontFamily: + 'Poppins', + fontSize: 12, + ), + arrivalType == '1' + ? AppText( + patient.startTime != + null + ? patient + .startTime + : '', + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + : AppText( + DateUtils.convertStringToDateFormat( + patient + .arrivedOn, + 'MM-dd-yyyy HH:mm'), + fontFamily: + 'Poppins', + fontWeight: + FontWeight.w600, + ) + ], + )) + : SizedBox(), + if (SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient") + Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .appointmentDate + + " : ", + fontSize: 14, + ), + patient.startTime != null + ? Container( + height: 15, + width: 60, + decoration: + BoxDecoration( + borderRadius: + BorderRadius + .circular( + 25), + color: HexColor( + "#20A169"), + ), + child: AppText( + patient.startTime, + color: Colors.white, + fontSize: 1.5 * + SizeConfig + .textMultiplier, + textAlign: TextAlign + .center, + fontWeight: + FontWeight.bold, + ), + ) + : SizedBox(), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(patient + .appointmentDate + .toString()), + fontSize: 1.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + ), + ), + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only( + top: 8, + ), + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig + .textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: + TranslationBase.of( + context) + .fileNumber, + style: TextStyle( + fontSize: 12, + fontFamily: + 'Poppins')), + new TextSpan( + text: patient.patientId + .toString(), + style: TextStyle( + fontWeight: + FontWeight.w700, + fontFamily: + 'Poppins', + fontSize: 14)), + ], + ), + ), + Row( + children: [ + AppText( + patient.nationalityName ?? + patient.nationality, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + patient.nationality != null + ? ClipRRect( + borderRadius: + BorderRadius + .circular( + 20.0), + child: Image.network( + patient + .nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: + (BuildContext + context, + Object + exception, + StackTrace + stackTrace) { + return Text( + 'No Image'); + }, + )) + : SizedBox() + ], + ) + ], + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .age + + " : ", + style: TextStyle( + fontSize: 14)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(patient.dateofBirth, context)}", + style: TextStyle( + fontWeight: + FontWeight.w700, + fontSize: 14)), + ], + ), + ), + ), + ], + ), + ), + ]), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 30, + height: 30, + margin: EdgeInsets.only(left: projectViewModel.isArabic?10:85, right: projectViewModel.isArabic?85:10,top: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border( + bottom:BorderSide(color: Colors.grey[400],width: 2.5), + left: BorderSide(color: Colors.grey[400],width: 2.5), + ) + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: LargeAvatar( + name: doctorName, + url: profileUrl, + ), + width: 25, + height: 25, + margin: EdgeInsets.only(top: 10), + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + '${TranslationBase.of(context).dr}.$doctorName', + color: Colors.black, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + if (orderNo != null) + Row( + children: [ + Texts( + 'Order No:', + color: Colors.grey[800], + ), + Texts( + orderNo ?? '', + ) + ], + ), + if (invoiceNO != null) + Row( + children: [ + Texts( + 'Invoice:', + color: Colors.grey[800], + ), + Texts( + invoiceNO, + ) + ], + ), + Row( + children: [ + Texts( + 'Result Date:', + color: Colors.grey[800], + ), + Texts( + '${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + ) + ], + ) + ]), + ), + ), + + ], + ), + ), + ), + ], + ) + ], + ), + ), + ); + } + + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } + + isToday(date) { + DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); + return DateFormat("yyyy-MM-dd").format(tempDate) == + DateFormat("yyyy-MM-dd").format(DateTime.now()); + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.green, + width: 5, + ), + ), + borderRadius: BorderRadius.circular(10)); + } +} diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart deleted file mode 100644 index 5fefcc1f..00000000 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ /dev/null @@ -1,438 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -import './profile_medical_info_widget.dart'; - -/* - *@author: Elham Rababah - *@Date:22/4/2020 - *@param: - *@return:PatientProfileWidget - *@desc: Patient Profile Widget - */ -class PatientProfileWidget extends StatelessWidget { - PatiantInformtion patient; - - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - patient = routeArgs['patient']; - - return Container( - color: Color(0XFFF2F2F2), - child: CustomScrollView(primary: false, slivers: [ - SliverList( - delegate: SliverChildListDelegate( - [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.shade300, - blurRadius: 10.0, - spreadRadius: 0, - offset: Offset(0, 10) - ), - ], - color: Colors.white - ), - child: Column(children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 20, - ), - AppText( - patient.patientId.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ) - ], - ) - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - Container( - height: 10 * SizeConfig.textMultiplier, - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).age, - fontWeight: FontWeight.bold, - fontSize: 2 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 4, - ), - AppText( - "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${patient.age}", - fontWeight: FontWeight.normal, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ], - ), - ), - ), - Container( - width: 1, - color: Color(0xffCCCCCC), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).nationality, - fontWeight: FontWeight.bold, - fontSize: 2 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 4, - ), - AppText( - patient.nationalityName, - fontWeight: FontWeight.normal, - fontSize: 1.7 * SizeConfig.textMultiplier, - ), - ], - ), - ), - ), - Container( - width: 1, - color: Color(0xffCCCCCC), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).gender, - fontWeight: FontWeight.bold, - fontSize: 2 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 4, - ), - AppText( - patient.genderDescription, - fontWeight: FontWeight.normal, - fontSize: 1.8 * SizeConfig.textMultiplier, - ), - ], - ), - ), - ), - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - ]), - ), - if (patient.admissionNo != null) - Container( - margin: EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).admissionDetail, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 1.8 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 4, - ), - Container( - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.fromBorderSide(BorderSide( - color: Color(0xffBBBBBB), - width: 1, - )), - ), - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(16), - child: Column( - children: [ - Row( - children: [ - Container( - width: 14 * SizeConfig.textMultiplier, - child: AppText( - TranslationBase.of(context).dateTime, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ), - AppText( - patient.admissionDate != null - ? "${DateUtils - .convertDateFromServerFormat( - patient.admissionDate, - 'EEEE dd, MMMM yyyy hh:mm a')}" - : "", - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: - 1.6 * SizeConfig.textMultiplier, - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - children: [ - Container( - width: 14 * SizeConfig.textMultiplier, - child: AppText( - TranslationBase.of(context).admissionNo, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ), - AppText( - patient.admissionNo != null - ? patient.admissionNo - : '', - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: 1.6 * - SizeConfig.textMultiplier, - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - children: [ - Container( - width: 14 * SizeConfig.textMultiplier, - child: AppText( - TranslationBase.of(context).losNo, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ), - AppText( - patient.admissionDate != null - ? DateUtils - .differenceBetweenServerDateAndCurrent( - patient.admissionDate) - : "", - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: 1.6 * - SizeConfig.textMultiplier, - ), - ], - ), - ], - ), - ), - const Divider( - color: Color(0xffCCCCCC), - height: 5, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: 10 * SizeConfig.textMultiplier, - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).area, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 4, - ), - AppText( - patient.clinicDescription, - fontWeight: FontWeight.normal, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ], - ), - ), - ), - Container( - width: 1, - color: Color(0xffCCCCCC), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).room, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - SizedBox( - width: 4, - ), - AppText( - "${patient.nursingStationName}\n${patient.roomId}", - fontWeight: FontWeight.normal, - fontSize: 1.4 * SizeConfig.textMultiplier, - ), - ], - ), - ), - SizedBox( - height: 4, - ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).bed, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - SizedBox( - width: 4, - ), - AppText( - "${patient.bedId}", - fontWeight: FontWeight.normal, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ) - ], - ), - ) - ], - ), - ), - ], - ), - ], - ), - ), - SliverPadding( - padding: const EdgeInsets.all(16.0), - sliver: ProfileMedicalInfoWidget( - patient: patient, - )) - ]), - ); - } -} - -class AvatarWidget extends StatelessWidget { - final Widget avatarIcon; - - AvatarWidget(this.avatarIcon); - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], - borderRadius: BorderRadius.all(Radius.circular(35.0)), - color: Color(0xffCCCCCC), - ), - child: avatarIcon, - ); - } -} diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart index a5b9d014..1c9b4462 100644 --- a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -1,11 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; @@ -19,7 +21,41 @@ class PrescriptionInPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: prescriptionReportForInPatientList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + ? Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: + Border.all(color: HexColor('#B8382C'), width: 4), + borderRadius: BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + // openAddPrescription(context); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noPrescription, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), @@ -28,9 +64,12 @@ class PrescriptionInPatientWidget extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return InkWell( onTap: () { - Navigator.of(context).pushNamed(IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { - 'prescription': prescriptionReportForInPatientList[index] - }); + Navigator.of(context).pushNamed( + IN_PATIENT_PRESCRIPTIONS_DETAILS, + arguments: { + 'prescription': + prescriptionReportForInPatientList[index] + }); }, child: CardWithBgWidgetNew( widget: Column( diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index fd43e48d..b4ceffb4 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -1,11 +1,14 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient_prescription_details_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/medication.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; @@ -18,7 +21,41 @@ class PrescriptionOutPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: patientPrescriptionsList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + ? Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: + Border.all(color: HexColor('#B8382C'), width: 4), + borderRadius: BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openAddPrescription(context); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noPrescription, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), @@ -91,4 +128,12 @@ class PrescriptionOutPatientWidget extends StatelessWidget { ), ); } + + openAddPrescription(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (context) { + return MedicationDetails(); + }); + } } diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart new file mode 100644 index 00000000..72f06fb1 --- /dev/null +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -0,0 +1,91 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class ProfileWelcomeWidget extends StatelessWidget { + final Widget clinicWidget; + final double height; + final bool isClilic; + ProfileWelcomeWidget(this.clinicWidget, + {this.height = 150, this.isClilic = false}); + + @override + Widget build(BuildContext context) { + AuthViewModel authProvider = Provider.of(context); + + return Container( + height: height, + // color: HexColor('#515B5D'), + width: double.infinity, + child: FractionallySizedBox( + widthFactor: 0.9, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.isClilic == true ? clinicWidget : SizedBox(), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).welcome, + // fontSize: SizeConfig.textMultiplier * 1.7, + // color: Colors.black, + // ) + // ], + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // AppText( + // // TranslationBase.of(context).dr + + // ' ${authProvider.doctorProfile.doctorName}', + // fontWeight: FontWeight.bold, + // fontSize: SizeConfig.textMultiplier * 2.5, + // color: Colors.black, + // ), + SizedBox( + width: 20, + ), + CircleAvatar( + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.network( + authProvider.doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 75, + height: 75, + ), + ), + backgroundColor: Colors.transparent, + ), + // ], + // ), + SizedBox( + height: 20, + ), + + /// ], + // ), + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + + // ], + // ), + // ), + ], + )), + ); + } +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index b8136026..b5afa0af 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,227 +1,228 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; + import '../../../config/size_config.dart'; import '../../shared/app_texts_widget.dart'; -import '../../shared/rounded_container_widget.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -/* - *@author: Elham Rababah - *@Date:22/4/2020 - *@param: - *@return:ProfileMedicalInfoWidget - *@desc: Profile Medical Info Widget - */ class ProfileMedicalInfoWidget extends StatelessWidget { - ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); - PatiantInformtion patient; + final String from; + final String to; + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + + ProfileMedicalInfoWidget( + {Key key, + this.patient, + this.patientType, + this.arrivalType, + this.from, + this.to}); + @override Widget build(BuildContext context) { - return SliverGrid.count( + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), crossAxisSpacing: 10, - mainAxisSpacing: 20, - crossAxisCount: 2, - childAspectRatio: 1.5, + mainAxisSpacing: 10, + childAspectRatio: 1 / 1.0, + crossAxisCount: 3, children: [ + /*if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + isDisable: patient.episodeNo != 0 ? true : false, + nameLine1: TranslationBase.of(context).createNew, + nameLine2: TranslationBase.of(context).episode, + route: CREATE_EPISODE, + onTap: () async { + PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( + appointmentNo: patient.appointmentNo, + patientMRN: patient.patientMRN); + await model.postEpisode(postEpisodeReqModel); + patient.episodeNo = model.episodeID; + Navigator.of(context).pushNamed(CREATE_EPISODE, + arguments: {'patient': patient}); + }, + isLoading: model.state == ViewState.BusyLocal, + icon: 'create-episod.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + isDisable: patient.episodeNo == 0 ? true : false, + nameLine1: TranslationBase.of(context).update, + nameLine2: TranslationBase.of(context).episode, + route: UPDATE_EPISODE, + icon: 'modilfy-episode.png'),*/ + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + route: VITAL_SIGN_DETAILS, + icon: 'patient/vital_signs.png'), + if (selectedPatientType != 7) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: LAB_RESULT, + nameLine1: TranslationBase.of(context).lab, + nameLine2: TranslationBase.of(context).result, + icon: 'patient/lab_results.png'), PatientProfileButton( key: key, patient: patient, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, - icon: 'heartbeat.png'), - PatientProfileButton( - key: key, - patient: patient, - route: LAB_ORDERS, - nameLine1: TranslationBase.of(context).lab, - nameLine2: TranslationBase.of(context).result, - icon: 'lab.png'), + patientType: patientType, + arrivalType: arrivalType, + route: MEDICAL_FILE, + nameLine1: TranslationBase.of(context).previewHealth, + nameLine2: TranslationBase.of(context).summaryReport, + icon: 'patient/health_summary.png'), + if (selectedPatientType != 0 && + selectedPatientType != 5 && + selectedPatientType != 7) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_ADMISSION_REQUEST, + nameLine1: TranslationBase.of(context).admission, + nameLine2: TranslationBase.of(context).request, + icon: 'patient/admission_req.png'), + (int.parse(patientType) == 7 || int.parse(patientType) == 6) + ? PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'patient/order_prescription.png') + : PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION_HISTORY, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'patient/order_prescription.png'), PatientProfileButton( key: key, patient: patient, - route: PRESCRIPTIONS, - nameLine1: TranslationBase.of(context).medicines, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION_NEW, + nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).prescription, - icon: 'note.png'), - PatientProfileButton( - key: key, - patient: patient, - route: RADIOLOGY, - nameLine1: TranslationBase.of(context).radiology, - nameLine2: TranslationBase.of(context).service, - icon: 'radiology-1.png'), - Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, - child: PatientProfileButton( - key: key, - patient: patient, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'heartbeat.png')), + icon: 'patient/order_prescription.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PROCEDURE, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).procedures, + icon: 'patient/Order_Procedures.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: REFER_PATIENT_TO_DOCTOR, + nameLine1: TranslationBase.of(context).myReferral, + nameLine2: TranslationBase.of(context).patient, + icon: 'patient/refer_patient.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ADD_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, + icon: 'patient/patient_sick_leave.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_UCAF_REQUEST, + nameLine1: TranslationBase.of(context).patient, + nameLine2: TranslationBase.of(context).ucaf, + icon: 'patient/ucaf.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: RADIOLOGY_PATIENT, + nameLine1: TranslationBase.of(context).radiology, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/health_summary.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_INSURANCE_APPROVALS_NEW, + nameLine1: TranslationBase.of(context).insurance, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/vital_signs.png'), PatientProfileButton( key: key, patient: patient, - route: PATIENT_INSURANCE_APPROVALS, - nameLine1: TranslationBase.of(context).insurance, - nameLine2: TranslationBase.of(context).approvals, - icon: 'lab.png'), - Visibility( - visible: selectedPatientType != 0 && - selectedPatientType != 5 && - selectedPatientType != 2, - child: PatientProfileButton( - key: key, - patient: patient, - route: REFER_PATIENT, - nameLine1: TranslationBase.of(context).myReferral, - nameLine2: TranslationBase.of(context).patient, - icon: 'note.png')), - Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, - child: PatientProfileButton( - key: key, - patient: patient, - route: PATIENT_ORDERS, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).list, - icon: 'radiology-1.png')), - ]); - } -} - -class CircleAvatarWidget extends StatelessWidget { - const CircleAvatarWidget( - {Key key, - @required this.url, - @required this.des, - this.height, - this.width}) - : super(key: key); - - final String url; - final String des; - - final double height; - final double width; - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - Container( - height: height, - width: width, - // width: 50, - // height: 50, - decoration: new BoxDecoration( - // color: Colors.green, // border color - shape: BoxShape.circle, - border: Border.all(color: HexColor('#B7831A'), width: 1.5)), - child: CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - child: Image.asset(url), - backgroundColor: Colors.transparent, - ), - ), - SizedBox( - height: 10, - ), - AppText( - des, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - ) + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_ECG, + nameLine1: TranslationBase.of(context).patient, + nameLine2: "ECG", + icon: 'patient/patient_sick_leave.png'), ], ), ); } } - -class PatientProfileButton extends StatelessWidget { - final String nameLine1; - final String nameLine2; - final String icon; - final dynamic route; - final PatiantInformtion patient; - final String url = "assets/images/"; - PatientProfileButton( - {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route}) - : super(key: key); - @override - Widget build(BuildContext context) { - return new Container( - margin: new EdgeInsets.symmetric(horizontal: 4.0), - child: InkWell( - onTap: () { - navigator(context, this.route); - }, - child: Column(children: [ - Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.all(5), - child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - this.nameLine1, - color: Color(0xFFB9382C), - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - AppText( - this.nameLine2, - color: Colors.black, - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - ], - ), - ), - Expanded( - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(10), - child: new Image.asset(url + icon)) - ], - )), - ) - ]), - ), - decoration: BoxDecoration( - // border: Border.all(), - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(10)), - border: Border.fromBorderSide(BorderSide( - color: Color(0xffBBBBBB), - width: 1, - )), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - padding: EdgeInsets.fromLTRB(5, 10, 5, 5), - ); - } - - void navigator(BuildContext context, route) { - Navigator.of(context).pushNamed(route, arguments: {'patient': patient}); - } -} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart new file mode 100644 index 00000000..c49c4576 --- /dev/null +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -0,0 +1,141 @@ +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProfileMedicalInfoWidgetSearch extends StatelessWidget { + final String from; + final String to; + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + + ProfileMedicalInfoWidgetSearch( + {Key key, + this.patient, + this.patientType, + this.arrivalType, + this.from, + this.to}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + childAspectRatio: 1 / 1.0, + crossAxisCount: 3, + children: [ + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: RADIOLOGY_PATIENT, + nameLine1: TranslationBase.of(context).radiology, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/health_summary.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_INSURANCE_APPROVALS_NEW, + nameLine1: TranslationBase.of(context).insurance, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/vital_signs.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: LAB_RESULT, + nameLine1: TranslationBase.of(context).lab, + nameLine2: TranslationBase.of(context).result, + icon: 'patient/lab_results.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + route: VITAL_SIGN_DETAILS, + icon: 'patient/vital_signs.png'), + // PatientProfileButton( + // key: key, + // patient: patient, + // route: PATIENT_ADMISSION_REQUEST, + // nameLine1: TranslationBase.of(context).admission, + // nameLine2: TranslationBase.of(context).request, + // icon: 'heartbeat.png'), + (int.parse(patientType) == 7 || int.parse(patientType) == 6) + ? PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION_NEW, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'patient/order_prescription.png') + : PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION_NEW, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'patient/order_prescription.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: MEDICAL_FILE, + nameLine1: TranslationBase.of(context).previewHealth, + nameLine2: TranslationBase.of(context).summaryReport, + icon: 'patient/health_summary.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_ECG, + nameLine1: TranslationBase.of(context).patient, + nameLine2: "ECG", + icon: 'patient/patient_sick_leave.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: SHOW_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, + icon: 'patient/patient_sick_leave.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/soap_update/custom_validation_error.dart b/lib/widgets/patients/profile/soap_update/custom_validation_error.dart new file mode 100644 index 00000000..a05d52a2 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/custom_validation_error.dart @@ -0,0 +1,33 @@ + +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class CustomValidationError extends StatelessWidget { + String error; + CustomValidationError({ + Key key, this.error, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + if(error == null ) + error = TranslationBase + .of(context) + .emptyMessage; + return Column( + children: [ + SizedBox( + height: 2, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 3), + child: AppText(error, color: Theme + .of(context) + .errorColor, fontSize: 14,), + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart new file mode 100644 index 00000000..a5bcf434 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -0,0 +1,466 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + + StepsWidget({Key key, this.index, this.changeCurrentTab}); + + // TODO : Add translation to name + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return !projectViewModel.isArabic + ? Stack( + children: [ + Container( + height: 120, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: index == 0 ? 15 : 30, + left: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 0 ? 70 : 50, + height: index == 0 ? 70 : 50, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Colors.white + : index > 0 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '1', + variant: index == 0 ? "heading2" : "", + bold: true, + color: index == 0 + ? Colors.black + : index > 0 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 0 ? 5 : 10, + ), + AppText( + "SUBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + ), + Positioned( + top: index == 1 ? 15 : 30, + left: MediaQuery.of(context).size.width * 0.28, + child: InkWell( + onTap: () => index >= 1 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 1 ? 70 : 50, + height: index == 1 ? 70 : 50, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Colors.white + : index > 1 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '2', + variant: index == 1 ? "heading2" : '', + bold: true, + color: index == 1 + ? Colors.black + : index > 1 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 1 ? 5 : 10, + ), + AppText( + "OBJECTIVE", + fontWeight: FontWeight.bold, + fontSize:14, + ), + ], + ), + ), + ), + Positioned( + top: index == 2 ? 15 : 30, + left: MediaQuery.of(context).size.width * 0.52, + child: InkWell( + onTap: () { + if(index >= 3) + changeCurrentTab(2); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 2 ? 70 : 50, + height: index == 2 ? 70 : 50, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Colors.white + : index > 2 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '3', + variant: index == 2 ? "heading2" : '', + bold: true, + color: index == 2 + ? Colors.black + : index > 2 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 2 ? 5 : 10, + ), + AppText( + "ASSESSMENT", + fontWeight: FontWeight.bold, + fontSize:14, + ), + ], + ), + ), + ), + Positioned( + top: index == 3 ? 15 : 30, + right: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 3 ? 70 : 50, + height: index == 3 ? 70 : 50, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Colors.white + : index > 3 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '4', + variant: index == 3 ? "heading2" : '', + bold: true, + color: index == 3 + ? Colors.black + : index > 3 + ? Colors.white + : Colors.grey, + ), + ) + ), + SizedBox( + height: index == 3 ? 5 : 10, + ), + Center( + child: AppText( + "PLAN", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize:14, + ), + ), + ], + ), + ), + ), + ], + ) + : Stack( + children: [ + Container( + height: 120, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: index == 0 ? 15 : 30, + right: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 0 ? 70 : 50, + height: index == 0 ? 70 : 50, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Colors.white + : index > 0 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '1', + variant: index == 0 ? "heading2" : "", + bold: true, + color: index == 0 + ? Colors.black + : index > 0 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 0 ? 5 : 10, + ), + AppText( + "شخصي", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + ), + Positioned( + top: index == 1 ? 15 : 30, + right: MediaQuery.of(context).size.width * 0.28, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 1 ? 70 : 50, + height: index == 1 ? 70 : 50, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Colors.white + : index > 1 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '2', + variant: index == 1 ? "heading2" : '', + bold: true, + color: index == 1 + ? Colors.black + : index > 1 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 1 ? 5 : 10, + ), + AppText( + "هدف", + fontWeight: FontWeight.bold, + fontSize:14, + ), + ], + ), + ), + ), + Positioned( + top: index == 2 ? 15 : 30, + right: MediaQuery.of(context).size.width * 0.52, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(2) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 2 ? 70 : 50, + height: index == 2 ? 70 : 50, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Colors.white + : index > 2 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '3', + variant: index == 2 ? "heading2" : '', + bold: true, + color: index == 2 + ? Colors.black + : index > 2 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 2 ? 5 : 10, + ), + Padding( + + padding: const EdgeInsets.only(right: 2), + child: AppText( + "تقدير", + fontWeight: FontWeight.bold, + fontSize:14, + ), + ), + ], + ), + ), + ), + Positioned( + top: index == 3 ? 15 : 30, + left: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: index == 3 ? 70 : 50, + height: index == 3 ? 70 : 50, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Colors.white + : index > 3 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '4', + variant: index == 3 ? "heading2" : '', + bold: true, + color: index == 3 + ? Colors.black + : index > 3 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 3 ? 5 : 10, + ), + Container( + margin: EdgeInsets.only(right:index == 3? 15:0), + child: AppText( + "خطة", + fontWeight: FontWeight.bold, + fontSize:14, + ), + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart new file mode 100644 index 00000000..afd14809 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -0,0 +1,513 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import '../custom_validation_error.dart'; + +class UpdateAllergiesWidget extends StatefulWidget { + final List myAllergiesList; + + UpdateAllergiesWidget({Key key, this.myAllergiesList}); + + @override + _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); +} + +class _UpdateAllergiesWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Column( + children: [ + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).addAllergies, + fontSize: 13.5, + onTapTextFields: () { + openAllergiesList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: widget.myAllergiesList.map((selectedAllergy) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergy.nameAr + : selectedAllergy.selectedAllergy.nameEn + .toUpperCase(), + variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, + bold: true, + color: Colors.black), + width: MediaQuery.of(context).size.width * 0.5, + ), + Texts( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergySeverity.nameAr + : selectedAllergy.selectedAllergySeverity.nameEn + .toUpperCase(), + variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, + bold: true, + color: AppGlobal.appPrimaryColor), + if (selectedAllergy.isChecked) + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeAllergy(selectedAllergy), + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + children: [ + AppText( + selectedAllergy.remark != null && + selectedAllergy.remark != '' + ? TranslationBase.of(context).remarks + " : " + : '', + fontWeight: FontWeight.bold, + fontSize: 13, + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + child: AppText( + selectedAllergy.remark ?? '', + fontSize: 10, + color: Colors.grey, + ), + ), + ], + ), + ), + DividerWithSpacesAround() + ], + ), + SizedBox( + height: 10, + ), + ], + ); + }).toList()), + ) + ], + ); + } + + removeAllergy(MySelectedAllergy mySelectedAllergy) { + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergySeverity.id == + element.selectedAllergySeverity.id && + mySelectedAllergy.selectedAllergy.id == element.selectedAllergy.id + ).toList(); + + if (allergy.length > 0) { + setState(() { + allergy[0].isChecked = false; + }); + } + + + print(allergy); + } + + openAllergiesList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddAllergies( + addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { + if (mySelectedAllergy.selectedAllergySeverity == null || + mySelectedAllergy.selectedAllergy == null) { + helpers.showErrorToast(TranslationBase + .of(context) + .requiredMsg); + + } else { + setState(() { + List allergy = + // ignore: missing_return + widget.myAllergiesList + .where((element) => + mySelectedAllergy.selectedAllergy.id == + element.selectedAllergy.id) + .toList(); + + if (allergy.isEmpty) { + widget.myAllergiesList.add(mySelectedAllergy); + Navigator.of(context).pop(); + } else { + allergy.first.selectedAllergy = + mySelectedAllergy.selectedAllergy; + allergy.first.selectedAllergySeverity = + mySelectedAllergy.selectedAllergySeverity; + allergy.first.remark = mySelectedAllergy.remark; + allergy.first.isChecked = mySelectedAllergy.isChecked; + Navigator.of(context).pop(); + + // helpers.showErrorToast(TranslationBase + // .of(context) + // .itemExist); + } + }); + } + },); + }); + } + +} + +class AddAllergies extends StatefulWidget { + final Function addAllergiesFun; + + const AddAllergies({Key key, this.addAllergiesFun}) : super(key: key); + + @override + _AddAllergiesState createState() => _AddAllergiesState(); +} + +class _AddAllergiesState extends State { + List allergiesList; + List allergySeverityList; + MasterKeyModel _selectedAllergySeverity; + MasterKeyModel _selectedAllergy; + TextEditingController remarkController = TextEditingController(); + TextEditingController severityController = TextEditingController(); + TextEditingController allergyController = TextEditingController(); + + GlobalKey key = new GlobalKey>(); + bool isFormSubmitted = false; + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 10, + color: Theme + .of(context) + .hintColor, + fontWeight: FontWeight.w700 + ), + ); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + final screenSize = MediaQuery + .of(context) + .size; + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.allergiesList.length == 0) { + await model.getMasterLookup(MasterKeysService.Allergies); + } + if (model.allergySeverityList.length == 0) { + await model.getMasterLookup(MasterKeysService.AllergySeverity); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 16, + ), + AppText( + TranslationBase + .of(context) + .addAllergies, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + allergyController.text = null; + }); + } + : null, + child: _selectedAllergy==null? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .selectAllergy, + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, true, icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() { + _selectedAllergy = item; + allergyController.text = + projectViewModel.isArabic + ? _selectedAllergy + .nameAr + : _selectedAllergy + .nameEn; + }), + key: key, + suggestions: model.allergiesList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + projectViewModel.isArabic ? suggestion + .nameAr : suggestion.nameEn), + padding: EdgeInsets.all(2.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.nameAr.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.nameEn.toLowerCase() + .startsWith(input.toLowerCase()), + ) : + TextFields( + onTapTextFields: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + allergyController.text = null; + }); + } + : null, + hasLabelText: allergyController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .selectAllergy, + fontSize: 13.5, + readOnly: true, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: allergyController, + suffixIcon: EvaIcons.search, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }) + ), + ), + if(isFormSubmitted && _selectedAllergy == null) + CustomValidationError(), + SizedBox( + height: 10, + ), + TextFields( + onTapTextFields: model + .allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.allergySeverityList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedAllergySeverity = + selectedValue; + + severityController.text = + projectViewModel.isArabic + ? _selectedAllergySeverity + .nameAr + : _selectedAllergySeverity + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: severityController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .selectSeverity, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: severityController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), SizedBox( + height: 5, + ), + if(isFormSubmitted && + _selectedAllergySeverity == null) + CustomValidationError(), + + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hasLabelText: remarkController.text != ''?true:false, + showLabelText: true, + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 10, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), SizedBox( + height: 10, + ), + AppButton( + title: TranslationBase.of(context).add.toUpperCase(), + onPressed: () { + setState(() { + isFormSubmitted = true; + }); + if(_selectedAllergy !=null && _selectedAllergySeverity !=null) { + MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( + remark: remarkController.text, + selectedAllergy: _selectedAllergy, + isChecked: true, + selectedAllergySeverity: _selectedAllergySeverity,); + widget.addAllergiesFun(mySelectedAllergy); + } + + }, + ), + ] + + ), + ), + ), + )), + ), + ); + } +} + + + + + + diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart new file mode 100644 index 00000000..de5d2fb2 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -0,0 +1,427 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class UpdateHistoryWidget extends StatefulWidget { + final List myHistoryList; + + const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key); + + @override + _UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState(); +} + +class _UpdateHistoryWidgetState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + @override + void initState() { + _controller = new PageController(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Column( + children: [ + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).addHistory, + fontSize: 13.5, + onTapTextFields: () { + openHistoryList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: widget.myHistoryList.map((myHistory) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + projectViewModel.isArabic + ? myHistory.selectedHistory.nameAr + : myHistory.selectedHistory.nameEn, + variant: "bodyText", + textDecoration: myHistory.isChecked + ? null + : TextDecoration.lineThrough, + bold: true, + color: Colors.black), + width: MediaQuery.of(context).size.width * 0.7, + ), + if (myHistory.isChecked) + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeHistory(myHistory.selectedHistory), + ) + ], + ), + SizedBox( + height: 20, + ), + ], + ); + }).toList(), + ), + ) + ], + ); + } + + removeHistory(MasterKeyModel historyKey) { + // Iterable history = widget.myHistoryList.where((element) => + // masterKey.id == element.id && masterKey.typeId == element.typeId); + // + + List history = + // ignore: missing_return + widget.myHistoryList.where((element) => + historyKey.id == + element.selectedHistory.id && + historyKey.typeId == + element.selectedHistory.typeId + ).toList(); + + + if (history.length > 0) + setState(() { + history[0].isChecked = false; + }); + } + + openHistoryList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddHistoryDialog( + changePageViewIndex: changePageViewIndex, + controller: _controller, + myHistoryList: widget.myHistoryList, + addSelectedHistories: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeHistory: (masterKey) => removeHistory(masterKey), + ); + }); + } +} + +class PriorityBar extends StatefulWidget { + final Function onTap; + + const PriorityBar({Key key, this.onTap}) : super(key: key); + + @override + _PriorityBarState createState() => _PriorityBarState(); +} + +class _PriorityBarState extends State { + int _activePriority = 0; + int index =-1; + List _priorities = [ + "Family", + "Surgical/Sports", + "Medical", + ]; + List _prioritiesAr = [ + "أسرة", + "جراحي / رياضي" , + "طبي", + ]; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 2.0, + )), + ); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + height: screenSize.height * 0.070, + decoration: + containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _priorities.map((item,) { + bool _isActive = _priorities[_activePriority] == item ? true : false; + if(index <2){ + index++; + } + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + (projectViewModel.isArabic)?_prioritiesAr[index]: item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () { + widget.onTap(_priorities.indexOf(item)); + + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }), + ); + }).toList(), + ), + ); + } +} + +class AddHistoryDialog extends StatefulWidget { + final Function changePageViewIndex; + final PageController controller; + final List myHistoryList; + final Function addSelectedHistories; + final Function (MasterKeyModel) removeHistory; + + const AddHistoryDialog( + {Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) + : super(key: key); + + @override + _AddHistoryDialogState createState() => _AddHistoryDialogState(); +} + +class _AddHistoryDialogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.historyFamilyList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryFamily); + } + + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + await model.getMasterLookup(MasterKeysService.HistorySports); + } + + if (model.historyMedicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 10, + ), + PriorityBar(onTap: (activePriority) async { + widget.changePageViewIndex(activePriority); + }), + SizedBox( + height: 20, + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: widget.controller, + onPageChanged: (index) { + setState(() { + // currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyFamilyList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + createAndAddHistory( + history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.mergeHistorySurgicalWithHistorySportList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + createAndAddHistory( + history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyMedicalList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + createAndAddHistory( + history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), + ), + ), + ], + ), + ), + ], + ), + )), + ), + ), + )); + } + + createAndAddHistory(MasterKeyModel history) { + List myhistory = widget.myHistoryList.where((element) => + history.id == + element.selectedHistory.id && + history.typeId == + element.selectedHistory.typeId + ).toList(); + + if (myhistory.isEmpty) { + setState(() { + MySelectedHistory mySelectedHistory = MySelectedHistory( + remark: history.remarks ?? "", + selectedHistory: history, + isChecked: true); + widget.myHistoryList.add(mySelectedHistory); + }); + } else { + myhistory.first.isChecked = true; + } + } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable history = + widget + .myHistoryList + .where((element) => + masterKey.id == element.selectedHistory.id && + masterKey.typeId == element.selectedHistory.typeId && + element.isChecked); + if (history.length > 0) { + return true; + } + return false; + } + +} diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart new file mode 100644 index 00000000..f32bfe6e --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart @@ -0,0 +1,563 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../custom_validation_error.dart'; + +class UpdateMedicationWidget extends StatefulWidget { + final TextEditingController medicationController; + + UpdateMedicationWidget({ + Key key, + this.medicationController, + }); + + @override + _UpdateMedicationWidgetState createState() => _UpdateMedicationWidgetState(); +} + +class _UpdateMedicationWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Column( + children: [ + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).addMedication, + fontSize: 13.5, + onTapTextFields: () { + openMedicationList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ) + ], + ); + } + + + openMedicationList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddMedication( + addMedicationFun: (MySelectedAllergy mySelectedAllergy) {}, + medicationController: widget.medicationController, + ); + }); + } +} + +// ignore: must_be_immutable +class AddMedication extends StatefulWidget { + final Function addMedicationFun; + TextEditingController medicationController; + + AddMedication({Key key, this.addMedicationFun, this.medicationController}) + : super(key: key); + + @override + _AddMedicationState createState() => _AddMedicationState(); +} + +class _AddMedicationState extends State { + MasterKeyModel _selectedMedicationDose; + MasterKeyModel _selectedMedicationStrength; + MasterKeyModel _selectedMedicationRoute; + MasterKeyModel _selectedMedicationFrequency; + + MasterKeyModel _selectedAllergy; + TextEditingController doseController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + GetMedicationResponseModel _selectedMedication; + + GlobalKey key = + new GlobalKey>(); + bool isFormSubmitted = false; + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 10, + color: Theme + .of(context) + .hintColor, + fontWeight: FontWeight.w700 + ), + ); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + final screenSize = MediaQuery + .of(context) + .size; + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.medicationStrengthList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationStrength,); + } + if (model.medicationFrequencyList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationFrequency); + } + if (model.medicationDoseTimeList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationDoseTime); + } + if (model.medicationRouteList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationRoute); + } + if (model.allMedicationList.length == 0) + await model.getMedicationList(); + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 16, + ), + AppText( + TranslationBase + .of(context) + .addMedication, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + setState(() { + _selectedMedication = null; + }); + } + : null, + child: _selectedMedication == null + ? AutoCompleteTextField< + GetMedicationResponseModel>( + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication.genericName + : null, + true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState( + () => _selectedMedication = item), + key: key, + suggestions: model.allMedicationList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + suggestion.description + '/' + + suggestion.genericName), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.genericName + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith(input.toLowerCase()), + ) + : TextField( + minLines: 2, + maxLines: 2, + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication.description + + (' (${_selectedMedication + .genericName} )') + : null, + true, + icon: EvaIcons.search), + enabled: false, + ), + ), + ), + if(isFormSubmitted && _selectedMedication == null) + CustomValidationError(), + SizedBox( + height: 5, + ), + TextFields( + onTapTextFields: model.medicationDoseTimeList != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationDoseTimeList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationDose = + selectedValue; + + doseController.text = + projectViewModel.isArabic + ? _selectedMedicationDose + .nameAr + : _selectedMedicationDose + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: doseController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .doseTime, + //TODO add translation + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: doseController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + SizedBox( + height: 5, + ), + if(isFormSubmitted && + _selectedMedicationDose == null) + CustomValidationError(), SizedBox( + height: 5, + ), + TextFields( + onTapTextFields: model + .medicationStrengthList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationStrengthList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationStrength = + selectedValue; + + strengthController.text = + projectViewModel.isArabic + ? _selectedMedicationStrength + .nameAr + : _selectedMedicationStrength + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: strengthController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .strength, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: strengthController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), SizedBox( + height: 5, + ), + if(isFormSubmitted && + _selectedMedicationStrength == null) + CustomValidationError(), + + SizedBox( + height: 5, + ), + + TextFields( + onTapTextFields: model + .medicationRouteList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationRouteList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationRoute = + selectedValue; + + routeController.text = + projectViewModel.isArabic + ? _selectedMedicationRoute + .nameAr + : _selectedMedicationRoute + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: routeController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .route, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: routeController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + SizedBox( + height: 5, + ), + if(isFormSubmitted && + _selectedMedicationRoute == null) + CustomValidationError(), + SizedBox( + height: 5, + ), + TextFields( + onTapTextFields: model + .medicationFrequencyList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationFrequencyList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationFrequency = + selectedValue; + + frequencyController.text = + projectViewModel.isArabic + ? _selectedMedicationFrequency + .nameAr + : _selectedMedicationFrequency + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: frequencyController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .frequency, + //TODO add translation + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: frequencyController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + SizedBox( + height: 5, + ), + if(isFormSubmitted && + _selectedMedicationFrequency == null) + CustomValidationError(), + SizedBox( + height: 30, + ), + AppButton( + title: TranslationBase + .of(context) + .add + .toUpperCase(), + onPressed: () { + setState(() { + isFormSubmitted = true; + }); + if (_selectedMedication != null && + _selectedMedicationDose != + null && + _selectedMedicationStrength != null && + _selectedMedicationRoute != null && + _selectedMedicationFrequency != null) { + widget.medicationController.text = + widget.medicationController.text + + '${_selectedMedication + .description } (${TranslationBase + .of(context) + .doseTime} ) ${doseController + .text} (${TranslationBase + .of(context) + .strength}) ${strengthController + .text} (${TranslationBase + .of(context) + .route }) ${routeController + .text} (${TranslationBase + .of(context) + .frequency }) ${frequencyController + .text} \n \n'; + Navigator.of(context).pop(); + } + }, + ), + ] + + ), + ), + ), + ),), + ), + ); + } +} + + + + + + diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart new file mode 100644 index 00000000..3bc89a7f --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -0,0 +1,635 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_history_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class UpdateSubjectivePage extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + final List myAllergiesList; + final List myHistoryList; + final PatiantInformtion patientInfo; + + UpdateSubjectivePage( + {Key key, + this.changePageViewIndex, + this.myAllergiesList, + this.myHistoryList, + this.patientInfo, this.changeLoadingState}); + + @override + _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); +} + +class _UpdateSubjectivePageState extends State { + bool isChiefExpand = false; + bool isHistoryExpand = false; + bool isAllergiesExpand = false; + TextEditingController illnessController = TextEditingController(); + TextEditingController complaintsController = TextEditingController(); + TextEditingController medicationController = TextEditingController(); + + final formKey = GlobalKey(); + + getHistory(SOAPViewModel model) async { + widget.changeLoadingState(true); + GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo, + doctorID: '', + editedBy: ''); + + await model.getPatientHistories(getHistoryReqModel,isFirst: true); + + if (model.patientHistoryList.isNotEmpty) { + if (model.historyFamilyList.isEmpty) { + await model.getMasterLookup(MasterKeysService.HistoryFamily); + } + if (model.historyMedicalList.isEmpty) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); + } + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + } + if (model.historySportList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySports); + } + + model.patientHistoryList.forEach((element) { + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( + masterKeys: MasterKeysService.HistoryFamily, + id: element.historyId, + ); + if (history != null) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: element.isChecked, + remark: element.remarks); + + widget.myHistoryList.add(mySelectedHistory); + } + } + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( + masterKeys: MasterKeysService.HistoryMedical, + id: element.historyId, + ); + if (history != null) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: element.isChecked, + remark: element.remarks); + + widget.myHistoryList.add(mySelectedHistory); + } + } + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( + masterKeys: MasterKeysService.HistorySports, + id: element.historyId, + ); + if (history != null) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: element.isChecked, + remark: element.remarks); + + widget.myHistoryList.add(mySelectedHistory); + } + } + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( + masterKeys: MasterKeysService.HistorySurgical, + id: element.historyId, + ); + if (history != null) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: element.isChecked, + remark: element.remarks); + + widget.myHistoryList.add(mySelectedHistory); + } + } + }); + } + } + + getAllergies(SOAPViewModel model) async { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + doctorID: '', + editedBy: ''); + await model.getPatientAllergy(generalGetReqForSOAP); + if (model.patientAllergiesList.isNotEmpty) { + if (model.allergiesList.isEmpty) + await model.getMasterLookup(MasterKeysService.Allergies); + if (model.allergySeverityList.isEmpty) + await model.getMasterLookup(MasterKeysService.AllergySeverity); + + model.patientAllergiesList.forEach((element) { + MasterKeyModel selectedAllergy = model.getOneMasterKey( + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); + MasterKeyModel selectedAllergySeverity; + if (element.severity == 0) { + selectedAllergySeverity = MasterKeyModel( + id: 0, + typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + } else { + selectedAllergySeverity = model.getOneMasterKey( + masterKeys: MasterKeysService.AllergySeverity, + id: element.severity, + ); + } + + MySelectedAllergy mySelectedAllergy = MySelectedAllergy( + selectedAllergy: selectedAllergy, + isChecked: element.isChecked, + createdBy: element.createdBy, + remark: element.remarks, + selectedAllergySeverity: selectedAllergySeverity); + if (selectedAllergy != null && selectedAllergySeverity != null) + widget.myAllergiesList.add(mySelectedAllergy); + }); + } + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + widget.myAllergiesList.clear(); + widget.myHistoryList.clear(); + + GetChiefComplaintReqModel getChiefComplaintReqModel = + GetChiefComplaintReqModel( + patientMRN: widget.patientInfo.patientMRN, + appointmentNo: widget.patientInfo.appointmentNo, + episodeId: widget.patientInfo.episodeNo, + episodeID: widget.patientInfo.episodeNo, + doctorID: ''); + await model.getPatientChiefComplaint(getChiefComplaintReqModel); + if (model.patientChiefComplaintList.isNotEmpty) { + complaintsController.text = helpers.parseHtmlString( + model.patientChiefComplaintList[0].chiefComplaint); + illnessController.text = model.patientChiefComplaintList[0].hopi; + medicationController.text = model.patientChiefComplaintList[0].currentMedication + '\n \n'; + } + + await getHistory(model); + await getAllergies(model); + + widget.changeLoadingState(false); + + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // baseViewModel: model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).chiefComplaints.toUpperCase(), + variant: isChiefExpand ? "bodyText" : '', + bold: isChiefExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isChiefExpand = !isChiefExpand; + }); + }, + child: Icon( + isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) + ], + ), + bodyWidget: Form( + key: formKey, + child: Column(children: [ + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hasLabelText: complaintsController.text != '' + ? true + : false, + hintText: TranslationBase.of(context) + .addChiefComplaints, + fontSize: 13.5, + // hintColor: Colors.black, + showLabelText: true, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: complaintsController, + validator: (value) { + if (value == null || value == "") + return TranslationBase.of(context) + .emptyMessage; + else if (value.length < 25) + return TranslationBase + .of(context) + .chiefComplaintLength; + //""; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hasLabelText: illnessController.text != '' + ? true + : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .historyOfPresentIllness, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: illnessController, + validator: (value) { + if (value == null || value == "") + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 10, + ), + UpdateMedicationWidget(medicationController: medicationController,), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hasLabelText: medicationController.text != '' + ? true + : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .currentMedications, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 23, + minLines: 10, + controller: medicationController, + validator: (value) { + if (value == null || value == "") + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + + ]), + ), + isExpand: isChiefExpand, + ), + + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase + .of(context) + .histories + .toUpperCase(), + variant: isHistoryExpand ? "bodyText" : '', + bold: isHistoryExpand ? true : false, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Icon(isHistoryExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column( + children: [ + UpdateHistoryWidget(myHistoryList: widget.myHistoryList) + ], + ), + isExpand: isHistoryExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase + .of(context) + .allergiesSoap + .toUpperCase(), + variant: isAllergiesExpand ? "bodyText" : '', + bold: isAllergiesExpand ? true : false, + color: Colors.black), + ], + ), + InkWell( + onTap: () { + setState(() { + isAllergiesExpand = !isAllergiesExpand; + }); + }, + child: Icon(isAllergiesExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget:Column( + children: [ + UpdateAllergiesWidget(myAllergiesList: widget.myAllergiesList,), + SizedBox( + height: 30, + ), + ], + ) + , + isExpand: isAllergiesExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + addSubjectiveInfo( + model: model, + myAllergiesList: widget.myAllergiesList, + myHistoryList: widget.myHistoryList); + }, + ), + ], + ), + ), + ), + ), + ), + ); + } + + addSubjectiveInfo({SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { + formKey.currentState.save(); + formKey.currentState.validate(); + + + if (complaintsController.text.isNotEmpty && + illnessController.text.isNotEmpty && + complaintsController.text.length > 25) { + await postChiefComplaint(model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + + if (myHistoryList.length != 0) { + await postHistories(model: model, myHistoryList: myHistoryList); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + if (myAllergiesList.length != 0) { + await postAllergy(myAllergiesList: myAllergiesList, model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + widget.changeLoadingState(true); + + widget.changePageViewIndex(1); + + } else { + helpers.showErrorToast(TranslationBase + .of(context) + .chiefComplaintErrorMsg); + } + + + } + + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); + + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + widget.myAllergiesList.forEach((allergy) { + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy??doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); + }); + if (model.patientAllergiesList.isEmpty) { + await model.postAllergy(postAllergyRequestModel); + } else { + await model.patchAllergy(postAllergyRequestModel); + } + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + doctorID: '', + editedBy: ''); + await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy : true); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(doctorID: ''); + widget.myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + //TODO: make static value dynamic + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: "", + historyId: history.selectedHistory.id, + historyType: history.selectedHistory.typeId, + isChecked: history.isChecked, + )); + }); + + + if (model.patientHistoryList.isEmpty) { + await model.postHistories(postHistoriesRequestModel); + } else { + await model.patchHistories(postHistoriesRequestModel); + } + + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + + postChiefComplaint({SOAPViewModel model}) async { + formKey.currentState.save(); + if(formKey.currentState.validate()){ + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + //TODO: make static value dynamic + new PostChiefComplaintRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + chiefComplaint: complaintsController.text, + currentMedication: medicationController.text, + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + doctorID: '', + + numberOfWeeks: 0); + if (model.patientChiefComplaintList.isEmpty) { + // TODO: make it postChiefComplaint after it start to work + postChiefComplaintRequestModel.editedBy=''; + await model.postChiefComplaint(postChiefComplaintRequestModel); + } else { + await model.patchChiefComplaint(postChiefComplaintRequestModel); + } + } + + } +} diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart new file mode 100644 index 00000000..ddb7b9d6 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -0,0 +1,1026 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import 'custom_validation_error.dart'; + +class UpdateAssessmentPage extends StatefulWidget { + final Function changePageViewIndex; + List mySelectedAssessmentList; + final PatiantInformtion patientInfo; + final Function changeLoadingState; + + UpdateAssessmentPage({Key key, + this.changePageViewIndex, + this.mySelectedAssessmentList, + this.patientInfo, this.changeLoadingState}); + + @override + _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); +} + +class _UpdateAssessmentPageState extends State { + bool isAssessmentExpand = false; + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async{ + widget.mySelectedAssessmentList.clear(); + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: widget.patientInfo.appointmentNo); + await model.getPatientAssessment(getAssessmentReqModel); + if(model.patientAssessmentList.isNotEmpty){ + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } + model.patientAssessmentList.forEach((element) { + MasterKeyModel diagnosisType = model.getOneMasterKey( + masterKeys: MasterKeysService.DiagnosisType, + id: element.diagnosisTypeID, + ); + MasterKeyModel selectedICD = model.getOneMasterKey( + masterKeys: MasterKeysService.ICD10, + id: element.icdCode10ID, + ); + MasterKeyModel diagnosisCondition = model.getOneMasterKey( + masterKeys: MasterKeysService.DiagnosisCondition, + id: element.conditionID, + ); + if(diagnosisCondition !=null &&diagnosisType !=null && diagnosisCondition!=null) { + MySelectedAssessment temMySelectedAssessment = MySelectedAssessment( + appointmentId: element.appointmentNo, + remark: element.remarks, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: element.doctorID, + doctorName: element.doctorName, + createdBy: element.createdBy, + createdOn: element.createdOn, + icdCode10ID: element.icdCode10ID + ); + + widget.mySelectedAssessmentList.add(temMySelectedAssessment); + } + + }); + } + + widget.changeLoadingState(false); + + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // baseViewModel: model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).assessment.toUpperCase(), + variant: + isAssessmentExpand ? "bodyText" : '', + bold: isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); + }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).addAssessment, + fontSize: 13.5, + onTapTextFields: () { + openAssessmentDialog(context,isUpdate: false, + model: model); + }, + readOnly: true, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal + .appPrimaryColor, + fontWeight: FontWeight.w600, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + + Column( + children: widget.mySelectedAssessmentList.map(( + assessment) { + return Container( + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + + assessment.createdOn !=null?DateTime.parse(assessment.createdOn).day.toString():DateTime.now().day.toString(), + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + AppText( + Helpers.getMonth(assessment.createdOn !=null?DateTime.parse(assessment.createdOn).month:DateTime.now().month).toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).ICDName +" : ", + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + Container( + width: MediaQuery + .of(context) + .size + .width * 0.29, + child: AppText( + assessment + .selectedICD.description + .toString(), + fontSize: 10, + color: Colors.grey, + ), + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).appointmentNo, + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + AppText( + assessment + .appointmentId + .toString(), + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).condition + " : ", + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + AppText( + projectViewModel.isArabic?assessment + .selectedDiagnosisCondition + .nameAr : assessment + .selectedDiagnosisCondition + .nameEn, + fontSize: 10, + color: Colors.grey, + + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).dType+' : ', + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + AppText( + projectViewModel.isArabic?assessment + .selectedDiagnosisType + .nameAr:assessment + .selectedDiagnosisType + .nameEn, + fontSize: 10, + color: Colors.grey, + ), + ], + ), + if(assessment.doctorName != null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).doc, + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + AppText( + assessment.doctorName??'', + fontSize: 10, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 6, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + AppText( + assessment.remark != null || + assessment.remark == '' + ? TranslationBase.of(context).remarks + " : " + : '', + fontWeight: FontWeight.bold, + fontSize: 13, + ), + Container( + width: MediaQuery + .of(context) + .size + .width * 0.38, + child: AppText( + assessment.remark ?? "", + fontSize: 10, + color: Colors.grey, + ), + ), + ], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + + children: [ + AppText( + "ICD : ".toUpperCase(), + fontWeight: FontWeight + .bold, + fontSize: 13, + ), + Container( + child: AppText( + assessment.selectedICD + .code.trim() + .toUpperCase() ?? + "", + fontSize: 10, + color: Colors.grey, + ), + ), + ], + ) + ], + ), + Column( + children: [ + InkWell( + onTap: () { + openAssessmentDialog( + context, isUpdate: true, + assessment: assessment, + model: model); + }, + child: Icon(EvaIcons + .edit2Outline), + ) + ], + ), + ], + ), + ); + }).toList(),) + ], + ) + ]), + isExpand: isAssessmentExpand, + ), + DividerWithSpacesAround( + height: 30, + ), + AppButton( + title: TranslationBase + .of(context) + .next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + if (widget.mySelectedAssessmentList.isEmpty) { + helpers.showErrorToast( + TranslationBase.of(context).assessmentErrorMsg); + } else { + widget.changePageViewIndex(3); + widget.changeLoadingState(true); + } + }, + ), + SizedBox( + height: 30, + ), + ], + ), + ), + ), + ))); + } + + + openAssessmentDialog(BuildContext context, + { + MySelectedAssessment assessment, bool isUpdate, + SOAPViewModel model + }) { + if (assessment == null) { + assessment = MySelectedAssessment( + remark: '', appointmentId: widget.patientInfo.appointmentNo); + } + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddAssessmentDetails( + mySelectedAssessment: assessment, + patientInfo: widget.patientInfo, + isUpdate: isUpdate, + mySelectedAssessmentList: widget.mySelectedAssessmentList, + addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, + bool isUpdate) async { + setState(() { + widget.mySelectedAssessmentList.add(mySelectedAssessment); + + }); + }); + }); + } + +} + +class AddAssessmentDetails extends StatefulWidget { + final MySelectedAssessment mySelectedAssessment; + final List mySelectedAssessmentList; + final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) addSelectedAssessment; + final PatiantInformtion patientInfo; + final bool isUpdate; + AddAssessmentDetails( + {Key key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo, this.isUpdate = false, this.mySelectedAssessmentList}); + + + @override + _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); +} + +class _AddAssessmentDetailsState extends State { + TextEditingController remarkController = TextEditingController(); + TextEditingController appointmentIdController = TextEditingController(); + TextEditingController conditionController = TextEditingController(); + TextEditingController typeController = TextEditingController(); + TextEditingController icdNameController = TextEditingController(); + + GlobalKey key = new GlobalKey>(); + bool isFormSubmitted = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + remarkController.text = widget.mySelectedAssessment.remark ?? ""; + appointmentIdController.text = + widget.mySelectedAssessment.appointmentId.toString(); + if(widget.isUpdate){ + if(widget.mySelectedAssessment + .selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + if(widget.mySelectedAssessment + .selectedDiagnosisType !=null) + typeController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisType + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisType + .nameEn; + if(widget.mySelectedAssessment.selectedICD !=null) + icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + } + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 10, + color: Theme.of(context).hintColor, + fontWeight: FontWeight.w700), + ); + } + return FractionallySizedBox( + heightFactor: 0.75, + child: BaseView( + onModelReady: (model) async { + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).addAssessmentDetails.toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 13, + ), + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).appointmentNumber, + fontSize: 13.5, + // hintColor: Colors.black, + hasLabelText: appointmentIdController.text != ''?true:false, + showLabelText: true, + fontWeight: FontWeight.w600, + readOnly: true, + controller: appointmentIdController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.080, + child: InkWell( + onTap: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, + child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .nameOrICD, + widget.mySelectedAssessment.selectedICD != + null ? widget.mySelectedAssessment + .selectedICD.nameEn : null, true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() + { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text =item.code; + }), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + suggestion.description + " / " + + suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.description.toLowerCase() + .startsWith(input.toLowerCase()) + || suggestion.code.toLowerCase().startsWith( + input.toLowerCase()) + , + ) + : TextFields( + onTapTextFields: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment.selectedICD = + null; + icdNameController.text = null; + }); + } + : null, + hasLabelText: icdNameController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .nameOrICD, + fontSize: 13.5, + readOnly: true, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: icdNameController, + suffixIcon: EvaIcons.search, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }) + + // TextField( + // decoration: textFieldSelectorDecoration( + // widget.mySelectedAssessment.selectedICD != + // null ? widget.mySelectedAssessment + // .selectedICD.code : "Name or ICD", + // widget.mySelectedAssessment.selectedICD != + // null ? projectViewModel.isArabic + // ? widget.mySelectedAssessment + // .selectedICD.nameAr + // : widget.mySelectedAssessment + // .selectedICD.nameEn : null, true, + // icon: EvaIcons.search), + // enabled: false, + // ), + ), + ), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedICD == null) + CustomValidationError(), + SizedBox( + height: 10, + ), + TextFields( + onTapTextFields: model + .listOfDiagnosisCondition != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment + .selectedDiagnosisCondition = + selectedValue; + conditionController.text = + projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: conditionController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .condition, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: conditionController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == null) + CustomValidationError(), + SizedBox( + height: 10, + ), + + + TextFields( + onTapTextFields: model + .listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + // _selectedDiagnosisType = + // selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisType = + selectedValue; + typeController.text = + projectViewModel.isArabic + ? selectedValue + .nameAr + : selectedValue + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hasLabelText: typeController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .dType, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: typeController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == null) + CustomValidationError(), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase + .of(context) + .remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 5, + hasLabelText: remarkController.text != + '' ? true : false, + showLabelText: true, + controller: remarkController, + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; + }, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: (widget.isUpdate?TranslationBase.of(context).update:TranslationBase.of(context).add).toUpperCase(), + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + setState(() { + isFormSubmitted = true; + }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment + .appointmentId = int.parse( + appointmentIdController.text); + if (widget.mySelectedAssessment + .selectedDiagnosisCondition != + null && + widget.mySelectedAssessment + .selectedDiagnosisType != + null && + widget.mySelectedAssessment + .selectedICD != null) { + await submitAssessment( + isUpdate: widget.isUpdate, + model: model, + mySelectedAssessment: widget + .mySelectedAssessment); + } + }, + ), + ])), + ), + ), + ))), + ); + } + + submitAssessment( + {SOAPViewModel model, MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { + if (isUpdate) { + PatchAssessmentReqModel patchAssessmentReqModel = + PatchAssessmentReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: mySelectedAssessment.selectedICD.code, + prevIcdCode10ID: mySelectedAssessment.icdCode10ID + ); + + await model.patchAssessment(patchAssessmentReqModel); + } else { + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ + new IcdCodeDetails( + remarks: mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: mySelectedAssessment.selectedICD.code) + ]); + + await model.postAssessment(postAssessmentRequestModel); + } + + + if (model.state == ViewState.ErrorLocal) { + helpers + .showErrorToast(model.error); + } else { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; + mySelectedAssessment.doctorName = doctorProfile.doctorName; + + if (!isUpdate) { + // widget.mySelectedAssessmentList.add(mySelectedAssessment); + widget.addSelectedAssessment(mySelectedAssessment,isUpdate); + } + Navigator.of(context).pop(); + } + + + // widget.changePageViewIndex(3); + } +} + + +class PatchAssessmentReqModel { + int patientMRN; + int appointmentNo; + int episodeID; + String icdcode10Id; + String prevIcdCode10ID; + int conditionId; + int diagnosisTypeId; + bool complexDiagnosis; + String remarks; + + PatchAssessmentReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.icdcode10Id, + this.prevIcdCode10ID, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + PatchAssessmentReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + icdcode10Id = json['Icdcode10Id']; + prevIcdCode10ID = json['PrevIcdCode10ID']; + conditionId = json['ConditionId']; + diagnosisTypeId = json['DiagnosisTypeId']; + complexDiagnosis = json['ComplexDiagnosis']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['Icdcode10Id'] = this.icdcode10Id; + data['PrevIcdCode10ID'] = this.prevIcdCode10ID; + data['ConditionId'] = this.conditionId; + data['DiagnosisTypeId'] = this.diagnosisTypeId; + data['ComplexDiagnosis'] = this.complexDiagnosis; + data['Remarks'] = this.remarks; + return data; + } +} + + diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart new file mode 100644 index 00000000..af960ff7 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -0,0 +1,632 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +class UpdateObjectivePage extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + + final List mySelectedExamination; + final PatiantInformtion patientInfo; + UpdateObjectivePage( + {Key key, this.changePageViewIndex, this.mySelectedExamination, this.patientInfo, this.changeLoadingState}); + + @override + _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); +} + +class _UpdateObjectivePageState extends State { + bool isSysExaminationExpand = false; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + widget.mySelectedExamination.clear(); + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + + await model.getPatientPhysicalExam(getPhysicalExamReqModel); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = MySelectedExamination( + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, + isAbnormal: element.isAbnormal); + widget.mySelectedExamination.add(tempEam); + }); + } + + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // baseViewModel: model, + + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).physicalSystemExamination, + variant: isSysExaminationExpand + ? "bodyText" + : '', + bold: isSysExaminationExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: Icon(isSysExaminationExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).physicalSystemExamination, + fontSize: 13.5, + onTapTextFields: () { + openExaminationList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Column( + children: + widget.mySelectedExamination.map((examination) { + TextEditingController remarksController= TextEditingController(text :examination.remark); + + return Container( + margin: EdgeInsets.only( + left: 15, right: 15, top: 15), + child: Column(children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + ( examination + .selectedExamination.nameEn ) + .toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + examination + .isNormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.grey), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + TranslationBase.of(context).normal, + style: TextStyle( + fontSize: 12, + color: + examination + .isNormal + ? Colors.white + : Colors + .black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination.isAbnormal = + false; + examination.isNormal = + true; + examination.notExamined = false; + }); + }), + SizedBox( + width: 12, + ), + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + examination + .isAbnormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + TranslationBase.of(context).abnormal, + style: TextStyle( + fontSize: 12, + color: + examination + .isAbnormal + ? Colors.white + : Colors + .black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination.isNormal = + false; + examination.isAbnormal = + true; + examination.notExamined = false; + }); + }),SizedBox( + width: 12, + ), + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + examination + .notExamined + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Not Examined", + style: TextStyle( + fontSize: 12, + color: + examination + .notExamined + ? Colors.white + : Colors + .black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), + ), + )), + ), + onTap: () { + setState(() { + examination.isAbnormal = + false; + examination.isNormal = + false; + examination.notExamined = true; + }); + }), + ], + ), + InkWell( + + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeExamination( + examination.selectedExamination), + ) + ], + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hasLabelText: remarksController.text != ''?true:false, + showLabelText: true, + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 4, + controller: remarksController, + onChanged: (val) { + examination.remark = val; + }, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + ])); + }).toList(), + ) + ], + ) + ]), + isExpand: isSysExaminationExpand, + ), + DividerWithSpacesAround(height: 30,), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitUpdateObjectivePage(model); + }, + ), + SizedBox( + height: 30, + ), + ], + ), + ), + ), + ))); + } + + submitUpdateObjectivePage(SOAPViewModel model) async { + + if(widget.mySelectedExamination.isNotEmpty){ + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy??doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + // masterDescription: exam.selectedExamination, + notExamined: exam.notExamined, + examinationType: exam.isNormal?1:exam.isAbnormal?2:3, + examinationTypeName: exam.isNormal?"Normal":exam.isAbnormal?'AbNormal':"Not Examined", + isNew:exam.isNew + + )); + }); + + if(model.patientPhysicalExamList.isEmpty) { + + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changeLoadingState(true); + + widget.changePageViewIndex(2); + } + } else { + // widget.changeLoadingState(true); + // + // widget.changePageViewIndex(2); + + helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + } + } + + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.mySelectedExamination + .where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + + if (history.length > 0) + setState(() { + widget.mySelectedExamination.remove(history.first); + }); + } + + openExaminationList(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddExaminationDailog( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey),); + }); + } +} + +class AddExaminationDailog extends StatefulWidget { + final List mySelectedExamination; + final Function addSelectedExamination; + final Function (MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup( + MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + MasterKeyCheckboxSearchWidget( + model: model, + hintSearchText: TranslationBase.of(context).searchExamination, + buttonName: TranslationBase.of(context).addExamination, + masterList: model.physicalExaminationList, + removeHistory: (history){ + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history){ + setState(() { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: history + ); + widget + .mySelectedExamination + .add( + mySelectedExamination); + }); + }, + addSelectedHistories: (){ + widget.addSelectedExamination(); + }, + isServiceSelected: (master) =>isServiceSelected(master), + ), + ]), + ))), + )), + ); + } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable exam = + widget + .mySelectedExamination + .where((element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart new file mode 100644 index 00000000..e1388ef1 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -0,0 +1,406 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class UpdatePlanPage extends StatefulWidget { + final Function changePageViewIndex; + final PatiantInformtion patientInfo; + final Function changeLoadingState; + GetPatientProgressNoteResModel patientProgressNote; + + UpdatePlanPage( + {Key key, + this.changePageViewIndex, + this.patientInfo, + this.changeLoadingState, + this.patientProgressNote}); + + @override + _UpdatePlanPageState createState() => _UpdatePlanPageState(); +} + +class _UpdatePlanPageState extends State { + bool isProgressNoteExpand = false; + + + TextEditingController progressNoteController = + TextEditingController(text: null); + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: widget.patientInfo.appointmentNo, + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: ''); + await model.getPatientProgressNote(getGetProgressNoteReqModel); + + if (model.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = helpers + .parseHtmlString(model.patientProgressNoteList[0].planNote); + widget.patientProgressNote.planNote = progressNoteController.text; + widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; + widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; + widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; + widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; + + } + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts(TranslationBase + .of(context) + .progressNoteSOAP, + variant: isProgressNoteExpand ? "bodyText" : '', + bold: isProgressNoteExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isProgressNoteExpand = !isProgressNoteExpand; + }); + }, + child: Icon(isProgressNoteExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + if(widget.patientProgressNote.planNote == null) + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + + hintText: TranslationBase + .of(context) + .addProgressNote, + fontSize: 13.5, + onTapTextFields: () { + openProgressNote(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + if ( widget.patientProgressNote.planNote != null) + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + + widget.patientProgressNote.createdOn !=null?DateTime.parse(widget.patientProgressNote.createdOn).day.toString():DateTime.now().day.toString(), + fontWeight: FontWeight + .bold, + fontSize: 16, + ), + AppText( + Helpers.getMonth(widget.patientProgressNote.createdOn !=null?(DateTime.parse(widget.patientProgressNote.createdOn).month):DateTime.now().month).toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + Padding( + padding: const EdgeInsets.all(0.0), + child: Container( + width: MediaQuery.of(context) + .size + .width * + 0.6, + child: AppText( + progressNoteController.text, + fontSize: 10, + color: Colors.grey, + ), + ), + ), + ], + ), + SizedBox( + height: 8, + ), + if(widget.patientProgressNote.createdByName !=null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).createdBy, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.patientProgressNote.createdByName??"", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + if(widget.patientProgressNote.editedByName !=null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).editedBy, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.patientProgressNote.editedByName??"", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + ], + ), + Column( + children: [ + InkWell( + onTap: () { + openProgressNote(context); + }, + child: Icon(EvaIcons.edit2Outline), + ) + ], + ), + ], + ), + ) + ], + ) + ]), + isExpand: isProgressNoteExpand, + ), + DividerWithSpacesAround( + height: 30, + ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () { + submitPlan(model); + // widget.changePageViewIndex(2); + }, + ), + SizedBox( + height: 30, + ), + ], + ), + ), + ), + ), + ), + ); + } + + submitPlan(SOAPViewModel model) async { + if (progressNoteController.text.isNotEmpty) { + PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + planNote: widget.patientProgressNote.planNote, doctorID: '', editedBy: ''); + + if(model.patientProgressNoteList.isEmpty){ + await model.postProgressNote(postProgressNoteRequestModel); + + }else { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + postProgressNoteRequestModel.editedBy =doctorProfile.doctorID; + await model.patchProgressNote(postProgressNoteRequestModel); + + } + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + Navigator.of(context).pop(); + } + } else { + helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + } + } + + openProgressNote(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.6, + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).addProgressNote, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + + child: TextFields( + hasLabelText: progressNoteController.text != ''?true:false, + showLabelText: true, + hintText: TranslationBase.of(context).addProgressNote, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 16, + minLines: 8, + controller: progressNoteController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ),SizedBox( + height: 10, + ), + AppButton( + title: TranslationBase.of(context).add.toUpperCase(), + onPressed: () async{ + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + widget.patientProgressNote.createdByName = widget.patientProgressNote.createdByName??doctorProfile.doctorName; + widget.patientProgressNote.editedByName=doctorProfile.doctorName; + widget.patientProgressNote.createdOn= DateTime.now().toString() ; + widget.patientProgressNote.planNote = progressNoteController.text; + setState(() { + print(progressNoteController.text); + }); + Navigator.of(context).pop(); + }, + ), + ]), + )), + ); + }); + } +} diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart new file mode 100644 index 00000000..5c646121 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -0,0 +1,154 @@ +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_objective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_plan_page.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class UpdateSoapIndex extends StatefulWidget { + final bool isUpdate; + + const UpdateSoapIndex({Key key, this.isUpdate}) : super(key: key); + @override + _UpdateSoapIndexState createState() => _UpdateSoapIndexState(); +} + +class _UpdateSoapIndexState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + List myAllergiesList = List(); + List myHistoryList = List(); + List mySelectedExamination = List(); + List mySelectedAssessment = List(); + + GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel(); + changePageViewIndex(pageIndex) { + if (pageIndex != _currentIndex) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + } + + bool _isLoading = true; + + @override + void initState() { + // TODO: implement initState + _controller = new PageController(); + + super.initState(); + } + + void changeLoadingState(isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + return BaseView( + builder: (_, model, w) => AppScaffold( + // baseViewModel: model, + isLoading: _isLoading, + appBarTitle: TranslationBase.of(context).healthRecordInformation, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: + BoxDecoration(boxShadow: [], color: Colors.white), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + FractionallySizedBox( + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.75, + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + left: + MediaQuery.of(context).size.width * 0.05, + right: + MediaQuery.of(context).size.width * 0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: changePageViewIndex, + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + UpdateSubjectivePage( + changePageViewIndex: changePageViewIndex, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList, + patientInfo: patient, + changeLoadingState:changeLoadingState + ), + UpdateObjectivePage( + changePageViewIndex: changePageViewIndex, + mySelectedExamination: + mySelectedExamination, + patientInfo: patient, + changeLoadingState:changeLoadingState + ), + UpdateAssessmentPage( + changePageViewIndex: changePageViewIndex, + mySelectedAssessmentList: + mySelectedAssessment, + patientInfo: patient, + changeLoadingState:changeLoadingState + + ), + UpdatePlanPage( + changePageViewIndex: changePageViewIndex, + patientInfo: patient, + patientProgressNote: patientProgressNote, + changeLoadingState:changeLoadingState + + ) + ], + ), + ), + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/widgets/shared/StarRating.dart b/lib/widgets/shared/StarRating.dart new file mode 100644 index 00000000..10c12fa5 --- /dev/null +++ b/lib/widgets/shared/StarRating.dart @@ -0,0 +1,48 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +import 'Text.dart'; + +class StarRating extends StatelessWidget { + final double totalAverage; + final double size; + final int totalCount; + final bool forceStars; + + StarRating( + {Key key, + this.totalAverage: 0.0, + this.size: 16.0, + this.totalCount = 5, + this.forceStars = false}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + if (!forceStars && (totalAverage == null || totalAverage == 0)) + Texts("New", style: "caption"), + if (forceStars || (totalAverage != null && totalAverage > 0)) + ...List.generate( + 5, + (index) => Padding( + padding: EdgeInsets.only(right: 1.0), + child: Icon( + (index + 1) <= (totalAverage ?? 0) + ? EvaIcons.star + : EvaIcons.starOutline, + size: size, + color: (index + 1) <= (totalAverage ?? 0) + ? Color.fromRGBO(255, 186, 0, 1.0) + : Theme.of(context).hintColor), + )), + if (totalCount != null) SizedBox(width: 9.0), + if (totalCount != null) + Texts( + "(" + totalCount.toString() + ")", + style: "overline", + color: Colors.grey[400], + ) + ]); + } +} diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 9f6dfdf1..59929075 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class Texts extends StatefulWidget { - final String text; final String variant; final Color color; @@ -16,12 +15,26 @@ class Texts extends StatefulWidget { final bool readMore; final String style; final bool allowExpand; + final double fontSize; + final FontWeight fontWeight; + final TextDecoration textDecoration; - Texts(this.text, {Key key, this.variant, this.color, - this.bold, this.regular, this.medium, this.allowExpand = true, - this.italic:false, this.textAlign, this.maxLength=60, - this.maxLines, this.readMore=false, this.style - }) : super(key: key); + Texts(this.text, + {Key key, + this.variant, + this.color, + this.bold, + this.regular, + this.medium, + this.allowExpand = true, + this.italic: false, + this.textAlign, + this.maxLength = 60, + this.maxLines, + this.readMore = false, + this.style, + this.textDecoration, this.fontSize, this.fontWeight}) + : super(key: key); @override _TextsState createState() => _TextsState(); @@ -34,7 +47,7 @@ class _TextsState extends State { @override void didUpdateWidget(Texts oldWidget) { setState(() { - if (widget.style=="overline") + if (widget.style == "overline") text = widget.text.toUpperCase(); else { text = widget.text; @@ -46,7 +59,7 @@ class _TextsState extends State { @override void initState() { hidden = widget.readMore; - if (widget.style=="overline") + if (widget.style == "overline") text = widget.text.toUpperCase(); else { text = widget.text; @@ -54,7 +67,7 @@ class _TextsState extends State { super.initState(); } - double _getFontSize () { + double _getFontSize() { switch (widget.variant) { case "heading0": return 40.0; @@ -91,16 +104,15 @@ class _TextsState extends State { } } - FontWeight _getFontWeight () { + FontWeight _getFontWeight() { if (widget.bold ?? false) { return FontWeight.w900; } else if (widget.regular ?? false) { return FontWeight.w500; } else if (widget.medium ?? false) { return FontWeight.w800; - } - else { - if (widget.style==null) { + } else { + if (widget.style == null) { switch (widget.variant) { case "heading": return FontWeight.w900; @@ -136,14 +148,12 @@ class _TextsState extends State { } else { return null; } - } } @override Widget build(BuildContext context) { - - TextStyle _getFontStyle () { + TextStyle _getFontStyle() { switch (widget.style) { case "headline2": return Theme.of(context).textTheme.headline2; @@ -167,7 +177,7 @@ class _TextsState extends State { return Theme.of(context).textTheme.overline; case "button": return Theme.of(context).textTheme.button; - default : + default: return TextStyle(); } } @@ -178,59 +188,71 @@ class _TextsState extends State { children: [ Stack( children: [ - Text(!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)), - textAlign: widget.textAlign, - overflow: widget.maxLines!=null ? ((widget.maxLines > 1) ? TextOverflow.fade : TextOverflow.ellipsis) : null, - maxLines: widget.maxLines ?? null, - style: widget.style != null ? _getFontStyle().copyWith( - fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color!=null ? widget.color : null, - fontWeight: _getFontWeight(), - ) : TextStyle( - fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color!=null ? widget.color : Colors.black, - fontSize: _getFontSize(), - letterSpacing: widget.variant=="overline" ? 1.5 : null, - fontWeight: _getFontWeight(), - ) - ), + Text( + !hidden + ? text + : (text.substring( + 0, + text.length > widget.maxLength + ? widget.maxLength + : text.length)), + textAlign: widget.textAlign, + overflow: widget.maxLines != null + ? ((widget.maxLines > 1) + ? TextOverflow.fade + : TextOverflow.ellipsis) + : null, + maxLines: widget.maxLines ?? null, + style: widget.style != null + ? _getFontStyle().copyWith( + fontStyle: widget.italic ? FontStyle.italic : null, + color: widget.color != null ? widget.color : null, + fontWeight: widget.fontWeight ?? _getFontWeight(), + ) + : TextStyle( + fontStyle: widget.italic ? FontStyle.italic : null, + color: + widget.color != null ? widget.color : Colors.black, + fontSize:widget.fontSize?? _getFontSize(), + letterSpacing: + widget.variant == "overline" ? 1.5 : null, + fontWeight: widget.fontWeight ?? _getFontWeight(), + decoration: + widget.textDecoration //TextDecoration.lineThrough + )), if (widget.readMore && text.length > widget.maxLength && hidden) - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context).backgroundColor, - Theme.of(context).backgroundColor.withOpacity(0), - ], - begin: Alignment.bottomCenter, - end: Alignment.topCenter - ) + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient(colors: [ + Theme.of(context).backgroundColor, + Theme.of(context).backgroundColor.withOpacity(0), + ], begin: Alignment.bottomCenter, end: Alignment.topCenter)), + height: 30, ), - height: 30, - ), - ) + ) ], ), - if (widget.allowExpand && widget.readMore && text.length > widget.maxLength) + if (widget.allowExpand && + widget.readMore && + text.length > widget.maxLength) Padding( padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0), child: InkWell( onTap: () { setState(() { - hidden=!hidden; + hidden = !hidden; }); }, child: Text(hidden ? "Read More" : "Read less", - style: _getFontStyle().copyWith( - color: HexColor('#FF0000'), - fontWeight: FontWeight.w800, - fontFamily: "WorkSans" - ) - ), + style: _getFontStyle().copyWith( + color: HexColor('#FF0000'), + fontWeight: FontWeight.w800, + fontFamily: "WorkSans", + )), ), ), ], diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 269ad660..706c65b7 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -2,13 +2,83 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +class NumberTextInputFormatter extends TextInputFormatter { + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + final int newTextLength = newValue.text.length; + int selectionIndex = newValue.selection.end; + int usedSubstringIndex = 0; + final StringBuffer newText = StringBuffer(); + if (newTextLength >= 1) { + newText.write('('); + if (newValue.selection.end >= 1) selectionIndex++; + } + if (newTextLength >= 4) { + newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + if (newValue.selection.end >= 3) selectionIndex += 2; + } + if (newTextLength >= 7) { + newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + if (newValue.selection.end >= 6) selectionIndex++; + } + if (newTextLength >= 11) { + newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + if (newValue.selection.end >= 10) selectionIndex++; + } + // Dump the rest. + if (newTextLength >= usedSubstringIndex) + newText.write(newValue.text.substring(usedSubstringIndex)); + return TextEditingValue( + text: newText.toString(), + selection: TextSelection.collapsed(offset: selectionIndex), + ); + } +} +final _mobileFormatter = NumberTextInputFormatter(); class TextFields extends StatefulWidget { - - TextFields({Key key, this.type, this.hintText, this.suffixIcon, this.autoFocus, this.onChanged, this.initialValue, this.minLines, this.maxLines, this.inputFormatters, this.padding, this.focus=false, this.maxLengthEnforced=true, - this.suffixIconColor, this.inputAction, this.onSubmit, this.keepPadding=true, this.textCapitalization = TextCapitalization.none, this.onTap, this.controller, this.keyboardType, this.validator, this.borderOnlyError=false, - this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false}) : super(key: key); + TextFields( + {Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction = TextInputAction.done, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.fillColor, + this.hintColor, + this.hasBorder = true, + this.onTapTextFields, + this.hasLabelText = false, + this.showLabelText = false}) + : super(key: key); final String hintText; final String initialValue; @@ -16,8 +86,9 @@ class TextFields extends StatefulWidget { final bool autoFocus; final IconData suffixIcon; final Color suffixIconColor; - final IconData prefixIcon; + final Icon prefixIcon; final VoidCallback onTap; + final Function onTapTextFields; final TextEditingController controller; final TextInputType keyboardType; final FormFieldValidator validator; @@ -41,6 +112,11 @@ class TextFields extends StatefulWidget { final EdgeInsets padding; final bool focus; final bool borderOnlyError; + final Color hintColor; + final Color fillColor; + final bool hasBorder; + final bool showLabelText; + bool hasLabelText; @override _TextFieldsState createState() => _TextFieldsState(); @@ -63,8 +139,7 @@ class _TextFieldsState extends State { @override void didUpdateWidget(TextFields oldWidget) { - if (widget.focus) - _focusNode.requestFocus(); + if (widget.focus) _focusNode.requestFocus(); super.didUpdateWidget(oldWidget); } @@ -77,25 +152,45 @@ class _TextFieldsState extends State { Widget _buildSuffixIcon() { switch (widget.type) { case "password": - { return Padding( - padding: const EdgeInsets.only(right: 8.0), - child: view ? - InkWell(onTap: () {this.setState(() { view= false; });}, child: Icon(EvaIcons.eye, size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) - : - InkWell(onTap: () {this.setState(() { view= true; });}, child: Icon(EvaIcons.eyeOff, size: 24.0, color: Colors.grey[500])) - );} + { + return Padding( + padding: const EdgeInsets.only(right: 8.0), + child: view + ? InkWell( + onTap: () { + this.setState(() { + view = false; + }); + }, + child: Icon(EvaIcons.eye, + size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) + : InkWell( + onTap: () { + this.setState(() { + view = true; + }); + }, + child: Icon(EvaIcons.eyeOff, + size: 24.0, color: Colors.grey[500]))); + } - break; + break; default: - if (widget.suffixIcon!=null) - return InkWell(onTap: widget.onSuffixTap, child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor!=null ? widget.suffixIconColor : Colors.grey[500])); + if (widget.suffixIcon != null) + return InkWell( + onTap: widget.onSuffixTap, + child: Icon(widget.suffixIcon, + size: 22.0, + color: widget.suffixIconColor != null + ? widget.suffixIconColor + : Colors.grey[500])); else return null; } } bool _determineReadOnly() { - if (widget.readOnly!=null && widget.readOnly) { + if (widget.readOnly != null && widget.readOnly) { _focusNode.unfocus(); return true; } else { @@ -105,81 +200,149 @@ class _TextFieldsState extends State { @override Widget build(BuildContext context) { - return ( - AnimatedContainer( - duration: Duration(milliseconds: 300), - decoration: widget.bare ? null :BoxDecoration( - boxShadow: [BoxShadow(color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), offset: Offset(0.0, 13.0), blurRadius: focus ? 34.0 : 12.0)] - ), - child: TextFormField( - keyboardAppearance: Theme.of(context).brightness, - scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, - textCapitalization: widget.textCapitalization, - onFieldSubmitted: widget.inputAction==TextInputAction.next ? (widget.onSubmit!=null ? widget.onSubmit : (val) { _focusNode.nextFocus(); }) : widget.onSubmit, - textInputAction: widget.inputAction, - minLines: widget.minLines ?? 1, - maxLines: widget.maxLines ?? 1, - maxLengthEnforced: widget.maxLengthEnforced, - initialValue: widget.initialValue, - onChanged: widget.onChanged, - focusNode: _focusNode, - maxLength: widget.maxLength ?? null, - controller: widget.controller, - keyboardType: widget.keyboardType, - readOnly: _determineReadOnly(), - obscureText: widget.type=="password" && !view ? true : false, - autofocus: widget.autoFocus ?? false, - validator: widget.validator, - onSaved: widget.onSaved, - style: Theme.of(context).textTheme.body2.copyWith( fontSize: widget.fontSize, fontWeight: widget.fontWeight ), - inputFormatters: widget.inputFormatters, - decoration: InputDecoration( - counterText: "", - hintText: widget.hintText, - hintStyle: TextStyle(fontSize: widget.fontSize, fontWeight: widget.fontWeight, color: Theme.of(context).hintColor), - - contentPadding: widget.padding!=null ? widget.padding : EdgeInsets.symmetric(vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, horizontal: 16.0), - filled: true, - fillColor: widget.bare ? Colors.transparent : Theme.of(context).backgroundColor, - - suffixIcon: _buildSuffixIcon(), - prefixIcon: widget.type!="search" ? - widget.prefixIcon!=null ? - Padding( - padding: EdgeInsets.only(left: 28.0, top: 14.0, bottom: 14.0, right: 0), - child: Text("\$", style: TextStyle( fontSize: 14, fontWeight: FontWeight.w800),), - ) - : - null - : - Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - - errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), - errorBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + return (AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration: widget.bare + ? null + : BoxDecoration(boxShadow: [ + // BoxShadow( + // color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), + // offset: Offset(0.0, 13.0), + // blurRadius: focus ? 34.0 : 12.0) + BoxShadow( + color: Color.fromRGBO(110, 68, 80, focus ? 0.20 : 0), + offset: Offset(0.0, 13.0), + blurRadius: focus ? 34.0 : 12.0) + ]), + child: Column( + children: [ + TextFormField( + onTap: widget.onTapTextFields, + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + initialValue: widget.initialValue, + onChanged: (value) { + if (widget.showLabelText) { + if ((value == null || value == '')) { + setState(() { + widget.hasLabelText = false; + }); + } else { + setState(() { + widget.hasLabelText = true; + }); + } + } + if (widget.onChanged != null) widget.onChanged(value); + }, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + style: Theme.of(context).textTheme.bodyText1.copyWith( + fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.hasLabelText ? widget.hintText : null, + labelStyle: TextStyle( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.hintColor ?? Theme.of(context).hintColor, + ), + counterText: "", + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.hintColor ?? Theme.of(context).hintColor, + ), + contentPadding: widget.padding != null + ? widget.padding + : EdgeInsets.symmetric( + vertical: + (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, + horizontal: 16.0), + filled: true, + fillColor: widget.bare + ? Colors.transparent + : Theme.of(context).backgroundColor, + suffixIcon: _buildSuffixIcon(), + prefixIcon: widget.prefixIcon, + errorStyle: TextStyle( + fontSize: 12.0, + fontWeight: widget.fontWeight, + height: widget.borderOnlyError ? 0.0 : null), + errorBorder: OutlineInputBorder( + borderSide: widget.hasBorder + ? BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: widget.hasBorder + ? BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + focusedBorder: OutlineInputBorder( + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), + ), + disabledBorder: OutlineInputBorder( + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0)), + enabledBorder: OutlineInputBorder( + borderSide: widget.hasBorder + ? BorderSide(color: Colors.grey, width: 1.0) + : BorderSide(color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder + ? BorderRadius.circular(widget.bare ? 0.0 : 8.0) + : BorderRadius.circular(0.0), + ), ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ) - ), - ), - ) - ); + ], + ), + )); } } diff --git a/lib/widgets/shared/app-textfield-custom.dart b/lib/widgets/shared/app-textfield-custom.dart new file mode 100644 index 00000000..15c8865a --- /dev/null +++ b/lib/widgets/shared/app-textfield-custom.dart @@ -0,0 +1,140 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:flutter/material.dart'; + +import 'app_texts_widget.dart'; + +class AppTextFieldCustom extends StatefulWidget { + final double height; + final Function onClick; + final String hintText; + final TextEditingController controller; + final bool isDropDown; + final Icon suffixIcon; + final Color dropDownColor; + + AppTextFieldCustom( + {this.height = 0, + this.onClick, + this.hintText, + this.controller, + this.isDropDown = false, + this.suffixIcon, + this.dropDownColor}); + + @override + _AppTextFieldCustomState createState() => _AppTextFieldCustomState(); +} + +class _AppTextFieldCustomState extends State { + @override + Widget build(BuildContext context) { + return Container( + height: widget.height != 0 ? widget.height : null, + decoration: + containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)), + padding: EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0), + child: InkWell( + onTap: widget.onClick ?? null, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.controller.text != "") + AppText( + widget.hintText, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.4, + fontWeight: FontWeight.w600, + ), + TextField( + textAlign: TextAlign.left, + decoration: textFieldSelectorDecoration( + widget.hintText, null, true), + style: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + controller: widget.controller, + ), + ], + ), + ), + widget.isDropDown + ? widget.suffixIcon != null + ? widget.suffixIcon + : Icon( + Icons.arrow_drop_down, + color: widget.dropDownColor != null + ? widget.dropDownColor + : Colors.black, + ) + : Container(), + ], + ), + ), + ); + } + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor, + {double borderWidth = -1}) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: borderWidth == -1 ? 2.0 : borderWidth, + )), + ); + } + + static InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon, Color dropDownColor}) { + return InputDecoration( + isDense: true, + contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + border: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + /*focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ),*/ + hintText: selectedText != null ? selectedText : hintText, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + /*suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: dropDownColor != null ? dropDownColor : Colors.black, + ) + : null,*/ + // labelText: + // labelStyle: + ); + } +} diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart index 984d4350..60a3528d 100644 --- a/lib/widgets/shared/app_button.dart +++ b/lib/widgets/shared/app_button.dart @@ -2,18 +2,22 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class Button extends StatefulWidget { + final String title; + final Widget icon; + final VoidCallback onTap; + final bool loading; + final Color color; + Button({ Key key, - this.title: "", + this.title = "", this.icon, this.onTap, - this.loading: false, + this.loading= false, + this.color, }) : super(key: key); - final String title; - final Widget icon; - final VoidCallback onTap; - final bool loading; + @override _ButtonState createState() => _ButtonState(); @@ -86,7 +90,8 @@ class _ButtonState extends State