From 0798057f31b646d79b1b099029d28101679de6f3 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 20 May 2021 13:55:59 +0300 Subject: [PATCH 01/11] change --- .../medical_report/PatientMedicalReportService.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index 760c7dd5..6e00b890 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -11,8 +11,6 @@ class PatientMedicalReportService extends BaseService { Future getMedicalReportList(PatiantInformtion patient) async { hasError = false; Map body = Map(); - // body['TokenID'] = "@dm!n"; - body['SetupID'] = "91877"; body['AdmissionNo'] = patient.admissionNo; await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, From b6cb6362f606ca4f03bb56e62271f28826c171b2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 20 May 2021 14:54:43 +0300 Subject: [PATCH 02/11] adding validation and voice speach to prescription form --- .../prescription/add_prescription_form.dart | 677 +++++++++++------- 1 file changed, 426 insertions(+), 251 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index a3c6e589..e80534c1 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,10 +5,12 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -23,12 +25,16 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) { @@ -102,6 +108,13 @@ class PrescriptionFormWidget extends StatefulWidget { } class _PrescriptionFormWidgetState extends State { + String routeError; + String frequencyError; + String doseTimeError; + String durationError; + String unitError; + String strengthError; + int selectedType; TextEditingController durationController = TextEditingController(); TextEditingController strengthController = TextEditingController(); @@ -124,6 +137,9 @@ class _PrescriptionFormWidgetState extends State { TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); final searchController = TextEditingController(); + stt.SpeechToText speech = stt.SpeechToText(); + var event = RobotProvider(); + var reconizedWord; var notesList; var filteredNotesList; @@ -188,6 +204,60 @@ class _PrescriptionFormWidgetState extends State { }); } + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + indicationController.text += reconizedWord + '\n'; + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + @override Widget build(BuildContext context) { ListSelectDialog drugDialog; @@ -244,7 +314,7 @@ class _PrescriptionFormWidgetState extends State { (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height * 1.45, + height: MediaQuery.of(context).size.height * 1.65, color: Color(0xffF8F8F8), child: Padding( padding: EdgeInsets.symmetric( @@ -437,11 +507,6 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: spaceBetweenTextFileds), Container( - //height: screenSize.height * 0.062, - height: MediaQuery.of(context) - .size - .height * - 0.0749, width: double.infinity, child: Row( children: [ @@ -451,44 +516,43 @@ class _PrescriptionFormWidgetState extends State { .size .width * 0.35, - child: TextField( - decoration: - textFieldSelectorDecorationStreangrh( - strengthController - .text, - 'Strength', //strengthController.text, - false), - enabled: true, - controller: - strengthController, - onChanged: - (String value) { - setState(() { - strengthChar = - value.length; - }); - if (strengthChar >= 5) { - DrAppToastMsg - .showErrorToast( - TranslationBase.of( - context) - .only5DigitsAllowedForStrength, - ); - } - }, - keyboardType: TextInputType - .numberWithOptions( - decimal: true, - )), + child: AppTextFieldCustom( + height: 40, + validationError: + strengthError, + hintText: 'Strength', + isTextFieldHasSuffix: false, + enabled: true, + controller: + strengthController, + onChanged: (String value) { + setState(() { + strengthChar = + value.length; + }); + if (strengthChar >= 5) { + DrAppToastMsg + .showErrorToast( + TranslationBase.of( + context) + .only5DigitsAllowedForStrength, + ); + } + }, + inputType: TextInputType + .numberWithOptions( + decimal: true, + ), + // keyboardType: TextInputType + // .numberWithOptions( + // decimal: true, + // ), + ), ), SizedBox( width: 5.0, ), Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.06, color: Colors.white, width: MediaQuery.of(context) .size @@ -538,23 +602,23 @@ class _PrescriptionFormWidgetState extends State { ); } : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - 'Select', - model.itemMedicineListUnit - .length == - 1 - ? units = model - .itemMedicineListUnit[0] - [ - 'description'] - : units != - null - ? units['description'] - .toString() - : null, - true), + child: AppTextFieldCustom( + hintText: 'Select', + isTextFieldHasSuffix: + true, + dropDownText: model + .itemMedicineListUnit + .length == + 1 + ? units = model + .itemMedicineListUnit[0] + ['description'] + : units != null + ? units['description'] + .toString() + : null, + validationError: + unitError, enabled: false), ), ), @@ -564,7 +628,7 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, + //height: screenSize.height * 0.070, color: Colors.white, child: InkWell( onTap: @@ -613,23 +677,44 @@ class _PrescriptionFormWidgetState extends State { ); } : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .route, - model.itemMedicineListRoute - .length == - 1 - ? model.itemMedicineListRoute[ - 0] - ['description'] - : route != null - ? route[ - 'description'] - : null, - true), + child: AppTextFieldCustom( + // decoration: + // textFieldSelectorDecoration( + // TranslationBase.of( + // context) + // .route, + // model.itemMedicineListRoute + // .length == + // 1 + // ? model.itemMedicineListRoute[ + // 0] + // ['description'] + // : route != null + // ? route[ + // 'description'] + // : null, + // true), + hintText: + TranslationBase.of(context) + .route, + dropDownText: model + .itemMedicineListRoute + .length == + 1 + ? model.itemMedicineListRoute[ + 0]['description'] + : route != null + ? route['description'] + : null, + isTextFieldHasSuffix: true, + //height: 45, + validationError: + model.itemMedicineListRoute + .length != + 1 + ? routeError + : null, + enabled: false, ), ), @@ -637,7 +722,7 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, + //height: screenSize.height * 0.070, color: Colors.white, child: InkWell( onTap: @@ -704,23 +789,22 @@ class _PrescriptionFormWidgetState extends State { ); } : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .frequency, - model.itemMedicineList - .length == - 1 - ? model.itemMedicineList[ - 0] - ['description'] - : frequency != null - ? frequency[ - 'description'] - : null, - true), + child: AppTextFieldCustom( + isTextFieldHasSuffix: true, + hintText: + TranslationBase.of(context) + .frequency, + dropDownText: model + .itemMedicineList + .length == + 1 + ? model.itemMedicineList[0] + ['description'] + : frequency != null + ? frequency[ + 'description'] + : null, + validationError: frequencyError, enabled: false, ), ), @@ -728,7 +812,7 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, + //height: screenSize.height * 0.070, color: Colors.white, child: InkWell( onTap: @@ -770,17 +854,18 @@ class _PrescriptionFormWidgetState extends State { ); } : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .doseTime, - doseTime != null - ? doseTime['nameEn'] - : null, - true), + child: AppTextFieldCustom( + hintText: + TranslationBase.of(context) + .doseTime, + isTextFieldHasSuffix: true, + dropDownText: doseTime != null + ? doseTime['nameEn'] + : null, + //height: 45, + enabled: false, + validationError: doseTimeError, ), ), ), @@ -894,7 +979,7 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, + //height: screenSize.height * 0.070, color: Colors.white, child: InkWell( onTap: @@ -963,16 +1048,15 @@ class _PrescriptionFormWidgetState extends State { ); } : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .duration, - duration != null - ? duration['nameEn'] - : null, - true), + child: AppTextFieldCustom( + validationError: durationError, + isTextFieldHasSuffix: true, + dropDownText: duration != null + ? duration['nameEn'] + : null, + hintText: + TranslationBase.of(context) + .duration, enabled: false, ), ), @@ -1101,14 +1185,36 @@ class _PrescriptionFormWidgetState extends State { width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - maxLines: 6, - minLines: 4, - hintText: - TranslationBase.of(context) + child: Stack( + children: [ + TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of( + context) .instruction, - controller: instructionController, - //keyboardType: TextInputType.number, + controller: + instructionController, + //keyboardType: TextInputType.number, + ), + Positioned( + top: + 0, //MediaQuery.of(context).size.height * 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + initSpeechState().then( + (value) => + {onVoiceText()}); + }, + ), + ), + ], ), ), SizedBox( @@ -1125,139 +1231,205 @@ class _PrescriptionFormWidgetState extends State { context) .addMedication, fontWeight: FontWeight.w600, - onPressed: () { - formKey.currentState.save(); - // Navigator.pop(context); - // openDrugToDrug(); - if (frequency == null || + onPressed: () async { + if (route != null && + duration != null && + doseTime != null && + frequency != null && + units != null && + selectedDate != null && strengthController - .text == - "" || - doseTime == null || - duration == null || - selectedDate == null) { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .pleaseFillAllFields); - return; - } - if (_selectedMedication - .isNarcotic == - true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .narcoticMedicineCanOnlyBePrescribedFromVida); - Navigator.pop(context); - return; - } + .text != + "") { + if (_selectedMedication + .isNarcotic == + true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .narcoticMedicineCanOnlyBePrescribedFromVida); + Navigator.pop(context); + return; + } - if (double.parse( - strengthController - .text) > - 1000.0) { - DrAppToastMsg.showErrorToast( - "1000 is the MAX for the strength"); - return; - } - if (double.parse( - strengthController - .text) < - 0.0) { - DrAppToastMsg.showErrorToast( - "strength can't be zero"); - return; - } + if (double.parse( + strengthController + .text) > + 1000.0) { + DrAppToastMsg + .showErrorToast( + "1000 is the MAX for the strength"); + return; + } + if (double.parse( + strengthController + .text) < + 0.0) { + DrAppToastMsg + .showErrorToast( + "strength can't be zero"); + return; + } - if (formKey.currentState - .validate()) { - Navigator.pop(context); - openDrugToDrug(model); - { - // postProcedure( - // icdCode: model - // .patientAssessmentList - // .isNotEmpty - // ? model - // .patientAssessmentList[ - // 0] - // .icdCode10ID - // .isEmpty - // ? "test" - // : model - // .patientAssessmentList[ - // 0] - // .icdCode10ID - // .toString() - // : "test", - // // icdCode: model - // // .patientAssessmentList - // // .map((value) => value - // // .icdCode10ID - // // .trim()) - // // .toList() - // // .join(' '), - // dose: strengthController - // .text, - // doseUnit: model - // .itemMedicineListUnit - // .length == - // 1 - // ? model - // .itemMedicineListUnit[ - // 0][ - // 'parameterCode'] - // .toString() - // : units['parameterCode'] - // .toString(), - // patient: widget.patient, - // doseTimeIn: - // doseTime['id'] - // .toString(), - // model: widget.model, - // duration: duration['id'] - // .toString(), - // frequency: model - // .itemMedicineList - // .length == - // 1 - // ? model - // .itemMedicineList[ - // 0][ - // 'parameterCode'] - // .toString() - // : frequency[ - // 'parameterCode'] - // .toString(), - // route: model.itemMedicineListRoute - // .length == - // 1 - // ? model - // .itemMedicineListRoute[ - // 0][ - // 'parameterCode'] - // .toString() - // : route['parameterCode'] - // .toString(), - // drugId: - // _selectedMedication - // .itemId - // .toString(), - // strength: - // strengthController - // .text, - // indication: - // indicationController - // .text, - // instruction: - // instructionController - // .text, - // doseTime: selectedDate, - // ); + if (formKey.currentState + .validate()) { + Navigator.pop(context); + openDrugToDrug(model); + { + // postProcedure( + // icdCode: model + // .patientAssessmentList + // .isNotEmpty + // ? model + // .patientAssessmentList[ + // 0] + // .icdCode10ID + // .isEmpty + // ? "test" + // : model + // .patientAssessmentList[ + // 0] + // .icdCode10ID + // .toString() + // : "test", + // // icdCode: model + // // .patientAssessmentList + // // .map((value) => value + // // .icdCode10ID + // // .trim()) + // // .toList() + // // .join(' '), + // dose: strengthController + // .text, + // doseUnit: model + // .itemMedicineListUnit + // .length == + // 1 + // ? model + // .itemMedicineListUnit[ + // 0][ + // 'parameterCode'] + // .toString() + // : units['parameterCode'] + // .toString(), + // patient: widget.patient, + // doseTimeIn: + // doseTime['id'] + // .toString(), + // model: widget.model, + // duration: duration['id'] + // .toString(), + // frequency: model + // .itemMedicineList + // .length == + // 1 + // ? model + // .itemMedicineList[ + // 0][ + // 'parameterCode'] + // .toString() + // : frequency[ + // 'parameterCode'] + // .toString(), + // route: model.itemMedicineListRoute + // .length == + // 1 + // ? model + // .itemMedicineListRoute[ + // 0][ + // 'parameterCode'] + // .toString() + // : route['parameterCode'] + // .toString(), + // drugId: + // _selectedMedication + // .itemId + // .toString(), + // strength: + // strengthController + // .text, + // indication: + // indicationController + // .text, + // instruction: + // instructionController + // .text, + // doseTime: selectedDate, + // ); + } } + } else { + setState(() { + if (duration == null) { + durationError = + TranslationBase.of( + context) + .fieldRequired; + } else { + durationError = null; + } + if (doseTime == null) { + doseTimeError = + TranslationBase.of( + context) + .fieldRequired; + } else { + doseTimeError = null; + } + if (route == null) { + routeError = + TranslationBase.of( + context) + .fieldRequired; + } else { + routeError = null; + } + if (frequency == null) { + frequencyError = + TranslationBase.of( + context) + .fieldRequired; + } else { + frequencyError = null; + } + if (units == null) { + unitError = + TranslationBase.of( + context) + .fieldRequired; + } else { + unitError = null; + } + if (strengthController + .text == + "") { + strengthError = + TranslationBase.of( + context) + .fieldRequired; + } else { + strengthError = null; + } + }); } + formKey.currentState.save(); + // Navigator.pop(context); + // openDrugToDrug(); + // if (frequency == null || + // strengthController + // .text == + // "" || + // doseTime == null || + // duration == null || + // selectedDate == null) { + // DrAppToastMsg.showErrorToast( + // TranslationBase.of( + // context) + // .pleaseFillAllFields); + // return; + // } + { // Navigator.push( // context, @@ -1430,17 +1602,20 @@ class _PrescriptionFormWidgetState extends State { // .join(' '), dose: strengthController.text, doseUnit: model.itemMedicineListUnit.length == 1 - ? model.itemMedicineListUnit[0]['parameterCode'].toString() + ? model.itemMedicineListUnit[0]['parameterCode'] + .toString() : units['parameterCode'].toString(), patient: widget.patient, doseTimeIn: doseTime['id'].toString(), model: widget.model, duration: duration['id'].toString(), frequency: model.itemMedicineList.length == 1 - ? model.itemMedicineList[0]['parameterCode'].toString() + ? model.itemMedicineList[0]['parameterCode'] + .toString() : frequency['parameterCode'].toString(), route: model.itemMedicineListRoute.length == 1 - ? model.itemMedicineListRoute[0]['parameterCode'].toString() + ? model.itemMedicineListRoute[0]['parameterCode'] + .toString() : route['parameterCode'].toString(), drugId: _selectedMedication.itemId.toString(), strength: strengthController.text, From 0ed0dbb5aaf9344f7db9f845ed7a8fde2044ce2e Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 20 May 2021 15:10:21 +0300 Subject: [PATCH 03/11] livecare changes --- lib/config/localized_values.dart | 1 + lib/screens/live_care/end_call_screen.dart | 48 ++++---- .../live-care_transfer_to_admin.dart | 108 ++++++++++++++++++ lib/util/helpers.dart | 51 ++++++++- lib/util/translations_delegate_base.dart | 2 + 5 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 lib/screens/live_care/live-care_transfer_to_admin.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index dcc4aa1f..f8d6a510 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,6 +1,7 @@ const Map> localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, + 'areYouSureYouWantTo': {'en': 'Are you sure you want to', 'ar': 'هل انت متاكد من انك تريد أن'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'lanEnglish': {'en': 'English', 'ar': 'English'}, 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index 880c8fd8..dff46923 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.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/PatientProfileButton.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; @@ -35,18 +36,24 @@ class _EndCallScreenState extends State { final List cardsList = [ PatientProfileCardModel(TranslationBase.of(context).resume, TranslationBase.of(context).theCall, '', 'patient/vital_signs.png', - isInPatient: isInpatient, onTap: () {}, isDartIcon: true, + isInPatient: isInpatient, + onTap: () {}, + isDartIcon: true, dartIcon: DoctorApp.call), PatientProfileCardModel( TranslationBase.of(context).endLC, TranslationBase.of(context).consultation, '', 'patient/vital_signs.png', - isInPatient: isInpatient, - onTap: () {}, - isDartIcon: true, - dartIcon: DoctorApp.end_consultaion - ), + isInPatient: isInpatient, onTap: () { + Helpers.showConfirmationDialog( + context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", + () { + Navigator.of(context).pop(); + + }); + }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), PatientProfileCardModel( TranslationBase.of(context).sendLC, TranslationBase.of(context).instruction, @@ -55,19 +62,13 @@ class _EndCallScreenState extends State { onTap: () {}, isInPatient: isInpatient, isDartIcon: true, - dartIcon: DoctorApp.send_instruction - ), - PatientProfileCardModel( - TranslationBase.of(context).transferTo, - TranslationBase.of(context).admin, - '', - 'patient/health_summary.png', + dartIcon: DoctorApp.send_instruction), + PatientProfileCardModel(TranslationBase.of(context).transferTo, + TranslationBase.of(context).admin, '', 'patient/health_summary.png', onTap: () {}, - isInPatient: isInpatient, - - isDartIcon: true, - dartIcon: DoctorApp.transfer_to_admin - ), + isInPatient: isInpatient, + isDartIcon: true, + dartIcon: DoctorApp.transfer_to_admin), ]; return AppScaffold( @@ -93,8 +94,8 @@ class _EndCallScreenState extends State { child: ListView( children: [ Padding( - padding: const EdgeInsets.symmetric( - vertical: 15.0, horizontal: 15), + padding: + const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -103,11 +104,14 @@ class _EndCallScreenState extends State { fontSize: 14, fontWeight: FontWeight.w500, ), - AppText(TranslationBase.of(context).endcall, + AppText( + TranslationBase.of(context).endcall, fontSize: 26, fontWeight: FontWeight.bold, ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), StaggeredGridView.countBuilder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart new file mode 100644 index 00000000..f6e3798f --- /dev/null +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -0,0 +1,108 @@ +import 'dart:html'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; + +class LivaCareTransferToAdmin extends StatefulWidget { + + final PatiantInformtion patient; + + const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key); + + @override + _LivaCareTransferToAdminState createState() => _LivaCareTransferToAdminState(); +} + +class _LivaCareTransferToAdminState extends State { + + stt.SpeechToText speech = stt.SpeechToText(); + var reconizedWord; + var event = RobotProvider(); + ProjectViewModel projectViewModel; + + TextEditingController noteController = TextEditingController(); + + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Container( + + ); + } + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + noteController.text += reconizedWord + '\n'; + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } +} diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 53f81ef2..7f72435f 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,7 +26,47 @@ class Helpers { static int cupertinoPickerIndex = 0; get currentLanguage => null; - static showCupertinoPicker(context, List items, decKey, onSelectFun, AuthenticationViewModel model) { + + static showConfirmationDialog( + BuildContext context, String message, Function okFunction) { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (_) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AlertDialog( + title: null, + content: Container( + child: AppText(message), + ), + actions: [ + AppButton( + onPressed: okFunction, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + AppButton( + onPressed: (){ + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.white, + color: Colors.red[600], + ), + ], + ), + ], + ), + ); + }); + } + + static showCupertinoPicker(context, List items, + decKey, onSelectFun, AuthenticationViewModel model) { showModalBottomSheet( isDismissible: false, context: context, @@ -64,8 +106,8 @@ class Helpers { Container( height: SizeConfig.realScreenHeight * 0.3, color: Color(0xfff7f7f7), - child: - buildPickerItems(context, items, decKey, onSelectFun, model)) + child: buildPickerItems( + context, items, decKey, onSelectFun, model)) ], ), ); @@ -75,7 +117,8 @@ class Helpers { static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); - static buildPickerItems(context, List items, decKey, onSelectFun, model) { + static buildPickerItems(context, List items, + decKey, onSelectFun, model) { return CupertinoPicker( magnification: 1.5, scrollController: diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ac805956..4f5a128b 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -18,6 +18,8 @@ class TranslationBase { String get settings => localizedValues['settings'][locale.languageCode]; + String get areYouSureYouWantTo => localizedValues['areYouSureYouWantTo'][locale.languageCode]; + String get language => localizedValues['language'][locale.languageCode]; String get lanEnglish => localizedValues['lanEnglish'][locale.languageCode]; From 5d5f9f692839d2dd76a275756c19d58e031b24db Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 20 May 2021 15:45:37 +0300 Subject: [PATCH 04/11] Fix issues on the add procedure --- lib/models/doctor/doctor_profile_model.dart | 2 +- lib/screens/live_care/video_call.dart | 2 +- .../procedures/add-procedure-form.dart | 38 +-- .../procedures/procedure_checkout_screen.dart | 303 +++++++++--------- 4 files changed, 163 insertions(+), 182 deletions(-) diff --git a/lib/models/doctor/doctor_profile_model.dart b/lib/models/doctor/doctor_profile_model.dart index 17625968..c2f5b0dd 100644 --- a/lib/models/doctor/doctor_profile_model.dart +++ b/lib/models/doctor/doctor_profile_model.dart @@ -7,7 +7,7 @@ class DoctorProfileModel { Null clinicDescriptionN; Null licenseExpiry; int employmentType; - Null setupID; + dynamic setupID; int projectID; String projectName; String nationalityID; diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 961654cc..321a7e0f 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -76,7 +76,7 @@ class _VideoCallPageState extends State { }); }, onCallNotRespond: (SessionStatusModel sessionStatusModel) { - //TODO handling onCalcallNotRespondlEnd + //TODO handling onCalNotRespondEnd WidgetsBinding.instance.addPostFrameCallback((_) { changeRoute(context); }); diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index b17f50ae..db249da7 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -13,13 +13,11 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'entity_list_checkbox_search_widget.dart'; -import 'entity_list_procedure_widget.dart'; valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, List entityList) async { @@ -139,9 +137,7 @@ class _AddSelectedProcedureState extends State { @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; return BaseView( - //onModelReady: (model) => model.getCategory(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, @@ -218,21 +214,23 @@ class _AddSelectedProcedureState extends State { width: MediaQuery.of(context).size.width * 0.02, ), - InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, + Expanded( + child: InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + categoryName: procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, + ), ), ), ], @@ -429,8 +427,6 @@ class _AddSelectedProcedureState extends State { color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () { - //print(entityList.toString()); - onPressed: if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( TranslationBase.of(context) diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index e3fc86be..f5b6dcb7 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -10,7 +10,6 @@ import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -37,164 +36,159 @@ class _ProcedureCheckOutScreenState extends State { AppScaffold( backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), isShowAppBar: false, - body: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - color: Colors.white, - ), - Container( - color: Colors.white, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Row( - //mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Icon( - Icons.arrow_back_ios_sharp, - size: 24.0, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + color: Colors.white, + ), + Container( + color: Colors.white, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Row( + //mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Icon( + Icons.arrow_back_ios_sharp, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, ), - onTap: () { - Navigator.pop(context); - }, - ), - SizedBox( - width: 5.0, - ), - AppText( - 'Add Procedure', - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ], + SizedBox( + width: 5.0, + ), + AppText( + 'Add Procedure', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), ), ), - ), - Padding( - padding: const EdgeInsets.only( - left: 12.0, right: 12.0, bottom: 26.0, top: 10), - child: ListView.builder( - scrollDirection: Axis.vertical, - physics: AlwaysScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: widget.items.length, - itemBuilder: (BuildContext context, int index) { - return Container( - margin: EdgeInsets.only(bottom: 15.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.all(Radius.circular(10.0))), - child: ExpansionTile( - initiallyExpanded: true, - title: Row( + SizedBox(height: 30,), + ...List.generate(widget.items.length, (index) => Container( + margin: EdgeInsets.only(bottom: 15.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.all(Radius.circular(10.0))), + child: ExpansionTile( + initiallyExpanded: true, + title: Row( + children: [ + Icon( + Icons.check_box, + color: Color(0xffD02127), + size: 30.5, + ), + SizedBox( + width: 6.0, + ), + Expanded( + child: + AppText(widget.items[index].procedureName)), + ], + ), + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.check_box, - color: Color(0xffD02127), - size: 30.5, + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 11), + child: AppText( + TranslationBase.of(context).orderType, + fontWeight: FontWeight.w700, + color: Color(0xff2B353E), + ), + ), + ], ), - SizedBox( - width: 6.0, + Row( + children: [ + Radio( + activeColor: Color(0xFFD02127), + value: 0, + groupValue: + widget.items[index].selectedType, + onChanged: (value) { + widget.items[index].selectedType = 0; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + 'routine', + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFD02127), + groupValue: + widget.items[index].selectedType, + value: 1, + onChanged: (value) { + widget.items[index].selectedType = 1; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + TranslationBase.of(context).urgent, + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + ], ), - Expanded( - child: - AppText(widget.items[index].procedureName)), ], ), - children: [ - Container( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 11), - child: AppText( - TranslationBase.of(context).orderType, - fontWeight: FontWeight.w700, - color: Color(0xff2B353E), - ), - ), - ], - ), - Row( - children: [ - Radio( - activeColor: Color(0xFFD02127), - value: 0, - groupValue: - widget.items[index].selectedType, - onChanged: (value) { - widget.items[index].selectedType = 0; - setState(() { - widget.items[index].type = - value.toString(); - }); - }, - ), - AppText( - 'routine', - color: Color(0xff575757), - fontWeight: FontWeight.w600, - ), - Radio( - activeColor: Color(0xFFD02127), - groupValue: - widget.items[index].selectedType, - value: 1, - onChanged: (value) { - widget.items[index].selectedType = 1; - setState(() { - widget.items[index].type = - value.toString(); - }); - }, - ), - AppText( - TranslationBase.of(context).urgent, - color: Color(0xff575757), - fontWeight: FontWeight.w600, - ), - ], - ), - ], - ), - ), - ), - SizedBox( - height: 2.0, - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 12, vertical: 15.0), - child: TextFields( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - onChanged: (value) { - widget.items[index].remarks = value; - }, - minLines: 3, - maxLines: 5, - borderWidth: 0.5, - borderColor: Colors.grey[500], - ), - ), - SizedBox( - height: 19.0, - ), - //DividerWithSpacesAround(), - ], ), - ); - }), - ), - ], + ), + SizedBox( + height: 2.0, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12, vertical: 15.0), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + onChanged: (value) { + widget.items[index].remarks = value; + }, + minLines: 3, + maxLines: 5, + borderWidth: 0.5, + borderColor: Colors.grey[500], + ), + ), + SizedBox( + height: 19.0, + ), + //DividerWithSpacesAround(), + ], + ), + )), + SizedBox(height: 90,), + + + ], + ), ), bottomSheet: Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), @@ -206,15 +200,6 @@ class _ProcedureCheckOutScreenState extends State { color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () async { - //print(entityList.toString()); - onPressed: - // if (entityList.isEmpty == true) { - // DrAppToastMsg.showErrorToast( - // TranslationBase.of(context) - // .fillTheMandatoryProcedureDetails, - // ); - // return; - // } List entityList = List(); widget.items.forEach((element) { entityList.add( From 8b2c7f1a059e5153d0508afccc9401e877938fef Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 20 May 2021 15:49:35 +0300 Subject: [PATCH 05/11] livecare --- .../patient/LiveCarePatientServices.dart | 16 ++ .../viewModel/LiveCarePatientViewModel.dart | 13 + lib/screens/live_care/end_call_screen.dart | 241 ++++++++++-------- .../live-care_transfer_to_admin.dart | 21 +- .../patient_profile_screen.dart | 8 +- 5 files changed, 179 insertions(+), 120 deletions(-) diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index e4443b9b..36ca2c7e 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -42,4 +42,20 @@ class LiveCarePatientServices extends BaseService{ }, body: endCallReq.toJson()); } + Future endCallWithCharge(int vcID) async{ + hasError = false; + await baseAppClient.post( + END_CALL_WITH_CHARGE, + onSuccess: (dynamic response, int statusCode) { + endCallResponse = response; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "VC_ID": vcID, + }, + ); + } } \ No newline at end of file diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 0cce5f86..8c7587a4 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -57,6 +57,19 @@ class LiveCarePatientViewModel extends BaseViewModel { } } + Future endCallWithCharge(int vcID) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices + .endCallWithCharge(vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + searchData(String str) { var strExist= str.length > 0 ? true : false; if (strExist) { diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index dff46923..b7657d31 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -1,6 +1,11 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/live_care/live-care_transfer_to_admin.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; @@ -8,6 +13,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head 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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -31,6 +37,8 @@ class _EndCallScreenState extends State { String from; String to; + LiveCarePatientViewModel liveCareModel; + @override Widget build(BuildContext context) { final List cardsList = [ @@ -46,13 +54,17 @@ class _EndCallScreenState extends State { '', 'patient/vital_signs.png', isInPatient: isInpatient, onTap: () { - Helpers.showConfirmationDialog( - context, + Helpers.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", - () { - Navigator.of(context).pop(); - - }); + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + liveCareModel.endCallWithCharge(0); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } + }); }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), PatientProfileCardModel( TranslationBase.of(context).sendLC, @@ -65,122 +77,133 @@ class _EndCallScreenState extends State { dartIcon: DoctorApp.send_instruction), PatientProfileCardModel(TranslationBase.of(context).transferTo, TranslationBase.of(context).admin, '', 'patient/health_summary.png', - onTap: () {}, + onTap: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) => + LivaCareTransferToAdmin(patient:widget.patient))); + }, isInPatient: isInpatient, isDartIcon: true, dartIcon: DoctorApp.transfer_to_admin), ]; - return AppScaffold( - appBarTitle: TranslationBase.of(context).patientProfile, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - widget.patient, arrivalType ?? '7', '1', - isInpatient: isInpatient, - height: (widget.patient.patientStatusType != null && - widget.patient.patientStatusType == 43) - ? 210 - : isDischargedPatient - ? 240 - : 0, - isDischargedPatient: isDischargedPatient), - body: Container( - height: !isSearchAndOut - ? isDischargedPatient - ? MediaQuery.of(context).size.height * 0.64 - : MediaQuery.of(context).size.height * 0.65 - : MediaQuery.of(context).size.height * 0.69, - child: ListView( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).patient, - fontSize: 14, - fontWeight: FontWeight.w500, - ), - AppText( - TranslationBase.of(context).endcall, - fontSize: 26, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 10, - ), - StaggeredGridView.countBuilder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - crossAxisCount: 3, - itemCount: cardsList.length, - staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => - PatientProfileButton( - patient: widget.patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, - isDartIcon: cardsList[index].isDartIcon, - dartIcon: cardsList[index].dartIcon, + return BaseView( + onModelReady: (model) { + liveCareModel = model; + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).patientProfile, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: true, + appBar: PatientProfileHeaderNewDesignAppBar( + widget.patient, arrivalType ?? '7', '1', + isInpatient: isInpatient, + height: (widget.patient.patientStatusType != null && + widget.patient.patientStatusType == 43) + ? 210 + : isDischargedPatient + ? 240 + : 0, + isDischargedPatient: isDischargedPatient), + body: Container( + height: !isSearchAndOut + ? isDischargedPatient + ? MediaQuery.of(context).size.height * 0.64 + : MediaQuery.of(context).size.height * 0.65 + : MediaQuery.of(context).size.height * 0.69, + child: ListView( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontSize: 14, + fontWeight: FontWeight.w500, ), - ), - ], + AppText( + TranslationBase.of(context).endcall, + fontSize: 26, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 10, + ), + StaggeredGridView.countBuilder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + crossAxisCount: 3, + itemCount: cardsList.length, + staggeredTileBuilder: (int index) => StaggeredTile.fit(1), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: widget.patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: + cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isDartIcon: cardsList[index].isDartIcon, + dartIcon: cardsList[index].dartIcon, + ), + ), + ], + ), ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.05, - ) - ], - ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), + SizedBox( + height: MediaQuery.of(context).size.height * 0.05, + ) + ], ), - border: Border.all(color: HexColor('#707070'), width: 0), ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - fontWeight: FontWeight.w700, - color: Colors.red[600], - title: "Close", //TranslationBase.of(context).close, - onPressed: () async {}, + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: Colors.red[600], + title: "Close", //TranslationBase.of(context).close, + onPressed: () async {}, + ), ), ), ), - ), - SizedBox( - height: 5, - ), - ], + SizedBox( + height: 5, + ), + ], + ), ), ), ); diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart index f6e3798f..33f55c95 100644 --- a/lib/screens/live_care/live-care_transfer_to_admin.dart +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -1,10 +1,11 @@ -import 'dart:html'; - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -13,17 +14,16 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class LivaCareTransferToAdmin extends StatefulWidget { - final PatiantInformtion patient; const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key); @override - _LivaCareTransferToAdminState createState() => _LivaCareTransferToAdminState(); + _LivaCareTransferToAdminState createState() => + _LivaCareTransferToAdminState(); } class _LivaCareTransferToAdminState extends State { - stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; var event = RobotProvider(); @@ -47,8 +47,15 @@ class _LivaCareTransferToAdminState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); - return Container( - + return BaseView( + onModelReady: (model) {}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: true, + body: Container(), + ), ); } 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 344c5394..a2aa07e3 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -277,13 +277,13 @@ class _PatientProfileScreenState extends State .of(context) .initiateCall, onPressed: () async { - if(model.isFinished) { + // if(model.isFinished) { Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) => EndCallScreen(patient:patient))); - } else { - // TODO Call initiateCall service - } + // } else { + // // TODO Call initiateCall service + // } }, ), From e313722743ec02a0905cc755ebf274cc8f69c80e Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 20 May 2021 15:59:25 +0300 Subject: [PATCH 06/11] fix bug when logout --- lib/core/viewModel/authentication_view_model.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 232d9619..a6e9eaeb 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -421,8 +421,9 @@ class AuthenticationViewModel extends BaseViewModel { doctorProfile = null; sharedPref.setString(APP_Language, lang); deleteUser(); - await getDeviceInfoFromFirebase(); + await getDeviceInfoFromFirebase(); this.isFromLogin = isFromLogin; + setState(ViewState.Idle); Navigator.pushAndRemoveUntil( AppGlobal.CONTEX, FadePage( From 269c8e21f6de3a46543b27721a1afe8ee3f1cfb0 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 20 May 2021 16:26:20 +0300 Subject: [PATCH 07/11] hot fix --- lib/screens/prescription/add_prescription_form.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index e80534c1..fc4609f3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -618,7 +618,11 @@ class _PrescriptionFormWidgetState extends State { .toString() : null, validationError: - unitError, + model.itemMedicineListUnit + .length != + 1 + ? unitError + : null, enabled: false), ), ), @@ -804,7 +808,12 @@ class _PrescriptionFormWidgetState extends State { ? frequency[ 'description'] : null, - validationError: frequencyError, + validationError: model + .itemMedicineList + .length != + 1 + ? frequencyError + : null, enabled: false, ), ), From 0cd7fa0cb2530d811dc1bd7691f99662b17c59ba Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 20 May 2021 17:07:50 +0300 Subject: [PATCH 08/11] working on livecare --- .../patient/LiveCarePatientServices.dart | 20 +++++ .../viewModel/LiveCarePatientViewModel.dart | 13 +++ lib/screens/live_care/end_call_screen.dart | 5 +- .../live-care_transfer_to_admin.dart | 86 ++++++++++++++++++- .../shared/buttons/button_bottom_sheet.dart | 38 ++++---- 5 files changed, 142 insertions(+), 20 deletions(-) diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index 36ca2c7e..0a8c4894 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -12,6 +12,7 @@ class LiveCarePatientServices extends BaseService{ bool get isFinished => _isFinished; var endCallResponse = {}; + var transferToAdminResponse = {}; Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{ hasError = false; @@ -58,4 +59,23 @@ class LiveCarePatientServices extends BaseService{ }, ); } + + Future transferToAdmin(int vcID, String notes) async{ + hasError = false; + await baseAppClient.post( + TRANSFERT_TO_ADMIN, + onSuccess: (dynamic response, int statusCode) { + transferToAdminResponse = response; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "VC_ID": vcID, + "IsOutKsa": false, + "Notes": notes, + }, + ); + } } \ No newline at end of file diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 8c7587a4..e8b07cba 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -70,6 +70,19 @@ class LiveCarePatientViewModel extends BaseViewModel { } } + Future transferToAdmin(int vcID, String notes) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices + .transferToAdmin(vcID, notes); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + searchData(String str) { var strExist= str.length > 0 ? true : false; if (strExist) { diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index b7657d31..e33d476c 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -59,10 +59,13 @@ class _EndCallScreenState extends State { () async { Navigator.of(context).pop(); GifLoaderDialogUtils.showMyDialog(context); - liveCareModel.endCallWithCharge(0); + liveCareModel.endCallWithCharge(widget.patient.vcId); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + Navigator.of(context).pop(); + Navigator.of(context).pop(); } }); }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart index 33f55c95..c5bcf304 100644 --- a/lib/screens/live_care/live-care_transfer_to_admin.dart +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -1,12 +1,19 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/button_bottom_sheet.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; @@ -30,6 +37,7 @@ class _LivaCareTransferToAdminState extends State { ProjectViewModel projectViewModel; TextEditingController noteController = TextEditingController(); + String noteError; void initState() { requestPermissions(); @@ -51,10 +59,84 @@ class _LivaCareTransferToAdminState extends State { onModelReady: (model) {}, builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + appBarTitle: + "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", backgroundColor: Theme.of(context).scaffoldBackgroundColor, isShowAppBar: true, - body: Container(), + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + color: Colors.white, + margin: EdgeInsets.all(16), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).notes, + //TranslationBase.of(context).addProgressNote, + controller: noteController, + maxLines: 35, + minLines: 25, + hasBorder: true, + validationError: noteError, + ), + Positioned( + top: -2, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon(DoctorApp.speechtotext, + color: Colors.black, size: 35), + onPressed: () { + initSpeechState() + .then((value) => {onVoiceText()}); + }, + ), + ], + )) + ], + ), + ), + ), + ), + ButtonBottomSheet( + title: + "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + onPressed: () { + setState(() { + if (noteController.text.isEmpty) { + noteError = TranslationBase.of(context).emptyMessage; + } else { + noteError = null; + } + if (noteController.text.isNotEmpty) { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + model.endCallWithCharge(widget.patient.vcId); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); + } + }); + }, + ) + ], + ), + ), ), ); } diff --git a/lib/widgets/shared/buttons/button_bottom_sheet.dart b/lib/widgets/shared/buttons/button_bottom_sheet.dart index 9db662d2..3c5cc32d 100644 --- a/lib/widgets/shared/buttons/button_bottom_sheet.dart +++ b/lib/widgets/shared/buttons/button_bottom_sheet.dart @@ -42,23 +42,27 @@ class ButtonBottomSheet extends StatelessWidget { Widget build(BuildContext context) { return Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: AppButton( - title: title, - onPressed: onPressed, - fontWeight: fontWeight, - color: color, - fontSize: fontSize, - padding: padding, - disabled: disabled, - radius: radius, - hasBorder: hasBorder, - fontColor: fontColor, - icon: icon, - iconData: iconData, - hPadding: hPadding, - vPadding: vPadding, - borderColor: borderColor, - loading: loading, + child: Column( + children: [ + AppButton( + title: title, + onPressed: onPressed, + fontWeight: fontWeight, + color: color, + fontSize: fontSize, + padding: padding, + disabled: disabled, + radius: radius, + hasBorder: hasBorder, + fontColor: fontColor, + icon: icon, + iconData: iconData, + hPadding: hPadding, + vPadding: vPadding, + borderColor: borderColor, + loading: loading, + ), + ], ), ); } From f26d870d5b74d6c0436e724d297162a2f11057c8 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 20 May 2021 18:17:06 +0300 Subject: [PATCH 09/11] procedure changes --- lib/client/base_app_client.dart | 4 +- lib/config/config.dart | 4 +- .../get_ordered_procedure_model.dart | 6 ++- lib/screens/procedures/ProcedureCard.dart | 42 +++++++++++-------- .../procedures/add-procedure-form.dart | 2 +- .../procedures/add_procedure_homeScreen.dart | 12 +++--- lib/screens/procedures/procedure_screen.dart | 6 +-- lib/screens/procedures/update-procedure.dart | 2 +- 8 files changed, 44 insertions(+), 34 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index f73d4068..7a8baa56 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -48,8 +48,8 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = "@dm!n";// token ?? ''; - // body['TokenID'] = "@dm!n" ?? ''; + body['TokenID'] = token ?? ''; + // body['TokenID'] = "@dm!n" ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; diff --git a/lib/config/config.dart b/lib/config/config.dart index 8464f720..93d38947 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/core/model/procedure/get_ordered_procedure_model.dart b/lib/core/model/procedure/get_ordered_procedure_model.dart index b7185711..c3c7718f 100644 --- a/lib/core/model/procedure/get_ordered_procedure_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_model.dart @@ -53,6 +53,7 @@ class EntityList { String remarks; String status; String template; + int doctorID; EntityList( {this.achiCode, @@ -78,10 +79,12 @@ class EntityList { this.procedureName, this.remarks, this.status, - this.template}); + this.template, + this.doctorID}); EntityList.fromJson(Map json) { achiCode = json['achiCode']; + doctorID = json['doctorID']; appointmentDate = json['appointmentDate']; appointmentNo = json['appointmentNo']; categoryID = json['categoryID']; @@ -110,6 +113,7 @@ class EntityList { Map toJson() { final Map data = new Map(); data['achiCode'] = this.achiCode; + data['doctorID'] = this.doctorID; data['appointmentDate'] = this.appointmentDate; data['appointmentNo'] = this.appointmentNo; data['categoryID'] = this.categoryID; diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index 0c3d952f..3448d0be 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -16,7 +17,7 @@ class ProcedureCard extends StatelessWidget { final String categoryName; final int categoryID; final PatiantInformtion patient; - final String doctorName; + final int doctorID; const ProcedureCard({ Key key, @@ -25,7 +26,7 @@ class ProcedureCard extends StatelessWidget { this.categoryID, this.categoryName, this.patient, - this.doctorName, + this.doctorID, }) : super(key: key); @override Widget build(BuildContext context) { @@ -241,22 +242,27 @@ class ProcedureCard extends StatelessWidget { ), ), ),*/ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // AppText( - // entityList.remarks.toString() ?? '', - // fontSize: 12, - // ), - // if (entityList.categoryID == 2 || - // entityList.categoryID == 4 && - // doctorName == entityList.doctorName) - // InkWell( - // child: Icon(DoctorApp.edit), - // onTap: onTap, - // ) - // ], - // ) + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: AppText( + entityList.remarks.toString() ?? '', + fontSize: 12, + ), + ), + if (entityList.categoryID == 2 || + entityList.categoryID == 4 && + doctorID == entityList.doctorID) + InkWell( + child: Icon(DoctorApp.edit), + onTap: onTap, + ) + ], + ), + ) ], ), //onTap: onTap, diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index b17f50ae..830b5a5e 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -186,7 +186,7 @@ class _AddSelectedProcedureState extends State { children: [ Container( width: MediaQuery.of(context).size.width * - 0.81, + 0.79, child: AppTextFieldCustom( hintText: TranslationBase.of(context) .searchProcedureHere, diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/add_procedure_homeScreen.dart index de242cd7..4a4d8242 100644 --- a/lib/screens/procedures/add_procedure_homeScreen.dart +++ b/lib/screens/procedures/add_procedure_homeScreen.dart @@ -125,12 +125,12 @@ class _AddProcedureHomeState extends State tabWidget( screenSize, _activeTab == 0, - 'All Procedures', + "Favorite Templates", ), tabWidget( screenSize, _activeTab == 1, - "Favorite Templates", + 'All Procedures', ), ], ), @@ -144,14 +144,14 @@ class _AddProcedureHomeState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - AddSelectedProcedure( - model: model, - patient: patient, - ), AddFavouriteProcedure( patient: patient, model: model, ), + AddSelectedProcedure( + model: model, + patient: patient, + ), ], ), ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index b964392e..bcc7c291 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -17,12 +17,12 @@ import 'package:flutter/material.dart'; import 'ProcedureCard.dart'; class ProcedureScreen extends StatelessWidget { - String doctorNameP; + int doctorNameP; void initState() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - doctorNameP = doctorProfile.doctorName; + doctorNameP = doctorProfile.doctorID; } @override @@ -187,7 +187,7 @@ class ProcedureScreen extends StatelessWidget { // 'You Cant Update This Procedure'); }, patient: patient, - doctorName: doctorNameP, + doctorID: doctorNameP, ), ), if (model.state == ViewState.ErrorLocal || diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 6190e92e..24c4ea41 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -100,7 +100,7 @@ class _UpdateProcedureWidgetState extends State { baseViewModel: model, child: SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height * 0.65, + height: MediaQuery.of(context).size.height * 0.9, child: Form( child: Padding( padding: From 17cca30b17678de20abd38126907c83caa307663 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 20 May 2021 18:18:39 +0300 Subject: [PATCH 10/11] procedure changes --- lib/config/config.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index c5372a07..f1d642eb 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -297,9 +297,11 @@ const GET_PROCEDURE_TEMPLETE = const GET_PROCEDURE_TEMPLETE_DETAILS = "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; -const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP ='Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp'; +const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP = + 'Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp'; -const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; +const DOCTOR_CHECK_HAS_LIVE_CARE = + "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; var selectedPatientType = 1; From 2a448406660dcff15c861c907f4e4b5088f1271b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 23 May 2021 09:34:09 +0300 Subject: [PATCH 11/11] hot fix --- lib/models/doctor/doctor_profile_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/doctor/doctor_profile_model.dart b/lib/models/doctor/doctor_profile_model.dart index 17625968..c2f5b0dd 100644 --- a/lib/models/doctor/doctor_profile_model.dart +++ b/lib/models/doctor/doctor_profile_model.dart @@ -7,7 +7,7 @@ class DoctorProfileModel { Null clinicDescriptionN; Null licenseExpiry; int employmentType; - Null setupID; + dynamic setupID; int projectID; String projectName; String nationalityID;