diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d06fa211..602ed1b9 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -649,5 +649,21 @@ const Map> localizedValues = { }, 'active': {'en': "Active", 'ar': "نشيط"}, 'hold': {'en': "Hold", 'ar': "معلق"}, - 'loading': {'en': "Loading...", 'ar': "جار التحميل..."} + 'loading': {'en': "Loading...", 'ar': "جار التحميل..."}, + 'assessmentErrorMsg': { + 'en': "You have to add at least one assessment.", + 'ar': "يجب عليك إضافة تقييم واحد على الأقل." + }, + 'examinationErrorMsg': { + 'en': "You have to add at least one examination.", + 'ar': "يجب عليك إضافة الفحص واحد على الأقل." + }, + 'progressNoteErrorMsg': { + 'en': "You have to add progress Note.", + 'ar': "يجب عليك إضافة ملاحظة التقدم." + }, + 'chiefComplaintErrorMsg': { + 'en': "You have to add chief complaint fields correctly .", + 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" + }, }; diff --git a/lib/core/model/get_medication_response_model.dart b/lib/core/model/get_medication_response_model.dart new file mode 100644 index 00000000..f9df77a3 --- /dev/null +++ b/lib/core/model/get_medication_response_model.dart @@ -0,0 +1,36 @@ +class GetMedicationResponseModel { + String description; + String genericName; + int itemId; + String keywords; + dynamic price; + dynamic quantity; + + GetMedicationResponseModel( + {this.description, + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity}); + + GetMedicationResponseModel.fromJson(Map json) { + description = json['Description']; + genericName = json['GenericName']; + itemId = json['ItemId']; + keywords = json['Keywords']; + price = json['Price']; + quantity = json['Quantity']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['GenericName'] = this.genericName; + data['ItemId'] = this.itemId; + data['Keywords'] = this.keywords; + data['Price'] = this.price; + data['Quantity'] = this.quantity; + return data; + } +} diff --git a/lib/core/model/search_drug_request_model.dart b/lib/core/model/search_drug_request_model.dart index e1cccc43..b64e7d18 100644 --- a/lib/core/model/search_drug_request_model.dart +++ b/lib/core/model/search_drug_request_model.dart @@ -1,18 +1,18 @@ class SearchDrugRequestModel { List search; - String vidaAuthTokenID; + // String vidaAuthTokenID; - SearchDrugRequestModel({this.search, this.vidaAuthTokenID}); + SearchDrugRequestModel({this.search}); SearchDrugRequestModel.fromJson(Map json) { search = json['Search'].cast(); - vidaAuthTokenID = json['VidaAuthTokenID']; + // vidaAuthTokenID = json['VidaAuthTokenID']; } Map toJson() { final Map data = new Map(); data['Search'] = this.search; - data['VidaAuthTokenID'] = this.vidaAuthTokenID; + // data['VidaAuthTokenID'] = this.vidaAuthTokenID; return data; } } diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 3f8b217a..d5503932 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; @@ -16,6 +17,7 @@ class PrescriptionService extends BaseService { List _drugsList = List(); List get drugsList => _drugsList; List doctorsList = []; + List allMedicationList = []; List specialityList = []; List drugToDrug = []; @@ -59,6 +61,21 @@ class PrescriptionService extends BaseService { }, body: _drugRequestModel.toJson()); } + Future getMedicationList() async { + hasError = false; + _drugRequestModel.search =[""]; + await baseAppClient.post(SEARCH_DRUG, + onSuccess: (dynamic response, int statusCode) { + allMedicationList = []; + response['MedicationList']['entityList'].forEach((v) { + allMedicationList.add(GetMedicationResponseModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } + Future postPrescription( PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index d4f50ce6..2c312ade 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -92,7 +92,10 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMasterLookup(MasterKeysService masterKeys) async { + Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async { + if(isBusyLocal){ + setState(ViewState.Busy); + }else setState(ViewState.Busy); await _SOAPService.getMasterLookup(masterKeys); if (_SOAPService.hasError) { diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index a86f6dfb..6b780858 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -9,6 +11,9 @@ class MedicineViewModel extends BaseViewModel { get pharmacyItemsList => _medicineService.pharmacyItemsList; get pharmaciesList => _medicineService.pharmaciesList; + PrescriptionService _prescriptionService = locator(); + List get allMedicationList => _prescriptionService.allMedicationList; + Future getMedicineItem(String itemName) async { setState(ViewState.Busy); @@ -19,6 +24,15 @@ class MedicineViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + Future getMedicationList() async { + setState(ViewState.Busy); + await _prescriptionService.getMedicationList(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } Future getPharmaciesList(int itemId) async { setState(ViewState.Busy); diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 3e39a7fa..e7da4385 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -17,6 +17,7 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionList => _prescriptionService.prescriptionList; List get drugsList => _prescriptionService.doctorsList; + List get allMedicationList => _prescriptionService.allMedicationList; Future getPrescription({int mrn}) async { hasError = false; diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index fa75abaa..08b6471f 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -1,8 +1,8 @@ const PATIENT_TYPE = const [ - {"text": "outPatiant", "text_ar": "المريض الخارجي", "val": "0"}, - {"text": "InPatiant", "text_ar": "المريض المنوم", "val": "1"}, + {"text": "Outpatient", "text_ar": "المريض الخارجي", "val": "0"}, + {"text": "Inpatient", "text_ar": "المريض المنوم", "val": "1"}, {"text": "Discharge", "text_ar": "المريض المعافى", "val": "2"}, - {"text": "Referrd", "text_ar": "المريض المحول الي", "val": "3"}, + {"text": "Referred", "text_ar": "المريض المحول الي", "val": "3"}, { "text": "Referral Discharge", "text_ar": "المريض المحال المعافى", diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 825abb83..42278d40 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -135,15 +135,15 @@ class _QrReaderScreenState extends State { /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result var result = await BarcodeScanner.scan(); - // if (result.rawContent == "") { - List listOfParams = result.rawContent.split(','); - String patientType = "1"; - setState(() { - isLoading = true; - isError = false; - patientList = []; - }); - String token = await sharedPref.getString(TOKEN); + if (result.rawContent != "") { + List listOfParams = result.rawContent.split(','); + String patientType = "1"; + setState(() { + isLoading = true; + isError = false; + patientList = []; + }); + String token = await sharedPref.getString(TOKEN); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); // patient.PatientID = 8808; @@ -213,5 +213,5 @@ class _QrReaderScreenState extends State { //DrAppToastMsg.showErrorToast(error); }); } -// } + } } diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 2c5b8213..5e26e65b 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -1,7 +1,8 @@ import 'dart:math'; -import 'package:doctor_app_flutter/config/config.dart'; +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -11,12 +12,12 @@ 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/medicine/medicine_item_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; @@ -45,6 +46,9 @@ class _MedicineSearchState extends State { bool _isInit = true; final SpeechToText speech = SpeechToText(); String lastStatus = ''; + GetMedicationResponseModel _selectedMedication; + GlobalKey key = + new GlobalKey>(); // String lastWords; List _localeNames = []; @@ -84,142 +88,206 @@ class _MedicineSearchState extends State { }); } + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + @override Widget build(BuildContext context) { return BaseView( - builder: (_, model, w) => AppScaffold( - appBarTitle: TranslationBase.of(context).searchMedicine, - body: FractionallySizedBox( - widthFactor: 0.97, - child: SingleChildScrollView( - child: Column( - children: [ - Column( - children: [ - Container( - child: Icon( - DoctorApp.medicine_search, - size: 100, - color: Colors.black, - ), - margin: EdgeInsets.only(top: 50), - ), - Padding( - padding: const EdgeInsets.only(top: 12.0), - child: AppText( - TranslationBase.of(context).type.toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: SizeConfig.heightMultiplier * 2.5, - ), - ), - Padding( - padding: const EdgeInsets.only(top: 5.0), - child: AppText( - TranslationBase.of(context).searchMedicineImageCaption, - fontSize: SizeConfig.heightMultiplier * 2, - ), - ) - ], - ), - SizedBox( - height: 15, - ), - FractionallySizedBox( - widthFactor: 0.9, + onModelReady: (model) async { + if(model.allMedicationList.isNotEmpty) + await model.getMedicationList(); + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase + .of(context) + .searchMedicine, + body: SingleChildScrollView( + child: FractionallySizedBox( + widthFactor: 0.97, + child: SingleChildScrollView( child: Column( children: [ - Container( - child: AppTextFormField( - hintText: TranslationBase.of(context) - .searchMedicineNameHere, - controller: myController, - onSaved: (value) {}, - onFieldSubmitted: (value) { - searchMedicine(context, model); - }, - textInputAction: TextInputAction.search, - // TODO return it back when it needed - // prefix: IconButton( - // icon: Icon(Icons.mic), - // color: - // lastStatus == 'listening' ? Colors.red : Colors.grey, - // onPressed: () { - // myController.text = ''; - // setState(() { - // lastStatus = 'listening'; - // }); - // - // startVoiceSearch(); - // }), - inputFormatter: ONLY_LETTERS), + Column( + children: [ + Container( + child: Icon( + DoctorApp.medicine_search, + size: 100, + color: Colors.black, + ), + margin: EdgeInsets.only(top: 50), + ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: AppText( + TranslationBase.of(context).type.toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: SizeConfig.heightMultiplier * 2.5, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 5.0), + child: AppText( + TranslationBase.of(context).searchMedicineImageCaption, + fontSize: SizeConfig.heightMultiplier * 2, + ), + ) + ], ), SizedBox( height: 15, ), - Container( - child: Wrap( - alignment: WrapAlignment.center, + FractionallySizedBox( + widthFactor: 0.9, + child: Column( children: [ - // TODO change it secondary button and add loading - AppButton( - title: TranslationBase.of(context).search, - onPressed: () async{ - await searchMedicine(context, model); - - }, - ), - ], - ), - ), - - Column( - children: [ - Container( - margin: EdgeInsets.only( - left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase - .of(context) - .youCanFind + - model.pharmacyItemsList.length - .toString() + - " " + + Container( + height: MediaQuery + .of(context) + .size + .height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + setState(() { + _selectedMedication = null; + }); + } + : null, + child: _selectedMedication == null + ? AutoCompleteTextField< + GetMedicationResponseModel>( + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication.genericName + : null, + true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState( + () => _selectedMedication = item), + key: key, + suggestions: model.allMedicationList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts(suggestion.description + '/' + + suggestion.genericName), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.genericName + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith(input.toLowerCase()), + ) + : TextField( + decoration: textFieldSelectorDecoration( TranslationBase .of(context) - .itemsInSearch, - fontWeight: FontWeight.bold, + .searchMedicineNameHere, + _selectedMedication != null + ? _selectedMedication.description + + ('${_selectedMedication.genericName}') + : null, + true, + icon: EvaIcons.search), + enabled: false, ), - ], + ), ), - ), - Container( - height: MediaQuery - .of(context) - .size - .height * 0.35, - child: Container( - child: ListView.builder( + SizedBox( + height: 15, + ), + Container( + child: Wrap( + alignment: WrapAlignment.center, + children: [ + // TODO change it secondary button and add loading + AppButton( + title: TranslationBase.of(context).search, + onPressed: () async { + await searchMedicine(context, model); + }, + ), + ], + ), + ), + Column( + children: [ + Container( + margin: EdgeInsets.only( + left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase + .of(context) + .youCanFind + + model.pharmacyItemsList.length + .toString() + + " " + + TranslationBase + .of(context) + .itemsInSearch, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + Container( + height: MediaQuery + .of(context) + .size + .height * 0.35, + child: Container( + child: ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: - model.pharmacyItemsList == - null - ? 0 - : model - .pharmacyItemsList.length, - itemBuilder: - (BuildContext context, int index) { + itemCount: model.pharmacyItemsList == null + ? 0 + : model.pharmacyItemsList.length, + itemBuilder: (BuildContext context, + int index) { return InkWell( child: MedicineItemWidget( - label: model - .pharmacyItemsList[index] - ["ItemDescription"], - url: model - .pharmacyItemsList[index] - ["ImageSRCUrl"], + label: model.pharmacyItemsList[index] + ["ItemDescription"], + url: model.pharmacyItemsList[index] + ["ImageSRCUrl"], ), onTap: () { Navigator.push( @@ -227,8 +295,8 @@ class _MedicineSearchState extends State { MaterialPageRoute( builder: (context) => PharmaciesListScreen( - itemID: model - .pharmacyItemsList[ + itemID: + model.pharmacyItemsList[ index]["ItemID"], url: model .pharmacyItemsList[ @@ -237,31 +305,32 @@ class _MedicineSearchState extends State { ); }, ); - }, - ), + }, + ), + ), + ), + ], ), - ), - ], + ], + ), ), ], ), ), - ], - ), ), ),),); } searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); - if (myController.text.isNullOrEmpty()) { + if (_selectedMedication.isNullOrEmpty()) { helpers.showErrorToast(TranslationBase .of(context) .typeMedicineName); //"Type Medicine Name") return; - } - if (myController.text.length < 3) { + } else + if (_selectedMedication.description.length < 3) { helpers.showErrorToast(TranslationBase .of(context) .moreThan3Letter); @@ -270,7 +339,7 @@ class _MedicineSearchState extends State { GifLoaderDialogUtils.showMyDialog(context); - await model.getMedicineItem(myController.text); + await model.getMedicineItem(_selectedMedication.description); GifLoaderDialogUtils.hideDialog(context); } diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 7915a168..52fbb677 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -42,7 +42,7 @@ class _PatientSearchScreenState extends State { String itemText2 = ''; final GlobalKey _formKey = GlobalKey(); bool _autoValidate = false; - bool onlyArrived = false; + bool onlyArrived = true; var _patientSearchFormValues = PatientModel( FirstName: "0", diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index 88e34cdb..56a5cd5e 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -141,9 +141,13 @@ class _ProgressNoteState extends State { indent: 0, endIndent: 0, ), - AppText( - notesList[index]["Notes"], - margin: 5, + Row(mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + notesList[index]["Notes"], + margin: 5, + ), + ], ) ], ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 13efb440..2c3be5b1 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1025,6 +1025,17 @@ class TranslationBase { String get active => localizedValues['active'][locale.languageCode]; String get hold => localizedValues['hold'][locale.languageCode]; String get loading => localizedValues['loading'][locale.languageCode]; + + String get assessmentErrorMsg => + localizedValues['assessmentErrorMsg'][locale.languageCode]; + String get examinationErrorMsg => + localizedValues['examinationErrorMsg'][locale.languageCode]; + + String get progressNoteErrorMsg => + localizedValues['progressNoteErrorMsg'][locale.languageCode]; + + String get chiefComplaintErrorMsg => + localizedValues['chiefComplaintErrorMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart index dd2698a9..abd2f5ad 100644 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ b/lib/widgets/patients/profile/patient-page-header-widget.dart @@ -77,7 +77,7 @@ class PatientPageHeaderWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).age, + TranslationBase.of(context).age , color: Colors.black, fontWeight: FontWeight.bold, ), diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index b7e9e837..ac5bee65 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -74,7 +75,7 @@ class StepsWidget extends StatelessWidget { AppText( "SUBJECTIVE", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize: SizeConfig.textMultiplier * 2.0, ), ], ), @@ -86,7 +87,7 @@ class StepsWidget extends StatelessWidget { child: InkWell( onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 1 ? 70 : 50, @@ -124,7 +125,7 @@ class StepsWidget extends StatelessWidget { AppText( "OBJECTIVE", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ], ), @@ -139,7 +140,7 @@ class StepsWidget extends StatelessWidget { changeCurrentTab(2); }, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 2 ? 70 : 50, @@ -177,7 +178,7 @@ class StepsWidget extends StatelessWidget { AppText( "ASSESSMENT", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ], ), @@ -189,7 +190,7 @@ class StepsWidget extends StatelessWidget { child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 3 ? 70 : 50, @@ -224,13 +225,12 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 3 ? 5 : 10, ), - Container( - margin: EdgeInsets.only(left: index == 3? 15:0), + Center( child: AppText( "PLAN", fontWeight: FontWeight.bold, textAlign: TextAlign.center, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ), ], @@ -309,7 +309,7 @@ class StepsWidget extends StatelessWidget { child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 1 ? 70 : 50, @@ -347,7 +347,7 @@ class StepsWidget extends StatelessWidget { AppText( "هدف", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ], ), @@ -359,7 +359,7 @@ class StepsWidget extends StatelessWidget { child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 2 ? 70 : 50, @@ -400,7 +400,7 @@ class StepsWidget extends StatelessWidget { child: AppText( "تقدير", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ), ], @@ -413,7 +413,7 @@ class StepsWidget extends StatelessWidget { child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: index == 3 ? 70 : 50, @@ -453,7 +453,7 @@ class StepsWidget extends StatelessWidget { child: AppText( "خطة", fontWeight: FontWeight.bold, - fontSize: 14, + fontSize:SizeConfig.textMultiplier * 2.0, ), ), ], diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart index 28f9f466..81217025 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -272,36 +272,31 @@ class _AddHistoryDialogState extends State { onModelReady: (model) async { if (model.historyFamilyList.length == 0) { await model.getMasterLookup(MasterKeysService.HistoryFamily); - setState(() { + } - }); + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + await model.getMasterLookup(MasterKeysService.HistorySports); + } + + if (model.historyMedicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); } }, builder: (_, model, w) => AppScaffold( - // baseViewModel: model, + baseViewModel: model, isShowAppBar: false, body: Center( child: Container( child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 10, - ), + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 10, + ), PriorityBar(onTap: (activePriority) async { widget.changePageViewIndex(activePriority); - if(activePriority ==1) { - if (model.historySurgicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySurgical); - await model.getMasterLookup(MasterKeysService.HistorySports); - } - } - if(activePriority ==2) { - if (model.historyMedicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistoryMedical); - } - } }), SizedBox( height: 20, diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 3e2f2d76..184b4391 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -504,7 +504,7 @@ class _UpdateSubjectivePageState extends State { } else { helpers.showErrorToast(TranslationBase .of(context) - .requiredMsg); + .chiefComplaintErrorMsg); } diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index ac1e547e..7bcea474 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -381,9 +381,13 @@ class _UpdateAssessmentPageState extends State { .next, loading: model.state == ViewState.BusyLocal, onPressed: () async { - widget.changePageViewIndex(3); - widget.changeLoadingState(true); - + if (widget.mySelectedAssessmentList.isEmpty) { + helpers.showErrorToast( + TranslationBase.of(context).assessmentErrorMsg); + } else { + widget.changePageViewIndex(3); + widget.changeLoadingState(true); + } }, ), SizedBox( @@ -690,6 +694,9 @@ class _AddAssessmentDetailsState extends State { maxLines: 18, minLines: 5, controller: remarkController, + onChanged:(value) { + widget.mySelectedAssessment.remark = remarkController.text; + }, validator: (value) { if (value == null) return TranslationBase diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index fe80a5c3..adf1e3d2 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -412,11 +412,11 @@ class _UpdateObjectivePageState extends State { widget.changePageViewIndex(2); } } else { - widget.changeLoadingState(true); + // widget.changeLoadingState(true); + // + // widget.changePageViewIndex(2); - widget.changePageViewIndex(2); - - // helpers.showErrorToast(TranslationBase.of(context).requiredMsg); + helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); } } @@ -505,7 +505,7 @@ class _AddExaminationDailogState extends State { }, builder: (_, model, w) => AppScaffold( - // baseViewModel: model, + baseViewModel: model, isShowAppBar: false, body: Center( child: Container( @@ -518,41 +518,38 @@ class _AddExaminationDailogState extends State { height: 16, ), AppText( - "Examinations", + TranslationBase.of(context).physicalSystemExamination, fontWeight: FontWeight.bold, fontSize: 16, ), SizedBox( height: 16, ), - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - hintSearchText: TranslationBase.of(context).searchExamination, - buttonName: TranslationBase.of(context).addExamination, - masterList: model.physicalExaminationList, - removeHistory: (history){ - setState(() { - widget.removeExamination(history); - }); - }, - addHistory: (history){ - setState(() { - MySelectedExamination mySelectedExamination = new MySelectedExamination( - selectedExamination: history - ); - widget - .mySelectedExamination - .add( - mySelectedExamination); - }); - }, - addSelectedHistories: (){ - widget.addSelectedExamination(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), + MasterKeyCheckboxSearchWidget( + model: model, + hintSearchText: TranslationBase.of(context).searchExamination, + buttonName: TranslationBase.of(context).addExamination, + masterList: model.physicalExaminationList, + removeHistory: (history){ + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history){ + setState(() { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: history + ); + widget + .mySelectedExamination + .add( + mySelectedExamination); + }); + }, + addSelectedHistories: (){ + widget.addSelectedExamination(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), ]), ))), diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index d059e445..06cbfc06 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -1,10 +1,12 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -130,7 +132,7 @@ class _UpdatePlanPageState extends State { ), Column( children: [ - if(model.patientProgressNoteList.isEmpty) + if(widget.patientProgressNote==null) Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), @@ -321,6 +323,8 @@ class _UpdatePlanPageState extends State { } else { Navigator.of(context).pop(); } + } else { + helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } } @@ -372,7 +376,13 @@ class _UpdatePlanPageState extends State { ), AppButton( title: TranslationBase.of(context).add.toUpperCase(), - onPressed: () { + onPressed: () async{ + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + widget.patientProgressNote.createdByName = widget.patientProgressNote.createdByName??doctorProfile.doctorName; + widget.patientProgressNote.editedByName=doctorProfile.doctorName; + widget.patientProgressNote.createdOn= DateTime.now().toString() ; setState(() { print(progressNoteController.text); });