diff --git a/lib/client/app_client.dart b/lib/client/app_client.dart index 68c4fb8b..89b62722 100644 --- a/lib/client/app_client.dart +++ b/lib/client/app_client.dart @@ -4,15 +4,14 @@ import 'package:http/http.dart'; // OWNER : Ibrahim albitar // DATE : 22-04-2020 -// DESCRIPTION : Custom App client to pin base url for all srvices +// DESCRIPTION : Custom App client to pin base url for all srvices class AppClient { - static Client client = HttpInterceptor().getClient(); - static Future post(dynamic path, {dynamic body}) async { + static Future post(dynamic path, {dynamic body}) async { String _fullUrl = BASE_URL + path; final response = await client.post(_fullUrl, body: body); return response; } -} \ No newline at end of file +} diff --git a/lib/config/config.dart b/lib/config/config.dart index ec656fe7..a93d5de1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,32 +2,38 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/Services/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; -const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; -const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; +//const BASE_URL = 'https://hmgwebservices.com/Services/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region"; +const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = - "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; + "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_INSURANCE_APPROVALS_URL = - "DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; + "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; const PATIENT_ORDERS_URL = - "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; -const PATIENT_REFER_TO_DOCTOR_URL = "DoctorApplication.svc/REST/ReferToDoctor"; + "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_REFER_TO_DOCTOR_URL = + "Services/DoctorApplication.svc/REST/ReferToDoctor"; const PATIENT_GET_DOCTOR_BY_CLINIC_URL = - "DoctorApplication.svc/REST/GetDoctorsByClinicID"; + "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; const PATIENT_GET_LIST_REFERAL_URL = - "Lists.svc/REST/GetList_STPReferralFrequency"; + "Services/Lists.svc/REST/GetList_STPReferralFrequency"; const PATIENT_GET_CLINIC_BY_PROJECT_URL = - "DoctorApplication.svc/REST/GetClinicsByProjectID"; + "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; -const GET_PROJECTS = 'Lists.svc/REST/GetProjectForDoctorAPP'; -const GET_PATIENT_VITAL_SIGN = 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; +const GET_PATIENT_VITAL_SIGN = + 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; const GET_PATIENT_LAB_OREDERS = - 'DoctorApplication.svc/REST/GetPatientLabOreders'; -const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; -const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; + 'Services/DoctorApplication.svc/REST/GetPatientLabOreders'; +const GET_PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const GET_RADIOLOGY = 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; -const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; +const GET_LIVECARE_PENDINGLIST = + 'Services/DoctorApplication.svc/REST/GetPendingPatientER'; +const START_LIVECARE_CALL = 'LiveCareApi/DoctorApp/CallPatient'; +const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = + "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 20ad3ca6..892d54fe 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -211,6 +211,7 @@ const Map> localizedValues = { 'en': 'You don\'t have any Orders', 'ar': 'لا يوجد لديك اي طلبات' }, + 'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingGreat': {'en': 'being great', 'ar': 'راثع'}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index fc74bb99..bfd350f1 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,8 +1,9 @@ final TOKEN = 'token'; -final PROJECT_ID='projectID'; +final PROJECT_ID = 'projectID'; //===========amjad============ -final DOCTOR_ID='doctorID'; +final DOCTOR_ID = 'doctorID'; //======================= -final SLECTED_PATIENT_TYPE='slectedPatientType'; +final SLECTED_PATIENT_TYPE = 'slectedPatientType'; final APP_Language = 'language'; -final DOCTOR_PROFILE = 'doctorProfile'; \ No newline at end of file +final DOCTOR_PROFILE = 'doctorProfile'; +final LIVE_CARE_PATIENT = 'livecare-patient-profile'; diff --git a/lib/main.dart b/lib/main.dart index bb3000ee..0e51a148 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/providers/livecare_provider.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/providers/schedule_provider.dart'; @@ -27,11 +28,21 @@ class MyApp extends StatelessWidget { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ - ChangeNotifierProvider(create: (context) => PatientsProvider()), - ChangeNotifierProvider(create: (context) => AuthProvider()), - ChangeNotifierProvider(create: (context) => HospitalProvider()), - ChangeNotifierProvider(create: (context) => ProjectProvider(),), - ChangeNotifierProvider(create: (context) => ScheduleProvider(),), + ChangeNotifierProvider( + create: (context) => PatientsProvider()), + ChangeNotifierProvider( + create: (context) => AuthProvider()), + ChangeNotifierProvider( + create: (context) => HospitalProvider()), + ChangeNotifierProvider( + create: (context) => ProjectProvider(), + ), + ChangeNotifierProvider( + create: (context) => ScheduleProvider(), + ), + ChangeNotifierProvider( + create: (context) => LiveCareProvider(), + ), ChangeNotifierProvider(create: (context) => MedicineProvider(),), ], child: Consumer( diff --git a/lib/models/livecare/get_panding_req_list.dart b/lib/models/livecare/get_panding_req_list.dart new file mode 100644 index 00000000..719b9134 --- /dev/null +++ b/lib/models/livecare/get_panding_req_list.dart @@ -0,0 +1,49 @@ +class LiveCarePendingListRequest { + PatientData patientData; + int doctorID; + String sErServiceID; + int projectID; + int sourceID; + + LiveCarePendingListRequest( + {this.patientData, + this.doctorID, + this.sErServiceID, + this.projectID, + this.sourceID}); + + LiveCarePendingListRequest.fromJson(Map json) { + patientData = new PatientData.fromJson(json['PatientData']); + + doctorID = json['DoctorID']; + sErServiceID = json['SErServiceID']; + projectID = json['ProjectID']; + sourceID = json['SourceID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientData'] = this.patientData.toJson(); + data['DoctorID'] = this.doctorID; + data['SErServiceID'] = this.sErServiceID; + data['ProjectID'] = this.projectID; + data['SourceID'] = this.sourceID; + return data; + } +} + +class PatientData { + bool isOutKSA; + + PatientData({this.isOutKSA}); + + PatientData.fromJson(Map json) { + isOutKSA = json['IsOutKSA']; + } + + Map toJson() { + final Map data = new Map(); + data['IsOutKSA'] = this.isOutKSA; + return data; + } +} diff --git a/lib/models/livecare/get_pending_res_list.dart b/lib/models/livecare/get_pending_res_list.dart new file mode 100644 index 00000000..22839f91 --- /dev/null +++ b/lib/models/livecare/get_pending_res_list.dart @@ -0,0 +1,168 @@ +class LiveCarePendingListResponse { + Null acceptedBy; + Null acceptedOn; + int age; + Null appointmentNo; + String arrivalTime; + String arrivalTimeD; + int callStatus; + String clientRequestID; + String clinicName; + Null consoltationEnd; + Null consultationNotes; + Null createdOn; + String dateOfBirth; + String deviceToken; + String deviceType; + Null doctorName; + String editOn; + String gender; + bool isFollowUP; + Null isFromVida; + int isLoginB; + bool isOutKSA; + int isRejected; + String language; + double latitude; + double longitude; + String mobileNumber; + Null openSession; + Null openTokenID; + String patientID; + String patientName; + int patientStatus; + String preferredLanguage; + int projectID; + int scoring; + int serviceID; + Null tokenID; + int vCID; + String voipToken; + + LiveCarePendingListResponse( + {this.acceptedBy, + this.acceptedOn, + this.age, + this.appointmentNo, + this.arrivalTime, + this.arrivalTimeD, + this.callStatus, + this.clientRequestID, + this.clinicName, + this.consoltationEnd, + this.consultationNotes, + this.createdOn, + this.dateOfBirth, + this.deviceToken, + this.deviceType, + this.doctorName, + this.editOn, + this.gender, + this.isFollowUP, + this.isFromVida, + this.isLoginB, + this.isOutKSA, + this.isRejected, + this.language, + this.latitude, + this.longitude, + this.mobileNumber, + this.openSession, + this.openTokenID, + this.patientID, + this.patientName, + this.patientStatus, + this.preferredLanguage, + this.projectID, + this.scoring, + this.serviceID, + this.tokenID, + this.vCID, + this.voipToken}); + + LiveCarePendingListResponse.fromJson(Map json) { + acceptedBy = json['AcceptedBy']; + acceptedOn = json['AcceptedOn']; + age = json['Age']; + appointmentNo = json['AppointmentNo']; + arrivalTime = json['ArrivalTime']; + arrivalTimeD = json['ArrivalTimeD']; + callStatus = json['CallStatus']; + clientRequestID = json['ClientRequestID']; + clinicName = json['ClinicName']; + consoltationEnd = json['ConsoltationEnd']; + consultationNotes = json['ConsultationNotes']; + createdOn = json['CreatedOn']; + dateOfBirth = json['DateOfBirth']; + deviceToken = json['DeviceToken']; + deviceType = json['DeviceType']; + doctorName = json['DoctorName']; + editOn = json['EditOn']; + gender = json['Gender']; + isFollowUP = json['IsFollowUP']; + isFromVida = json['IsFromVida']; + isLoginB = json['IsLoginB']; + isOutKSA = json['IsOutKSA']; + isRejected = json['IsRejected']; + language = json['Language']; + latitude = json['Latitude']; + longitude = json['Longitude']; + mobileNumber = json['MobileNumber']; + openSession = json['OpenSession']; + openTokenID = json['OpenTokenID']; + patientID = json['PatientID']; + patientName = json['PatientName']; + patientStatus = json['PatientStatus']; + preferredLanguage = json['PreferredLanguage']; + projectID = json['ProjectID']; + scoring = json['Scoring']; + serviceID = json['ServiceID']; + tokenID = json['TokenID']; + vCID = json['VC_ID']; + voipToken = json['VoipToken']; + } + + Map toJson() { + final Map data = new Map(); + data['AcceptedBy'] = this.acceptedBy; + data['AcceptedOn'] = this.acceptedOn; + data['Age'] = this.age; + data['AppointmentNo'] = this.appointmentNo; + data['ArrivalTime'] = this.arrivalTime; + data['ArrivalTimeD'] = this.arrivalTimeD; + data['CallStatus'] = this.callStatus; + data['ClientRequestID'] = this.clientRequestID; + data['ClinicName'] = this.clinicName; + data['ConsoltationEnd'] = this.consoltationEnd; + data['ConsultationNotes'] = this.consultationNotes; + data['CreatedOn'] = this.createdOn; + data['DateOfBirth'] = this.dateOfBirth; + data['DeviceToken'] = this.deviceToken; + data['DeviceType'] = this.deviceType; + data['DoctorName'] = this.doctorName; + data['EditOn'] = this.editOn; + data['Gender'] = this.gender; + data['IsFollowUP'] = this.isFollowUP; + data['IsFromVida'] = this.isFromVida; + data['IsLoginB'] = this.isLoginB; + data['IsOutKSA'] = this.isOutKSA; + data['IsRejected'] = this.isRejected; + data['Language'] = this.language; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['MobileNumber'] = this.mobileNumber; + data['OpenSession'] = this.openSession; + data['OpenTokenID'] = this.openTokenID; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PatientStatus'] = this.patientStatus; + data['PreferredLanguage'] = this.preferredLanguage; + data['ProjectID'] = this.projectID; + data['Scoring'] = this.scoring; + data['ServiceID'] = this.serviceID; + data['TokenID'] = this.tokenID; + data['VC_ID'] = this.vCID; + data['VoipToken'] = this.voipToken; + return data; + } +} diff --git a/lib/models/livecare/start_call_req.dart b/lib/models/livecare/start_call_req.dart new file mode 100644 index 00000000..1ad04480 --- /dev/null +++ b/lib/models/livecare/start_call_req.dart @@ -0,0 +1,56 @@ +class StartCallReq { + int vCID; + bool isrecall; + String tokenID; + String generalid; + int doctorId; + bool isOutKsa; + String projectName; + String docotrName; + String clincName; + String docSpec; + int clinicId; + + StartCallReq( + {this.vCID, + this.isrecall, + this.tokenID, + this.generalid, + this.doctorId, + this.isOutKsa, + this.projectName, + this.docotrName, + this.clincName, + this.docSpec, + this.clinicId}); + + StartCallReq.fromJson(Map json) { + vCID = json['VC_ID']; + isrecall = json['isrecall']; + tokenID = json['TokenID']; + generalid = json['generalid']; + doctorId = json['DoctorId']; + isOutKsa = json['IsOutKsa']; + projectName = json['projectName']; + docotrName = json['DocotrName']; + clincName = json['clincName']; + docSpec = json['Doc_Spec']; + clinicId = json['ClinicId']; + } + + Map toJson() { + final Map data = new Map(); + data['VC_ID'] = this.vCID; + data['isrecall'] = this.isrecall; + data['TokenID'] = this.tokenID; + data['generalid'] = this.generalid; + data['DoctorId'] = this.doctorId; + data['IsOutKsa'] = this.isOutKsa; + data['projectName'] = this.projectName; + data['DocotrName'] = this.docotrName; + data['clincName'] = this.clincName; + data['Doc_Spec'] = this.docSpec; + data['ClinicId'] = this.clinicId; + return data; + } +} diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index 22bd80f6..5a3c9272 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -6,17 +6,18 @@ import 'package:flutter/cupertino.dart'; import '../models/doctor/user_model.dart'; -const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New'; -const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; +const LOGIN_URL = 'Services/Sentry.svc/REST/MemberLogIN_New'; +const INSERT_DEVICE_IMEI = + 'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; const SELECT_DEVICE_IMEI = - 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; + 'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = - 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; + 'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; const MEMBER_CHECK_ACTIVATION_CODE_NEW = - 'Sentry.svc/REST/MemberCheckActivationCode_New'; -const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; + 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; +const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } @@ -137,7 +138,7 @@ class AuthProvider with ChangeNotifier { localRes = response; selectedClinicName = ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - notifyListeners(); + notifyListeners(); response['List_DoctorsClinic'].forEach((v) { doctorsClinicList.add(new ClinicModel.fromJson(v)); }); @@ -165,8 +166,9 @@ class AuthProvider with ChangeNotifier { onSuccess: (dynamic response, int statusCode) { localRes = response; //ClinicDescription - selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription']; - notifyListeners(); + selectedClinicName = + response['DoctorProfileList'][0]['ClinicDescription']; + notifyListeners(); }, onFailure: (String error, int statusCode) { throw error; }, body: docInfo); diff --git a/lib/providers/livecare_provider.dart b/lib/providers/livecare_provider.dart new file mode 100644 index 00000000..31c012f8 --- /dev/null +++ b/lib/providers/livecare_provider.dart @@ -0,0 +1,78 @@ +import 'dart:convert'; + +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/livecare/get_panding_req_list.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_req.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; + +class LiveCareProvider with ChangeNotifier { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + + var liveCarePendingList = []; + var inCallResponse = {}; + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + + LiveCarePendingListRequest _pendingRequestModel = + LiveCarePendingListRequest(); + + Future getpendingList() async { + var profile = await sharedPref.getObj(DOCTOR_PROFILE); + _pendingRequestModel.projectID = await sharedPref.getInt(PROJECT_ID); + _pendingRequestModel.doctorID = profile['DoctorID']; + _pendingRequestModel.sErServiceID = "1,3"; + _pendingRequestModel.sourceID = 1; + _pendingRequestModel.patientData = PatientData(isOutKSA: false); + resetDefaultValues(); + // dynamic localRes; + await BaseAppClient.post(GET_LIVECARE_PENDINGLIST, + onSuccess: (response, statusCode) async { + isFinished = true; + liveCarePendingList = response["List_PendingPatientList"]; + }, onFailure: (String error, int statusCode) { + isFinished = true; + throw error; + }, body: _pendingRequestModel.toJson()); + return Future.value(liveCarePendingList); + } + + Future startCall(request, bool isReCall) async { + var profile = await sharedPref.getObj(DOCTOR_PROFILE); + resetDefaultValues(); + /* the request model is not same hence added manually */ + var newRequest = new StartCallReq(); + newRequest.clinicId = profile["ClinicID"]; + newRequest.vCID = request["VC_ID"]; + newRequest.isrecall = isReCall; + newRequest.doctorId = profile["DoctorID"]; + newRequest.isOutKsa = request["IsOutKSA"]; + newRequest.projectName = profile["ProjectName"]; + newRequest.docotrName = profile["DoctorName"]; + newRequest.clincName = profile["ClinicDescription"]; + newRequest.clincName = profile["ClinicDescription"]; + newRequest.docSpec = profile["DoctorTitleForProfile"]; + newRequest.generalid = 'Cs2020@2016\$2958'; + isFinished = false; + await BaseAppClient.post(START_LIVECARE_CALL, + onSuccess: (response, statusCode) async { + isFinished = true; + inCallResponse = response; + }, onFailure: (String error, int statusCode) { + isFinished = true; + throw error; + }, body: newRequest.toJson()); + return Future.value(inCallResponse); + } + + resetDefaultValues() { + isFinished = false; + hasError = false; + errorMsg = ''; + notifyListeners(); + } +} diff --git a/lib/providers/project_provider.dart b/lib/providers/project_provider.dart index ae5bd759..6c867228 100644 --- a/lib/providers/project_provider.dart +++ b/lib/providers/project_provider.dart @@ -5,13 +5,12 @@ 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'; - class ProjectProvider with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); Locale _appLocale; String currentLanguage = 'ar'; bool _isArabic = false; - bool isInternetConnection=true; + bool isInternetConnection = true; Locale get appLocal => _appLocale; diff --git a/lib/routes.dart b/lib/routes.dart index cd5b3187..9280d95e 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,3 @@ - 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'; @@ -6,8 +5,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_scree 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 'package:doctor_app_flutter/screens/live_care/video_call.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -38,6 +37,7 @@ import './screens/profile_screen.dart'; import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; +import 'screens/live_care/panding_list.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -67,11 +67,13 @@ 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 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'; - +const String VIDEO_CALL = 'video-call'; +const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -79,7 +81,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), - PATIENTS_REFERRED:(_)=>PatientReferredScreen(), + PATIENTS_REFERRED: (_) => PatientReferredScreen(), PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), @@ -100,10 +102,12 @@ var routes = { PRESCRIPTIONS: (_) => PrescriptionScreen(), RADIOLOGY: (_) => RadiologyScreen(), PROGRESS_NOTE: (_) => ProgressNoteScreen(), - REFER_PATIENT: (_)=> ReferPatientScreen(), + REFER_PATIENT: (_) => ReferPatientScreen(), PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), - IN_PATIENT_PRESCRIPTIONS_DETAILS:(_)=> InpatientPrescriptionDetailsScreen() + IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), + VIDEO_CALL: (_) => VideoCallPage(), + LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen() }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 7950b0d6..b099df76 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -67,7 +67,7 @@ class _DashboardScreenState extends State { isLoading: isLoading, body: SingleChildScrollView( child: SizedBox( - height: MediaQuery.of(context).size.height * 1.09, + height: MediaQuery.of(context).size.height * 1.3, child: Column( children: [ Row( @@ -78,7 +78,9 @@ class _DashboardScreenState extends State { Container( margin: EdgeInsets.only(left: 10, top: 10), child: AppText( - authProvider.selectedClinicName != null?authProvider.selectedClinicName:'', + authProvider.selectedClinicName != null + ? authProvider.selectedClinicName + : '', fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, ), @@ -240,15 +242,17 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( - flex: 2, - child: new DashboardItemIconText( - DoctorApp.in_patient_white, - "23", - TranslationBase.of(context).outPatients, - showBorder: true, - backgroundColor: Colors.red[900], - iconColor: Colors.white), - ), + flex: 2, + child: InkWell( + onTap: () {}, + child: new DashboardItemIconText( + DoctorApp.in_patient_white, + "23", + TranslationBase.of(context).outPatients, + showBorder: true, + backgroundColor: Colors.red[900], + iconColor: Colors.white), + )), Expanded( flex: 2, child: new DashboardItemIconText( @@ -441,6 +445,35 @@ class _DashboardScreenState extends State { ), ], )), + Expanded( + flex: 2, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + // Navigator.of(context).pushNamed(VIDEO_CALL); + Navigator.of(context) + .pushNamed(LIVECARE_PENDING_LIST); + }, + child: DashboardItemIconText( + DoctorApp.referral, + "", + TranslationBase.of(context).livecare, + showBorder: true, + backgroundColor: Colors.white, + valueFontColor: Colors.black, + titleFontColor: Colors.black, + iconColor: Colors.black, + titleFontSize: SizeConfig.textMultiplier * 2, + ), + ), + ), + Expanded(flex: 1, child: Container()) + ], + )) ], ), ), diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart new file mode 100644 index 00000000..202fc774 --- /dev/null +++ b/lib/screens/live_care/panding_list.dart @@ -0,0 +1,294 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/providers/livecare_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/shared/app_scaffold_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 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.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 '../../config/size_config.dart'; +import '../../config/size_config.dart'; +import '../../widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import '../../routes.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; + +DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); + +class LiveCarePandingListScreen extends StatefulWidget { + // In the constructor, require a item id. + LiveCarePandingListScreen({Key key}) : super(key: key); + + @override + _LiveCarePandingListState createState() => _LiveCarePandingListState(); +} + +class _LiveCarePandingListState extends State { + var _data = []; + Helpers helpers = new Helpers(); + LiveCareProvider _liveCareProvider; + @override + void didChangeDependencies() { + super.didChangeDependencies(); + _liveCareProvider = Provider.of(context); + if (_data.isEmpty) pendingList(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).livecare, + body: Container( + child: ListView(scrollDirection: Axis.vertical, + + // physics: const AlwaysScrollableScrollPhysics(), + children: [ + RoundedContainer( + child: !_liveCareProvider.isFinished + ? Container( + height: SizeConfig.screenHeight, + width: SizeConfig.screenWidth, + child: DrAppCircularProgressIndeicator()) + : _liveCareProvider.hasError + ? Center( + child: Text( + _liveCareProvider.errorMsg, + style: TextStyle( + color: Theme.of(context).errorColor), + ), + ) + : Column( + children: _data.map((item) { + return Container( + decoration: myBoxDecoration(), + child: InkWell( + child: CardWithBgWidgetNew( + //CardWithBgWidget( + widget: Column( + children: [ + Container( + // decoration: myBoxDecoration(), + child: Row( + children: [ + Column( + children: [ + 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( + item["Gender"] == + "1" + ? DoctorApp.male + : DoctorApp + .femaleicon, + size: 80, + )), + ], + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + AppText( + item["PatientName"], + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of( + context) + .fileNo + + item["PatientID"] + .toString(), + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + + // SizedBox( + // height: 8, + // ), + AppText( + TranslationBase.of( + context) + .age + + ' ' + + item["Age"] + .toString(), + fontSize: 2.0 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: 8, + ), + ], + ), + SizedBox( + width: 80, + ), + // Divider(color: Colors.grey + Expanded( + flex: 3, + child: IconButton( + icon: Icon( + Icons.video_call, + size: 40, + ), + color: Colors + .green, //Colors.black, + onPressed: () => { + sharedPref.setObj( + LIVE_CARE_PATIENT, + item), + Navigator.of(context) + .pushNamed( + VIDEO_CALL) + }, + ), + ) + ], + ), + ), + // Divider(color: Colors.grey) + ], + ), + ), + onTap: () {}, + ), + ); + }).toList(), + )) + ]), + )); + } + + Future pendingList() async { + _liveCareProvider.getpendingList().then((result) { + this.setState(() { + _data = _liveCareProvider.liveCarePendingList; + // _data = [ + // { + // "AcceptedBy": null, + // "AcceptedOn": null, + // "Age": 33, + // "AppointmentNo": null, + // "ArrivalTime": "2020-06-14 09:34", + // "ArrivalTimeD": "/Date(1592116471237+0300)/", + // "CallStatus": 1, + // "ClientRequestID": "2344670985-1231755-1584378710", + // "ClinicName": "ER Clinic", + // "ConsoltationEnd": null, + // "ConsultationNotes": null, + // "CreatedOn": null, + // "DateOfBirth": "1987-01-04", + // "DeviceToken": + // "fbxt2XpseU_DpO8Msqa1V6:APA91bHUxsfKpAewTt0DzGg_mSTN0T7KIQM92VpubUTobgTm0-DGcJMgcc3DmERbEiWbyTup3zGttU3_9RBaRBxZUKj9ju5wnTGSrIelEE-qxOK30YnIaDhbhs8fJixACbyzgr72HU8Y", + // "DeviceType": "iOS", + // "DoctorName": null, + // "EditOn": "/Date(1592116471237+0300)/", + // "Gender": "1", + // "IsFollowUP": false, + // "IsFromVida": null, + // "IsLoginB": 0, + // "IsOutKSA": false, + // "IsRejected": 0, + // "Language": "AR", + // "Latitude": 24.708879, + // "Longitude": 46.665827, + // "MobileNumber": "0537503378", + // "OpenSession": null, + // "OpenTokenID": null, + // "PatientID": "1231755", + // "PatientName": "TAMER FANASHEH", + // "PatientStatus": 1, + // "PreferredLanguage": "Ar", + // "ProjectID": 0, + // "Scoring": 0.00, + // "ServiceID": 1, + // "TokenID": null, + // "VC_ID": 2240, + // "VoipToken": + // "8dcc17e2365d4f3c4afadc6b5d625a88407398ee517f0e9beda7f663007e88b9" + // } + // ]; + }); + }); + return true; + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + bottom: BorderSide( + // <--- top side + color: Colors.grey, + width: 1.0, + ), + ), + ); + } +} diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart new file mode 100644 index 00000000..be2d47de --- /dev/null +++ b/lib/screens/live_care/video_call.dart @@ -0,0 +1,235 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/providers/livecare_provider.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:flutter/material.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; + +class VideoCallPage extends StatefulWidget { + @override + _VideoCallPageState createState() => _VideoCallPageState(); +} + +DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); + +class _VideoCallPageState extends State { + Timer _timmerInstance; + int _start = 0; + String _timmer = ''; + LiveCareProvider _liveCareProvider; + bool _isInit = true; + var patientData = {}; + String image_url = 'https://hmgwebservices.com/Images/MobileImages/DUBAI/'; + //bool _isOutOfStuck = false; + Helpers helpers = new Helpers(); + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + _liveCareProvider = Provider.of(context); + startCall(); + } + _isInit = false; + } + + void connectOpenTok(tokenData) { + /* opentok functionalites need to be written */ + print(tokenData["OpenSessionID"]); + print(tokenData["OpenTokenID"]); + } + + String getTimerTime(int start) { + int minutes = (start ~/ 60); + String sMinute = ''; + if (minutes.toString().length == 1) { + sMinute = '0' + minutes.toString(); + } else + sMinute = minutes.toString(); + + int seconds = (start % 60); + String sSeconds = ''; + if (seconds.toString().length == 1) { + sSeconds = '0' + seconds.toString(); + } else + sSeconds = seconds.toString(); + + return sMinute + ':' + sSeconds; + } + + startCall() async { + patientData = await sharedPref.getObj(LIVE_CARE_PATIENT); + _liveCareProvider.startCall(patientData, false).then((result) { + connectOpenTok(result); + }).catchError((error) => + {helpers.showErrorToast(error), Navigator.of(context).pop()}); + } + + // @override + // void initState() { + // super.initState(); + + // } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Container( + height: MediaQuery.of(context).size.height * 1.09, + // width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Colors.white, + ), + padding: EdgeInsets.all(50.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 10.0, + ), + Text( + 'Calling', + style: TextStyle( + color: Colors.deepPurpleAccent, + fontWeight: FontWeight.w300, + fontSize: 15), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + Text( + patientData["PatientName"], + style: TextStyle( + color: Colors.deepPurpleAccent, + fontWeight: FontWeight.w900, + fontSize: 20), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + Container( + child: Text( + _timmer == '' ? 'Connecting' : 'Connected', + style: TextStyle( + color: Colors.deepPurpleAccent, + fontWeight: FontWeight.w300, + fontSize: 15), + )), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + ClipRRect( + borderRadius: BorderRadius.circular(200.0), + child: Image.network( + patientData["Gender"] == "1" + ? image_url + 'unkown.png' + : image_url + 'unkowwn_female.png', + height: 200.0, + width: 200.0, + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.02, + ), + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + FunctionalButton( + title: 'Speaker', + icon: Icons.phone_in_talk, + onPressed: () {}, + ), + FunctionalButton( + title: 'Flip', + icon: Icons.flip_to_back, + onPressed: () {}, + ), + FunctionalButton( + title: 'Mute', + icon: Icons.mic_off, + onPressed: () {}, + ), + ], + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.1, + ), + FloatingActionButton( + onPressed: () { + Navigator.of(context).pop(); + }, + elevation: 20.0, + shape: CircleBorder(side: BorderSide(color: Colors.red)), + mini: false, + child: Icon( + Icons.call_end, + color: Colors.red, + ), + backgroundColor: Colors.red[100], + ) + ], + ), + ), + ), + ); + } +} + +class FunctionalButton extends StatefulWidget { + final title; + final icon; + final Function() onPressed; + + const FunctionalButton({Key key, this.title, this.icon, this.onPressed}) + : super(key: key); + + @override + _FunctionalButtonState createState() => _FunctionalButtonState(); +} + +class _FunctionalButtonState extends State { + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + RawMaterialButton( + onPressed: widget.onPressed, + splashColor: Colors.deepPurpleAccent, + fillColor: Colors.white, + elevation: 10.0, + shape: CircleBorder(), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Icon( + widget.icon, + size: 30.0, + color: Colors.deepPurpleAccent, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0), + child: Text( + widget.title, + style: TextStyle(fontSize: 15.0, color: Colors.deepPurpleAccent), + ), + ) + ], + ); + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 822e74c7..ca49936e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -230,6 +230,7 @@ class TranslationBase { localizedValues['prescriptionInfo'][locale.languageCode]; String get errorNoOrders => localizedValues['errorNoOrders'][locale.languageCode]; + String get livecare => localizedValues['livecare'][locale.languageCode]; String get beingBad => localizedValues['beingBad'][locale.languageCode]; String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; } diff --git a/pubspec.lock b/pubspec.lock index ded299e4..cafaf489 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -127,6 +127,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" charcode: dependency: transitive description: @@ -748,5 +755,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.9.0-14.0.dev <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0"