From da45f8c4b6c5536fc9b07826cfada444370526cc Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 24 May 2021 16:47:11 +0300 Subject: [PATCH 01/12] prescription refactoring --- .../prescription/add_prescription_form.dart | 1191 +++-------------- .../prescription/prescription_text_filed.dart | 76 ++ .../prescription/prescriptions_page.dart | 15 +- lib/util/date-utils.dart | 106 +- .../text_fields/app-textfield-custom.dart | 61 +- .../shared/text_fields/text_field_error.dart | 17 +- 6 files changed, 384 insertions(+), 1082 deletions(-) create mode 100644 lib/screens/prescription/prescription_text_filed.dart diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index fc4609f3..894d7c33 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -6,7 +6,6 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req 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'; @@ -15,6 +14,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -23,7 +23,6 @@ import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.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/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; @@ -36,8 +35,7 @@ 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) { +addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) { showModalBottomSheet( isScrollControlled: true, context: context, @@ -46,7 +44,7 @@ addPrescriptionForm(context, PrescriptionViewModel model, }); } -postProcedure( +postPrescription( {String duration, String doseTimeIn, String dose, @@ -62,16 +60,15 @@ postProcedure( String icdCode, PatiantInformtion patient, String patientType}) async { - PostPrescriptionReqModel postProcedureReqModel = - new PostPrescriptionReqModel(); - List sss = List(); + PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + List prescriptionList = List(); postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.clinicID = patient.clinicId; postProcedureReqModel.episodeID = patient.episodeNo; postProcedureReqModel.patientMRN = patient.patientMRN; - sss.add(PrescriptionRequestModel( + prescriptionList.add(PrescriptionRequestModel( covered: true, dose: double.parse(dose), itemId: drugId.isEmpty ? 1 : int.parse(drugId), @@ -84,9 +81,7 @@ postProcedure( doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), duration: duration.isEmpty ? 1 : int.parse(duration), doseStartDate: doseTime.toIso8601String())); - postProcedureReqModel.prescriptionRequestModel = sss; - //postProcedureReqModel.procedures = controlsProcedure; - + postProcedureReqModel.prescriptionRequestModel = prescriptionList; await model.postPrescription(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { @@ -99,8 +94,9 @@ postProcedure( class PrescriptionFormWidget extends StatefulWidget { final PrescriptionViewModel model; - PatiantInformtion patient; - List prescriptionList; + final PatiantInformtion patient; + final List prescriptionList; + PrescriptionFormWidget(this.model, this.patient, this.prescriptionList); @override @@ -116,10 +112,8 @@ class _PrescriptionFormWidgetState extends State { String strengthError; int selectedType; - TextEditingController durationController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); - TextEditingController routeController = TextEditingController(); - TextEditingController frequencyController = TextEditingController(); TextEditingController indicationController = TextEditingController(); TextEditingController instructionController = TextEditingController(); @@ -128,11 +122,9 @@ class _PrescriptionFormWidgetState extends State { final myController = TextEditingController(); DateTime selectedDate; - dynamic selectedDrug; int strengthChar; GetMedicationResponseModel _selectedMedication; - GlobalKey key = - new GlobalKey>(); + GlobalKey key = new GlobalKey>(); TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); @@ -141,15 +133,8 @@ class _PrescriptionFormWidgetState extends State { var event = RobotProvider(); var reconizedWord; - var notesList; - var filteredNotesList; - String textSeartch = "Amoxicillin"; - final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; - List referToList; - dynamic type; - dynamic strength; dynamic route; dynamic frequency; dynamic duration; @@ -161,41 +146,12 @@ class _PrescriptionFormWidgetState extends State { dynamic x; List indicationList; - String routeInatial = 'By Mouth'; - //PatiantInformtion patient; @override void initState() { super.initState(); selectedType = 1; - referToList = List(); - indicationList = List(); - - dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; - dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; - dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; - dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; - dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; - dynamic indication6 = { - "id": 550, - "name": "Phenytoin Hypersensitivity Syndrome" - }; - dynamic indication7 = {"id": 551, "name": "Asterixis"}; - dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; - dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; - dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; - - indicationList.add(indication1); - indicationList.add(indication2); - indicationList.add(indication3); - indicationList.add(indication4); - indicationList.add(indication5); - indicationList.add(indication6); - indicationList.add(indication7); - indicationList.add(indication8); - indicationList.add(indication9); - indicationList.add(indication10); } setSelectedType(int val) { @@ -207,8 +163,7 @@ 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); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -222,7 +177,6 @@ class _PrescriptionFormWidgetState extends State { void errorListener(SpeechRecognitionError error) { event.setValue({"searchText": 'null'}); - //SpeechToText.closeAlertDialog(context); print(error); } @@ -252,21 +206,15 @@ class _PrescriptionFormWidgetState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } @override Widget build(BuildContext context) { - ListSelectDialog drugDialog; final screenSize = MediaQuery.of(context).size; ProjectViewModel projectViewModel = Provider.of(context); - - // final routeArgs = ModalRoute.of(context).settings.arguments as Map; - // patient = routeArgs['patient']; - return BaseView( onModelReady: (model) async { x = model.patientAssessmentList.map((element) { @@ -278,22 +226,16 @@ class _PrescriptionFormWidgetState extends State { editedBy: '', doctorID: '', appointmentNo: widget.patient.appointmentNo); - //await model.getMedicationList(); if (model.medicationStrengthList.length == 0) { await model.getMedicationStrength(); } - //await model.getPrescription(mrn: widget.patient.patientMRN); if (model.medicationDurationList.length == 0) { await model.getMedicationDuration(); } - //await model.getMedicationRoute(); - //await model.getMedicationFrequency(); if (model.medicationDoseTimeList.length == 0) { await model.getMedicationDoseTime(); } - //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); - //await model.getItem(); }, builder: ( BuildContext context, @@ -310,18 +252,14 @@ class _PrescriptionFormWidgetState extends State { initialChildSize: 0.98, maxChildSize: 0.98, minChildSize: 0.9, - builder: - (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.65, color: Color(0xffF8F8F8), child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ @@ -329,12 +267,10 @@ class _PrescriptionFormWidgetState extends State { height: 15, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - TranslationBase.of(context) - .newPrescriptionOrder, + TranslationBase.of(context).newPrescriptionOrder, fontWeight: FontWeight.w700, fontSize: 20, ), @@ -358,17 +294,13 @@ class _PrescriptionFormWidgetState extends State { child: Form( key: formKey, child: Column( - //mainAxisAlignment: MainAxisAlignment.end, children: [ FractionallySizedBox( widthFactor: 0.9, child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.all(10), child: AppTextFormField( onTap: () { @@ -376,8 +308,7 @@ class _PrescriptionFormWidgetState extends State { visbiltySearch = true; }, borderColor: Colors.white, - hintText: TranslationBase.of(context) - .searchMedicineNameHere, + hintText: TranslationBase.of(context).searchMedicineNameHere, controller: myController, onSaved: (value) {}, onFieldSubmitted: (value) { @@ -403,12 +334,9 @@ class _PrescriptionFormWidgetState extends State { children: [ // TODO change it secondary button and add loading AppButton( - title: TranslationBase.of( - context) - .search, + title: TranslationBase.of(context).search, onPressed: () async { - await searchMedicine( - context, model); + await searchMedicine(context, model); }, ), ], @@ -417,50 +345,25 @@ class _PrescriptionFormWidgetState extends State { ), if (myController.text != '') Container( - height: MediaQuery.of(context) - .size - .height * - 0.5, + height: MediaQuery.of(context).size.height * 0.5, child: ListView.builder( - padding: const EdgeInsets.only( - top: 20), + padding: const EdgeInsets.only(top: 20), scrollDirection: Axis.vertical, // shrinkWrap: true, - itemCount: - model.allMedicationList == - null - ? 0 - : model - .allMedicationList - .length, - itemBuilder: - (BuildContext context, - int index) { + itemCount: model.allMedicationList == null + ? 0 + : model.allMedicationList.length, + itemBuilder: (BuildContext context, int index) { return InkWell( child: MedicineItemWidget( - label: model - .allMedicationList[ - index] - .description - // url: model - // .pharmacyItemsList[ - // index]["ImageSRCUrl"], - ), + label: model.allMedicationList[index].description), onTap: () { - model.getItem( - itemID: model - .allMedicationList[ - index] - .itemId); - visbiltyPrescriptionForm = - true; + model.getItem(itemID: model.allMedicationList[index].itemId); + visbiltyPrescriptionForm = true; visbiltySearch = false; - _selectedMedication = - model.allMedicationList[ - index]; - uom = _selectedMedication - .uom; + _selectedMedication = model.allMedicationList[index]; + uom = _selectedMedication.uom; }, ); }, @@ -479,409 +382,134 @@ class _PrescriptionFormWidgetState extends State { child: Column( children: [ AppText( - _selectedMedication?.description ?? - "", + _selectedMedication?.description ?? "", bold: true, ), Container( child: Row( children: [ AppText( - TranslationBase.of(context) - .orderType, + TranslationBase.of(context).orderType, fontWeight: FontWeight.w600, ), Radio( - activeColor: - Color(0xFFB9382C), + activeColor: Color(0xFFB9382C), value: 1, groupValue: selectedType, onChanged: (value) { setSelectedType(value); }, ), - Text('Regular'), + Text(TranslationBase.of(context).regular), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( width: double.infinity, child: Row( children: [ Container( - color: Colors.white, - width: MediaQuery.of(context) - .size - .width * - 0.35, + width: MediaQuery.of(context).size.width * 0.35, child: AppTextFieldCustom( height: 40, - validationError: - strengthError, + validationError: strengthError, hintText: 'Strength', isTextFieldHasSuffix: false, enabled: true, - controller: - strengthController, + controller: strengthController, onChanged: (String value) { setState(() { - strengthChar = - value.length; + strengthChar = value.length; }); if (strengthChar >= 5) { - DrAppToastMsg - .showErrorToast( - TranslationBase.of( - context) - .only5DigitsAllowedForStrength, + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).only5DigitsAllowedForStrength, ); } }, - inputType: TextInputType - .numberWithOptions( + inputType: TextInputType.numberWithOptions( decimal: true, ), - // keyboardType: TextInputType - // .numberWithOptions( - // decimal: true, - // ), ), ), SizedBox( width: 5.0, ), - Container( - color: Colors.white, - width: MediaQuery.of(context) - .size - .width * - 0.560, - child: InkWell( - onTap: - model.itemMedicineListUnit != - null - ? () { - Helpers - .hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineListUnit, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState( - () { - units = - selectedValue; - units['isDefault'] = - true; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: - context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: AppTextFieldCustom( - hintText: 'Select', - isTextFieldHasSuffix: - true, - dropDownText: model - .itemMedicineListUnit - .length == - 1 - ? units = model - .itemMedicineListUnit[0] - ['description'] - : units != null - ? units['description'] - .toString() - : null, - validationError: - model.itemMedicineListUnit - .length != - 1 - ? unitError - : null, - enabled: false), - ), + PrescriptionTextFiled( + width: MediaQuery.of(context).size.width * 0.560, + element: units, + elementError: unitError, + keyName: 'description', + keyId: 'parameterCode', + hintText: 'Select', + elementList: model.itemMedicineListUnit, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + units['isDefault'] = true; + }); + }, ), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - //height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.itemMedicineListRoute != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineListRoute, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - route = - selectedValue; - route['isDefault'] = - true; - }); - if (route == - null) { - Helpers.showErrorToast( - 'plase fill'); - } - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: 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, - ), - ), - ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - //height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.itemMedicineList != null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineList, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - frequency = - selectedValue; - frequency[ - 'isDefault'] = - true; - if (_selectedMedication != null && - duration != - null && - frequency != - null && - strengthController - .text != - null) { - model.getBoxQuantity( - freq: frequency[ - 'parameterCode'], - duration: - duration[ - 'id'], - itemCode: - _selectedMedication - .itemId, - strength: - double.parse( - strengthController.text)); - - return; - } - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: AppTextFieldCustom( - isTextFieldHasSuffix: true, - hintText: - TranslationBase.of(context) - .frequency, - dropDownText: model - .itemMedicineList - .length == - 1 - ? model.itemMedicineList[0] - ['description'] - : frequency != null - ? frequency[ - 'description'] - : null, - validationError: model - .itemMedicineList - .length != - 1 - ? frequencyError - : null, - enabled: false, - ), - ), - ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - //height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.medicationDoseTimeList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .medicationDoseTimeList, - attributeName: - 'nameEn', - attributeValueId: - 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - doseTime = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: AppTextFieldCustom( - hintText: - TranslationBase.of(context) - .doseTime, - isTextFieldHasSuffix: true, - dropDownText: doseTime != null - ? doseTime['nameEn'] - : null, - //height: 45, - - enabled: false, - validationError: doseTimeError, - ), - ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + elementList: model.itemMedicineListRoute, + element: route, + elementError: routeError, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + route['isDefault'] = true; + }); + }, + hintText: TranslationBase.of(context).route, ), - SizedBox( - height: spaceBetweenTextFileds), - if (model - .patientAssessmentList.isNotEmpty) + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).frequency, + elementError: frequencyError, + element: frequencyError, + elementList: model.itemMedicineList, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + frequency['isDefault'] = true; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text)); + + return; + } + }); + }), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).doseTime, + elementError: doseTimeError, + element: doseTime, + elementList: model.medicationDoseTimeList, + keyId: 'id', + keyName: 'nameEn', + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }), + SizedBox(height: spaceBetweenTextFileds), + if (model.patientAssessmentList.isNotEmpty) Container( height: screenSize.height * 0.070, width: double.infinity, @@ -889,326 +517,121 @@ class _PrescriptionFormWidgetState extends State { child: Row( children: [ Container( - width: - MediaQuery.of(context) - .size - .width * - 0.29, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), - indication != - null - ? indication[ - 'name'] - : null, - false), - enabled: true, - readOnly: true, - ), + width: MediaQuery.of(context).size.width * 0.29, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].icdCode10ID.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, ), ), Container( - width: - MediaQuery.of(context) - .size - .width * - 0.65, + width: MediaQuery.of(context).size.width * 0.65, color: Colors.white, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - maxLines: 5, - decoration: - textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .asciiDesc - .toString(), - indication != - null - ? indication[ - 'name'] - : null, - false), - enabled: true, - readOnly: true, - ), + child: TextField( + maxLines: 5, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].asciiDesc.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, ), ), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( height: screenSize.height * 0.070, color: Colors.white, child: InkWell( - onTap: () => selectDate( - context, widget.model), + onTap: () => selectDate(context, widget.model), child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .date, - selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), enabled: false, ), ), ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - //height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.medicationDurationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .medicationDurationList, - attributeName: - 'nameEn', - attributeValueId: - 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - if (_selectedMedication != null && - duration != - null && - frequency != - null && - strengthController - .text != - null) { - model - .getBoxQuantity( - freq: frequency[ - 'parameterCode'], - duration: - duration[ - 'id'], - itemCode: - _selectedMedication - .itemId, - strength: double.parse( - strengthController - .text), - ); - box = model - .boxQuintity; + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + element: duration, + elementError: durationError, + hintText: TranslationBase.of(context).duration, + elementList: model.medicationDurationList, + keyName: 'nameEn', + keyId: 'id', + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text), + ); + box = model.boxQuintity; - return; - } - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: AppTextFieldCustom( - validationError: durationError, - isTextFieldHasSuffix: true, - dropDownText: duration != null - ? duration['nameEn'] - : null, - hintText: - TranslationBase.of(context) - .duration, - enabled: false, - ), - ), + return; + } + }); + }, ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, color: Colors.white, - child: InkWell( - onTap: model.allMedicationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - "UOM", - uom != null - ? uom - : null, - false), - //enabled: false, - readOnly: true, - ), + child: AppTextFieldCustom( + hintText: "UOM", + isTextFieldHasSuffix: false, + dropDownText: uom != null ? uom : null, + enabled: false, ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, color: Colors.white, - child: InkWell( - onTap: model.allMedicationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).boxQuantity, + isTextFieldHasSuffix: false, + dropDownText: box != null + ? TranslationBase.of(context).boxQuantity + + ": " + + model.boxQuintity.toString() : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .boxQuantity, - box != null - ? TranslationBase.of( - context) - .boxQuantity + - ": " + - model - .boxQuintity - .toString() - : null, - false), - //enabled: false, - readOnly: true, - ), + enabled: false, ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: - HexColor("#CCCCCC"))), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), child: Stack( children: [ TextFields( maxLines: 6, minLines: 4, - hintText: TranslationBase.of( - context) - .instruction, - controller: - instructionController, + hintText: TranslationBase.of(context).instruction, + controller: instructionController, //keyboardType: TextInputType.number, ), Positioned( - top: - 0, //MediaQuery.of(context).size.height * 0, + top: 0, right: 15, child: IconButton( icon: Icon( @@ -1217,28 +640,22 @@ class _PrescriptionFormWidgetState extends State { size: 35, ), onPressed: () { - initSpeechState().then( - (value) => - {onVoiceText()}); + initSpeechState().then((value) => {onVoiceText()}); }, ), ), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap( alignment: WrapAlignment.center, children: [ AppButton( color: Color(0xff359846), - title: TranslationBase.of( - context) - .addMedication, + title: TranslationBase.of(context).addMedication, fontWeight: FontWeight.w600, onPressed: () async { if (route != null && @@ -1247,41 +664,25 @@ class _PrescriptionFormWidgetState extends State { frequency != null && units != null && selectedDate != null && - strengthController - .text != - "") { - if (_selectedMedication - .isNarcotic == - true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .narcoticMedicineCanOnlyBePrescribedFromVida); + strengthController.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"); + 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"); + if (double.parse(strengthController.text) < 0.0) { + DrAppToastMsg.showErrorToast("strength can't be zero"); return; } - if (formKey.currentState - .validate()) { + if (formKey.currentState.validate()) { Navigator.pop(context); openDrugToDrug(model); { @@ -1370,52 +771,32 @@ class _PrescriptionFormWidgetState extends State { } else { setState(() { if (duration == null) { - durationError = - TranslationBase.of( - context) - .fieldRequired; + durationError = TranslationBase.of(context).fieldRequired; } else { durationError = null; } if (doseTime == null) { - doseTimeError = - TranslationBase.of( - context) - .fieldRequired; + doseTimeError = TranslationBase.of(context).fieldRequired; } else { doseTimeError = null; } if (route == null) { - routeError = - TranslationBase.of( - context) - .fieldRequired; + routeError = TranslationBase.of(context).fieldRequired; } else { routeError = null; } if (frequency == null) { - frequencyError = - TranslationBase.of( - context) - .fieldRequired; + frequencyError = TranslationBase.of(context).fieldRequired; } else { frequencyError = null; } if (units == null) { - unitError = - TranslationBase.of( - context) - .fieldRequired; + unitError = TranslationBase.of(context).fieldRequired; } else { unitError = null; } - if (strengthController - .text == - "") { - strengthError = - TranslationBase.of( - context) - .fieldRequired; + if (strengthController.text == "") { + strengthError = TranslationBase.of(context).fieldRequired; } else { strengthError = null; } @@ -1423,30 +804,6 @@ class _PrescriptionFormWidgetState extends State { } 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, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } }, ), ], @@ -1489,8 +846,7 @@ class _PrescriptionFormWidgetState extends State { } } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon suffixIcon}) { return InputDecoration( focusedBorder: OutlineInputBorder( @@ -1530,48 +886,6 @@ class _PrescriptionFormWidgetState extends State { ); } - InputDecoration textFieldSelectorDecorationStreangrh( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) - : null, - hintStyle: TextStyle( - fontSize: 13, - color: Color(0xff2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ), - hintText: selectedText == null || selectedText == "" ? hintText : null, - labelText: - selectedText != null && selectedText != "" ? '\n$selectedText' : null, - labelStyle: TextStyle( - fontSize: 15, - color: Color(0xff2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ), - ); - } - openDrugToDrug(model) { showModalBottomSheet( context: context, @@ -1583,9 +897,7 @@ class _PrescriptionFormWidgetState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - DrugToDrug( - widget.patient, - getPriscriptionforDrug(widget.prescriptionList, model), + DrugToDrug(widget.patient, getPriscriptionforDrug(widget.prescriptionList, model), model.patientAssessmentList), Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3), @@ -1594,37 +906,25 @@ class _PrescriptionFormWidgetState extends State { onPressed: () { Navigator.pop(context); - postProcedure( + postPrescription( icdCode: model.patientAssessmentList.isNotEmpty - ? model.patientAssessmentList[0].icdCode10ID - .isEmpty + ? model.patientAssessmentList[0].icdCode10ID.isEmpty ? "test" - : model.patientAssessmentList[0].icdCode10ID - .toString() + : 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() + ? 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, @@ -1632,36 +932,6 @@ class _PrescriptionFormWidgetState extends State { instruction: instructionController.text, doseTime: selectedDate, ); - - // postProcedure( - // icdCode: model.patientAssessmentList.isNotEmpty - // ? model.patientAssessmentList[0].icdCode10ID - // .isEmpty - // ? "test" - // : model.patientAssessmentList[0].icdCode10ID - // .toString() - // : "test", - // // icdCode: model - // // .patientAssessmentList - // // .map((value) => value - // // .icdCode10ID - // // .trim()) - // // .toList() - // // .join(' '), - // dose: strengthController.text, - // doseUnit: units['parameterCode'].toString(), - // patient: widget.patient, - // doseTimeIn: doseTime['id'].toString(), - // model: widget.model, - // duration: duration['id'].toString(), - // frequency: frequency['parameterCode'].toString(), - // route: route['parameterCode'].toString(), - // drugId: _selectedMedication.itemId.toString(), - // strength: strengthController.text, - // indication: indicationController.text, - // instruction: instructionController.text, - // doseTime: selectedDate, - // ); }, )) ], @@ -1673,17 +943,7 @@ class _PrescriptionFormWidgetState extends State { }); } - // selectedValue(itemMdeicationList,key){ - // // String selected = ""; - // // units[key]=itemMdeicationList.length==1? itemMdeicationList[0][key]:units[key].toString(); - // // - // // selected = units[key]; - // // - // // return selected; - // // } - - getPriscriptionforDrug( - List prescriptionList, MedicineViewModel model) { + getPriscriptionforDrug(List prescriptionList, MedicineViewModel model) { var prescriptionDetails = []; if (prescriptionList.length > 0) { prescriptionList[0].entityList.forEach((element) { @@ -1728,19 +988,10 @@ class _PrescriptionFormWidgetState extends State { searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); - // if (myController.text.isEmpty()) { - // Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); - // //"Type Medicine Name") - // return; - // } if (myController.text.length < 3) { Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); return; } - - //GifLoaderDialogUtils.showMyDialog(context); - await model.getMedicationList(drug: myController.text); - //GifLoaderDialogUtils.hideDialog(context); } } diff --git a/lib/screens/prescription/prescription_text_filed.dart b/lib/screens/prescription/prescription_text_filed.dart new file mode 100644 index 00000000..56020ca3 --- /dev/null +++ b/lib/screens/prescription/prescription_text_filed.dart @@ -0,0 +1,76 @@ +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.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/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionTextFiled extends StatefulWidget { + dynamic element; + final String elementError; + final List elementList; + final String keyName; + final String keyId; + final String hintText; + final double width; + final Function(dynamic) okFunction; + + PrescriptionTextFiled( + {Key key, + @required this.element, + @required this.elementError, + this.width, + this.elementList, + this.keyName, + this.keyId, + this.hintText, + this.okFunction}) + : super(key: key); + + @override + _PrescriptionTextFiledState createState() => _PrescriptionTextFiledState(); +} + +class _PrescriptionTextFiledState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: widget.width ?? null, + child: InkWell( + onTap: widget.elementList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: widget.elementList, + attributeName: '${widget.keyName}', + attributeValueId: '${widget.keyId}', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) => + widget.okFunction(selectedValue), + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: AppTextFieldCustom( + hintText: widget.hintText, + dropDownText: widget.elementList.length == 1 + ? widget.elementList[0]['${widget.keyName}'] + : widget.element != null + ? widget.element['${widget.keyName}'] + : null, + isTextFieldHasSuffix: true, + validationError: + widget.elementList.length != 1 ? widget.elementError : null, + enabled: false, + ), + ), + ); + } +} diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 9bfd9b49..81c8760f 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -1,5 +1,4 @@ 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/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; @@ -16,7 +15,6 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_ca import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { @override @@ -86,9 +84,7 @@ class PrescriptionsPage extends StatelessWidget { fontSize: 13, ), AppText( - TranslationBase - .of(context) - .prescriptions, + TranslationBase.of(context).prescriptions, bold: true, fontSize: 22, ), @@ -96,15 +92,14 @@ class PrescriptionsPage extends StatelessWidget { ), ), if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { addPrescriptionForm(context, model, patient, model.prescriptionList); }, - label: TranslationBase - .of(context) + label: TranslationBase.of(context) .applyForNewPrescriptionsOrder, ), ...List.generate( @@ -132,7 +127,7 @@ class PrescriptionsPage extends StatelessWidget { .clinicDescription, isPrescriptions: true, appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( + AppDateUtils.getDateTimeFromServerFormat( model.prescriptionsList[index] .appointmentDate, ), @@ -201,7 +196,7 @@ class PrescriptionsPage extends StatelessWidget { clinic: 'basheer', isPrescriptions: true, appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( + AppDateUtils.getDateTimeFromServerFormat( model.inPatientPrescription[index] .prescriptionDatetime, ), diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index fb68ab4e..9ce078ed 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -7,7 +7,7 @@ class AppDateUtils { return DateFormat(dateFormat).format(dateTime); } - static DateTime convertISOStringToDateTime(String date){ + static DateTime convertISOStringToDateTime(String date) { DateTime newDate; newDate = DateTime.parse(date); @@ -27,22 +27,20 @@ class AppDateUtils { } static DateTime getDateTimeFromServerFormat(String str) { - DateTime date= DateTime.now(); - if (str!=null) { + DateTime date = DateTime.now(); + if (str != null) { const start = "/Date("; const end = "+0300)"; - if(str.contains("/Date")){ - final startIndex = str.indexOf(start); + if (str.contains("/Date")) { + final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - } else { - date = DateTime.now(); - } + final endIndex = str.indexOf(end, startIndex + start.length); + date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); + } else { + date = DateTime.now(); + } } else { date = DateTime.parse(str); } @@ -50,8 +48,7 @@ class AppDateUtils { return date; } - static String differenceBetweenDateAndCurrentInYearMonthDay( - DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // now = now.add(Duration(days: 400, minutes: 0)); var difference = firstDate.difference(now); @@ -71,15 +68,13 @@ class AppDateUtils { return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}"; } - static String differenceBetweenDateAndCurrent( - DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // DateTime now = nows.add(Duration(days: 400, minutes: 25, hours: 0)); var difference = now.difference(firstDate); int minutesInDays = difference.inMinutes; - int hoursInDays = - minutesInDays ~/ 60; // ~/ : truncating division to make the result int + int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int int minutes = minutesInDays % 60; int days = hoursInDays ~/ 24; int hours = hoursInDays % 24; @@ -89,8 +84,7 @@ class AppDateUtils { return "$days ${TranslationBase.of(context).days}, $hours ${TranslationBase.of(context).hr}, $minutes ${TranslationBase.of(context).min}"; } - static String differenceBetweenServerDateAndCurrent( - String str, BuildContext context) { + static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) { const start = "/Date("; const end = "+0300)"; @@ -99,8 +93,7 @@ class AppDateUtils { final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); + var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); return differenceBetweenDateAndCurrent(date, context); } @@ -246,7 +239,10 @@ class AppDateUtils { final startIndex = date.indexOf(start); final endIndex = date.indexOf(end, startIndex + start.length); DateTime newDate = DateTime.fromMillisecondsSinceEpoch( - int.parse(date.substring(startIndex + start.length, endIndex),),); + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + ); return newDate; } else return DateTime.now(); @@ -256,35 +252,30 @@ class AppDateUtils { /// [dateTime] convert DateTime to data formatted Arabic static String getMonthDayYearDateFormattedAr(DateTime dateTime) { if (dateTime != null) - return getMonthArabic(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted - static String getMonthDayYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return isArabic + ? getMonthArabic(dateTime.month) + : getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } /// get data formatted like 26 Apr 2020 /// [dateTime] convert DateTime to data formatted - static String getDayMonthYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return dateTime.day.toString()+" "+ "${isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) }"+ + return dateTime.day.toString() + + " " + + "${isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month)}" + " " + - dateTime.year.toString(); else return ""; @@ -292,9 +283,9 @@ class AppDateUtils { /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted - static String getDayMonthYearDate(DateTime dateTime,{bool isArabic = false}) { + static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return dateTime.day.toString()+"/"+ "${dateTime.month}"+ "/" + dateTime.year.toString(); + return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString(); else return ""; } @@ -302,15 +293,15 @@ class AppDateUtils { /// get data formatted like 10:45 PM /// [dateTime] convert DateTime to data formatted static String getHour(DateTime dateTime) { - return DateFormat('hh:mm a').format(dateTime); + return DateFormat('hh:mm a').format(dateTime); } - static String getAgeByBirthday(String birthOfDate, BuildContext context, { bool isServerFormat = true}) { + static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) { // https://leechy.dev/calculate-dates-diff-in-dart DateTime birthDate; - if(birthOfDate.contains("/Date")) { + if (birthOfDate.contains("/Date")) { birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate); - }else{ + } else { birthDate = DateTime.parse(birthOfDate); } final now = DateTime.now(); @@ -328,24 +319,18 @@ class AppDateUtils { return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; } - static bool isToday(DateTime dateTime){ - + static bool isToday(DateTime dateTime) { DateTime todayDate = DateTime.now().toUtc(); - if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { + if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { return true; } return false; - } static String getDate(DateTime dateTime) { print(dateTime); if (dateTime != null) - return getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - "," + - dateTime.year.toString(); + return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString(); else return ""; } @@ -353,28 +338,23 @@ class AppDateUtils { static String getDateFormatted(DateTime dateTime) { print(dateTime); if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString(); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString(); else return ""; } - static String getTimeHHMMA(DateTime dateTime){ + static String getTimeHHMMA(DateTime dateTime) { return DateFormat('hh:mm a').format(dateTime); } - static String getTimeHHMMA2 (DateTime dateTime){ + static String getTimeHHMMA2(DateTime dateTime) { return DateFormat('hh:mm').format(dateTime); } - static String getStartTime(String dateTime){ - String time=dateTime; + static String getStartTime(String dateTime) { + String time = dateTime; - if(dateTime.length>7) - time = dateTime.substring(0,5); + if (dateTime.length > 7) time = dateTime.substring(0, 5); return time; } diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index 7e13f411..fc7df189 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -105,37 +105,36 @@ class _AppTextFieldCustomState extends State { ? widget.height - 22 : null, child: TextField( - textAlign: projectViewModel.isArabic - ? TextAlign.right - : TextAlign.left, - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - widget.hintText, null, true), - style: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.7, - fontFamily: 'Poppins', - color: Color(0xFF575757), - ), - controller: widget.controller, - keyboardType: widget.inputType ?? - (widget.maxLines == 1 - ? TextInputType.text - : TextInputType.multiline), - enabled: widget.enabled, - minLines: widget.minLines, - maxLines: widget.maxLines, - inputFormatters: - widget.inputFormatters != null - ? widget.inputFormatters - : [], - onChanged: (value) { - setState(() {}); - if (widget.onChanged != null) { - widget.onChanged(value); - } - }, - obscureText: widget.isSecure - ), + textAlign: projectViewModel.isArabic + ? TextAlign.right + : TextAlign.left, + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + widget.hintText, null, true), + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + fontFamily: 'Poppins', + color: Color(0xFF575757), + ), + controller: widget.controller, + keyboardType: widget.inputType ?? + (widget.maxLines == 1 + ? TextInputType.text + : TextInputType.multiline), + enabled: widget.enabled, + minLines: widget.minLines, + maxLines: widget.maxLines, + inputFormatters: + widget.inputFormatters != null + ? widget.inputFormatters + : [], + onChanged: (value) { + setState(() {}); + if (widget.onChanged != null) { + widget.onChanged(value); + } + }, + obscureText: widget.isSecure), ) : AppText( widget.dropDownText, diff --git a/lib/widgets/shared/text_fields/text_field_error.dart b/lib/widgets/shared/text_fields/text_field_error.dart index ee22a6a4..9c781db0 100644 --- a/lib/widgets/shared/text_fields/text_field_error.dart +++ b/lib/widgets/shared/text_fields/text_field_error.dart @@ -7,12 +7,11 @@ import '../app_texts_widget.dart'; class TextFieldsError extends StatelessWidget { const TextFieldsError({ Key key, - @required this.error, + @required this.error, }) : super(key: key); final String error; - @override Widget build(BuildContext context) { return Container( @@ -27,12 +26,14 @@ class TextFieldsError extends StatelessWidget { SizedBox( width: 12, ), - AppText( - error, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.red.shade700, - fontWeight: FontWeight.w700, + Expanded( + child: AppText( + error, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.red.shade700, + fontWeight: FontWeight.w700, + ), ), ], ), From 13fb50f9be283a1c3a2cb3abea3fe0744b476e0a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 30 May 2021 14:59:13 +0300 Subject: [PATCH 02/12] prescription refactoring --- lib/screens/prescription/add_prescription_form.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 894d7c33..3fd1fbb3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -145,13 +145,10 @@ class _PrescriptionFormWidgetState extends State { dynamic box; dynamic x; - List indicationList; - @override void initState() { super.initState(); selectedType = 1; - indicationList = List(); } setSelectedType(int val) { @@ -348,9 +345,7 @@ class _PrescriptionFormWidgetState extends State { height: MediaQuery.of(context).size.height * 0.5, child: ListView.builder( padding: const EdgeInsets.only(top: 20), - scrollDirection: Axis.vertical, - // shrinkWrap: true, itemCount: model.allMedicationList == null ? 0 : model.allMedicationList.length, From c82a4a05d548df090eb91bee7a4edb941bb8e4e8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 31 May 2021 10:36:44 +0300 Subject: [PATCH 03/12] medical report design changes --- .../MedicalReport/MeidcalReportModel.dart | 20 +++++ .../medical_report/MedicalReportPage.dart | 76 ++++++++++++------- lib/widgets/patients/PatientCard.dart | 29 +++++++ 3 files changed, 96 insertions(+), 29 deletions(-) diff --git a/lib/models/patient/MedicalReport/MeidcalReportModel.dart b/lib/models/patient/MedicalReport/MeidcalReportModel.dart index 473140d1..1acbc1b4 100644 --- a/lib/models/patient/MedicalReport/MeidcalReportModel.dart +++ b/lib/models/patient/MedicalReport/MeidcalReportModel.dart @@ -2,6 +2,8 @@ class MedicalReportModel { String reportData; String setupID; int projectID; + String projectName; + String projectNameN; int patientID; String invoiceNo; int status; @@ -19,12 +21,17 @@ class MedicalReportModel { String doctorImageURL; String doctorName; String doctorNameN; + int clinicID; + String clinicName; + String clinicNameN; String reportDataHtml; MedicalReportModel( {this.reportData, this.setupID, this.projectID, + this.projectName, + this.projectNameN, this.patientID, this.invoiceNo, this.status, @@ -42,12 +49,17 @@ class MedicalReportModel { this.doctorImageURL, this.doctorName, this.doctorNameN, + this.clinicID, + this.clinicName, + this.clinicNameN, this.reportDataHtml}); MedicalReportModel.fromJson(Map json) { reportData = json['ReportData']; setupID = json['SetupID']; projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; patientID = json['PatientID']; invoiceNo = json['InvoiceNo']; status = json['Status']; @@ -65,6 +77,9 @@ class MedicalReportModel { doctorImageURL = json['DoctorImageURL']; doctorName = json['DoctorName']; doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + clinicNameN = json['ClinicNameN']; reportDataHtml = json['ReportDataHtml']; } @@ -73,6 +88,8 @@ class MedicalReportModel { data['ReportData'] = this.reportData; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; data['PatientID'] = this.patientID; data['InvoiceNo'] = this.invoiceNo; data['Status'] = this.status; @@ -90,6 +107,9 @@ class MedicalReportModel { data['DoctorImageURL'] = this.doctorImageURL; data['DoctorName'] = this.doctorName; data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['ClinicNameN'] = this.clinicNameN; data['ReportDataHtml'] = this.reportDataHtml; return data; } diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 746068ad..e2da651b 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -89,17 +89,15 @@ class MedicalReportPage extends StatelessWidget { ...List.generate( model.medicalReportList.length, (index) => InkWell( - onTap: (){ - if (model.medicalReportList[index].status == - 1) { + onTap: () { + if (model.medicalReportList[index].status == 1) { Navigator.of(context).pushNamed( PATIENT_MEDICAL_REPORT_DETAIL, arguments: { 'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, - 'medicalReport': - model.medicalReportList[index] + 'medicalReport': model.medicalReportList[index] }); } else { Navigator.of(context).pushNamed( @@ -109,8 +107,7 @@ class MedicalReportPage extends StatelessWidget { 'patientType': patientType, 'arrivalType': arrivalType, 'type': MedicalReportStatus.ADD, - 'medicalReport': - model.medicalReportList[index] + 'medicalReport': model.medicalReportList[index] }); } }, @@ -132,12 +129,13 @@ class MedicalReportPage extends StatelessWidget { AppText( model.medicalReportList[index].status == 1 ? TranslationBase.of(context).onHold - : TranslationBase.of(context).verified, - color: - model.medicalReportList[index].status == - 1 - ? Colors.red[700] - : Colors.green[700], + : TranslationBase.of(context) + .verified, + color: model.medicalReportList[index] + .status == + 1 + ? Colors.red[700] + : Colors.green[700], fontSize: 1.4 * SizeConfig.textMultiplier, bold: true, ), @@ -173,37 +171,55 @@ class MedicalReportPage extends StatelessWidget { ], ), Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( margin: EdgeInsets.only( left: 0, top: 4, right: 8, bottom: 0), child: LargeAvatar( name: projectViewModel.isArabic - ? model - .medicalReportList[index].doctorNameN - : model - .medicalReportList[index].doctorName, - url: model - .medicalReportList[index].doctorImageURL, + ? model.medicalReportList[index] + .doctorNameN + : model.medicalReportList[index] + .doctorName, + url: model.medicalReportList[index] + .doctorImageURL, ), width: 50, height: 50, ), Expanded( child: Container( - height: 50, - child: AppText( - TranslationBase.of(context).showDetail, - fontSize: 1.4 * SizeConfig.textMultiplier, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index] + .projectNameN + : model.medicalReportList[index] + .projectName, + fontSize: + 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index] + .clinicNameN + : model.medicalReportList[index] + .clinicName, + fontSize: + 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + ], ), ), - // child: Html( - // data: model.medicalReportList[index] - // .reportDataHtml ?? - // ""), ), Container( + height: 50, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -224,7 +240,9 @@ class MedicalReportPage extends StatelessWidget { ), ), ), - SizedBox(height: 15,) + SizedBox( + height: 15, + ) ], ), ), diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index 45445bbf..2174e6d5 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -440,6 +440,35 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w700, fontSize: 13)), ]))), + if (isFromLiveCare) + Column( + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: + TranslationBase.of(context).clinic + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + patientInfo.clinicName, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ], + ), + ), + ), + ], + ), ])) ]), isFromLiveCare From dc6cbdd1889b4114389c4aede5c6b017b2c8db68 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 31 May 2021 16:44:05 +0300 Subject: [PATCH 04/12] Add ChangeCallStatus services --- .../Service/SessionStatusAPI.java | 15 -- .../ui/VideoCallContract.java | 18 --- .../main/kotlin/com/hmg/hmgDr/MainActivity.kt | 6 +- .../Model/ChangeCallStatusRequestModel.java | 137 ++++++++++++++++++ .../hmgDr}/Model/GetSessionStatusModel.java | 2 +- .../hmg/hmgDr}/Model/SessionStatusModel.java | 2 +- .../com/hmg/hmgDr}/Service/AppRetrofit.java | 2 +- .../hmg/hmgDr/Service/SessionStatusAPI.java | 19 +++ .../com/hmg/hmgDr}/ui/VideoCallActivity.java | 14 +- .../com/hmg/hmgDr/ui/VideoCallContract.java | 24 +++ .../hmg/hmgDr}/ui/VideoCallPresenterImpl.java | 32 +++- 11 files changed, 224 insertions(+), 47 deletions(-) delete mode 100644 android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java delete mode 100644 android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Model/GetSessionStatusModel.java (98%) rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Model/SessionStatusModel.java (98%) rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Service/AppRetrofit.java (97%) create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/ui/VideoCallActivity.java (95%) create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/ui/VideoCallPresenterImpl.java (56%) diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java b/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java deleted file mode 100644 index fbc8d1d3..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.doctor_app_flutter.Service; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - - -import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.POST; - -public interface SessionStatusAPI { - - @POST("LiveCareApi/DoctorApp/GetSessionStatus") - Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); -} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java b/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java deleted file mode 100644 index 21122239..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.doctor_app_flutter.ui; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - -public interface VideoCallContract { - - interface VideoCallView{ - - void onCallSuccessful(SessionStatusModel sessionStatusModel); - void onFailure(); - } - - interface VideoCallPresenter { - - void callClintConnected(GetSessionStatusModel statusModel); - } -} diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt index aed21dd3..612118c9 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt @@ -3,9 +3,9 @@ package com.hmg.hmgDr import android.app.Activity import android.content.Intent import androidx.annotation.NonNull -import com.example.doctor_app_flutter.Model.GetSessionStatusModel -import com.example.doctor_app_flutter.Model.SessionStatusModel -import com.example.doctor_app_flutter.ui.VideoCallActivity +import com.hmg.hmgDr.Model.GetSessionStatusModel +import com.hmg.hmgDr.Model.SessionStatusModel +import com.hmg.hmgDr.ui.VideoCallActivity import com.google.gson.GsonBuilder import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java new file mode 100644 index 00000000..5fcdb611 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java @@ -0,0 +1,137 @@ +package com.hmg.hmgDr.Model; + + +import android.os.Parcel; +import android.os.Parcelable; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + + +public class ChangeCallStatusRequestModel implements Parcelable { + + @SerializedName("CallStatus") + @Expose + private Integer callStatus; + @SerializedName("DoctorId") + @Expose + private Integer doctorId; + @SerializedName("generalid") + @Expose + private String generalid; + @SerializedName("TokenID") + @Expose + private String tokenID; + @SerializedName("VC_ID") + @Expose + private Integer vcId; + + public ChangeCallStatusRequestModel(Integer callStatus, Integer doctorId, String generalid, String tokenID, Integer vcId) { + this.callStatus = callStatus; + this.doctorId = doctorId; + this.generalid = generalid; + this.tokenID = tokenID; + this.vcId = vcId; + } + + protected ChangeCallStatusRequestModel(Parcel in) { + if (in.readByte() == 0) { + callStatus = null; + } else { + callStatus = in.readInt(); + } + if (in.readByte() == 0) { + doctorId = null; + } else { + doctorId = in.readInt(); + } + generalid = in.readString(); + tokenID = in.readString(); + if (in.readByte() == 0) { + vcId = null; + } else { + vcId = in.readInt(); + } + } + + public static final Creator CREATOR = new Creator() { + @Override + public ChangeCallStatusRequestModel createFromParcel(Parcel in) { + return new ChangeCallStatusRequestModel(in); + } + + @Override + public ChangeCallStatusRequestModel[] newArray(int size) { + return new ChangeCallStatusRequestModel[size]; + } + }; + + public Integer getCallStatus() { + return callStatus; + } + + public void setCallStatus(Integer callStatus) { + this.callStatus = callStatus; + } + + public Integer getDoctorId() { + return doctorId; + } + + public void setDoctorId(Integer doctorId) { + this.doctorId = doctorId; + } + + public String getGeneralid() { + return generalid; + } + + public void setGeneralid(String generalid) { + this.generalid = generalid; + } + + public String getTokenID() { + return tokenID; + } + + public void setTokenID(String tokenID) { + this.tokenID = tokenID; + } + + public Integer getVcId() { + return vcId; + } + + public void setVcId(Integer vcId) { + this.vcId = vcId; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + if (callStatus == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(callStatus); + } + if (doctorId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(doctorId); + } + dest.writeString(generalid); + dest.writeString(tokenID); + if (vcId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(vcId); + } + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java index 8f83b7b9..d41aa146 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java index da6bba1d..51b0b1ee 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java similarity index 97% rename from android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java index 6646bd6f..9ca9abc1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Service; +package com.hmg.hmgDr.Service; import android.app.Activity; import android.app.Application; diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java new file mode 100644 index 00000000..e507650e --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java @@ -0,0 +1,19 @@ +package com.hmg.hmgDr.Service; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + + +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface SessionStatusAPI { + + @POST("LiveCareApi/DoctorApp/GetSessionStatus") + Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); + + @POST("LiveCareApi/DoctorApp/ChangeCallStatus") + Call changeCallStatus(@Body ChangeCallStatusRequestModel changeCallStatusRequestModel); +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java similarity index 95% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java index 0b6adadb..e196e7f1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -20,8 +20,9 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; import com.hmg.hmgDr.R; import com.opentok.android.Session; import com.opentok.android.Stream; @@ -277,6 +278,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } isConnected = true; subscribeToStream(stream); + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(3,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); } @Override @@ -369,6 +371,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi if (countDownTimer != null) { countDownTimer.cancel(); } + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(16,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); finish(); } @@ -423,6 +426,11 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } } + @Override + public void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel) { + + } + @Override public void onFailure() { diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java new file mode 100644 index 00000000..2b099551 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java @@ -0,0 +1,24 @@ +package com.hmg.hmgDr.ui; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + +public interface VideoCallContract { + + interface VideoCallView { + + void onCallSuccessful(SessionStatusModel sessionStatusModel); + + void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel); + + void onFailure(); + } + + interface VideoCallPresenter { + + void callClintConnected(GetSessionStatusModel statusModel); + + void callChangeCallStatus(ChangeCallStatusRequestModel statusModel); + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java similarity index 56% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java index 363d1ca8..ea2128ba 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java @@ -1,9 +1,10 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; -import com.example.doctor_app_flutter.Service.AppRetrofit; -import com.example.doctor_app_flutter.Service.SessionStatusAPI; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; +import com.hmg.hmgDr.Service.AppRetrofit; +import com.hmg.hmgDr.Service.SessionStatusAPI; import org.jetbrains.annotations.NotNull; @@ -46,4 +47,25 @@ public class VideoCallPresenterImpl implements VideoCallContract.VideoCallPresen }); } + + @Override + public void callChangeCallStatus(ChangeCallStatusRequestModel statusModel) { + sessionStatusAPI = AppRetrofit.getRetrofit(baseUrl).create(SessionStatusAPI.class); + + Call call = sessionStatusAPI.changeCallStatus(statusModel); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) { + if (!response.isSuccessful()) + view.onFailure(); + + } + + @Override + public void onFailure(@NotNull Call call, @NotNull Throwable t) { + view.onFailure(); + } + }); + } } From 519e6f2fec046bb2cfe07d81dc5a1c2cdf894daa Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 1 Jun 2021 12:51:50 +0300 Subject: [PATCH 05/12] Prescription favourite templates --- lib/core/viewModel/medicine_view_model.dart | 75 +- lib/core/viewModel/procedure_View_model.dart | 136 +--- .../add_favourite_prescription.dart | 119 +++ .../prescription/add_prescription_form.dart | 4 +- .../prescription_checkout_screen.dart | 760 ++++++++++++++++++ .../prescription_home_screen.dart | 203 +++++ .../prescription/prescriptions_page.dart | 77 +- .../procedures/ExpansionProcedure.dart | 118 +-- .../procedures/entity_list_fav_procedure.dart | 38 +- 9 files changed, 1292 insertions(+), 238 deletions(-) create mode 100644 lib/screens/prescription/add_favourite_prescription.dart create mode 100644 lib/screens/prescription/prescription_checkout_screen.dart create mode 100644 lib/screens/prescription/prescription_home_screen.dart diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index d49b8cc3..8ccf1a70 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/medicine_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; @@ -11,9 +13,12 @@ import '../../locator.dart'; import 'base_view_model.dart'; class MedicineViewModel extends BaseViewModel { + bool hasError = false; MedicineService _medicineService = locator(); + ProcedureService _procedureService = locator(); PrescriptionService _prescriptionService = locator(); - + List get procedureTemplate => _procedureService.templateList; + List templateList = List(); get pharmacyItemsList => _medicineService.pharmacyItemsList; get searchText => _medicineService.searchText; get pharmaciesList => _medicineService.pharmaciesList; @@ -27,20 +32,15 @@ class MedicineViewModel extends BaseViewModel { get medicationFrequencyList => _prescriptionService.medicationFrequencyList; get boxQuintity => _prescriptionService.boxQuantity; - get medicationIndicationsList => - _prescriptionService.medicationIndicationsList; + get medicationIndicationsList => _prescriptionService.medicationIndicationsList; get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; - List get patientAssessmentList => - _prescriptionService.patientAssessmentList; + List get patientAssessmentList => _prescriptionService.patientAssessmentList; - List get allMedicationList => - _prescriptionService.allMedicationList; + List get allMedicationList => _prescriptionService.allMedicationList; List get itemMedicineList => _prescriptionService.itemMedicineList; - List get itemMedicineListRoute => - _prescriptionService.itemMedicineListRoute; - List get itemMedicineListUnit => - _prescriptionService.itemMedicineListUnit; + List get itemMedicineListRoute => _prescriptionService.itemMedicineListRoute; + List get itemMedicineListUnit => _prescriptionService.itemMedicineListUnit; Future getItem({int itemID}) async { //hasError = false; @@ -54,6 +54,35 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + setTemplateListDependOnId() { + procedureTemplate.forEach((element) { + List templateListData = + templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); + + if (templateListData.length != 0) { + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); + } else { + var template = ProcedureTempleteDetailsModelList( + templateName: element.templateName, templateId: element.templateID, template: element); + if (!templateList.contains(template)) templateList.add(template); + } + }); + print(templateList.length.toString()); + } + + Future getProcedureTemplate({String categoryID}) async { + hasError = false; + setState(ViewState.Busy); + await _procedureService.getProcedureTemplate(categoryID: categoryID); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + setTemplateListDependOnId(); + setState(ViewState.Idle); + } + } + Future getPrescription({int mrn}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); @@ -86,8 +115,7 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientAssessment( - GetAssessmentReqModel getAssessmentReqModel) async { + Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel) async { setState(ViewState.Busy); await _prescriptionService.getPatientAssessment(getAssessmentReqModel); if (_prescriptionService.hasError) { @@ -99,8 +127,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationStrength() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationStrength); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationStrength); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -110,8 +137,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationRoute() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationRoute); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationRoute); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -121,8 +147,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationIndications() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationIndications); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationIndications); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -132,8 +157,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationDoseTime() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDoseTime); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDoseTime); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -143,8 +167,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationFrequency() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationFrequency); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationFrequency); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -154,8 +177,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationDuration() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDuration); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDuration); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -163,8 +185,7 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getBoxQuantity( - {int itemCode, int duration, double strength, int freq}) async { + Future getBoxQuantity({int itemCode, int duration, double strength, int freq}) async { setState(ViewState.Busy); await _prescriptionService.calculateBoxQuantity( strength: strength, itemCode: itemCode, duration: duration, freq: freq); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index ad62158e..cb3a2a7e 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -28,14 +28,11 @@ class ProcedureViewModel extends BaseViewModel { bool hasError = false; ProcedureService _procedureService = locator(); - List get procedureList => - _procedureService.procedureList; + List get procedureList => _procedureService.procedureList; - List get valadteProcedureList => - _procedureService.valadteProcedureList; + List get valadteProcedureList => _procedureService.valadteProcedureList; - List get categoriesList => - _procedureService.categoriesList; + List get categoriesList => _procedureService.categoriesList; List get categoryList => _procedureService.categoryList; RadiologyService _radiologyService = locator(); @@ -44,25 +41,18 @@ class ProcedureViewModel extends BaseViewModel { List _finalRadiologyListHospital = List(); List get finalRadiologyList => - filterType == FilterType.Clinic - ? _finalRadiologyListClinic - : _finalRadiologyListHospital; + filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital; - List get radiologyList => - _radiologyService.finalRadiologyList; + List get radiologyList => _radiologyService.finalRadiologyList; - List get patientLabOrdersList => - _labsService.patientLabOrdersList; + List get patientLabOrdersList => _labsService.patientLabOrdersList; - List get labOrdersResultsList => - _labsService.labOrdersResultsList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; - List get procedureTemplate => - _procedureService.templateList; + List get procedureTemplate => _procedureService.templateList; List templateList = List(); - List get procedureTemplateDetails => - _procedureService.templateDetailsList; + List get procedureTemplateDetails => _procedureService.templateDetailsList; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -88,7 +78,7 @@ class ProcedureViewModel extends BaseViewModel { hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, categoryID: categoryID,patientId: patientId); + categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -123,22 +113,15 @@ class ProcedureViewModel extends BaseViewModel { setTemplateListDependOnId() { procedureTemplate.forEach((element) { - List templateListData = templateList - .where((elementTemplate) => - elementTemplate.templateId == element.templateID) - .toList(); + List templateListData = + templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); if (templateListData.length != 0) { - templateList[templateList.indexOf(templateListData[0])] - .procedureTemplate - .add(element); + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); } else { var template = ProcedureTempleteDetailsModelList( - templateName: element.templateName, - templateId: element.templateID, - template: element); - if(!templateList.contains(template)) - templateList.add(template); + templateName: element.templateName, templateId: element.templateID, template: element); + if (!templateList.contains(template)) templateList.add(template); } }); print(templateList.length.toString()); @@ -159,8 +142,7 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProcedure( - PostProcedureReqModel postProcedureReqModel, int mrn) async { + Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -174,8 +156,7 @@ class ProcedureViewModel extends BaseViewModel { } } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -188,9 +169,7 @@ class ProcedureViewModel extends BaseViewModel { } } - Future updateProcedure( - {UpdateProcedureRequestModel updateProcedureRequestModel, - int mrn}) async { + Future updateProcedure({UpdateProcedureRequestModel updateProcedureRequestModel, int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -203,11 +182,9 @@ class ProcedureViewModel extends BaseViewModel { //await getProcedure(mrn: mrn); } - void getPatientRadOrders(PatiantInformtion patient, - {String patientType, bool isInPatient = false}) async { + void getPatientRadOrders(PatiantInformtion patient, {String patientType, bool isInPatient = false}) async { setState(ViewState.Busy); - await _radiologyService.getPatientRadOrders(patient, - isInPatient: isInPatient); + await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient); if (_radiologyService.hasError) { error = _radiologyService.error; if (patientType == "7") @@ -216,39 +193,32 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else { _radiologyService.finalRadiologyList.forEach((element) { - List finalRadiologyListClinic = - _finalRadiologyListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + List finalRadiologyListClinic = _finalRadiologyListClinic + .where((elementClinic) => elementClinic.filterName == element.clinicDescription) + .toList(); if (finalRadiologyListClinic.length != 0) { - _finalRadiologyListClinic[ - finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] + _finalRadiologyListClinic[finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] .finalRadiologyList .add(element); } else { - _finalRadiologyListClinic.add(FinalRadiologyList( - filterName: element.clinicDescription, finalRadiology: element)); + _finalRadiologyListClinic + .add(FinalRadiologyList(filterName: element.clinicDescription, finalRadiology: element)); } // FinalRadiologyList list sort via project - List finalRadiologyListHospital = - _finalRadiologyListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List finalRadiologyListHospital = _finalRadiologyListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (finalRadiologyListHospital.length != 0) { - _finalRadiologyListHospital[finalRadiologyListHospital - .indexOf(finalRadiologyListHospital[0])] + _finalRadiologyListHospital[finalRadiologyListHospital.indexOf(finalRadiologyListHospital[0])] .finalRadiologyList .add(element); } else { - _finalRadiologyListHospital.add(FinalRadiologyList( - filterName: element.projectName, finalRadiology: element)); + _finalRadiologyListHospital.add(FinalRadiologyList(filterName: element.projectName, finalRadiology: element)); } }); @@ -258,17 +228,10 @@ class ProcedureViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async { setState(ViewState.Busy); await _radiologyService.getRadImageURL( - invoiceNo: invoiceNo, - lineItem: lineItem, - projectId: projectId, - patient: patient); + invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); @@ -281,8 +244,7 @@ class ProcedureViewModel extends BaseViewModel { notifyListeners(); } - List get patientLabSpecialResult => - _labsService.patientLabSpecialResult; + List get patientLabSpecialResult => _labsService.patientLabSpecialResult; List get labResultList => _labsService.labResultList; @@ -304,18 +266,10 @@ class ProcedureViewModel extends BaseViewModel { } getLaboratoryResult( - {String projectID, - int clinicID, - String invoiceNo, - String orderNo, - PatiantInformtion patient}) async { + {String projectID, int clinicID, String invoiceNo, String orderNo, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getLaboratoryResult( - invoiceNo: invoiceNo, - orderNo: orderNo, - projectID: projectID, - clinicID: clinicID, - patient: patient); + invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -324,15 +278,10 @@ class ProcedureViewModel extends BaseViewModel { } } - getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: procedure, - patient: patient); + patientLabOrder: patientLabOrder, procedure: procedure, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -340,9 +289,8 @@ class ProcedureViewModel extends BaseViewModel { bool isShouldClear = false; if (_labsService.labOrdersResultsList.length == 1) { labOrdersResultsList.forEach((element) { - if (element.resultValue.contains('/') || - element.resultValue.contains('*') || - element.resultValue.isEmpty) isShouldClear = true; + if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty) + isShouldClear = true; }); } if (isShouldClear) _labsService.labOrdersResultsList.clear(); diff --git a/lib/screens/prescription/add_favourite_prescription.dart b/lib/screens/prescription/add_favourite_prescription.dart new file mode 100644 index 00000000..7dad10dd --- /dev/null +++ b/lib/screens/prescription/add_favourite_prescription.dart @@ -0,0 +1,119 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class AddFavPrescription extends StatefulWidget { + final PrescriptionViewModel model; + final PatiantInformtion patient; + final String categoryID; + + const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) : super(key: key); + + @override + _AddFavPrescriptionState createState() => _AddFavPrescriptionState(); +} + +class _AddFavPrescriptionState extends State { + MedicineViewModel model; + PatiantInformtion patient; + + List entityList = List(); + ProcedureTempleteDetailsModel groupProcedures; + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.categoryID), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( + isShowAppBar: false, + baseViewModel: model, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + if (model.templateList.length != 0) + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchFavProceduresWidget( + isProcedure: false, + model: model, + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + isEntityFavListSelected: (master) => isEntityListSelected(master), + groupProcedures: groupProcedures, + selectProcedures: (valasd) { + setState(() { + groupProcedures = valasd; + }); + }, + ), + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'Add Prescription', + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + if (groupProcedures == null) { + DrAppToastMsg.showErrorToast( + 'Please Select item ', + ); + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionCheckOutScreen( + patient: widget.patient, + model: widget.model, + groupProcedures: groupProcedures, + ), + ), + ); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { + Iterable history = entityList.where( + (element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); + if (history.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 3fd1fbb3..797d0255 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -261,7 +261,7 @@ class _PrescriptionFormWidgetState extends State { Column( children: [ SizedBox( - height: 15, + height: 60, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -468,7 +468,7 @@ class _PrescriptionFormWidgetState extends State { PrescriptionTextFiled( hintText: TranslationBase.of(context).frequency, elementError: frequencyError, - element: frequencyError, + element: frequency, elementList: model.itemMedicineList, keyId: 'parameterCode', keyName: 'description', diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart new file mode 100644 index 00000000..78c78590 --- /dev/null +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -0,0 +1,760 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/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/procedure/procedure_template_details_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/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'; +import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/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/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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; + +class PrescriptionCheckOutScreen extends StatefulWidget { + final PrescriptionViewModel model; + final PatiantInformtion patient; + final List prescriptionList; + final ProcedureTempleteDetailsModel groupProcedures; + + const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures}) + : super(key: key); + + @override + _PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState(); +} + +class _PrescriptionCheckOutScreenState extends State { + postPrescription( + {String duration, + String doseTimeIn, + String dose, + String drugId, + String strength, + String route, + String frequency, + String indication, + String instruction, + PrescriptionViewModel model, + DateTime doseTime, + String doseUnit, + String icdCode, + PatiantInformtion patient, + String patientType}) async { + PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + List prescriptionList = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.clinicID = patient.clinicId; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + prescriptionList.add(PrescriptionRequestModel( + covered: true, + dose: double.parse(dose), + itemId: drugId.isEmpty ? 1 : int.parse(drugId), + doseUnitId: int.parse(doseUnit), + route: route.isEmpty ? 1 : int.parse(route), + frequency: frequency.isEmpty ? 1 : int.parse(frequency), + remarks: instruction, + approvalRequired: true, + icdcode10Id: icdCode.toString(), + doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), + duration: duration.isEmpty ? 1 : int.parse(duration), + doseStartDate: doseTime.toIso8601String())); + postProcedureReqModel.prescriptionRequestModel = prescriptionList; + await model.postPrescription(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + model.getPrescriptions(patient); + DrAppToastMsg.showSuccesToast('Medication has been added'); + } + } + + String routeError; + String frequencyError; + String doseTimeError; + String durationError; + String unitError; + String strengthError; + + int selectedType; + + TextEditingController strengthController = TextEditingController(); + TextEditingController indicationController = TextEditingController(); + TextEditingController instructionController = TextEditingController(); + + bool visbiltyPrescriptionForm = true; + bool visbiltySearch = true; + + final myController = TextEditingController(); + DateTime selectedDate; + int strengthChar; + GetMedicationResponseModel _selectedMedication; + GlobalKey key = new GlobalKey>(); + + TextEditingController drugIdController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + final searchController = TextEditingController(); + stt.SpeechToText speech = stt.SpeechToText(); + var event = RobotProvider(); + var reconizedWord; + + final GlobalKey formKey = GlobalKey(); + final double spaceBetweenTextFileds = 12; + dynamic route; + dynamic frequency; + dynamic duration; + dynamic doseTime; + dynamic indication; + dynamic units; + dynamic uom; + dynamic box; + dynamic x; + + @override + void initState() { + super.initState(); + selectedType = 1; + } + + 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'}); + 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; + } + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) async { + model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", ""))); + + x = model.patientAssessmentList.map((element) { + return element.icdCode10ID; + }); + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patient.patientMRN, + episodeID: widget.patient.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: widget.patient.appointmentNo); + if (model.medicationStrengthList.length == 0) { + await model.getMedicationStrength(); + } + if (model.medicationDurationList.length == 0) { + await model.getMedicationDuration(); + } + if (model.medicationDoseTimeList.length == 0) { + await model.getMedicationDoseTime(); + } + await model.getPatientAssessment(getAssessmentReqModel); + }, + builder: ( + BuildContext context, + MedicineViewModel model, + Widget child, + ) => + AppScaffold( + backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.35, + color: Color(0xffF8F8F8), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + child: Column( + children: [ + Column( + children: [ + SizedBox( + height: 60, + ), + Row( + //mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Icon( + Icons.arrow_back_ios, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ), + SizedBox( + width: 7.0, + ), + AppText( + TranslationBase.of(context).newPrescriptionOrder, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + ], + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + children: [ + Container( + child: Column( + children: [ + SizedBox( + height: 14.5, + ), + ], + ), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Visibility( + visible: visbiltyPrescriptionForm, + child: Container( + child: Column( + children: [ + AppText( + widget.groupProcedures.procedureName ?? "", + bold: true, + ), + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType, + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFB9382C), + value: 1, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.35, + 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, + ), + ), + ), + SizedBox( + width: 5.0, + ), + PrescriptionTextFiled( + width: MediaQuery.of(context).size.width * 0.560, + element: units, + elementError: unitError, + keyName: 'description', + keyId: 'parameterCode', + hintText: 'Select', + elementList: model.itemMedicineListUnit, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + units['isDefault'] = true; + }); + }, + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + elementList: model.itemMedicineListRoute, + element: route, + elementError: routeError, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + route['isDefault'] = true; + }); + }, + hintText: TranslationBase.of(context).route, + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).frequency, + elementError: frequencyError, + element: frequency, + elementList: model.itemMedicineList, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + frequency['isDefault'] = true; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text)); + + return; + } + }); + }), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).doseTime, + elementError: doseTimeError, + element: doseTime, + elementList: model.medicationDoseTimeList, + keyId: 'id', + keyName: 'nameEn', + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }), + SizedBox(height: spaceBetweenTextFileds), + if (model.patientAssessmentList.isNotEmpty) + Container( + height: screenSize.height * 0.070, + width: double.infinity, + color: Colors.white, + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].icdCode10ID.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.65, + color: Colors.white, + child: TextField( + maxLines: 5, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].asciiDesc.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: () => selectDate(context, widget.model), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + element: duration, + elementError: durationError, + hintText: TranslationBase.of(context).duration, + elementList: model.medicationDurationList, + keyName: 'nameEn', + keyId: 'id', + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text), + ); + box = model.boxQuintity; + + return; + } + }); + }, + ), + SizedBox(height: spaceBetweenTextFileds), + // Container( + // color: Colors.white, + // child: AppTextFieldCustom( + // hintText: "UOM", + // isTextFieldHasSuffix: false, + // dropDownText: uom != null ? uom : null, + // enabled: false, + // ), + // ), + SizedBox(height: spaceBetweenTextFileds), + // Container( + // color: Colors.white, + // child: AppTextFieldCustom( + // hintText: TranslationBase.of(context).boxQuantity, + // isTextFieldHasSuffix: false, + // dropDownText: box != null + // ? TranslationBase.of(context).boxQuantity + + // ": " + + // model.boxQuintity.toString() + // : null, + // enabled: false, + // ), + // ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: Stack( + children: [ + TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of(context).instruction, + controller: instructionController, + //keyboardType: TextInputType.number, + ), + Positioned( + top: 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + initSpeechState().then((value) => {onVoiceText()}); + }, + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + color: Color(0xff359846), + title: TranslationBase.of(context).addMedication, + fontWeight: FontWeight.w600, + onPressed: () async { + if (route != null && + duration != null && + doseTime != null && + frequency != null && + units != null && + selectedDate != null && + strengthController.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 (formKey.currentState.validate()) { + Navigator.pop(context); + // openDrugToDrug(model); + { + postPrescription( + 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: (widget.groupProcedures.aliasN + .replaceAll("item code ;", "")), + 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(); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + Helpers.hideKeyboard(context); + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + : null, + hintStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + labelText: selectedText != null ? '$hintText\n$selectedText' : null, + labelStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + ); + } +} diff --git a/lib/screens/prescription/prescription_home_screen.dart b/lib/screens/prescription/prescription_home_screen.dart new file mode 100644 index 00000000..641b684a --- /dev/null +++ b/lib/screens/prescription/prescription_home_screen.dart @@ -0,0 +1,203 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_favourite_prescription.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionHomeScreen extends StatefulWidget { + final PrescriptionViewModel model; + final PatiantInformtion patient; + + const PrescriptionHomeScreen({Key key, this.model, this.patient}) : super(key: key); + @override + _PrescriptionHomeScreenState createState() => _PrescriptionHomeScreenState(); +} + +class _PrescriptionHomeScreenState extends State with SingleTickerProviderStateMixin { + PrescriptionViewModel model; + PatiantInformtion patient; + TabController _tabController; + int _activeTab = 0; + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @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, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + InkWell( + child: Icon( + Icons.arrow_back_ios, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ), + SizedBox( + width: 7.0, + ), + AppText( + 'Add prescription', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070), + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: + BorderSide(color: Theme.of(context).dividerColor, width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + 'All Prescription', + ), + tabWidget( + screenSize, + _activeTab == 1, + "Favorite Templates", + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PrescriptionFormWidget( + widget.model, widget.patient, widget.model.prescriptionList), + AddFavPrescription( + model: widget.model, + patient: widget.patient, + categoryID: '55', + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 81c8760f..b56befdb 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_home_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -49,8 +50,7 @@ class PrescriptionsPage extends StatelessWidget { SizedBox( height: 12, ), - if (model.prescriptionsList.isNotEmpty && - patient.patientStatusType != 43) + if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -70,8 +70,7 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient.patientStatusType != null && patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -91,16 +90,20 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { - addPrescriptionForm(context, model, patient, - model.prescriptionList); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionHomeScreen( + patient: patient, + model: model, + )), + ); }, - label: TranslationBase.of(context) - .applyForNewPrescriptionsOrder, + label: TranslationBase.of(context).applyForNewPrescriptionsOrder, ), ...List.generate( model.prescriptionsList.length, @@ -109,8 +112,7 @@ class PrescriptionsPage extends StatelessWidget { context, FadePage( page: PrescriptionItemsPage( - prescriptions: - model.prescriptionsList[index], + prescriptions: model.prescriptionsList[index], patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -118,22 +120,16 @@ class PrescriptionsPage extends StatelessWidget { ), ), child: DoctorCard( - doctorName: - model.prescriptionsList[index].doctorName, - profileUrl: model - .prescriptionsList[index].doctorImageURL, + doctorName: model.prescriptionsList[index].doctorName, + profileUrl: model.prescriptionsList[index].doctorImageURL, branch: model.prescriptionsList[index].name, - clinic: model.prescriptionsList[index] - .clinicDescription, + clinic: model.prescriptionsList[index].clinicDescription, isPrescriptions: true, - appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( - model.prescriptionsList[index] - .appointmentDate, + appointmentDate: AppDateUtils.getDateTimeFromServerFormat( + model.prescriptionsList[index].appointmentDate, ), ))), - if (model.prescriptionsList.isEmpty && - patient.patientStatusType != 43) + if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -144,8 +140,7 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context) - .noPrescriptionsFound), + child: AppText(TranslationBase.of(context).noPrescriptionsFound), ) ], ), @@ -170,38 +165,29 @@ class PrescriptionsPage extends StatelessWidget { FadePage( page: PrescriptionItemsInPatientPage( prescriptionIndex: index, - prescriptions: model - .inPatientPrescription[index], + prescriptions: model.inPatientPrescription[index], patient: patient, patientType: patientType, arrivalType: arrivalType, - startOn: AppDateUtils - .getDateTimeFromServerFormat( - model.inPatientPrescription[index] - .startDatetime, + startOn: AppDateUtils.getDateTimeFromServerFormat( + model.inPatientPrescription[index].startDatetime, ), - stopOn: AppDateUtils - .getDateTimeFromServerFormat( - model.inPatientPrescription[index] - .stopDatetime, + stopOn: AppDateUtils.getDateTimeFromServerFormat( + model.inPatientPrescription[index].stopDatetime, ), ), ), ), child: InPatientDoctorCard( - doctorName: model.inPatientPrescription[index] - .itemDescription, + doctorName: model.inPatientPrescription[index].itemDescription, profileUrl: 'sss', branch: 'hamza', clinic: 'basheer', isPrescriptions: true, - appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( - model.inPatientPrescription[index] - .prescriptionDatetime, + appointmentDate: AppDateUtils.getDateTimeFromServerFormat( + model.inPatientPrescription[index].prescriptionDatetime, ), - createdBy: model.inPatientPrescription[index] - .createdByName, + createdBy: model.inPatientPrescription[index].createdByName, ))), if (model.inPatientPrescription.length == 0) Center( @@ -214,8 +200,7 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context) - .noPrescriptionsFound), + child: AppText(TranslationBase.of(context).noPrescriptionsFound), ) ], ), diff --git a/lib/screens/procedures/ExpansionProcedure.dart b/lib/screens/procedures/ExpansionProcedure.dart index cdad16da..06e56f03 100644 --- a/lib/screens/procedures/ExpansionProcedure.dart +++ b/lib/screens/procedures/ExpansionProcedure.dart @@ -15,10 +15,12 @@ class ExpansionProcedure extends StatefulWidget { final ProcedureViewModel model; final Function(ProcedureTempleteDetailsModel) removeFavProcedure; final Function(ProcedureTempleteDetailsModel) addFavProcedure; - final Function(ProcedureTempleteDetailsModel) addProceduresRemarks; + final Function(ProcedureTempleteDetailsModel) selectProcedures; final bool Function(ProcedureTempleteModel) isEntityListSelected; final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; + final bool isProcedure; + final ProcedureTempleteDetailsModel groupProcedures; const ExpansionProcedure( {Key key, @@ -26,9 +28,11 @@ class ExpansionProcedure extends StatefulWidget { this.model, this.removeFavProcedure, this.addFavProcedure, - this.addProceduresRemarks, + this.selectProcedures, this.isEntityListSelected, - this.isEntityFavListSelected}) + this.isEntityFavListSelected, + this.isProcedure = true, + this.groupProcedures}) : super(key: key); @override @@ -70,11 +74,11 @@ class _ExpansionProcedureState extends State { ), Expanded( child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), child: AppText( - "Procedures for " + - widget.procedureTempleteModel.templateName, + widget.isProcedure == true + ? "Procedures for " + widget.procedureTempleteModel.templateName + : "Prescription for " + widget.procedureTempleteModel.templateName, fontSize: 16.0, variant: "bodyText", bold: true, @@ -87,9 +91,7 @@ class _ExpansionProcedureState extends State { width: 25, height: 25, child: Icon( - _isShowMore - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, + _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.grey[800], size: 22, ), @@ -111,48 +113,62 @@ class _ExpansionProcedureState extends State { )), duration: Duration(milliseconds: 7000), child: Column( - children: widget.procedureTempleteModel.procedureTemplate - .map((itemProcedure) { - return Container( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 11), - child: Checkbox( - value: widget - .isEntityFavListSelected(itemProcedure), - activeColor: Color(0xffD02127), - onChanged: (bool newValue) { - setState(() { - if (widget.isEntityFavListSelected( - itemProcedure)) { - widget - .removeFavProcedure(itemProcedure); - } else { - widget.addFavProcedure(itemProcedure); - } - }); - }), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), - child: AppText(itemProcedure.procedureName, - fontSize: 14.0, - variant: "bodyText", - bold: true, - color: Color(0xff575757)), + children: widget.procedureTempleteModel.procedureTemplate.map((itemProcedure) { + return InkWell( + onTap: () { + if (widget.isProcedure) { + setState(() { + if (widget.isEntityFavListSelected(itemProcedure)) { + widget.removeFavProcedure(itemProcedure); + } else { + widget.addFavProcedure(itemProcedure); + } + }); + } else { + widget.selectProcedures(itemProcedure); + } + }, + child: Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 11), + child: widget.isProcedure + ? Checkbox( + value: widget.isEntityFavListSelected(itemProcedure), + activeColor: Color(0xffD02127), + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityFavListSelected(itemProcedure)) { + widget.removeFavProcedure(itemProcedure); + } else { + widget.addFavProcedure(itemProcedure); + } + }); + }) + : Radio( + value: itemProcedure, + groupValue: widget.groupProcedures, + activeColor: Color(0xffD02127), + onChanged: (newValue) { + widget.selectProcedures(newValue); + })), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: AppText(itemProcedure.procedureName, + fontSize: 14.0, variant: "bodyText", bold: true, color: Color(0xff575757)), + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), ); diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart index 822726ce..c386afc8 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -22,12 +22,15 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { final Function(ProcedureTempleteDetailsModel) removeFavProcedure; final Function(ProcedureTempleteDetailsModel) addFavProcedure; - final Function(ProcedureTempleteDetailsModel) addProceduresRemarks; + final Function(ProcedureTempleteDetailsModel) selectProcedures; + final ProcedureTempleteDetailsModel groupProcedures; final bool Function(ProcedureTempleteModel) isEntityListSelected; final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; final List masterList; + final bool isProcedure; + EntityListCheckboxSearchFavProceduresWidget( {Key key, this.model, @@ -36,11 +39,13 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { this.masterList, this.addHistory, this.addFavProcedure, - this.addProceduresRemarks, + this.selectProcedures, this.removeFavProcedure, this.isEntityListSelected, this.isEntityFavListSelected, - this.addRemarks}) + this.addRemarks, + this.isProcedure = true, + this.groupProcedures}) : super(key: key); @override @@ -48,8 +53,7 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { _EntityListCheckboxSearchFavProceduresWidgetState(); } -class _EntityListCheckboxSearchFavProceduresWidgetState - extends State { +class _EntityListCheckboxSearchFavProceduresWidgetState extends State { int selectedType = 0; int typeUrgent; int typeRegular; @@ -85,9 +89,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState child: Center( child: Container( margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), child: ListView( children: [ TextFields( @@ -106,20 +108,20 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ? Column( children: widget.model.templateList.map((historyInfo) { return ExpansionProcedure( - procedureTempleteModel: historyInfo, - model: widget.model, - removeFavProcedure: widget.removeFavProcedure, - addFavProcedure: widget.addFavProcedure, - addProceduresRemarks: widget.addProceduresRemarks, - isEntityListSelected: widget.isEntityListSelected, - isEntityFavListSelected: widget.isEntityFavListSelected, - ); + procedureTempleteModel: historyInfo, + model: widget.model, + removeFavProcedure: widget.removeFavProcedure, + addFavProcedure: widget.addFavProcedure, + selectProcedures: widget.selectProcedures, + isEntityListSelected: widget.isEntityListSelected, + isEntityFavListSelected: widget.isEntityFavListSelected, + isProcedure: widget.isProcedure, + groupProcedures: widget.groupProcedures); }).toList(), ) : Center( child: Container( - child: AppText("Sorry , No Match", - color: Color(0xFFB9382C)), + child: AppText("Sorry , No Match", color: Color(0xFFB9382C)), ), ) ], From ad74ff00dc6e1f775810c5596ad8bb9b36fd37d2 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 1 Jun 2021 15:49:51 +0300 Subject: [PATCH 06/12] fix issues in android and add ChangeCallStatus services in IOS --- android/app/build.gradle | 2 +- android/app/src/main/AndroidManifest.xml | 4 + .../com/hmg/hmgDr/ui/VideoCallActivity.java | 12 +- ios/Podfile | 2 +- ios/Podfile.lock | 331 ------------------ ios/Runner/VideoViewController.swift | 35 +- lib/client/base_app_client.dart | 12 +- lib/config/config.dart | 4 +- lib/screens/qr_reader/QR_reader_screen.dart | 6 +- pubspec.lock | 12 +- pubspec.yaml | 2 +- 11 files changed, 63 insertions(+), 359 deletions(-) delete mode 100644 ios/Podfile.lock diff --git a/android/app/build.gradle b/android/app/build.gradle index fd6c7720..b7605ad0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -70,7 +70,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' //openTok - implementation 'com.opentok.android:opentok-android-sdk:2.16.5' + implementation 'com.opentok.android:opentok-android-sdk:2.20.1' //permissions implementation 'pub.devrel:easypermissions:0.4.0' //retrofit diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 57a59745..c656ebbf 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@