diff --git a/.vscode/settings.json b/.vscode/settings.json index e592e48b..045932f0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "commentBox.styles": { "defaultStyle": { - "commentStartToken": "/* \n *@author: Amjad Amireh \n *@Date:27/4/2020 \n *@param: \n *@return:\n *@desc: ", + "commentStartToken": "/* \n *@author: Ibrahim Albitar \n *@Date:03/06/2020 \n *@param: \n *@return:\n *@desc: ", "commentEndToken": "\n */", "leftEdgeToken": " * ", "rightEdgeToken": "", diff --git a/assets/images/dashboard_icon/discharge_patient.svg b/assets/images/dashboard_icon/discharge_patient.svg deleted file mode 100644 index 68186c51..00000000 --- a/assets/images/dashboard_icon/discharge_patient.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/home_icon.svg b/assets/images/dashboard_icon/home_icon.svg deleted file mode 100644 index 32597a47..00000000 --- a/assets/images/dashboard_icon/home_icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/dashboard_icon/home_icon_active.svg b/assets/images/dashboard_icon/home_icon_active.svg deleted file mode 100644 index 31b47d99..00000000 --- a/assets/images/dashboard_icon/home_icon_active.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/dashboard_icon/in_patient_white.svg b/assets/images/dashboard_icon/in_patient_white.svg deleted file mode 100644 index d648f62c..00000000 --- a/assets/images/dashboard_icon/in_patient_white.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/images/dashboard_icon/lab_results.svg b/assets/images/dashboard_icon/lab_results.svg deleted file mode 100644 index 353c6a19..00000000 --- a/assets/images/dashboard_icon/lab_results.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/menu_icon.svg b/assets/images/dashboard_icon/menu_icon.svg deleted file mode 100644 index 0a62759b..00000000 --- a/assets/images/dashboard_icon/menu_icon.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/menu_icon_active.svg b/assets/images/dashboard_icon/menu_icon_active.svg deleted file mode 100644 index b565b40a..00000000 --- a/assets/images/dashboard_icon/menu_icon_active.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/message_icon.svg b/assets/images/dashboard_icon/message_icon.svg deleted file mode 100644 index d200320b..00000000 --- a/assets/images/dashboard_icon/message_icon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/images/dashboard_icon/message_icon_active.svg b/assets/images/dashboard_icon/message_icon_active.svg deleted file mode 100644 index 87759ec7..00000000 --- a/assets/images/dashboard_icon/message_icon_active.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/images/dashboard_icon/operations.svg b/assets/images/dashboard_icon/operations.svg deleted file mode 100644 index 1dc283cc..00000000 --- a/assets/images/dashboard_icon/operations.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/out_patient.svg b/assets/images/dashboard_icon/out_patient.svg deleted file mode 100644 index bc0a7a9b..00000000 --- a/assets/images/dashboard_icon/out_patient.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/images/dashboard_icon/patient.svg b/assets/images/dashboard_icon/patient.svg deleted file mode 100644 index 40082dcc..00000000 --- a/assets/images/dashboard_icon/patient.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/images/dashboard_icon/qr-code.svg b/assets/images/dashboard_icon/qr-code.svg deleted file mode 100644 index a85e6e63..00000000 --- a/assets/images/dashboard_icon/qr-code.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/dashboard_icon/radiology.svg b/assets/images/dashboard_icon/radiology.svg deleted file mode 100644 index e8e45723..00000000 --- a/assets/images/dashboard_icon/radiology.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/dashboard_icon/referral.svg b/assets/images/dashboard_icon/referral.svg deleted file mode 100644 index bdf4d096..00000000 --- a/assets/images/dashboard_icon/referral.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/images/dashboard_icon/scdedule_icon_active.svg b/assets/images/dashboard_icon/scdedule_icon_active.svg deleted file mode 100644 index 5c3fc7ae..00000000 --- a/assets/images/dashboard_icon/scdedule_icon_active.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/images/dashboard_icon/schedule_icon.svg b/assets/images/dashboard_icon/schedule_icon.svg deleted file mode 100644 index 10b78b14..00000000 --- a/assets/images/dashboard_icon/schedule_icon.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/images/dashboard_icon/search_patient.svg b/assets/images/dashboard_icon/search_patient.svg deleted file mode 100644 index 92c1ca4b..00000000 --- a/assets/images/dashboard_icon/search_patient.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/icons_app/config.json b/icons_app/config.json index 1acbf629..0e33e54a 100644 --- a/icons_app/config.json +++ b/icons_app/config.json @@ -34,20 +34,6 @@ "male" ] }, - { - "uid": "0bbb324cc39e62b3a4e05639a4f4008f", - "css": "home_icon", - "code": 59394, - "src": "custom_icons", - "selected": true, - "svg": { - "path": "M973.1 435L973.1 435 565 27A92 92 0 0 0 434.9 27L27.2 434.7 26.8 435.1A92 92 0 0 0 88 591.9C88.9 591.9 89.9 591.9 90.8 591.9H107.1V892.1A107.9 107.9 0 0 0 214.8 999.9H374.4A29.3 29.3 0 0 0 403.7 970.6V735.3A49.2 49.2 0 0 1 452.9 686.2H547A49.2 49.2 0 0 1 596.2 735.3V970.7A29.3 29.3 0 0 0 625.5 1000H785.1A107.9 107.9 0 0 0 892.8 892.3V592H907.8A92.1 92.1 0 0 0 973 434.9ZM931.6 523.7A33.4 33.4 0 0 1 907.9 533.5H863.5A29.3 29.3 0 0 0 834.2 562.8V892.3A49.2 49.2 0 0 1 785.1 941.4H654.9V735.3A107.9 107.9 0 0 0 547 627.5H452.9A107.9 107.9 0 0 0 345.1 735.2V941.3H215A49.2 49.2 0 0 1 165.8 892.1V562.8A29.3 29.3 0 0 0 136.5 533.5H92.8L91.4 533.5A33.4 33.4 0 0 1 68.4 476.4H68.4L476.3 68.4A33.4 33.4 0 0 1 523.6 68.4L931.4 476.2 931.6 476.4A33.4 33.4 0 0 1 931.6 523.7ZM931.6 523.7", - "width": 1000 - }, - "search": [ - "home_icon" - ] - }, { "uid": "06d6838cdcf6af812f2eb51e0269afc0", "css": "home_icon_active", @@ -383,6 +369,62 @@ "search": [ "scdedule_icon_active" ] + }, + { + "uid": "5a324eddf382f5a1167d7d40325f82c8", + "css": "reject_icon", + "code": 59402, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M681 626.7L554.3 500 681 373.3A38.5 38.5 0 0 0 626.7 318.9L500 445.7 373.3 319A38.5 38.5 0 1 0 318.9 373.3L445.7 500 318.9 626.8A37.2 37.2 0 0 0 318.9 681.1 38.2 38.2 0 0 0 373.3 681.1L500 554.4 626.7 681.1A38.5 38.5 0 0 0 681.1 681.1 38.2 38.2 0 0 0 681 626.7ZM500 67.3A432.5 432.5 0 1 1 194 194 429.8 429.8 0 0 1 500 67.3M500 0A500 500 0 1 0 1000 500 500 500 0 0 0 500 0Z", + "width": 1000 + }, + "search": [ + "reject_icon" + ] + }, + { + "uid": "2742f64b5e69cc4f39a2dcc5a081ad03", + "css": "approved_icon", + "code": 59403, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M756.3 348.3L714 304.8A9.1 9.1 0 0 0 707.2 302H707.2A8.7 8.7 0 0 0 700.5 304.8L407.2 600.3 300.5 493.5A9.3 9.3 0 0 0 287.1 493.5L244.2 536.3A9.6 9.6 0 0 0 244.2 550L378.8 684.5A42.6 42.6 0 0 0 406.9 698.2 44.6 44.6 0 0 0 434.8 685H435L756.5 362A10.3 10.3 0 0 0 756.3 348.3ZM500 67.3A432.5 432.5 0 1 1 194 194 429.8 429.8 0 0 1 500 67.3M500 0A499.9 499.9 0 1 0 999.9 500 499.9 499.9 0 0 0 500 0Z", + "width": 1000 + }, + "search": [ + "approved_icon" + ] + }, + { + "uid": "148de09f7fd22c378cdfdbaacaa8e205", + "css": "pending_icon", + "code": 59404, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M809.8 932H797.3C781.5 932 768.2 929.8 766.5 914V913.7C731 583.9 523.3 577.6 523.3 499.9S731.1 415.9 766.5 86V85.9C768.2 70.1 781.5 68 797.3 68H809.8A34.8 34.8 0 0 0 844.7 35.7 34 34 0 0 0 810.7 0H35A34.8 34.8 0 0 0 0 32.3 34 34 0 0 0 34 68H47.2C63 68 76.3 70.2 78.1 85.9V86.2C113.7 416 321.5 422.3 321.5 500S113.7 584 78.3 913.8V914C76.6 929.8 63.3 932 47.5 932H35A34.8 34.8 0 0 0 0.1 964.3 34 34 0 0 0 34.1 1000H810.7A33.9 33.9 0 0 0 844.7 964.3 34.8 34.8 0 0 0 809.8 932ZM197.4 848.9C267 655.2 390.6 678.7 390.6 602.3V467.5C390.6 420.4 301.2 387.6 245.4 311.1A19 19 0 0 1 261.2 281H583.8A18.9 18.9 0 0 1 600 310.6C545.2 387.3 454.2 420.4 454.2 467.4V602.4C454.2 678.1 572.9 657.5 647.8 849 654.7 866.3 649.5 887.8 631.2 887.8H214.1C195.4 887.8 191.1 866.5 197.4 849Z", + "width": 845 + }, + "search": [ + "pending_icon" + ] + }, + { + "uid": "0bbb324cc39e62b3a4e05639a4f4008f", + "css": "home_icon", + "code": 59394, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M973.1 435L973.1 435 565 27A92 92 0 0 0 434.9 27L27.2 434.7 26.8 435.1A92 92 0 0 0 88 591.9C88.9 591.9 89.9 591.9 90.8 591.9H107.1V892.1A107.9 107.9 0 0 0 214.8 999.9H374.4A29.3 29.3 0 0 0 403.7 970.6V735.3A49.2 49.2 0 0 1 452.9 686.2H547A49.2 49.2 0 0 1 596.2 735.3V970.7A29.3 29.3 0 0 0 625.5 1000H785.1A107.9 107.9 0 0 0 892.8 892.3V592H907.8A92.1 92.1 0 0 0 973 434.9ZM931.6 523.7A33.4 33.4 0 0 1 907.9 533.5H863.5A29.3 29.3 0 0 0 834.2 562.8V892.3A49.2 49.2 0 0 1 785.1 941.4H654.9V735.3A107.9 107.9 0 0 0 547 627.5H452.9A107.9 107.9 0 0 0 345.1 735.2V941.3H215A49.2 49.2 0 0 1 165.8 892.1V562.8A29.3 29.3 0 0 0 136.5 533.5H92.8L91.4 533.5A33.4 33.4 0 0 1 68.4 476.4H68.4L476.3 68.4A33.4 33.4 0 0 1 523.6 68.4L931.4 476.2 931.6 476.4A33.4 33.4 0 0 1 931.6 523.7ZM931.6 523.7", + "width": 1000 + }, + "search": [ + "home_icon" + ] } ] } \ No newline at end of file diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 0d57b9dd..27fcb103 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -2,10 +2,13 @@ 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/interceptor/http_interceptor.dart'; import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:http/http.dart'; +import 'package:http/http.dart' as http; + +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +Helpers helpers = new Helpers(); /* *@author: Mohammad Aljammal @@ -14,6 +17,7 @@ import 'package:http/http.dart'; *@return: *@desc: */ + ///Example /* await BaseAppClient.post('', @@ -22,8 +26,6 @@ import 'package:http/http.dart'; body: null); * */ class BaseAppClient { - static Client client = HttpInterceptor().getClient(); - static post( String endPoint, { Map body, @@ -34,12 +36,15 @@ class BaseAppClient { try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - body['DoctorID'] = doctorProfile.doctorID; - body['EditedBy'] = doctorProfile.doctorID; - body['ProjectID'] = doctorProfile.projectID; - body['ClinicID'] = doctorProfile.clinicID; - body['TokenID'] = token; + if (profile != null) { + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + body['DoctorID'] = doctorProfile?.doctorID; + body['EditedBy'] = doctorProfile?.doctorID; + body['ProjectID'] = doctorProfile?.projectID; + // if (!body.containsKey('ClinicID')) + body['ClinicID'] = doctorProfile?.clinicID; + } + body['TokenID'] = token ?? ''; body['LanguageID'] = LANGUAGE_ID; body['stamp'] = STAMP; body['IPAdress'] = IP_ADDRESS; @@ -48,15 +53,26 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = PATIENT_OUT_SA; + print("URL : $url"); + print("Body : ${json.encode(body)}"); if (await Helpers.checkConnection()) { - final response = await client.post(url, body: json.encode(body)); + final response = await http.post(url, + body: json.encode(body), + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - if (parsed['MessageStatus'] == 1) { + if (!parsed['IsAuthenticated']) { + await helpers.logout(); + + helpers.showErrorToast('Your session expired Please login agian'); + } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], diff --git a/lib/config/config.dart b/lib/config/config.dart index 4eeb0ad4..af7633f3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,6 +1,6 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; -const ONLY_LETTERS = "[a-zA-Z]"; +const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; //const BASE_URL = 'https://hmgwebservices.com/Services/'; const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; @@ -12,6 +12,13 @@ const PATIENT_INSURANCE_APPROVALS_URL = "DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; const PATIENT_ORDERS_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_REFER_TO_DOCTOR_URL = "DoctorApplication.svc/REST/ReferToDoctor"; +const PATIENT_GET_DOCTOR_BY_CLINIC_URL = + "DoctorApplication.svc/REST/GetDoctorsByClinicID"; +const PATIENT_GET_LIST_REFERAL_URL = + "Lists.svc/REST/GetList_STPReferralFrequency"; +const PATIENT_GET_CLINIC_BY_PROJECT_URL = + "DoctorApplication.svc/REST/GetClinicsByProjectID"; const GET_PROJECTS = 'Lists.svc/REST/GetProjectForDoctorAPP'; const GET_PATIENT_VITAL_SIGN = 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; @@ -20,7 +27,7 @@ const GET_PATIENT_LAB_OREDERS = const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; -var selectedPatientType = 0; +var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ var SERVICES_PATIANT = [ @@ -67,3 +74,7 @@ const PATIENT_OUT_SA = false; /// Timer Info const TIMER_MIN = 10; + +class AppGlobal { + static var CONTEX; +} diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 675d846f..33f184d2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -41,5 +41,19 @@ const Map> localizedValues = { 'inPatient': {'en': 'In-Patient', 'ar': 'االمريض الداخلي'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, - 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'} + 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, + 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, + 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, + 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, + 'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'}, + 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, + 'phoneNumber': {'en': 'Phone Number ', 'ar': 'رقم الجوال'}, + 'patientID': {'en': 'Patient ID', 'ar': 'رقم المريض'}, + 'patientFile': {'en': 'Patient File', 'ar': 'ملف المريض'}, + 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'}, + 'search': {'en': 'Search', 'ar': 'بحث'}, + 'onlyArrivedPatient': { + 'en': 'Only Arrived Patient', + 'ar': 'المريض الذي حضر للموعد' + }, }; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index a9f844f8..174a38ab 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -51,14 +51,7 @@ class _LandingPageState extends State { }, ), centerTitle: true, - actions: [ - ProfileImageWidget( - height: 50, - width: 50, - url: - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - ) - ], + ), drawer: Theme( data: Theme.of(context).copyWith( diff --git a/lib/main.dart b/lib/main.dart index 470c5d52..d5f65406 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import './providers/auth_provider.dart'; import './providers/patients_provider.dart'; import './providers/hospital_provider.dart'; import './routes.dart'; +import 'config/config.dart'; void main() => runApp(MyApp()); @@ -18,6 +19,7 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { + AppGlobal.CONTEX = context; return LayoutBuilder( builder: (context, constraints) { return OrientationBuilder(builder: (context, orientation) { diff --git a/lib/models/patient/get_clinic_by_project_id_request.dart b/lib/models/patient/get_clinic_by_project_id_request.dart new file mode 100644 index 00000000..862fbab4 --- /dev/null +++ b/lib/models/patient/get_clinic_by_project_id_request.dart @@ -0,0 +1,80 @@ +class ClinicByProjectIdRequest { + + /* + *@author: Ibrahim Albitar + *@Date:03/06/2020 + *@param: + *@return: + *@desc: ClinicByProjectIdRequest + */ + + int projectID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + int patientTypeID; + /* + { + "ProjectID": 21, + "LanguageID": 2, + "stamp": "2020-06-03T11:18:19.979Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", + "SessionID": "JBXRsDl37L", + "IsLoginForDoctorApp": true, + "PatientOutSA": false, + "PatientTypeID": 1 +} + */ + + ClinicByProjectIdRequest( + {this.projectID, + this.languageID = 2, + this.stamp = "2020-06-03T11:18:19.979Z", + this.iPAdress = "11.11.11.11", + this.versionID = 1.2, + this.channel = 9, + this.tokenID, + this.sessionID = "JBXRsDl37L", + this.isLoginForDoctorApp = true, + this.patientOutSA = false, + this.patientTypeID = 1}); + + ClinicByProjectIdRequest.fromJson(Map json) { + projectID = json['ProjectID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/models/patient/get_doctor_by_clinic_id_request.dart b/lib/models/patient/get_doctor_by_clinic_id_request.dart new file mode 100644 index 00000000..a2b33e29 --- /dev/null +++ b/lib/models/patient/get_doctor_by_clinic_id_request.dart @@ -0,0 +1,86 @@ +class DoctorsByClinicIdRequest { + +/* + *@author: Ibrahim Albitar + *@Date:03/06/2020 + *@param: + *@return: + *@desc: DoctorsByClinicIdRequest + */ + + int projectID; + String clinicID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + int patientTypeID; + + /* + { + "ProjectID": 21, + "ClinicID": "0", + "LanguageID": 2, + "stamp": "2020-06-03T11:22:04.702Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", + "SessionID": "JBXRsDl37L", + "IsLoginForDoctorApp": true, + "PatientOutSA": false, + "PatientTypeID": 1 +} + */ + + DoctorsByClinicIdRequest( + {this.projectID, + this.clinicID, + this.languageID = 2, + this.stamp = "2020-06-03T11:22:04.702Z", + this.iPAdress = "11.11.11.11", + this.versionID = 1.2, + this.channel = 9, + this.tokenID, + this.sessionID = "JBXRsDl37L", + this.isLoginForDoctorApp = true, + this.patientOutSA = false, + this.patientTypeID = 1}); + + DoctorsByClinicIdRequest.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/models/patient/get_list_stp_referral_frequency_request.dart b/lib/models/patient/get_list_stp_referral_frequency_request.dart new file mode 100644 index 00000000..3b3c2655 --- /dev/null +++ b/lib/models/patient/get_list_stp_referral_frequency_request.dart @@ -0,0 +1,75 @@ +class STPReferralFrequencyRequest { + +/* + *@author: Ibrahim Albitar + *@Date:03/06/2020 + *@param: + *@return: + *@desc: + */ + + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + int patientTypeID; + /* +{ + "LanguageID": 2, + "stamp": "2020-06-03T11:18:19.986Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", + "SessionID": "JBXRsDl37L", + "IsLoginForDoctorApp": true, + "PatientOutSA": false, + "PatientTypeID": 1 +} + */ + + STPReferralFrequencyRequest( + {this.languageID = 2, + this.stamp = "2020-06-03T11:18:19.986Z", + this.iPAdress = "11.11.11.11", + this.versionID = 1.2, + this.channel = 9, + this.tokenID, + this.sessionID = "JBXRsDl37L", + this.isLoginForDoctorApp = true, + this.patientOutSA = false, + this.patientTypeID = 1}); + + STPReferralFrequencyRequest.fromJson(Map json) { + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/models/patient/prescription_report_for_in_patient.dart b/lib/models/patient/prescription_report_for_in_patient.dart index d4452e32..9b88279e 100644 --- a/lib/models/patient/prescription_report_for_in_patient.dart +++ b/lib/models/patient/prescription_report_for_in_patient.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class PrescriptionReportForInPatient { int admissionNo; int authorizedBy; @@ -25,7 +27,7 @@ class PrescriptionReportForInPatient { int orderNo; int patientID; String pharmacyRemarks; - String prescriptionDatetime; + DateTime prescriptionDatetime; int prescriptionNo; String processedBy; int projectID; @@ -38,11 +40,11 @@ class PrescriptionReportForInPatient { int routeId; Null routeN; Null setupID; - String startDatetime; + DateTime startDatetime; int status; String statusDescription; Null statusDescriptionN; - String stopDatetime; + DateTime stopDatetime; int unitofMeasurement; String unitofMeasurementDescription; Null unitofMeasurementDescriptionN; @@ -123,7 +125,7 @@ class PrescriptionReportForInPatient { orderNo = json['OrderNo']; patientID = json['PatientID']; pharmacyRemarks = json['PharmacyRemarks']; - prescriptionDatetime = json['PrescriptionDatetime']; + prescriptionDatetime = Helpers.convertStringToDate(json['PrescriptionDatetime']); prescriptionNo = json['PrescriptionNo']; processedBy = json['ProcessedBy']; projectID = json['ProjectID']; @@ -136,11 +138,11 @@ class PrescriptionReportForInPatient { routeId = json['RouteId']; routeN = json['RouteN']; setupID = json['SetupID']; - startDatetime = json['StartDatetime']; + startDatetime = Helpers.convertStringToDate(json['StartDatetime']) ; status = json['Status']; statusDescription = json['StatusDescription']; statusDescriptionN = json['StatusDescriptionN']; - stopDatetime = json['StopDatetime']; + stopDatetime = Helpers.convertStringToDate(json['StopDatetime']); unitofMeasurement = json['UnitofMeasurement']; unitofMeasurementDescription = json['UnitofMeasurementDescription']; unitofMeasurementDescriptionN = json['UnitofMeasurementDescriptionN']; diff --git a/lib/models/patient/refer_to_doctor_request.dart b/lib/models/patient/refer_to_doctor_request.dart new file mode 100644 index 00000000..28eb488b --- /dev/null +++ b/lib/models/patient/refer_to_doctor_request.dart @@ -0,0 +1,149 @@ +import 'package:flutter/cupertino.dart'; + +class ReferToDoctorRequest { + +/* + *@author: Ibrahim Albitar + *@Date:03/06/2020 + *@param: + *@return: + *@desc: ReferToDoctor + */ + + int projectID; + int admissionNo; + String roomID; + String referralClinic; + String referralDoctor; + int createdBy; + int editedBy; + int patientID; + int patientTypeID; + int referringClinic; + int referringDoctor; + String referringDoctorRemarks; + String priority; + String frequency; + String extension; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + + /* +{ + "ProjectID": 21, + "AdmissionNo": 2020005477, + "RoomID": "ISO-6", + "ReferralClinic": "36", + "ReferralDoctor": "230893", + "CreatedBy": 121814, + "EditedBy": 121814, + "PatientID": 3349491, + "PatientTypeID": 1, + "ReferringClinic": 14, + "ReferringDoctor": 121814, + "ReferringDoctorRemarks": "dfcdfdfdf", + "Priority": "1", + "Frequency": "1", + "Extension": "eeee", + "LanguageID": 2, + "stamp": "2020-06-03T11:26:42.358Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", + "SessionID": "JBXRsDl37L", + "IsLoginForDoctorApp": true, + "PatientOutSA": false +} + */ + + ReferToDoctorRequest( + {@required this.projectID, + @required this.admissionNo, + @required this.roomID , + @required this.referralClinic, + @required this.referralDoctor , + @required this.createdBy, + @required this.editedBy , + @required this.patientID, + @required this.patientTypeID, + @required this.referringClinic, + @required this.referringDoctor, + @required this.referringDoctorRemarks, + @required this.priority , + @required this.frequency, + @required this.extension, + this.languageID = 2, + this.stamp = "2020-06-03T11:26:42.358Z", + this.iPAdress = "11.11.11.11", + this.versionID = 1.2, + this.channel = 9, + @required this.tokenID, + this.sessionID = "JBXRsDl37L", + this.isLoginForDoctorApp = true, + this.patientOutSA = false}); + + ReferToDoctorRequest.fromJson(Map json) { + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + roomID = json['RoomID']; + referralClinic = json['ReferralClinic']; + referralDoctor = json['ReferralDoctor']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + referringClinic = json['ReferringClinic']; + referringDoctor = json['ReferringDoctor']; + referringDoctorRemarks = json['ReferringDoctorRemarks']; + priority = json['Priority']; + frequency = json['Frequency']; + extension = json['Extension']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['RoomID'] = this.roomID; + data['ReferralClinic'] = this.referralClinic; + data['ReferralDoctor'] = this.referralDoctor; + data['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['ReferringClinic'] = this.referringClinic; + data['ReferringDoctor'] = this.referringDoctor; + data['ReferringDoctorRemarks'] = this.referringDoctorRemarks; + data['Priority'] = this.priority; + data['Frequency'] = this.frequency; + data['Extension'] = this.extension; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/models/pharmacies_items_request_model.dart b/lib/models/pharmacies_items_request_model.dart index f9531e63..96df6da8 100644 --- a/lib/models/pharmacies_items_request_model.dart +++ b/lib/models/pharmacies_items_request_model.dart @@ -5,55 +5,65 @@ *@return: *@desc: */ + + class PharmaciesItemsRequestModel { - String phrItemName; - int languageID; - String stamp; - String ipAdress; - double versionID; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + String pHRItemName; + int pageIndex = 0; + int pageSize = 20; + double versionID = 5.2; + int channel = 3; + int languageID = 2; + String iPAdress = "10.20.10.20"; + String generalid = "Cs2020@2016\$2958"; + int patientOutSA = 0; + String sessionID = "KvFJENeAUCxyVdIfEkHw"; + bool isDentalAllowedBackend = false; + int deviceTypeID = 2; PharmaciesItemsRequestModel( - {this.phrItemName = '', - this.patientTypeID = 1, - this.languageID = 2, - this.stamp = '2020-04-23T21:01:21.492Z', - this.ipAdress = '10.20.10.20', + {this.pHRItemName, + this.pageIndex = 0, + this.pageSize = 20, this.versionID = 5.2, - this.tokenID , + this.channel = 3, + this.languageID = 2, + this.iPAdress = "10.20.10.20", + this.generalid = "Cs2020@2016\$2958", + this.patientOutSA = 0, this.sessionID = "KvFJENeAUCxyVdIfEkHw", - this.isLoginForDoctorApp = true, - this.patientOutSA = false}); + this.isDentalAllowedBackend = false, + this.deviceTypeID = 2}); PharmaciesItemsRequestModel.fromJson(Map json) { - phrItemName = json['PHR_itemName']; - patientTypeID = json['PatientTypeID']; - languageID = json['LanguageID']; - stamp = json['stamp']; - ipAdress = json['IPAdress']; + pHRItemName = json['PHR_itemName']; + pageIndex = json['PageIndex']; + pageSize = json['PageSize']; versionID = json['VersionID']; - tokenID = json['TokenID']; - sessionID = json['SessionID']; - isLoginForDoctorApp = json['IsLoginForDoctorApp']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; } Map toJson() { final Map data = new Map(); - data['PHR_itemName'] = this.phrItemName; - data['PatientTypeID'] = this.patientTypeID; - data['LanguageID'] = this.languageID; - data['stamp'] = this.stamp; - data['IPAdress'] = this.ipAdress; + data['PHR_itemName'] = this.pHRItemName; + data['PageIndex'] = this.pageIndex; + data['PageSize'] = this.pageSize; data['VersionID'] = this.versionID; - data['TokenID'] = this.tokenID; - data['SessionID'] = this.sessionID; - data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + 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; return data; } -} +} \ No newline at end of file diff --git a/lib/models/prescription_report.dart b/lib/models/prescription_report.dart new file mode 100644 index 00000000..05d28bdc --- /dev/null +++ b/lib/models/prescription_report.dart @@ -0,0 +1,140 @@ +class PrescriptionReport { + String address; + int appointmentNo; + String clinic; + String companyName; + int days; + String doctorName; + int doseDailyQuantity; + String frequency; + int frequencyNumber; + Null imageExtension; + Null imageSRCUrl; + Null imageString; + Null imageThumbUrl; + String isCovered; + String itemDescription; + int itemID; + String orderDate; + int patientID; + String patientName; + String phoneOffice1; + Null prescriptionQR; + int prescriptionTimes; + Null productImage; + String productImageBase64; + String productImageString; + int projectID; + String projectName; + String remarks; + String route; + String sKU; + int scaleOffset; + String startDate; + + PrescriptionReport( + {this.address, + this.appointmentNo, + this.clinic, + this.companyName, + this.days, + this.doctorName, + this.doseDailyQuantity, + this.frequency, + this.frequencyNumber, + 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}); + + 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']; + 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['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/models/request_prescription_report.dart b/lib/models/request_prescription_report.dart new file mode 100644 index 00000000..0581692e --- /dev/null +++ b/lib/models/request_prescription_report.dart @@ -0,0 +1,68 @@ +class RequestPrescriptionReport { + int projectID; + int appointmentNo; + int episodeID; + String setupID; + int patientTypeID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + RequestPrescriptionReport( + {this.projectID, + this.appointmentNo, + this.episodeID, + this.setupID, + this.patientTypeID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA}); + + RequestPrescriptionReport.fromJson(Map json) { + projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + setupID = json['SetupID']; + patientTypeID = json['PatientTypeID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['SetupID'] = this.setupID; + data['PatientTypeID'] = this.patientTypeID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/presentation/doctor_app_icons.dart b/lib/presentation/doctor_app_icons.dart index 6c8064b8..272f3539 100644 --- a/lib/presentation/doctor_app_icons.dart +++ b/lib/presentation/doctor_app_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -21,24 +21,50 @@ class DoctorApp { static const _kFontFam = 'DoctorApp'; static const _kFontPkg = null; - static const IconData femaleicon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_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 in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = IconData(0xe80e, 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 search_patient = IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData femaleicon = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_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 in_patient_white = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = + IconData(0xe80e, 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 search_patient = + IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = + 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); } diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index af93c837..415b8d39 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -1,27 +1,66 @@ -import 'dart:convert'; -import 'package:doctor_app_flutter/client/app_client.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; + import '../models/user_model.dart'; -const LOGIN_URL = - 'Sentry.svc/REST/MemberLogIN_New'; -const INSERT_DEVICE_IMEI = - 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; +const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New'; +const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; const SELECT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; -const MEMBER_CHECK_ACTIVATION_CODE_NEW ='Sentry.svc/REST/MemberCheckActivationCode_New'; +const MEMBER_CHECK_ACTIVATION_CODE_NEW = + 'Sentry.svc/REST/MemberCheckActivationCode_New'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } + + class AuthProvider with ChangeNotifier { - Future login(UserModel userInfo) async { - const url = LOGIN_URL; + bool isLogin= false; + bool isLoading = true; + AuthProvider(){ + getUserAuthentication(); + } + + void getUserAuthentication() async{ + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if(profile != null) + { + isLoading = false; + isLogin = true; + } else { + isLoading = false; + isLogin = false; + } + notifyListeners(); + } + APP_STATUS get stutas { + if (isLoading) { + return APP_STATUS.LOADING; + } else{ + if ( this.isLogin) { + return APP_STATUS.AUTHENTICATED; + } else { + return APP_STATUS.UNAUTHENTICATED; + } + } + } + Future login(UserModel userInfo) async { try { - final response = await AppClient.post(url, - body: json.encode({ + dynamic localRes; + + await BaseAppClient.post(LOGIN_URL, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: { "UserID": userInfo.UserID, "Password": userInfo.Password, "ProjectID": userInfo.ProjectID, @@ -30,79 +69,103 @@ class AuthProvider with ChangeNotifier { "VersionID": userInfo.VersionID, "Channel": userInfo.Channel, "SessionID": userInfo.SessionID - })); - return Future.value(json.decode(response.body)); + }); + + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future insertDeviceImei(imei) async { - const url = INSERT_DEVICE_IMEI; - + Future insertDeviceImei(imei) async { try { - final response = await AppClient.post(url, body: json.encode(imei)); - return Future.value(json.decode(response.body)); + dynamic localRes; + + await BaseAppClient.post(INSERT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: imei); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future selectDeviceImei(imei) async { - const url = SELECT_DEVICE_IMEI; - + Future selectDeviceImei(imei) async { try { - final response = await AppClient.post(url, body: json.encode(imei)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(SELECT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: imei); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future sendActivationCodeByOtpNotificationType( + Future sendActivationCodeByOtpNotificationType( activationCodeModel) async { - const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE; - try { - final response = await AppClient.post(url, body: json.encode(activationCodeModel)); - return Future.value(json.decode(response.body)); + 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: activationCodeModel); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future memberCheckActivationCodeNew(activationCodeModel) async { - const url = MEMBER_CHECK_ACTIVATION_CODE_NEW; - + Future memberCheckActivationCodeNew(activationCodeModel) async { try { - final response = await AppClient.post(url, body: json.encode(activationCodeModel)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - /* - *@author: Elham Rababah + /* + *@author: Elham Rababah *@Date:17/5/2020 *@param: docInfo *@return:Future *@desc: getDocProfiles */ - Future getDocProfiles(docInfo) async { - const url = GET_DOC_PROFILES; - + Future getDocProfiles(docInfo) async { try { - final response = await AppClient.post(url, body: json.encode(docInfo)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(GET_DOC_PROFILES, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: docInfo); + return Future.value(localRes); } catch (error) { print(error); throw error; } } + + } diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index c7e48afa..493cb472 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; import 'package:flutter/cupertino.dart'; - class DoctorReplyProvider with ChangeNotifier { List listDoctorWorkingHoursTable = []; @@ -18,20 +17,21 @@ class DoctorReplyProvider with ChangeNotifier { getDoctorReply() async { try { - await BaseAppClient.post('DoctorApplication.svc/REST/GtMyPatientsQuestions', - body: _requestDoctorReply.toJson(), - onSuccess: (dynamic response, int statusCode) { - response['List_GtMyPatientsQuestions'].forEach((v) { - listDoctorWorkingHoursTable.add(ListGtMyPatientsQuestions.fromJson(v)); - isError = false; - isLoading = false; - }); - }, - onFailure: (String error, int statusCode) { - isError = true; + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyPatientsQuestions', + body: _requestDoctorReply.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_GtMyPatientsQuestions'].forEach((v) { + listDoctorWorkingHoursTable + .add(ListGtMyPatientsQuestions.fromJson(v)); + isError = false; isLoading = false; - this.error= error; }); + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }); notifyListeners(); } catch (error) { diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index abf758a2..547bffe2 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -1,11 +1,8 @@ -import 'dart:convert'; - -import 'package:doctor_app_flutter/client/app_client.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:flutter/cupertino.dart'; class HospitalProvider with ChangeNotifier { - Future getProjectsList() async { const url = GET_PROJECTS; var info = { @@ -18,12 +15,17 @@ class HospitalProvider with ChangeNotifier { "SessionID": "i1UJwCTSqt", "IsLoginForDoctorApp": true }; - try { - final response = await AppClient.post(url, body: json.encode(info)); - return Future.value(json.decode(response.body)); - } catch (error) { - throw error; - // print('error'); - } + dynamic localRes ; + + await BaseAppClient.post(url, + onSuccess: ( response, statusCode) async { + localRes= response; + }, + onFailure: (String error, int statusCode) { + throw error; + }, + body: info); + return Future.value(localRes); + } } diff --git a/lib/providers/medicine_provider.dart b/lib/providers/medicine_provider.dart index 97e030fe..a0d8f4ed 100644 --- a/lib/providers/medicine_provider.dart +++ b/lib/providers/medicine_provider.dart @@ -25,7 +25,7 @@ class MedicineProvider with ChangeNotifier { resetDefaultValues(); try { if (await Helpers.checkConnection()) { - _itemsRequestModel.phrItemName = itemName; + _itemsRequestModel.pHRItemName = itemName; final response = await AppClient.post(PHARMACY_ITEMS_URL, body: json.encode(_itemsRequestModel.toJson())); diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 9bf8d34b..2d1f4fe1 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -2,6 +2,11 @@ import 'dart:convert'; import 'package:doctor_app_flutter/client/app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.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'; import 'package:doctor_app_flutter/models/patient/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result.dart'; import 'package:doctor_app_flutter/models/patient/lab_result_req_model.dart'; @@ -9,13 +14,12 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; +import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart'; +import 'package:doctor_app_flutter/models/prescription_report.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; -import '../client/app_client.dart'; import '../config/config.dart'; -import '../interceptor/http_interceptor.dart'; import '../models/patient/lab_orders_res_model.dart'; import '../models/patient/patiant_info_model.dart'; import '../models/patient/patient_model.dart'; @@ -25,6 +29,7 @@ import '../models/patient/vital_sign_res_model.dart'; import '../util/helpers.dart'; Helpers helpers = Helpers(); +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class PatientsProvider with ChangeNotifier { bool isLoading = false; @@ -36,6 +41,7 @@ class PatientsProvider with ChangeNotifier { List patientPrescriptionsList = []; List patientRadiologyList = []; List prescriptionReportForInPatientList = []; + List prescriptionReport = []; /*@author: ibrahe albitar *@Date:2/6/2020 @@ -47,25 +53,31 @@ class PatientsProvider with ChangeNotifier { var patientProgressNoteList = []; var insuranceApporvalsList = []; - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + var doctorsList = []; + var clinicsList = []; + var referalFrequancyList = []; - PatiantInformtion _selectedPatient; + DoctorsByClinicIdRequest _doctorsByClinicIdRequest = + DoctorsByClinicIdRequest(); + STPReferralFrequencyRequest _referralFrequencyRequest = + STPReferralFrequencyRequest(); + ClinicByProjectIdRequest _clinicByProjectIdRequest = + ClinicByProjectIdRequest(); + ReferToDoctorRequest _referToDoctorRequest; - Future getPatientList(PatientModel patient, patientType) async { - /* const url = - BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ + PatiantInformtion _selectedPatient; + Future getPatientList(PatientModel patient, patientType) async { int val = int.parse(patientType); - //**********Modify url by amjad amireh for patiant type********* - - final url = - BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; - // print("a===========$url=======a"); try { - final response = await client.post(url, - body: json.encode({ + dynamic localRes; + await BaseAppClient.post('DoctorApplication.svc/REST/' + SERVICES_PATIANT[val], + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: { "ProjectID": patient.ProjectID, "ClinicID": patient.ClinicID, "DoctorID": patient.DoctorID, @@ -86,13 +98,12 @@ class PatientsProvider with ChangeNotifier { "SessionID": patient.SessionID, "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, "PatientOutSA": patient.PatientOutSA - })); -//********************** -//*********************** + }); - return Future.value(json.decode(response.body)); - } catch (err) { - throw err; + return Future.value(localRes); + } catch (error) { + print(error); + throw error; } } @@ -114,21 +125,10 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_VITAL_SIGN, + onSuccess: (dynamic response, int statusCode) { patientVitalSignList = []; - res['List_DoctorPatientVitalSign'].forEach((v) { + response['List_DoctorPatientVitalSign'].forEach((v) { patientVitalSignList.add(new VitalSignResModel.fromJson(v)); }); @@ -141,21 +141,22 @@ class PatientsProvider with ChangeNotifier { a.vitalSignDate.microsecondsSinceEpoch; }); patientVitalSignOrderdSubList.clear(); - for (int x = 0; x < 20; x++) { + int length = patientVitalSignOrderdSubListTemp.length >= 20 + ? 20 + : patientVitalSignOrderdSubListTemp.length; + for (int x = 0; x < length; x++) { patientVitalSignOrderdSubList .add(patientVitalSignOrderdSubListTemp[x]); } } - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -174,33 +175,20 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_LAB_OREDERS, + onSuccess: (dynamic response, int statusCode) { patientLabResultOrdersList = []; - res['List_GetLabOreders'].forEach((v) { + response['List_GetLabOreders'].forEach((v) { patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -215,36 +203,21 @@ class PatientsProvider with ChangeNotifier { */ getOutPatientPrescriptions(patient) async { setBasicData(); - try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PRESCRIPTION, + onSuccess: (dynamic response, int statusCode) { patientPrescriptionsList = []; - res['PatientPrescriptionList'].forEach((v) { - patientPrescriptionsList - .add(new PrescriptionResModel.fromJson(v)); + response['PatientPrescriptionList'].forEach((v) { + patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -265,23 +238,44 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post( 'DoctorApplication.svc/REST/GetPrescriptionReportForInPatient', onSuccess: (dynamic response, int statusCode) { - response['List_PrescriptionReportForInPatient'].forEach((v) { - prescriptionReportForInPatientList - .add(PrescriptionReportForInPatient.fromJson(v)); - }); - isError = false; - isLoading = false; - }, onFailure: (String error, int statusCode) { + response['List_PrescriptionReportForInPatient'].forEach((v) { + prescriptionReportForInPatientList + .add(PrescriptionReportForInPatient.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { isError = true; + isLoading = false; this.error = error; }, body: patient); notifyListeners(); - } catch (err) { handelCatchErrorCase(err); } } + getPrescriptionReport(prescriptionReqModel) async { + prescriptionReport = []; + isLoading = true; + isError = false; + error = ""; + notifyListeners(); + await BaseAppClient.post('Patients.svc/REST/GetPrescriptionReport', + onSuccess: (dynamic response, int statusCode) { + response['ListPRM'].forEach((v) { + prescriptionReport.add(PrescriptionReport.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, body: prescriptionReqModel); + notifyListeners(); + } + /*@author: Elham Rababah *@Date:12/5/2020 *@param: patient @@ -307,33 +301,20 @@ class PatientsProvider with ChangeNotifier { // notifyListeners(); setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_RADIOLOGY, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_RADIOLOGY, + onSuccess: (dynamic response, int statusCode) { patientRadiologyList = []; - res['List_GetRadOreders'].forEach((v) { + response['List_GetRadOreders'].forEach((v) { patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -351,47 +332,33 @@ class PatientsProvider with ChangeNotifier { requestLabResult.patientTypeID = labOrdersResModel.patientType; await BaseAppClient.post('DoctorApplication.svc/REST/GetPatientLabResults', onSuccess: (dynamic response, int statusCode) { - isError = false; - isLoading = false; - response['List_GetLabNormal'].forEach((v) { - labResultList.add(new LabResult.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - isError = true; - isLoading = false; - this.error = error; - }, body: requestLabResult.toJson()); + isError = false; + isLoading = false; + response['List_GetLabNormal'].forEach((v) { + labResultList.add(new LabResult.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, body: requestLabResult.toJson()); notifyListeners(); } getPatientInsuranceApprovals(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - //patientRadiologyList = []; - insuranceApporvalsList = res['List_ApprovalMain_InPatient']; - } else { + await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL, + onSuccess: (dynamic response, int statusCode) { + insuranceApporvalsList = response['List_ApprovalMain_InPatient']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -400,38 +367,177 @@ class PatientsProvider with ChangeNotifier { /*@author: ibrahe albitar *@Date:2/6/2020 - *@desc: getPatientPrescriptions + *@desc: getPatientProgressNote */ getPatientProgressNote(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_PROGRESS_NOTE_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; + await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL, + onSuccess: (dynamic response, int statusCode) { + patientProgressNoteList = response['List_GetPregressNoteForInPatient']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, body: patient); + notifyListeners(); + } catch (err) { + handelCatchErrorCase(err); + } + } - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - patientProgressNoteList = res['List_GetPregressNoteForInPatient']; - } else { + /*@author: ibrahem albitar + *@Date:3/6/2020 + *@desc: getDoctorsList + */ + getDoctorsList(String clinicId) async { + setBasicData(); + try { + _doctorsByClinicIdRequest.clinicID = clinicId; + await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = response['List_Doctors_All']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: _doctorsByClinicIdRequest.toJson()); + notifyListeners(); + } catch (err) { + handelCatchErrorCase(err); + } + } + + List getDoctorNameList() { + var doctorNamelist = + doctorsList.map((value) => value['DoctorName'].toString()).toList(); + return doctorNamelist; + } + + /*@author: ibrahem albitar + *@Date:3/6/2020 + *@desc: getClinicsList + */ + getClinicsList() async { + setBasicData(); + try { + await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, + onSuccess: (dynamic response, int statusCode) { + clinicsList = response['List_Clinic_All']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, body: _clinicByProjectIdRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); } } + + List getClinicNameList() { + var clinicsNameslist = clinicsList + .map((value) => value['ClinicDescription'].toString()) + .toList(); + return clinicsNameslist; + } + + /*@author: ibrahem albitar + *@Date:3/6/2020 + *@desc: getReferralFrequancyList + */ + getReferralFrequancyList() async { + setBasicData(); + try { + await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL, + onSuccess: (dynamic response, int statusCode) { + referalFrequancyList = response['list_STPReferralFrequency']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, body: _referralFrequencyRequest.toJson()); + notifyListeners(); + } catch (err) { + handelCatchErrorCase(err); + } + } + + List getReferralNamesList() { + var referralNamesList = referalFrequancyList + .map((value) => value['Description'].toString()) + .toList(); + return referralNamesList; + } + + /*@author: ibrahem albitar + *@Date:3/6/2020 + *@desc: referToDoctor + */ + referToDoctor(context, + {String selectedDoctorID, + String selectedClinicID, + int admissionNo, + String extension, + String priority, + String frequency, + String referringDoctorRemarks, + int patientID, + int patientTypeID, + String roomID, + int projectID}) async { + setBasicData(); + try { + String token = await sharedPref.getString(TOKEN); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = + new DoctorProfileModel.fromJson(profile); + int doctorID = doctorProfile.doctorID; + int clinicId = doctorProfile.clinicID; + _referToDoctorRequest = ReferToDoctorRequest( + projectID: projectID, + admissionNo: admissionNo, + roomID: roomID, + referralClinic: selectedClinicID.toString(), + referralDoctor: selectedDoctorID.toString(), + createdBy: doctorID, + editedBy: doctorID, + patientID: patientID, + patientTypeID: patientTypeID, + referringClinic: clinicId, + referringDoctor: doctorID, + referringDoctorRemarks: referringDoctorRemarks, + priority: priority, + frequency: frequency, + extension: extension, + tokenID: token); + await BaseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL, + onSuccess: (dynamic response, int statusCode) { + // print('Done : \n $res'); + Navigator.pop(context); + }, + onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, + body: _referToDoctorRequest.toJson()); + notifyListeners(); + + } catch (err) { + handelCatchErrorCase(err); + } + } } diff --git a/lib/root_page.dart b/lib/root_page.dart new file mode 100644 index 00000000..e361e42c --- /dev/null +++ b/lib/root_page.dart @@ -0,0 +1,38 @@ +import 'package:doctor_app_flutter/providers/auth_provider.dart'; +import 'package:doctor_app_flutter/screens/auth/login_screen.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:provider/provider.dart'; + +import 'config/config.dart'; +import 'landing_page.dart'; + +class RootPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + AuthProvider authProvider = Provider.of(context); + Widget buildRoot() { + switch (authProvider.stutas) { + case APP_STATUS.LOADING: + return Scaffold( + body: Center( + child: DrAppCircularProgressIndeicator(), + ), + ); + break; + case APP_STATUS.UNAUTHENTICATED: + return Loginsreen(); + break; + case APP_STATUS.AUTHENTICATED: + return LandingPage(); + break; + } + } + + return AnimatedSwitcher( + duration: Duration(microseconds: 350), + child: buildRoot(), + ); + } +} diff --git a/lib/routes.dart b/lib/routes.dart index a24cfe52..cd5b3187 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,14 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.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/refer_patient_screen.dart'; + + +import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; + import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; import './screens/auth/login_screen.dart'; @@ -29,7 +39,8 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; -const String INIT_ROUTE = LOGIN; +const String INIT_ROUTE = ROOT; +const String ROOT = 'root'; const String HOME = '/'; const String LOGIN = 'login'; const String PROFILE = 'profile'; @@ -54,12 +65,15 @@ const String LAB_ORDERS = 'patients/lab_orders'; const String PRESCRIPTIONS = 'patients/prescription'; const String RADIOLOGY = 'patients/radiology'; const String PROGRESS_NOTE = 'patients/progress-note'; +const String REFER_PATIENT = 'patients/refer-patient'; const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; +const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; var routes = { + ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), LOGIN: (_) => Loginsreen(), PROFILE: (_) => ProfileScreen(), @@ -86,8 +100,10 @@ var routes = { PRESCRIPTIONS: (_) => PrescriptionScreen(), RADIOLOGY: (_) => RadiologyScreen(), PROGRESS_NOTE: (_) => ProgressNoteScreen(), + REFER_PATIENT: (_)=> ReferPatientScreen(), PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), - BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen() + BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), + IN_PATIENT_PRESCRIPTIONS_DETAILS:(_)=> InpatientPrescriptionDetailsScreen() }; diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index bbbe327a..27afd2ee 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -7,6 +7,7 @@ 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/providers/patients_provider.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/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -23,7 +24,7 @@ class QrReaderScreen extends StatefulWidget { } class _QrReaderScreenState extends State { -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); bool isLoading = false; bool isError = false; @@ -72,9 +73,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); height: 7, ), AppText( - 'scan Qr code to retrieve patient profile', - fontSize: 14, - fontWeight: FontWeight.w400, + 'scan Qr code to retrieve patient profile', + fontSize: 14, + fontWeight: FontWeight.w400, textAlign: TextAlign.center ), SizedBox( @@ -123,15 +124,15 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); /// 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; @@ -140,57 +141,64 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); // patient.setClinicID = doctorProfile.clinicID; // patient.setProjectID = doctorProfile.projectID; // Provider.of(context, listen: false); - patient.PatientID = 8808; - patient.TokenID = token; - Provider.of(context, listen: false) - .getPatientList(patient, "1") - .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; - error = 'No patient'; - isLoading = false; - }); - } + patient.PatientID = 8808; + patient.TokenID = token; + Provider.of(context, listen: false) + .getPatientList(patient, "1") + .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; - 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(() { - error = 'No patient'; - isError = true; - isLoading = false; - }); - break; - } - } - } else { - setState(() { - error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ; - isLoading = false; - isError = true; - }); + } } + } else { + setState(() { + isLoading = false; + isError = true; + }); + DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']); + + } + }).catchError((error){ + setState(() { + isLoading = false; }); - } - // } + helpers.showErrorToast(error); + //DrAppToastMsg.showErrorToast(error); + }); + } +// } } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 8b25d21d..38c81cc3 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -11,8 +12,8 @@ import '../../widgets/auth/login_form.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class Loginsreen extends StatefulWidget { @override _LoginsreenState createState() => _LoginsreenState(); @@ -40,10 +41,10 @@ class _LoginsreenState extends State { }); } -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading +/* + *@author: Elham Rababah + *@Date:19/4/2020 + *@param: isLoading *@return: *@desc: Change Isloading attribute in order to show or hide loader */ @@ -55,6 +56,7 @@ class _LoginsreenState extends State { @override Widget build(BuildContext context) { + getSharedPref(); return AppScaffold( isLoading: _isLoading, @@ -78,24 +80,24 @@ class _LoginsreenState extends State { children: [ (platformImei == null) ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.knownUser), - LoginForm( - changeLoadingStata: - changeLoadingStata, - ), - ], - ) + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.knownUser), + LoginForm( + changeLoadingStata: + changeLoadingStata, + ), + ], + ) : Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.unknownUser), - KnownUserLogin(), - ], - ), + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.unknownUser), + KnownUserLogin(), + ], + ), ])); } } diff --git a/lib/screens/auth/verify_account_screen.dart b/lib/screens/auth/verify_account_screen.dart index 61d58306..b7eee5df 100644 --- a/lib/screens/auth/verify_account_screen.dart +++ b/lib/screens/auth/verify_account_screen.dart @@ -1,5 +1,3 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; import '../../lookups/auth_lookup.dart'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index d5a3dbaa..f2304479 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -37,6 +37,11 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { + FocusScopeNode currentFocus = FocusScope.of(context); + + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } projectsProvider = Provider.of(context); return SafeArea( bottom: true, @@ -166,36 +171,27 @@ class _DashboardScreenState extends State { Expanded( flex: 2, child: new DashboardItemIconText( - widget.iconURL + 'lab_results.svg', + DoctorApp.lab_results, "08", TranslationBase.of(context).labResult, backgroundColor: Colors.black45, - // valueFontColor: Colors.white, - // titleFontColor: Colors.white, - // iconColor: Colors.white, ), ), Expanded( flex: 2, child: new DashboardItemIconText( - widget.iconURL + 'radiology.svg', + DoctorApp.radiology, "10", TranslationBase.of(context).radiology, backgroundColor: Colors.black45, - // valueFontColor: Colors.white, - // titleFontColor: Colors.white, - // iconColor: Colors.white, )), Expanded( flex: 2, child: new DashboardItemIconText( - widget.iconURL + 'referral.svg', + DoctorApp.referral, "05", TranslationBase.of(context).referral, backgroundColor: Colors.black45, - // valueFontColor: Colors.white, - // titleFontColor: Colors.white, - // iconColor: Colors.white, )), ], ), @@ -208,9 +204,7 @@ class _DashboardScreenState extends State { Expanded( flex: 2, child: new DashboardItemIconText( - widget.iconURL + 'in_patient_white.svg', - "23", - "In-Patient", + DoctorApp.in_patient_white, "23", "In-Patient", showBorder: true, backgroundColor: Colors.red[900], iconColor: Colors.white), @@ -218,7 +212,8 @@ class _DashboardScreenState extends State { Expanded( flex: 2, child: new DashboardItemIconText( - widget.iconURL + 'operations.svg', + //widget.iconURL + 'operations.svg', + DoctorApp.operations, "23", TranslationBase.of(context).operations, showBorder: true, @@ -246,7 +241,7 @@ class _DashboardScreenState extends State { flex: 2, child: InkWell( child: DashboardItemIconText( - widget.iconURL + 'search_patient.svg', + DoctorApp.search_patient, "", TranslationBase.of(context).searchPatient, showBorder: true, @@ -276,7 +271,7 @@ class _DashboardScreenState extends State { ); }, child: DashboardItemIconText( - widget.iconURL + 'message_icon.svg', + DoctorApp.message_icon, "", TranslationBase.of(context).doctorReply, showBorder: true, @@ -300,9 +295,9 @@ class _DashboardScreenState extends State { flex: 1, child: InkWell( child: DashboardItemIconText( - widget.iconURL + 'search_patient.svg', + DoctorApp.search_patient, "", - "Search Medicine", + TranslationBase.of(context).searchMedicine, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, @@ -338,9 +333,9 @@ class _DashboardScreenState extends State { ); }, child: DashboardItemIconText( - widget.iconURL + 'referral.svg', + DoctorApp.referral, "", - "My Referral Patient", + TranslationBase.of(context).myReferralPatient, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, @@ -373,9 +368,9 @@ class _DashboardScreenState extends State { ); }, child: DashboardItemIconText( - widget.iconURL + 'referral.svg', + DoctorApp.referral, "", - "My Referred Patient", + TranslationBase.of(context).myReferredPatient, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, @@ -392,7 +387,7 @@ class _DashboardScreenState extends State { Navigator.of(context).pushNamed(QR_READER); }, child: DashboardItemIconText( - widget.iconURL + 'qr-code.svg', + DoctorApp.qr_code, "", "QR Reader", showBorder: true, @@ -408,17 +403,9 @@ class _DashboardScreenState extends State { )), ], ), - //) - - // , - //constraints: new BoxConstraints(), ), ), ), ); - - // Container( - - // ); } } diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index f7b9d444..36b449a7 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indei import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../config/size_config.dart'; -import '../../widgets/shared/app_scaffold_widget.dart'; class MyScheduleScreen extends StatelessWidget { ScheduleProvider scheduleProvider; diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 49194018..368a4bd1 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -11,7 +11,6 @@ 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/dr_app_circular_progress_Indeicator.dart'; -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../util/extenstions.dart'; @@ -50,21 +49,19 @@ class _MedicineSearchState extends State { appBarTitle: "Search Medicine", body: Column( children: [ - Padding( - padding: EdgeInsets.only( - bottom: SizeConfig.heightMultiplier * 1, - right: SizeConfig.heightMultiplier * 2, - left: SizeConfig.heightMultiplier * 2, - top: SizeConfig.heightMultiplier * 3), - child: AppTextFormField( - hintText: 'Search Medicine Name Here..', - controller: myController, - onSaved: (value) {}, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_LETTERS), - ), + Padding( + padding: EdgeInsets.only( + bottom: SizeConfig.heightMultiplier * 1, + right: SizeConfig.heightMultiplier * 2, + left: SizeConfig.heightMultiplier * 2, + top: SizeConfig.heightMultiplier * 3), + child: AppTextFormField( + hintText: 'Search Medicine Name Here..', + controller: myController, + onSaved: (value) {}, + inputFormatter: ONLY_LETTERS), + ), + Container( margin: EdgeInsets.only( bottom: SizeConfig.heightMultiplier * 1, @@ -130,7 +127,7 @@ class _MedicineSearchState extends State { ChangeNotifierProvider( create: (_) => MedicineProvider(), child: PharmaciesListScreen( - itemID: data[index]["ItemID"]), + itemID: data[index]["ItemID"], url: data[index]["ProductImageBase64"]), ), ), ); diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index 4c682cea..60f24862 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -1,11 +1,10 @@ -import 'package:doctor_app_flutter/config/config.dart'; +import 'dart:convert'; +import 'dart:typed_data'; + import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.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/widgets/medicine/medicine_item_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/dr_app_circular_progress_Indeicator.dart'; @@ -20,8 +19,11 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class PharmaciesListScreen extends StatefulWidget { final int itemID; + final String url; + // In the constructor, require a item id. - PharmaciesListScreen({Key key, @required this.itemID}) : super(key: key); + PharmaciesListScreen({Key key, @required this.itemID, this.url}) + : super(key: key); @override _PharmaciesListState createState() => _PharmaciesListState(); @@ -61,44 +63,77 @@ class _PharmaciesListState extends State { TextStyle(color: Theme.of(context).errorColor), ), ) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - AppText( - "Description", - margin: 10, - fontWeight: FontWeight.bold, - ), - AppText( - _data[0]["ItemDescription"], - marginLeft: 10, - marginTop: 0, - marginRight: 10, - marginBottom: 10, - ), - AppText( - "Price", - margin: 10, - fontWeight: FontWeight.bold, - ), - AppText( - _data[0]["SellingPrice"].toString(), - marginLeft: 10, - marginTop: 0, - marginRight: 10, - marginBottom: 10, - ), - ], - )), + : StreamBuilder( + stream: null, + builder: (context, snapshot) { + return Row( + children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(7)), + child: Image.memory( + dataFromBase64String(widget.url), + height: SizeConfig.imageSizeMultiplier * 21, + width: SizeConfig.imageSizeMultiplier * 20, + fit: BoxFit.cover, + ), + ), + ), + Expanded( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + AppText( + "Description", + marginLeft: 10, + marginTop: 0, + marginRight: 10, + marginBottom: 2, + fontWeight: FontWeight.bold, + ), + AppText( + _data[0]["ItemDescription"], + marginLeft: 10, + marginTop: 0, + marginRight: 10, + marginBottom: 10, + ), + AppText( + "Price", + marginLeft: 10, + marginTop: 0, + marginRight: 10, + marginBottom: 2, + fontWeight: FontWeight.bold, + ), + AppText( + _data[0]["SellingPrice"].toString(), + marginLeft: 10, + marginTop: 0, + marginRight: 10, + marginBottom: 10, + ), + ], + ), + ) + ], + ); + })), Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.only(top:SizeConfig.widthMultiplier * 2, + bottom: SizeConfig.widthMultiplier * 2, + right: SizeConfig.widthMultiplier * 4, + left: SizeConfig.widthMultiplier * 4,), child: Align( alignment: Alignment.centerLeft, child: AppText( "You can Find it in", fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 3, ))), Expanded( child: Container( @@ -114,7 +149,8 @@ class _PharmaciesListState extends State { Expanded( flex: 1, child: ClipRRect( - borderRadius:BorderRadius.all(Radius.circular(7)), + borderRadius: + BorderRadius.all(Radius.circular(7)), child: Image.network( _data[index]["ProjectImageURL"], height: SizeConfig.imageSizeMultiplier * 15, @@ -138,25 +174,36 @@ class _PharmaciesListState extends State { crossAxisAlignment: WrapCrossAlignment.end, children: [ Padding( - padding: EdgeInsets.all(5), - child: InkWell(child: Icon(Icons.call, color: Colors.red,),onTap: ()=>launch( - "tel://" + _data[index]["PhoneNumber"]),), - ), -Padding( - padding: EdgeInsets.all(5), - child: InkWell(child: Icon(Icons.pin_drop, color: Colors.red,),onTap: () { - MapsLauncher.launchCoordinates( - double.parse(_data[index]["Latitude"]), - double.parse(_data[index]["Longitude"]), - _data[index]["LocationDescription"]); - },), - ), + padding: EdgeInsets.all(5), + child: InkWell( + child: Icon( + Icons.call, + color: Colors.red, + ), + onTap: () => launch( + "tel://" + _data[index]["PhoneNumber"]), + ), + ), + Padding( + padding: EdgeInsets.all(5), + child: InkWell( + child: Icon( + Icons.pin_drop, + color: Colors.red, + ), + onTap: () { + MapsLauncher.launchCoordinates( + double.parse( + _data[index]["Latitude"]), + double.parse( + _data[index]["Longitude"]), + _data[index]["LocationDescription"]); + }, + ), + ), ], - ), ), - - ], ), ); @@ -170,9 +217,20 @@ Padding( _medicineProvider.getPharmaciesList(widget.itemID).then((result) { this.setState(() { _data = _medicineProvider.pharmaciesList; - //if(_data == null || _data.length == 0) }); }); return true; } + + Image imageFromBase64String(String base64String) { + return Image.memory(base64Decode(base64String)); + } + + Uint8List dataFromBase64String(String base64String) { + return base64Decode(base64String); + } + + String base64String(Uint8List data) { + return base64Encode(data); + } } diff --git a/lib/screens/patients/out_patient_prescription_details_screen.dart b/lib/screens/patients/out_patient_prescription_details_screen.dart new file mode 100644 index 00000000..a8f97290 --- /dev/null +++ b/lib/screens/patients/out_patient_prescription_details_screen.dart @@ -0,0 +1,67 @@ +import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; +import 'package:doctor_app_flutter/models/request_prescription_report.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_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:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class OutPatientPrescriptionDetailsScreen extends StatefulWidget { + final PrescriptionResModel prescriptionResModel; + + OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel}); + + @override + _OutPatientPrescriptionDetailsScreenState createState() => + _OutPatientPrescriptionDetailsScreenState(); +} + +class _OutPatientPrescriptionDetailsScreenState + extends State { + bool _isInit = true; + PatientsProvider patientsProvider; + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + patientsProvider = Provider.of(context); + + RequestPrescriptionReport prescriptionReqModel = + RequestPrescriptionReport( + appointmentNo: widget.prescriptionResModel.appointmentNo, + episodeID: widget.prescriptionResModel.episodeID, + setupID: widget.prescriptionResModel.setupID, + patientTypeID: widget.prescriptionResModel.patientID); + patientsProvider.getPrescriptionReport(prescriptionReqModel.toJson()); + } + _isInit = false; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Prescription Details', + body: patientsProvider.isLoading + ? DrAppCircularProgressIndeicator() + : patientsProvider.isError + ? DrAppEmbeddedError(error: patientsProvider.error) + : CardWithBgWidgetNew( + widget: ListView.builder( + itemCount: patientsProvider.prescriptionReport.length, + itemBuilder: (BuildContext context, int index) { + return OutPatientPrescriptionDetailsItem( + prescriptionReport: + patientsProvider.prescriptionReport[index], + ); + }), + ), + ); + } +} + + diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 2e80a1b1..f020ca2e 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -18,6 +18,7 @@ import '../../lookups/patient_lookup.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../config/config.dart'; import '../../models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -112,7 +113,7 @@ class _PatientSearchScreenState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "SEARCH FOR PATIENT", + appBarTitle: TranslationBase.of(context).searchPatient, body: ListView( children: [ RoundedContainer( @@ -209,7 +210,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'First Name', + hintText: TranslationBase.of(context).firstName, onSaved: (value) { value == null ? _patientSearchFormValues.setFirstName = @@ -229,7 +230,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'Middle Name', + hintText: TranslationBase.of(context).middleName, onSaved: (value) { value == null ? _patientSearchFormValues.setMiddleName = @@ -248,7 +249,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'Last Name', + hintText: TranslationBase.of(context).lastName, onSaved: (value) { value == null ? _patientSearchFormValues.setLastName = "0" @@ -264,7 +265,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Phone Number', + hintText: TranslationBase.of(context).phoneNumber, // validator: (value) { // return TextValidator().validateMobile(value); // }, @@ -287,7 +288,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patient ID', + hintText: TranslationBase.of(context).patientID, // inputFormatter: ONLY_NUMBERS, onSaved: (value) { @@ -306,7 +307,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patient File', + hintText: TranslationBase.of(context).patientFile, // validator: (value) { // return TextValidator().validateIdNumber(value); // }, @@ -400,7 +401,9 @@ class _PatientSearchScreenState extends State { value: true, activeColor: Color(0xffFFDDD9), onChanged: (bool newValue) {}), - AppText('Only Arrived Patient', + AppText( + TranslationBase.of(context) + .onlyArrivedPatient, fontSize: SizeConfig.textMultiplier * 2), ])), SizedBox( @@ -419,7 +422,7 @@ class _PatientSearchScreenState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: "Search", + title: TranslationBase.of(context).search, color: Color(0xff58434F), onPressed: () { _validateInputs(); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 61f6fb1e..96211046 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -52,7 +52,7 @@ class _PatientsScreenState extends State { final String assetName = 'assets/image.svg'; // List _locations = ['Today', 'Old Date', 'YESTERDAY']; - List _locations = ['Today', 'Tomorrow', 'Next Week']; + List _locations = ['All','Today', 'Tomorrow', 'Next Week']; int _activeLocation = 0; bool _isInit = true; @@ -102,8 +102,10 @@ class _PatientsScreenState extends State { } }); }).catchError((error) { + print(error); setState(() { _isError = true; + _isLoading = false; this.error = helpers.generateContactAdminMsg(error); }); }); @@ -277,10 +279,10 @@ class _PatientsScreenState extends State { if ((currentTime.day - checkedTime.day) <= -2) { return "Next Week"; } else { - return "Old Date"; + return "All"; } } - return "Old Date"; + return "All"; } /* diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index bb88321d..2bb59318 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/insurance_aprovals_request.dart'; +import 'package:doctor_app_flutter/presentation/doctor_app_icons.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'; @@ -116,29 +117,46 @@ class _InsuranceApprovalsState extends State { ExpansionTile( title: Row( children: [ - Icon( - approvalsList[index][ - "ApprovalStatusDescption"] - .toString() - .contains("Approved") - ? Icons.check_circle_outline - : approvalsList[index][ + Column( + children: [ + Icon( + approvalsList[index][ "ApprovalStatusDescption"] .toString() - .contains("Cancelled") - ? Icons.highlight_off - : Icons.history, - color: approvalsList[index][ - "ApprovalStatusDescption"] - .toString() - .contains("Approved") - ? Colors.green - : approvalsList[index][ + .contains("Approved") + ? DoctorApp.approved_icon + : approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Cancelled") + ? DoctorApp.reject_icon + : DoctorApp.pending_icon, + color: approvalsList[index][ "ApprovalStatusDescption"] .toString() - .contains("Cancelled") - ? Colors.red - : Colors.yellow, + .contains("Approved") + ? Colors.green + : approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Cancelled") + ? Colors.red + : Colors.yellow, + ), + AppText(approvalsList[index]["ApprovalStatusDescption"], + fontSize: SizeConfig.textMultiplier * 1.5, + color: approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Approved") + ? Colors.green + : approvalsList[index][ + "ApprovalStatusDescption"] + .toString() + .contains("Cancelled") + ? Colors.red + : Colors.yellow,) + ], ), Expanded( child: Column( @@ -186,15 +204,8 @@ class _InsuranceApprovalsState extends State { backgroundColor: Color(PRIMARY_COLOR), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "Approval No:", - color: Colors.white, - fontSize: 16, - margin: 10, - ), AppText( approvalsList[index] ["ApprovalNo"] @@ -203,10 +214,21 @@ class _InsuranceApprovalsState extends State { fontSize: 19, fontWeight: FontWeight.bold, - margin: 5, + marginTop: 10, + marginLeft: 10, + marginRight: 10, + marginBottom: 2, + ), + + AppText( + "Approval No:", + color: Colors.white, + fontSize: 16, + marginTop: 2, + marginLeft: 10, + marginBottom: 15, + marginRight: 10, ), - ], - ), Row( children: [ Expanded( diff --git a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart new file mode 100644 index 00000000..f4a8a395 --- /dev/null +++ b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart @@ -0,0 +1,192 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_patient.dart'; +import 'package:doctor_app_flutter/util/helpers.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:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class InpatientPrescriptionDetailsScreen extends StatefulWidget { + @override + _InpatientPrescriptionDetailsScreenState createState() => + _InpatientPrescriptionDetailsScreenState(); +} + +class _InpatientPrescriptionDetailsScreenState + extends State { + bool _showDetails = false; + String error; + TextEditingController answerController; + bool _isInit = true; + PrescriptionReportForInPatient prescription; + + @override + void initState() { + super.initState(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + prescription = routeArgs['prescription']; + } + _isInit = false; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Prescription info', + body: CardWithBgWidgetNew( + widget: Container( + child: ListView( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + prescription.itemDescription, + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + ), + children: [ + buildTableRow( + des: '${prescription.direction}', + key: 'Direction'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Refill'), + buildTableRow( + des: '${prescription.dose}', key: 'Dose'), + buildTableRow( + des: '${prescription.unitofMeasurement}', + key: 'UOM'), + buildTableRow( + des: + '${Helpers.getDate(prescription.startDatetime)}', + key: 'Start Date'), + buildTableRow( + des: + '${Helpers.getDate(prescription.stopDatetime)}', + key: 'Stop Date'), + buildTableRow( + des: '${prescription.noOfDoses}', + key: 'No of Doses'), + buildTableRow( + des: '${prescription.route}', key: 'Route'), + buildTableRow( + des: '${prescription.comments}', + key: 'Comments'), + buildTableRow( + des: '${prescription.pharmacyRemarks}', + key: 'Pharmacy Remarks'), + buildTableRow( + des: + '${Helpers.getDate(prescription.prescriptionDatetime)}', + key: 'Prescription Date'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Status'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Created By'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Processed By'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Authorized By'), + ], + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + SizedBox( + height: 5, + ), + ], + ), + ) + ], + ), + ), + ), + ); + } + + TableRow buildTableRow({des, key}) { + print('$key: $des'); + return TableRow(children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Row( + children: [ + Expanded( + child: Container( + child: AppText( + key, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + '${des}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ], + ), + ), + ]); + } +} diff --git a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart new file mode 100644 index 00000000..fc212afe --- /dev/null +++ b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart @@ -0,0 +1,138 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/prescription_report.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OutPatientPrescriptionDetailsItem extends StatefulWidget { + final PrescriptionReport prescriptionReport; + + OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); + + @override + _OutPatientPrescriptionDetailsItemState createState() => + _OutPatientPrescriptionDetailsItemState(); +} + +class _OutPatientPrescriptionDetailsItemState + extends State { + bool _showDetails = false; + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + flex: 5, + child: AppText( + '${widget.prescriptionReport.itemDescription} ', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + ), + children: [ + buildTableRow( + key: 'Route', + des: widget.prescriptionReport.route), + buildTableRow( + key: 'Frequency Timing', + des: widget.prescriptionReport.frequency), + buildTableRow(key: 'Insurance Covered', des: ''), + buildTableRow( + key: 'Duration Days', + des: widget.prescriptionReport.days), + buildTableRow( + key: 'IDoctor Remarks', + des: widget.prescriptionReport.remarks), + ], + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + ], + ), + ) + ], + ), + ); + } + + TableRow buildTableRow({des, key}) { + print('$key: $des'); + return TableRow(children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Row( + children: [ + Expanded( + child: Container( + child: AppText( + key, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + '${des}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ], + ), + ), + ]); + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart index 360ec776..b2ee2f48 100644 --- a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart +++ b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/models/patient/reauest_prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/prescription_in_patinets_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/prescription_out_patinets_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -33,9 +35,10 @@ class PrescriptionScreen extends StatefulWidget { class _PrescriptionScreenState extends State { PatientsProvider patientsProv; - var _isInit = true; + bool _isInit = true; + String type = '2'; - /* + /* *@author: Elham Rababah *@Date:28/4/2020 *@param: context @@ -46,7 +49,7 @@ class _PrescriptionScreenState extends State { 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); + type = await sharedPref.getString(SLECTED_PATIENT_TYPE); if (type == '1') { RequestPrescriptionReportForInPatient prescriptionReqModel = @@ -85,74 +88,14 @@ class _PrescriptionScreenState extends State { ? DrAppCircularProgressIndeicator() : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientPrescriptionsList.length == 0 - ? DrAppEmbeddedError( - error: 'You don\'t have any Prescriptions') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: - patientsProv.patientPrescriptionsList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: CardWithBgWidgetNew( - widget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - LargeAvatar( - url: patientsProv - .patientPrescriptionsList[index] - .doctorImageURL, - name: patientsProv - .patientPrescriptionsList[index] - .doctorName, - radius: 10, - width: 70, - ), - Expanded( - child: Container( - margin: EdgeInsets.only( - left: 15, right: 15), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - '${patientsProv.patientPrescriptionsList[index].name}', - fontSize: 2.5 * - SizeConfig.textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - '${patientsProv.patientPrescriptionsList[index].clinicDescription}', - fontSize: 2.5 * - SizeConfig - .textMultiplier, - color: Theme.of(context) - .primaryColor), - SizedBox( - height: 8, - ), - ], - ), - ), - ) - ], - ), - ], - ), - ), - onTap: () {}, - ); - }), + : type == '1' + ? PrescriptionInPatientWidget( + prescriptionReportForInPatientList: + patientsProv.prescriptionReportForInPatientList, + ) + : PrescriptionOutPatientWidget( + patientPrescriptionsList: + patientsProv.patientPrescriptionsList, ), ); } diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index 07f0ff88..f9d8be44 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -20,7 +20,7 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); /* *@author: ibrahim albitar *@Date:15/5/2020 - *@param: + *@param: ' *@return: *@desc: */ @@ -182,7 +182,7 @@ class _ProgressNoteState extends State { if (strExist) { filteredNotesList = null; - filteredNotesList = notesList + filteredNotesList = patientsProv.patientProgressNoteList .where((note) => note["DoctorName"].toString().contains(str.toUpperCase())) .toList(); diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index 1ddf944e..4b47956c 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -79,116 +79,112 @@ class _RadiologyScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientRadiologyList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(20.0), - ), - ), - child: ListView.builder( - itemCount: patientsProv.patientRadiologyList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),); - }, - child: Container( - padding: EdgeInsets.all(10), - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(10)), - 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), + ? DrAppEmbeddedError(error: patientsProv.error) + : patientsProv.patientRadiologyList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') + : Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.realScreenWidth * 0.05, + 0, + SizeConfig.realScreenWidth * 0.05, + 0), + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(20.0), + ), + ), + child: ListView.builder( + itemCount: patientsProv.patientRadiologyList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),); + }, + child: Container( + padding: EdgeInsets.all(10), + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(10)), + 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: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + url: patientsProv + .patientRadiologyList[index] + .doctorImageURL, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.fromLTRB( + 8, 0, 0, 0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${patientsProv.patientRadiologyList[index].doctorName}', + fontSize: 2.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold), + SizedBox( + height: 8, + ), + AppText( + 'Invoice No:${patientsProv.patientRadiologyList[index].invoiceNo}', + fontSize: 2 * + SizeConfig + .textMultiplier, + ), + SizedBox( + height: 8, ), - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - LargeAvatar( - url: patientsProv - .patientRadiologyList[index] - .doctorImageURL, - name: patientsProv - .patientLabResultOrdersList[ - index] - .doctorName, - ), - Expanded( - child: Padding( - padding: - const EdgeInsets.fromLTRB( - 8, 0, 0, 0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - '${patientsProv.patientRadiologyList[index].doctorName}', - fontSize: 2.5 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold), - SizedBox( - height: 8, - ), - AppText( - 'Invoice No:${patientsProv.patientRadiologyList[index].invoiceNo}', - fontSize: 2 * - SizeConfig - .textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - ' ${patientsProv.patientRadiologyList[index].clinicName}', - fontSize: 2 * - SizeConfig - .textMultiplier, - color: Theme.of(context) - .primaryColor, - ), - SizedBox( - height: 8, - ), - ], - ), - ), - ) - ], - ), - ], - ), + AppText( + ' ${patientsProv.patientRadiologyList[index].clinicName}', + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Theme.of(context) + .primaryColor, + ), + SizedBox( + height: 8, + ), + ], ), - ); - }), - ), + ), + ) + ], + ), + ], ), + ), + ); + }), + ), + ), ); } } diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart new file mode 100644 index 00000000..1da89f97 --- /dev/null +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -0,0 +1,516 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.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/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/scheduler.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; +import '../../../config/size_config.dart'; +import '../../../providers/patients_provider.dart'; +import '../../../util/dr_app_shared_pref.dart'; +import '../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../widgets/shared/app_texts_widget.dart'; +import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../util/extenstions.dart'; + +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + +/* + *@author: ibrahim albitar + *@Date:4/6/2020 + *@param: + *@return: + *@desc: + */ + +class ReferPatientScreen extends StatefulWidget { + @override + _ReferPatientState createState() => _ReferPatientState(); +} + +class _ReferPatientState extends State { + PatientsProvider patientsProv; + var doctorsList; + final _remarksController = TextEditingController(); + final _extController = TextEditingController(); + var _isInit = true; + bool isValid; + + var clinicId; + var doctorId; + var freqId; + + String _selectedClinic; + String _selectedDoctor; + String _selectedReferralFrequancy; + + List _priorities = ['Very Urgent', 'Urgent', 'Routine']; + int _activePriority = 2; + + FocusNode myFocusNode; + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + myFocusNode = FocusNode(); + doctorsList = null; + patientsProv = Provider.of(context); + patientsProv.getClinicsList(); + patientsProv.getReferralFrequancyList(); + } + _isInit = false; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "Refer Patient", + body: patientsProv.isLoading + ? DrAppCircularProgressIndeicator() + : patientsProv.isError + ? DrAppEmbeddedError(error: patientsProv.error) + : patientsProv.clinicsList == null + ? DrAppEmbeddedError(error: 'Something Wrong!') + : SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "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 patientsProv + .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 = patientsProv + .clinicsList + .where((i) => + i['ClinicDescription'] + .toString() + .contains( + _selectedClinic)) + .toList(); + + clinicId = clinicInfo[0]['ClinicID'] + .toString(); + + patientsProv.getDoctorsList(clinicId); + }) + }, + items: patientsProv + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, + ), + ); + }).toList(), + ), + ), + ], + ), + ), + ), + //--------------------------------------------------------------------// + AppText( + "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 patientsProv + .getDoctorNameList() + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + _selectedDoctor = newValue; + doctorsList = + patientsProv.doctorsList; + + var doctorInfo = doctorsList + .where((i) => i['DoctorName'] + .toString() + .contains(_selectedDoctor)) + .toList(); + doctorId = doctorInfo[0]['DoctorID'] + .toString(); + }) + }, + items: patientsProv + .getDoctorNameList() + .map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, + ), + ); + }).toList(), + ), + ), + ], + ), + ), + ), //-----------------------------/// + AppText( + "Ext#", + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: AppTextFormField( + hintText: "Ext#", + controller: _extController, + inputFormatter: ONLY_NUMBERS, + textInputType: TextInputType.number, + onChanged: (value) => {}, + ), + ), + AppText( + "Priority", + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + + priorityBar(context), + + AppText( + "Replay Before: " + getPriority(), + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + + AppText( + "Referral Frequency", + 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: _selectedReferralFrequancy, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return patientsProv + .getReferralNamesList() + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + _selectedReferralFrequancy = newValue; + var freqInfo = patientsProv + .referalFrequancyList + .singleWhere((i) => i[ + 'Description'] + .toString() + .contains( + _selectedReferralFrequancy)); + freqId = freqInfo['ParameterCode'] + .toString(); + myFocusNode.requestFocus(); + }) + }, + items: patientsProv + .getReferralNamesList() + .map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, + ), + ); + }).toList(), + ), + ), + ], + ), + ), + ), + AppText( + "Clinical Details and Remarks", + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: AppTextFormField( + hintText: "Remarks", + focusNode: myFocusNode, + controller: _remarksController, + inputFormatter: ONLY_LETTERS, + textInputType: TextInputType.text, + onChanged: (value) => {}, + ), + ), + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + children: [ + AppText( + "Please fill all fields..!", + color: Colors.red, + fontWeight: FontWeight.bold, + margin: 10, + visibility: + isValid == null ? false : !isValid, + ), + AppButton( + title: "Send", + color: Color(PRIMARY_COLOR), + onPressed: () => {referToDoctor(context)}, + ) + ], + )) + ], + ), + ), + ); + } + + Widget priorityBar(BuildContext _context) { + 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)), + 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, + ), + ), + )), + ), + 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() + ]); + }).toList(), + ), + ); + } + + String getPriority() { + DateTime date = DateTime.now(); + switch (_activePriority) { + case 0: + date = date.add(new Duration(hours: 3)); + break; + case 1: + date = date.add(new Duration(hours: 6)); + break; + case 2: + date = date.add(new Duration(days: 1)); + break; + } + var format = DateFormat('yyyy/mm/dd HH:mm a'); + var time = format.format(date); + print(time); + return time; + } + + void referToDoctor(context) { + if (!validation()) { + return; + } + + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + patientsProv.referToDoctor(context, + extension: _extController.value.text, + admissionNo: int.parse(patient.admissionNo), + referringDoctorRemarks: _remarksController.value.text, + frequency: freqId, + patientID: patient.patientId, + patientTypeID: patient.patientType, + priority: (_activePriority + 1).toString(), + roomID: patient.roomId, + selectedClinicID: clinicId.toString(), + selectedDoctorID: doctorId.toString(), + projectID: patient.projectId); + } + + bool validation() { + setState(() { + isValid = !_extController.value.text.isNullOrEmpty() && + !_remarksController.value.text.isNullOrEmpty() && + freqId != null && + clinicId != null && + doctorId != null; + }); + return isValid; + } +} 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 16466704..68966553 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 @@ -99,7 +99,7 @@ class _VitalSignDetailsScreenState extends State { vitalSignDetails.bodyMeasurements }); }, - child: Expanded( + child: Container( child: VitalSignItem( des: 'Body Measurements', url: url + 'heartbeat.png', @@ -118,7 +118,7 @@ class _VitalSignDetailsScreenState extends State { }); }, - child: Expanded( + child: Container( child: VitalSignItem( des: 'Temperature', url: url + 'heartbeat.png', diff --git a/lib/screens/profile_screen.dart b/lib/screens/profile_screen.dart index 9a09424f..88f9565a 100644 --- a/lib/screens/profile_screen.dart +++ b/lib/screens/profile_screen.dart @@ -1,3 +1,7 @@ + +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; +////////////// import 'package:flutter/material.dart'; import '../config/size_config.dart'; @@ -7,17 +11,28 @@ import '../widgets/shared/profile_image_widget.dart'; import '../widgets/shared/rounded_container_widget.dart'; class ProfileScreen extends StatefulWidget { - ProfileScreen({Key key, this.title}) : super(key: key); + ProfileScreen({Key key, this.title,this.doctorProfileall}) : super(key: key); final String title; + DoctorProfileModel doctorProfileall ; @override _ProfileScreenState createState() => _ProfileScreenState(); } class _ProfileScreenState extends State { +//************************** + DoctorProfileModel doctorProfile ; + //AppDrawer dr; +//****************** @override Widget build(BuildContext context) { + + Map arg=ModalRoute.of(context).settings.arguments as Map;//ModalRoute.of(context).settings.arguments; + doctorProfile = arg['doctorProfileall']; + print("******************"); + //print(doctorProfile.doctorName); + print("******************"); return AppScaffold( appBarTitle: 'Profile', body: ListView(padding: EdgeInsets.zero, children: [ @@ -25,10 +40,10 @@ class _ProfileScreenState extends State { height: SizeConfig.heightMultiplier * 30, child: DrawerHeader( child: ProfileImageWidget( - url: - "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", - name: "Dr. Chris evans", - des: "Director of medical records", + url:doctorProfile.doctorImageURL, + //"https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", + name: doctorProfile.doctorName,//"Dr. Chris evans", + des: doctorProfile.clinicDescription//"Director of medical records", ), ), ), @@ -36,28 +51,30 @@ class _ProfileScreenState extends State { child: ListView( children: [ DrawerItem( - "Gender", + "Gender" + , Icons.person_pin, color: Colors.black, - subTitle: "Male", + subTitle: doctorProfile.genderDescription//"Male" + , ), DrawerItem( "Clinic", Icons.build, color: Colors.black, - subTitle: "Neurology Clinic", + subTitle: doctorProfile.clinicDescription//"Neurology Clinic", ), DrawerItem( "Hospital", Icons.local_hospital, color: Colors.black, - subTitle: "Al-Takkassussi", + subTitle: doctorProfile.projectName,//"Al-Takkassussi", ), DrawerItem( "Speciality", Icons.crop_square, color: Colors.black, - subTitle: "being great", + subTitle: doctorProfile.doctorRate==0 ?"being bad":"being great", ), ], ), diff --git a/lib/util/dr_app_shared_pref.dart b/lib/util/dr_app_shared_pref.dart index f75c171e..54c8cc45 100644 --- a/lib/util/dr_app_shared_pref.dart +++ b/lib/util/dr_app_shared_pref.dart @@ -82,4 +82,14 @@ class DrAppSharedPreferances { } return json.decode(string); } + + clear() async { + final SharedPreferences prefs = await _prefs; + prefs.clear(); + } + + remove(String key) async { + final SharedPreferences prefs = await _prefs; + prefs.remove(key); + } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index e05f0d74..aa92b253 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,12 +1,16 @@ import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; +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 '../config/size_config.dart'; import '../util/dr_app_toast_msg.dart'; import 'package:connectivity/connectivity.dart'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); /* *@author: Elham Rababah @@ -48,10 +52,6 @@ class Helpers { onPressed: () { Navigator.pop(context); }, - // padding: const EdgeInsets.symmetric( - // horizontal: 16.0, - // vertical: 5.0, - // ), ), CupertinoButton( child: Text( @@ -97,7 +97,7 @@ class Helpers { children: items.map((item) { return Text( '${item["$decKey"]}', - style: TextStyle(fontSize: SizeConfig.textMultiplier * 3), + style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), ); }).toList(), @@ -164,14 +164,15 @@ class Helpers { ), ); } - /* + + /* *@author: Amjad Amireh *@Date:5/5/2020 *@param: checkDate *@return: DateTime *@desc: convert String to DateTime */ -static String checkDate(String dateString) { + static String checkDate(String dateString) { DateTime checkedTime = DateTime.parse(dateString); DateTime currentTime = DateTime.now(); @@ -257,6 +258,7 @@ static String checkDate(String dateString) { return "Sunday"; } } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 @@ -275,6 +277,7 @@ static String checkDate(String dateString) { else return ""; } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 @@ -301,13 +304,14 @@ static String checkDate(String dateString) { *@return: List *@desc: convert workingHours string to List */ - static List getWorkingHours(String workingHours ){ - List myWorkingHours =[]; + static List getWorkingHours(String workingHours) { + List myWorkingHours = []; List listOfHours = workingHours.split('a'); listOfHours.forEach((element) { WorkingHours workingHours = WorkingHours(); - var from = element.substring(element.indexOf('m ') + 2 , element.indexOf('To')-2); + var from = element.substring( + element.indexOf('m ') + 2, element.indexOf('To') - 2); workingHours.from = from.trim(); var to = element.substring(element.indexOf('To') + 2); workingHours.to = to.trim(); @@ -316,9 +320,6 @@ static String checkDate(String dateString) { return myWorkingHours; } - - - /* *@author: Elham Rababah *@Date:12/5/2020 @@ -333,4 +334,13 @@ static String checkDate(String dateString) { } return localMsg; } + + static clearSharedPref() async { + await sharedPref.clear(); + } + + logout() async { + await clearSharedPref(); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index acbff5ce..41a923f5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -71,6 +71,21 @@ class TranslationBase { String get operations => localizedValues['inPatient'][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 myReferredPatient => + localizedValues['myReferredPatient'][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]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index b93bfafa..17b5520d 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -36,9 +36,9 @@ class _LoginFormState extends State { String _platformImei = 'Unknown'; String uniqueId = "Unknown"; var projectsList = []; - - FocusNode focusPass; - FocusNode focusProject; + bool _isInit = true; + FocusNode focusPass = FocusNode(); + FocusNode focusProject = FocusNode(); var userInfo = UserModel( UserID: '', @@ -54,16 +54,26 @@ class _LoginFormState extends State { void initState() { super.initState(); initPlatformState(); + + } @override - Widget build(BuildContext context) { - final focusPass = FocusNode(); - final focusProject = FocusNode(); - - if (projectsList.length == 0) { + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + if (projectsList.length == 0) { getProjectsList(); } + } + _isInit = false; + } + + + @override + Widget build(BuildContext context) { + + AuthProvider authProv = Provider.of(context); return Form( @@ -89,8 +99,9 @@ class _LoginFormState extends State { userInfo.UserID = value.trim(); }, onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusPass); + focusPass.nextFocus(); }, + autofocus: false, ), buildSizedBox(), TextFormField( @@ -109,7 +120,7 @@ class _LoginFormState extends State { userInfo.Password = value; }, onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusProject); + focusPass.nextFocus(); helpers.showCupertinoPicker( context, projectsList, 'Name', onSelectProject); }, @@ -134,22 +145,8 @@ class _LoginFormState extends State { }), buildSizedBox(), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: true, - activeColor: Theme.of(context).primaryColor, - onChanged: (bool newValue) {}), - Text("Remember me", - style: TextStyle( - fontSize: 2 * SizeConfig.textMultiplier)), - ], - ), - ), RaisedButton( onPressed: () { login(context, authProv, widget.changeLoadingStata); @@ -194,17 +191,26 @@ class _LoginFormState extends State { */ InputDecoration buildInputDecoration(BuildContext context, hint, asset) { return InputDecoration( - prefixIcon: Image.asset(asset), - hintText: hint, - hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - )); + prefixIcon: Image.asset(asset), + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + 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), + ), + ); } SizedBox buildSizedBox() { @@ -214,6 +220,11 @@ class _LoginFormState extends State { } login(context, AuthProvider authProv, Function changeLoadingStata) { + FocusScopeNode currentFocus = FocusScope.of(context); + + // if (!currentFocus.hasPrimaryFocus) { + // currentFocus.unfocus(); + // } changeLoadingStata(true); if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); @@ -227,7 +238,7 @@ class _LoginFormState extends State { sharedPref.setString(TOKEN, res['LogInTokenID']); print("token" + res['LogInTokenID']); - Navigator.of(context).pushNamed(VERIFICATION_METHODS); + Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); } else { // handel error // widget.showCenterShortLoadingToast("watting"); @@ -237,7 +248,7 @@ class _LoginFormState extends State { }).catchError((err) { print('$err'); changeLoadingStata(false); - helpers.showErrorToast(); + helpers.showErrorToast(err); }); } else { changeLoadingStata(false); @@ -285,7 +296,7 @@ class _LoginFormState extends State { // Platform messages may fail, so we use a try/catch PlatformException. try { platformImei = - await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); + await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); idunique = await ImeiPlugin.getId(); } on PlatformException { platformImei = 'Failed to get platform version.'; diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart index 3ee67312..1b77fd9a 100644 --- a/lib/widgets/auth/show_timer_text.dart +++ b/lib/widgets/auth/show_timer_text.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -34,6 +35,8 @@ class _ShowTimerTextState extends State { setState(() { sec = sec - 1; if (sec == 0 && min == 0) { + Navigator.of(context).pushNamed(LOGIN); + min = 0; sec = 0; } else if (sec == 0) { @@ -72,11 +75,10 @@ class _ShowTimerTextState extends State { resendActivatioinCode(); }, child: Text( - min == 0 && sec == 0 ? 'Resend Login Code' : timerText, + timerText, style: TextStyle( fontSize: 3.0 * SizeConfig.textMultiplier, - color: - min == 0 && sec == 0 ? Colors.blue : Hexcolor('#B8382C'), + color: Hexcolor('#B8382C'), fontWeight: FontWeight.bold), ), ), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 9a4ad85c..611bd315 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -100,6 +100,7 @@ class _VerifyAccountState extends State { child: TextFormField( textInputAction: TextInputAction.next, style: buildTextStyle(), + autofocus: true, maxLength: 1, textAlign: TextAlign.center, keyboardType: TextInputType.number, @@ -190,20 +191,13 @@ class _VerifyAccountState extends State { validator: validateCodeDigit)) ], ), - // buildSizedBox(40), buildSizedBox(20), buildText(), - // buildSizedBox(10.0), - // Text() - buildSizedBox(40), - - // buildSizedBox(), RaisedButton( onPressed: () { verifyAccount( authProv, widget.changeLoadingStata); - // Navigator.of(context).pushNamed(HOME); }, elevation: 0.0, child: Container( @@ -263,16 +257,25 @@ class _VerifyAccountState extends State { */ InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( - // ts/images/password_icon.png - contentPadding: EdgeInsets.only(top: 30, bottom: 30), - 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), - )); + // ts/images/password_icon.png + contentPadding: EdgeInsets.only(top: 30, bottom: 30), + 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), + ), + ); } /* @@ -283,6 +286,16 @@ class _VerifyAccountState extends State { *@desc: buildText */ RichText buildText() { + String medthodName; + switch (model['OTP_SendType']) { + case 1: + medthodName = 'SMS'; + break; + case 2: + medthodName = 'WhatsApp'; + break; + default: + } var text = RichText( text: new TextSpan( style: new TextStyle( @@ -292,7 +305,7 @@ class _VerifyAccountState extends State { new TextSpan( text: 'Login Code ', style: TextStyle(fontWeight: FontWeight.w700)), - new TextSpan(text: 'By SMS, Please enter the code') + new TextSpan(text: 'By ${medthodName}, Please enter the code') ])); return text; } @@ -321,7 +334,7 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit4']; print(activationCode); int projectID = await sharedPref.getInt(PROJECT_ID); - Map model = { + Map model = { "activationCode": activationCode, "DoctorID": _loggedUser['DoctorID'], "LogInTokenID": _loggedUser['LogInTokenID'], @@ -380,7 +393,7 @@ class _VerifyAccountState extends State { Map profile, Function changeLoadingStata) { changeLoadingStata(false); sharedPref.setObj(DOCTOR_PROFILE, profile); - Navigator.of(context).pushNamed(HOME); + Navigator.of(context).pushReplacementNamed(HOME); } Future _asyncSimpleDialog( @@ -420,7 +433,7 @@ class _VerifyAccountState extends State { projectID: clinicInfo.projectID, tokenID: '', languageID: 2); - authProv.getDocProfiles(docInfo).then((res) { + authProv.getDocProfiles(docInfo.toJson()).then((res) { if (res['MessageStatus'] == 1) { print("DoctorProfileList ${res['DoctorProfileList'][0]}"); loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 3a7fa482..8c996556 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -50,7 +50,7 @@ class _VerificationMethodsState extends State { super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; verificationMethod = - routeArgs != null ? routeArgs['verificationMethod'] : null; + routeArgs != null ? routeArgs['verificationMethod'] : null; } @override @@ -101,17 +101,17 @@ class _VerificationMethodsState extends State { child: buildFingerprintMethod( context, authProv), replacement: - buildWhatsAppMethod(context, authProv), + buildWhatsAppMethod(context, authProv), ), Visibility( visible: hideSilentMethods() ? false : true, child: buildFaceIDMethod(context, authProv), replacement: - buildSMSMethod(context, authProv), + buildSMSMethod(context, authProv), ), Visibility( visible: - hideSilentMethods() ? false : true, + hideSilentMethods() ? false : true, child: buildWhatsAppMethod( context, authProv)), Visibility( @@ -126,8 +126,8 @@ class _VerificationMethodsState extends State { // height: 500, ), SizedBox( - // height: 20, - ) + // height: 20, + ) ], ), ); @@ -136,7 +136,7 @@ class _VerificationMethodsState extends State { }); } - /* + /* *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv @@ -149,7 +149,7 @@ class _VerificationMethodsState extends State { sendActivationCodeByOtpNotificationType(1, authProv); }); } - /* + /* *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv @@ -159,9 +159,9 @@ class _VerificationMethodsState extends State { Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod( context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp', - () { - sendActivationCodeByOtpNotificationType(2, authProv); - }); + () { + sendActivationCodeByOtpNotificationType(2, authProv); + }); } /* *@author: Elham Rababah @@ -186,8 +186,8 @@ class _VerificationMethodsState extends State { Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod(context, 'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () { - sendActivationCodeByOtpNotificationType(4, authProv); - }); + sendActivationCodeByOtpNotificationType(4, authProv); + }); } /* @@ -212,7 +212,7 @@ class _VerificationMethodsState extends State { width: 1, color: Hexcolor( '#CCCCCC') // <--- border width here - ), + ), borderRadius: BorderRadius.all(Radius.circular(10))), child: Column( children: [ @@ -251,11 +251,12 @@ class _VerificationMethodsState extends State { *@desc: send Activation Code By Otp Notification Type */ sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { + // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); - Map model = { + Map model = { "LogInTokenID": _loggedUser['LogInTokenID'], "Channel": 9, "MobileNumber": _loggedUser['MobileNumber'], @@ -270,7 +271,7 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { - Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model}); + Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model}); } else { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); diff --git a/lib/widgets/dashboard/dashboard_item_icons_texts.dart b/lib/widgets/dashboard/dashboard_item_icons_texts.dart index 12fd9a40..6c231199 100644 --- a/lib/widgets/dashboard/dashboard_item_icons_texts.dart +++ b/lib/widgets/dashboard/dashboard_item_icons_texts.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import '../shared/app_texts_widget.dart'; class DashboardItemIconText extends StatefulWidget { - final String icon; + final IconData icon; final String value; final String label; final Color backgroundColor; @@ -46,12 +46,13 @@ class _DashboardItemTextsState extends State { Align( alignment: FractionalOffset.topLeft, child: Container( - padding: EdgeInsets.all(10), - child: SvgPicture.asset( - widget.icon, - color: widget.iconColor, - width: SizeConfig.widthMultiplier * 7, - ))), + padding: EdgeInsets.all(10), + child: Icon( + widget.icon, + size: SizeConfig.textMultiplier * 2.8, + color: widget.iconColor, + ), + )), Align( alignment: FractionalOffset.bottomRight, child: Container( diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 5ec30858..6fc9ec66 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; +import 'package:doctor_app_flutter/presentation/doctor_app_icons.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'; @@ -42,7 +43,28 @@ class _DoctorReplyWidgetState extends State { child: Row( children: [ SizedBox(width: 5,), - LargeAvatar(name: widget.reply.patientName,url: '',), + //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.femaleicon,size: 80,)), + SizedBox(width: 15,), Expanded( child: Container( diff --git a/lib/widgets/doctor/my_referral_patient_widget.dart b/lib/widgets/doctor/my_referral_patient_widget.dart index 02d3f10a..f30de7cb 100644 --- a/lib/widgets/doctor/my_referral_patient_widget.dart +++ b/lib/widgets/doctor/my_referral_patient_widget.dart @@ -42,269 +42,277 @@ class _MyReferralPatientWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', - fontSize: 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - InkWell( - onTap: () { - setState(() { - _showDetails = !_showDetails; - }); - }, - child: Icon(_showDetails - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)), - ], + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down), + + ], + ), ), !_showDetails ? Container() : AnimatedContainer( - duration: Duration(milliseconds: 200), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 5,), - Divider(color: Color(0xFF000000),height: 0.5,), - Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5),), + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 5,), + Divider(color: Color(0xFF000000),height: 0.5,), + Table( + border: TableBorder.symmetric(inside: BorderSide(width: 0.5),), + children: [ + TableRow( children: [ - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'File No', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.referringDoctor}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'File No', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Referring Doctor', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.myReferralPatientModel - .referringClinicDescription, - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.referringDoctor}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Doctor', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - ), - ] + SizedBox(height: 5,), + AppText( + widget.myReferralPatientModel + .referringClinicDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), ), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Referring Clinic', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.referringClinicDescription}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + ] + ), + TableRow( + children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Clinic', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Frequency', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.myReferralPatientModel - .frequencyDescription, - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.referringClinicDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, ) - ] + ], + ), ), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Priority', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.priorityDescription}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Frequency', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), + SizedBox(height: 5,), + AppText( + widget.myReferralPatientModel + .frequencyDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ) + ] + ), + TableRow( + children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Priority', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Max Response Time', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - Helpers.getDateFormatted(widget - .myReferralPatientModel - .mAXResponseTime), - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.priorityDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, ) ], ), + ), + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Max Response Time', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox(height: 5,), + AppText( + Helpers.getDateFormatted(widget + .myReferralPatientModel + .mAXResponseTime), + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ) + ], + ), - ], - ), - Divider(color: Color(0xFF000000),height: 0.5,), - SizedBox( - height: 5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Clinic Details and Remarks', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - textAlign: TextAlign.start,), - Texts( - '${widget.myReferralPatientModel.referringDoctorRemarks}', - style: "bodyText1", - readMore: true, - textAlign: TextAlign.start, - maxLength: 100) - ], - ), - SizedBox( - height: 5, - ), - AppText( - 'Answer/Suggestions', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + ], + ), + Divider(color: Color(0xFF000000),height: 0.5,), + SizedBox( + height: 5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Clinic Details and Remarks', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start,), + Texts( + '${widget.myReferralPatientModel.referringDoctorRemarks}', + style: "bodyText1", + readMore: true, textAlign: TextAlign.start, - ), - SizedBox( - height: 5, - ), - Form( - key: _formKey, - child: TextFields( - maxLines: 2, - minLines: 2, - hintText: 'Answer the patient', - fontWeight: FontWeight.normal, - initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', - readOnly: _isLoading, - validator: (value) { - if (value.isEmpty) - return "please enter answer"; - else - return null; - }, - ), - ), - SizedBox(height: 10.0), - SizedBox(height: 10.0), - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 10,right: 10), - child: Button( - onTap: () async { - final form = _formKey.currentState; - if (form.validate()) { - setState(() { - _isLoading = true; - }); - try { - await Provider.of(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); - setState(() { - _isLoading = false; - }); - DrAppToastMsg.showSuccesToast('Reply Successfully'); + maxLength: 100) + ], + ), + SizedBox( + height: 5, + ), + AppText( + 'Answer/Suggestions', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), + Form( + key: _formKey, + child: TextFields( + maxLines: 2, + minLines: 2, + hintText: 'Answer the patient', + fontWeight: FontWeight.normal, + initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', + readOnly: _isLoading, + validator: (value) { + if (value.isEmpty) + return "please enter answer"; + else + return null; + }, + ), + ), + SizedBox(height: 10.0), + SizedBox(height: 10.0), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 10,right: 10), + child: Button( + onTap: () async { + final form = _formKey.currentState; + if (form.validate()) { + setState(() { + _isLoading = true; + }); + try { + await Provider.of(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); + setState(() { + _isLoading = false; + }); + DrAppToastMsg.showSuccesToast('Reply Successfully'); - } catch (e) { - setState(() { - _isLoading = false; - }); - DrAppToastMsg.showErrorToast(e); - } - } - }, - title: 'Reply', - loading: _isLoading, - ), - ) - ], + } catch (e) { + setState(() { + _isLoading = false; + }); + DrAppToastMsg.showErrorToast(e); + } + } + }, + title: 'Reply', + loading: _isLoading, ), ) + ], + ), + ) ], ), ), diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index c37d09ad..48f70d7c 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -45,6 +45,7 @@ class MyScheduleWidget extends StatelessWidget { 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,) ], ), @@ -56,6 +57,7 @@ class MyScheduleWidget extends StatelessWidget { 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,) ], ), diff --git a/lib/widgets/medicine/medicine_item_widget.dart b/lib/widgets/medicine/medicine_item_widget.dart index 345cef4d..ad15ddab 100644 --- a/lib/widgets/medicine/medicine_item_widget.dart +++ b/lib/widgets/medicine/medicine_item_widget.dart @@ -1,10 +1,6 @@ import 'dart:convert'; import 'dart:typed_data'; - -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; - import '../shared/rounded_container_widget.dart'; import '../shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 8b6fc5a8..36808cb0 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -29,9 +29,28 @@ 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; + + + } else { + + + selectedDate = pickedDate.year.toString() + + "-" + + pickedDate.month.toString().padLeft(2, '0') + + "-" + + pickedDate.day.toString().padLeft(2, '0'); + _toDateController.text = selectedDate; + // _toDateController.text = selectedDate; } }); }); @@ -50,7 +69,7 @@ class _DynamicElementsState extends State { AppTextFormField( textInputType: TextInputType.number, hintText: 'From', - controller: _fromDateController, //_fromDateController, + controller: _fromDateController, inputFormatter: ONLY_DATE, onTap: () { @@ -72,8 +91,11 @@ class _DynamicElementsState extends State { if (_fromDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.From = "0"; } else { - widget._patientSearchFormValues.From = - _fromDateController.text; + widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); + + + + // _fromDateController.text; } }, ), @@ -83,7 +105,7 @@ class _DynamicElementsState extends State { AppTextFormField( textInputType: TextInputType.number, hintText: 'TO', - controller: _fromDateController, //_toDateController, + controller: _toDateController, onTap: () { _presentDatePicker('_selectedToDate'); }, @@ -103,7 +125,7 @@ class _DynamicElementsState extends State { if (_toDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.To = "0"; } else { - widget._patientSearchFormValues.To = _toDateController.text; + widget._patientSearchFormValues.To = _toDateController.text.replaceAll("/", "-"); } }, ), diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index 54cbcb30..d18fdf3d 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -54,6 +54,8 @@ class LargeAvatar extends StatelessWidget { @override Widget build(BuildContext context) { + var vlr = name; + var asd; return InkWell( onTap: disableProfileView ? null diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 0ef50d81..056d0be5 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -1,15 +1,8 @@ -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:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; - import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import './Profile_general_info_Widget.dart'; -import './profile_header_widget.dart'; import './profile_medical_info_widget.dart'; -import './profile_status_info_widget.dart'; /* *@author: Elham Rababah @@ -25,19 +18,12 @@ class PatientProfileWidget extends StatelessWidget { Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; - // return ListView(padding: EdgeInsets.zero, children: [ - // ProfileHeaderWidget(patient: patient), - // ProfileGeneralInfoWidget(patient: patient), - // ProfileMedicalInfoWidget(patient: patient), - // ProfileStatusInfoWidget() - // ]); return CustomScrollView(primary: false, slivers: [ SliverList( delegate: SliverChildListDelegate( [ - Expanded( - flex: 1, + Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -78,15 +64,9 @@ class PatientProfileWidget extends StatelessWidget { ), SliverPadding( padding: const EdgeInsets.fromLTRB(20, 30, 15, 10), - sliver: ProfileMedicalInfoWidget()) + sliver: ProfileMedicalInfoWidget( + patient: patient, + )) ]); - - // Container( - // child: Column(children: [ - // Expanded( - // flex: 2, - // child: , - // ) - // ])); } } diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart new file mode 100644 index 00000000..cafa6290 --- /dev/null +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -0,0 +1,87 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_patient.dart'; +import 'package:doctor_app_flutter/routes.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 'large_avatar.dart'; + +class PrescriptionInPatientWidget extends StatelessWidget { + final List prescriptionReportForInPatientList; + + PrescriptionInPatientWidget( + {Key key, this.prescriptionReportForInPatientList}); + + @override + Widget build(BuildContext context) { + return Container( + child: prescriptionReportForInPatientList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + : Container( + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, + SizeConfig.realScreenWidth * 0.05, 0), + child: ListView.builder( + itemCount: prescriptionReportForInPatientList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.of(context).pushNamed(IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { + 'prescription': prescriptionReportForInPatientList[index] + }); + }, + child: CardWithBgWidgetNew( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + name: + prescriptionReportForInPatientList[index] + .createdByName, + radius: 10, + width: 70, + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 15, right: 15), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${prescriptionReportForInPatientList[index].createdByName}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText( + '${prescriptionReportForInPatientList[index].itemDescription}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + color: + Theme.of(context).primaryColor), + SizedBox( + height: 8, + ), + ], + ), + ), + ) + ], + ), + ], + ), + )); + }, + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart new file mode 100644 index 00000000..bedd6427 --- /dev/null +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -0,0 +1,94 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; +import 'package:doctor_app_flutter/screens/patients/out_patient_prescription_details_screen.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 'large_avatar.dart'; + +class PrescriptionOutPatientWidget extends StatelessWidget { + final List patientPrescriptionsList; + + PrescriptionOutPatientWidget({Key key, this.patientPrescriptionsList}); + + @override + Widget build(BuildContext context) { + return Container( + child: patientPrescriptionsList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + : Container( + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, + SizeConfig.realScreenWidth * 0.05, 0), + child: ListView.builder( + itemCount: patientPrescriptionsList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + OutPatientPrescriptionDetailsScreen( + prescriptionResModel: + patientPrescriptionsList[index], + ), + ), + ); + }, + child: CardWithBgWidgetNew( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + url: patientPrescriptionsList[index] + .doctorImageURL, + name: patientPrescriptionsList[index] + .doctorName, + radius: 10, + width: 70, + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 15, right: 15), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${patientPrescriptionsList[index].name}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText( + '${patientPrescriptionsList[index].clinicDescription}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + color: + Theme.of(context).primaryColor), + SizedBox( + height: 8, + ), + ], + ), + ), + ) + ], + ), + ], + ), + )); + }, + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index c60c2d29..78f37c1a 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,13 +1,10 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/routes.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'; /* *@author: Elham Rababah @@ -21,8 +18,6 @@ class ProfileMedicalInfoWidget extends StatelessWidget { PatiantInformtion patient; @override Widget build(BuildContext context) { - // final double contWidth = SizeConfig.realScreenWidth * 0.70; - // final double contHeight = SizeConfig.screenHeight * 0.30; return SliverGrid.count( crossAxisSpacing: 10, mainAxisSpacing: 20, @@ -74,7 +69,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { child: PatientProfileButton( key: key, patient: patient, - route: PRESCRIPTIONS, + route: REFER_PATIENT, name: 'Refer Patient', icon: 'note.png')), Visibility( @@ -86,141 +81,6 @@ class ProfileMedicalInfoWidget extends StatelessWidget { name: 'Orders', icon: 'radiology-1.png')), ]); - // child: ListView( - // children: [ - // Padding( - // padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // AppText( - // 'Patient Medical Information ', - // fontSize: SizeConfig.textMultiplier * 3, - // fontWeight: FontWeight.w700, - // color: Hexcolor('#58434F'), - // ), - // SizedBox( - // height: 20, - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // InkWell( - // onTap: () { - // navigator(context, VITAL_SIGN_DETAILS); - // }, - // child: CircleAvatarWidget( - // des: 'Vital Sign', - // url: url + 'heartbeat.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // InkWell( - // onTap: () { - // navigator(context, LAB_ORDERS); - // }, - // child: CircleAvatarWidget( - // des: 'Lab Result', - // url: url + 'lab.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // InkWell( - // onTap: () { - // navigator(context, PRESCRIPTIONS); - // }, - // child: CircleAvatarWidget( - // des: 'Prescription', - // url: url + 'note.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // InkWell( - // //RADIOLOGY - // onTap: () { - // navigator(context, RADIOLOGY); - // }, - // child: CircleAvatarWidget( - // des: 'Radiology', - // url: url + 'radiology-1.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // Visibility( - // visible: selectedPatientType != 0 && selectedPatientType != 5 , - // child: InkWell( - // onTap: () { - // navigator(context, PROGRESS_NOTE); - // }, - // child: CircleAvatarWidget( - // des: 'Progress Notes', - // url: url + 'heartbeat.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // ), - // Visibility( - - // child: InkWell( - // onTap: () { - // navigator(context, PATIENT_INSURANCE_APPROVALS); - // }, - // child: CircleAvatarWidget( - // des: 'Insurance Aprovals', - // url: url + 'lab.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // ), - // Visibility( - // visible: selectedPatientType != 0 && selectedPatientType != 5 && selectedPatientType != 2, - // child: InkWell( - // onTap: () { - // navigator(context, PRESCRIPTIONS); - // }, - // child: CircleAvatarWidget( - // des: 'Refer Patient ', - // url: url + 'note.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // ), - // Visibility( - // visible: selectedPatientType != 0 && selectedPatientType != 5, - // child: InkWell( - // onTap: () { - // navigator(context, PATIENT_ORDERS); - // }, - // child: CircleAvatarWidget( - // des: 'Orders', - // url: url + 'radiology-1.png', - // width: (contWidth) / 4.5, - // height: (contWidth) / 4.5, - // ), - // ), - // ), - // ], - // ) - // ], - // ), - // ), - // ], - // ), - // width: contWidth, - // height: contHeight, - //); } } @@ -291,31 +151,26 @@ class PatientProfileButton extends StatelessWidget { navigator(context, this.route); }, child: Column(children: [ - Expanded( - flex: 1, - child: Expanded( - child: Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.all(5), - child: new AppText( - this.name, - color: Colors.red, - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - )), + Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.all(5), + child: new AppText( + this.name, + color: Colors.red, + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), ), - Expanded( - flex: 1, + Container( child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(10), - child: new Image.asset(url + icon)) - ], - )) + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(10), + child: new Image.asset(url + icon)) + ], + )) ]), ), decoration: BoxDecoration( diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index e124a88f..b2cd3dd9 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -81,39 +82,33 @@ class _AppDrawerState extends State { ), ), onTap: () { - Navigator.of(context).pushNamed(PROFILE); + //Navigator.of(context).pushNamed(PROFILE); + Navigator.of(context).pushNamed(PROFILE, arguments: {'title':doctorProfile.doctorName, + "doctorProfileall": doctorProfile + }); + }, ), ), - InkWell( - child: DrawerItem("My Schedule", Icons.table_chart), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChangeNotifierProvider( - create: (_) => ScheduleProvider(), - child: MyScheduleScreen(), - ), - ), - ); - }, - ), InkWell( child: DrawerItem("Settings", Icons.settings), onTap: () { + Navigator.pop(context); Navigator.of(context).pushNamed(SETTINGS); }, ), InkWell( child: DrawerItem("QR Reader", Icons.search), onTap: () { + Navigator.pop(context); Navigator.of(context).pushNamed(QR_READER); }, ), InkWell( child: DrawerItem("lOGOUT", Icons.exit_to_app), - onTap: () { + onTap: () async { + await Helpers.clearSharedPref(); + Navigator.pop(context); Navigator.of(context).pushNamed(LOGIN); }, ), diff --git a/lib/widgets/shared/app_expandable_notifier.dart b/lib/widgets/shared/app_expandable_notifier.dart index ca3edd09..4ae87e8a 100644 --- a/lib/widgets/shared/app_expandable_notifier.dart +++ b/lib/widgets/shared/app_expandable_notifier.dart @@ -30,6 +30,7 @@ class AppExpandableNotifier extends StatelessWidget { padding: EdgeInsets.all(10), child: Text( "See Graph Details", + style: TextStyle(fontWeight: FontWeight.bold), )), collapsed: Text(''), expanded: bodyWid, diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 1e6da3fc..824ba11b 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,13 +1,9 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/routes.dart'; -import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; - -import '../../config/size_config.dart'; import '../../presentation/doctor_app_icons.dart'; -import '../../widgets/shared/app_drawer_widget.dart'; import '../../widgets/shared/app_loader_widget.dart'; -import '../../widgets/shared/custom_shape_clipper.dart'; class AppScaffold extends StatelessWidget { String appBarTitle; @@ -18,6 +14,7 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { + AppGlobal.CONTEX = context; return Scaffold( backgroundColor: Hexcolor('#F5F5F5'), appBar: appBarTitle != '' @@ -37,12 +34,11 @@ class AppScaffold extends StatelessWidget { }), centerTitle: true, actions: [ - ProfileImageWidget( - height: 50, - width: 50, - url: - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - ) + IconButton( + icon: Icon(DoctorApp.home_icon_active), + color: Colors.white, //Colors.black, + onPressed: () => Navigator.pushNamedAndRemoveUntil(context, HOME,(r) => false ), + ), ], ) : null, diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index fd50ad66..06dfb9e7 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -18,7 +18,8 @@ class AppTextFormField extends FormField { TextEditingController controller, bool autovalidate = true, TextInputType textInputType, - String hintText + String hintText, + FocusNode focusNode }) : super( onSaved: onSaved, validator: validator, @@ -27,6 +28,7 @@ class AppTextFormField extends FormField { return Column( children: [ TextFormField( + focusNode: focusNode, keyboardType: textInputType, inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)),], onChanged: onChanged?? (value){ diff --git a/lib/widgets/shared/errors/dr_app_embedded_error.dart b/lib/widgets/shared/errors/dr_app_embedded_error.dart index 6bac4a2c..de9fd698 100644 --- a/lib/widgets/shared/errors/dr_app_embedded_error.dart +++ b/lib/widgets/shared/errors/dr_app_embedded_error.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import '../app_texts_widget.dart'; + /* *@author: Elham Rababah *@Date:12/5/2020 @@ -18,10 +20,11 @@ class DrAppEmbeddedError extends StatelessWidget { @override Widget build(BuildContext context) { return Center( - child: Text( + child: AppText( error, - style: TextStyle(color: Theme.of(context).errorColor), + color: Theme.of(context).errorColor, textAlign: TextAlign.center, + margin: 10, ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 0ed049f9..53409f9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -71,7 +71,6 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/images/ - - assets/images/dashboard_icon/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see