From fb6ef8fca1e94ae7d54081281d31e636a9a6bb8a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 1 Jun 2021 17:04:39 +0300 Subject: [PATCH 1/2] fix appointment in live care --- ios/Podfile.lock | 2 +- lib/config/config.dart | 4 ++-- .../ucaf/patient-ucaf-service.dart | 4 ++-- lib/models/livecare/start_call_res.dart | 4 ++++ lib/models/patient/patiant_info_model.dart | 6 +++++- .../patients/profile/UCAF/UCAF-input-screen.dart | 3 ++- .../profile/lab_result/labs_home_page.dart | 10 ++++++++-- .../profile_screen/patient_profile_screen.dart | 4 ++++ .../profile_screen/profile_gird_for_other.dart | 14 ++++++++------ 9 files changed, 36 insertions(+), 15 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 59cdf14c..1cf7499c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -328,4 +328,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0.rc.1 diff --git a/lib/config/config.dart b/lib/config/config.dart index c8af8ad9..0283577e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart index db2deb13..22f53226 100644 --- a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart +++ b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart @@ -17,9 +17,9 @@ class UcafService extends LookupService { Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; Map body = Map(); - body['PatientMRN'] = patient.patientMRN; + body['PatientMRN'] = patient.patientMRN ; body['AppointmentNo'] = patient.appointmentNo; - body['EpisodeID'] = patient.episodeNo; + body['EpisodeID'] = patient.episodeNo ; body['DoctorID'] = ""; await baseAppClient.post(GET_CHIEF_COMPLAINT, diff --git a/lib/models/livecare/start_call_res.dart b/lib/models/livecare/start_call_res.dart index 0566d76d..67259996 100644 --- a/lib/models/livecare/start_call_res.dart +++ b/lib/models/livecare/start_call_res.dart @@ -4,12 +4,14 @@ class StartCallRes { String openTokenID; bool isAuthenticated; int messageStatus; + String appointmentNo; StartCallRes( {this.result, this.openSessionID, this.openTokenID, this.isAuthenticated, + this.appointmentNo, this.messageStatus}); StartCallRes.fromJson(Map json) { @@ -18,6 +20,7 @@ class StartCallRes { openTokenID = json['OpenTokenID']; isAuthenticated = json['IsAuthenticated']; messageStatus = json['MessageStatus']; + appointmentNo = json['AppointmentNo']; } Map toJson() { @@ -27,6 +30,7 @@ class StartCallRes { data['OpenTokenID'] = this.openTokenID; data['IsAuthenticated'] = this.isAuthenticated; data['MessageStatus'] = this.messageStatus; + data['AppointmentNo'] = this.appointmentNo; return data; } } diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 75552184..09282644 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -224,7 +224,11 @@ class PatiantInformtion { isSigned: json['isSigned'], medicationOrders: json['medicationOrders'], nationality: json['nationality'] ?? json['NationalityNameN'], - patientMRN: json['patientMRN'] ?? json['PatientMRN'], + patientMRN: json['patientMRN'] ?? json['PatientMRN']??json["PatientID"] != null + ? json["PatientID"] is String + ? int.parse(json["PatientID"]) + : json["PatientID"] + : json["patientID"], visitType: json['visitType'] ?? json['visitType'] ?? json['visitType'], nationalityFlagURL: json['NationalityFlagURL'] ?? json['NationalityFlagURL'], diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 5e1b6155..5f7b91f3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -428,10 +428,11 @@ class _UCAFInputScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - model.patientVitalSignsHistory.length > 0 + model.patientVitalSignsHistory.length == 0 ? TranslationBase.of(context).vitalSignEmptyMsg : TranslationBase.of(context).chiefComplaintEmptyMsg, fontWeight: FontWeight.normal, + textAlign: TextAlign.center, color: HexColor("#B8382B"), fontSize: SizeConfig.textMultiplier * 2.5, ), diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 578e9f17..d6f6fde2 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -27,6 +27,9 @@ class _LabsHomePageState extends State { String arrivalType; PatiantInformtion patient; bool isInpatient; + bool isFromLiveCare; + + @override void didChangeDependencies() { super.didChangeDependencies(); @@ -35,6 +38,8 @@ class _LabsHomePageState extends State { patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; isInpatient = routeArgs['isInpatient']; + isFromLiveCare = routeArgs['isFromLiveCare']; + print(arrivalType); } @@ -105,8 +110,9 @@ class _LabsHomePageState extends State { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index ae5406d5..55b2d6f9 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -290,11 +290,15 @@ class _PatientProfileScreenState extends State } else { GifLoaderDialogUtils.showMyDialog(context); await model.startCall( isReCall : false, vCID: patient.vcId); + if(model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(model.error); } else { await model.getDoctorProfile(); + patient.appointmentNo = model.startCallRes.appointmentNo; + patient.episodeNo = 0; + GifLoaderDialogUtils.hideDialog(context); await VideoChannel.openVideoCallScreen( kToken: model.startCallRes.openTokenID, diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index fee8b1e1..c01757c5 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -107,8 +107,8 @@ class ProfileGridForOther extends StatelessWidget { PATIENT_UCAF_REQUEST, 'patient/ucaf.png', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 || - patient.appointmentNo == null ? true : false), + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null ), if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( @@ -121,8 +121,9 @@ class ProfileGridForOther extends StatelessWidget { REFER_PATIENT_TO_DOCTOR, 'patient/refer_patient.png', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 || - patient.appointmentNo == null ? true : false), + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null , + ), if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( @@ -135,8 +136,9 @@ class ProfileGridForOther extends StatelessWidget { PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 || - patient.appointmentNo == null ? true : false), + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null + ), ]; return Column( From 9692e54b97615607decc6a10a3e07c9106743099 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 1 Jun 2021 12:11:27 +0300 Subject: [PATCH 2/2] fix login issue # Conflicts: # lib/core/viewModel/authentication_view_model.dart # lib/root_page.dart # lib/widgets/shared/app_drawer_widget.dart --- .../viewModel/authentication_view_model.dart | 43 +++++++++---------- lib/core/viewModel/base_view_model.dart | 1 + .../auth/verification_methods_screen.dart | 10 ++--- lib/widgets/shared/app_drawer_widget.dart | 3 +- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 4e8217d3..58df9331 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -17,14 +17,12 @@ import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_m import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/doctor/user_model.dart'; import 'package:doctor_app_flutter/root_page.dart'; -import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -34,7 +32,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; -import 'package:provider/provider.dart'; enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED, UNVERIFIED } @@ -76,7 +73,7 @@ class AuthenticationViewModel extends BaseViewModel { APP_STATUS app_status = APP_STATUS.LOADING; AuthenticationViewModel({bool checkDeviceInfo = false}) { - getDeviceInfoFromFirebase(); + getDeviceInfoFromFirebase(); getDoctorProfile(); } @@ -303,7 +300,7 @@ class AuthenticationViewModel extends BaseViewModel { license: true, projectID: clinicInfo.projectID, tokenID: '', - languageID: 2); + languageID: 2);//TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); if (_authService.hasError) { error = _authService.error; @@ -362,7 +359,12 @@ class AuthenticationViewModel extends BaseViewModel { if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } - setState(ViewState.Busy); + + try { + setState(ViewState.Busy); + } catch (e) { + Helpers.showErrorToast("fdfdfdfdf"+e.toString()); + } var token = await _firebaseMessaging.getToken(); if (DEVICE_TOKEN == "") { DEVICE_TOKEN = token; @@ -415,29 +417,24 @@ class AuthenticationViewModel extends BaseViewModel { /// logout function logout({bool isFromLogin = false}) async { - DEVICE_TOKEN = ""; - String lang = await sharedPref.getString(APP_Language); - await Helpers.clearSharedPref(); - doctorProfile = null; - sharedPref.setString(APP_Language, lang); - deleteUser(); - await getDeviceInfoFromFirebase(); - this.isFromLogin = isFromLogin; - app_status = APP_STATUS.UNAUTHENTICATED; - setState(ViewState.Idle); - Navigator.pushAndRemoveUntil( - AppGlobal.CONTEX, - FadePage( - page: RootPage(), - ), - (r) => false); + + + DEVICE_TOKEN = ""; + String lang = await sharedPref.getString(APP_Language); + await Helpers.clearSharedPref(); + doctorProfile = null; + sharedPref.setString(APP_Language, lang); + deleteUser(); + await getDeviceInfoFromFirebase(); + this.isFromLogin = isFromLogin; + app_status = APP_STATUS.UNAUTHENTICATED; + setState(ViewState.Idle); } deleteUser(){ user = null; unverified = false; isLogin = false; - // notifyListeners(); } } diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 9d4fe36d..9d7032aa 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -50,5 +50,6 @@ class BaseViewModel extends ChangeNotifier { setDoctorProfile(DoctorProfileModel doctorProfile)async { await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile); this.doctorProfile = doctorProfile; + notifyListeners(); } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 8257ebf0..69d4a47a 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -58,6 +58,8 @@ class _VerificationMethodsScreenState extends State { projectsProvider = Provider.of(context); authenticationViewModel = Provider.of(context); + + return AppScaffold( isShowAppBar: false, backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -553,6 +555,8 @@ class _VerificationMethodsScreenState extends State { Helpers.showErrorToast(authenticationViewModel.error); } else { await authenticationViewModel.onCheckActivationCodeSuccess(); + Navigator.pop(context); + Navigator.pop(context); navigateToLandingPage(); } } @@ -561,11 +565,7 @@ class _VerificationMethodsScreenState extends State { if (authenticationViewModel.state == ViewState.ErrorLocal) { Helpers.showErrorToast(authenticationViewModel.error); } else { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), (r) => false); + authenticationViewModel.setAppStatus(APP_STATUS.AUTHENTICATED); } } diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 8f8c0108..b13a4f10 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -173,9 +173,8 @@ class _AppDrawerState extends State { ), onTap: () async { Navigator.pop(context); - GifLoaderDialogUtils.showMyDialog(context); await authenticationViewModel.logout(isFromLogin: false); - // GifLoaderDialogUtils.showMyDialog(context); + }, ), ],