diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index d0cebe77..be772515 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 600a83a5..e3df5a7c 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; diff --git a/lib/models/SOAP/PatchAssessmentReqModel.dart b/lib/models/SOAP/PatchAssessmentReqModel.dart new file mode 100644 index 00000000..8cbf5cb7 --- /dev/null +++ b/lib/models/SOAP/PatchAssessmentReqModel.dart @@ -0,0 +1,48 @@ +class PatchAssessmentReqModel { + int patientMRN; + int appointmentNo; + int episodeID; + String icdcode10Id; + String prevIcdCode10ID; + int conditionId; + int diagnosisTypeId; + bool complexDiagnosis; + String remarks; + + PatchAssessmentReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.icdcode10Id, + this.prevIcdCode10ID, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + PatchAssessmentReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + icdcode10Id = json['Icdcode10Id']; + prevIcdCode10ID = json['PrevIcdCode10ID']; + conditionId = json['ConditionId']; + diagnosisTypeId = json['DiagnosisTypeId']; + complexDiagnosis = json['ComplexDiagnosis']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['Icdcode10Id'] = this.icdcode10Id; + data['PrevIcdCode10ID'] = this.prevIcdCode10ID; + data['ConditionId'] = this.conditionId; + data['DiagnosisTypeId'] = this.diagnosisTypeId; + data['ComplexDiagnosis'] = this.complexDiagnosis; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart new file mode 100644 index 00000000..c9e24dbc --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -0,0 +1,563 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +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/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_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/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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/dialogs/master_key_dailog.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../custom_validation_error.dart'; + +class AddAssessmentDetails extends StatefulWidget { + final MySelectedAssessment mySelectedAssessment; + final List mySelectedAssessmentList; + final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) + addSelectedAssessment; + final PatiantInformtion patientInfo; + final bool isUpdate; + AddAssessmentDetails( + {Key key, + this.mySelectedAssessment, + this.addSelectedAssessment, + this.patientInfo, + this.isUpdate = false, + this.mySelectedAssessmentList}); + + @override + _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); +} + +class _AddAssessmentDetailsState extends State { + TextEditingController remarkController = TextEditingController(); + TextEditingController appointmentIdController = TextEditingController(); + TextEditingController conditionController = TextEditingController(); + TextEditingController typeController = TextEditingController(); + TextEditingController icdNameController = TextEditingController(); + + GlobalKey key = new GlobalKey>(); + bool isFormSubmitted = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + remarkController.text = widget.mySelectedAssessment.remark ?? ""; + appointmentIdController.text = + widget.mySelectedAssessment.appointmentId.toString(); + if (widget.isUpdate) { + if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr + : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn; + if (widget.mySelectedAssessment.selectedDiagnosisType != null) + typeController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment.selectedDiagnosisType.nameAr + : widget.mySelectedAssessment.selectedDiagnosisType.nameEn; + if (widget.mySelectedAssessment.selectedICD != null) + icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + } + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { + return InputDecoration( + fillColor: Colors.white, + + contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + filled: true, + hintStyle: TextStyle( + fontSize: 10, + color: Colors.grey.shade600, + ), + ); + } + + return FractionallySizedBox( + heightFactor: 1, + child: BaseView( + onModelReady: (model) async { + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + child: Center( + child: Column( + children: [ + BottomSheetTitle( + title: TranslationBase.of(context).addAssessmentDetails), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + height: 55.0, + hintText: + TranslationBase.of(context).appointmentNumber, + //fontSize: 13.5, + // hintColor: Colors.black, + //hasLabelText: appointmentIdController.text != '' + // ? true + // : false, + //showLabelText: true, + //fontWeight: FontWeight.w600, + //readOnly: true, + isDropDown: false, + enabled: false, + controller: appointmentIdController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 55.0, + child: InkWell( + onTap: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, + child: widget + .mySelectedAssessment.selectedICD == + null + ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .nameOrICD, + widget.mySelectedAssessment + .selectedICD != + null + ? widget.mySelectedAssessment + .selectedICD.nameEn + : null, + true, + icon: Icons.keyboard_arrow_down), + itemSubmitted: (item) => setState(() { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text = item.code; + }), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts(suggestion + .description + + " / " + + suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.code + .toLowerCase() + .startsWith( + input.toLowerCase()), + ) + : AppTextFieldCustom( + onClick: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, + //hasLabelText: + // icdNameController.text != '' + // ? true + // : false, + //showLabelText: true, + hintText: TranslationBase.of(context) + .nameOrICD, + + //fontSize: 13.5, + //readOnly: true, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: icdNameController, + //suffixIcon: EvaIcons.search, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + + isDropDown: true, + enabled: false, + height: 55.0, + ) + + // TextField( + // decoration: textFieldSelectorDecoration( + // widget.mySelectedAssessment.selectedICD != + // null ? widget.mySelectedAssessment + // .selectedICD.code : "Name or ICD", + // widget.mySelectedAssessment.selectedICD != + // null ? projectViewModel.isArabic + // ? widget.mySelectedAssessment + // .selectedICD.nameAr + // : widget.mySelectedAssessment + // .selectedICD.nameEn : null, true, + // icon: EvaIcons.search), + // enabled: false, + // ), + ), + ), + if (isFormSubmitted && + widget.mySelectedAssessment.selectedICD == null) + CustomValidationError(), + SizedBox( + height: 7, + ), + AppTextFieldCustom( + height: 55.0, + onClick: model.listOfDiagnosisCondition != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment + .selectedDiagnosisCondition = + selectedValue; + conditionController + .text = projectViewModel + .isArabic + ? widget + .mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget + .mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + //hasLabelText: + // conditionController.text != '' ? true : false, + //showLabelText: true, + hintText: TranslationBase.of(context).condition, + //fontSize: 13.5, + //readOnly: true, + //suffixIcon: EvaIcons.arrowDown, + // hintColor: Colors.black, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: conditionController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context).emptyMessage; + // else + // return null; + // }, + + isDropDown: true, + enabled: false, + ), + if (isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == + null) + CustomValidationError(), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: 55.0, + onClick: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + // _selectedDiagnosisType = + // selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisType = + selectedValue; + typeController.text = + projectViewModel.isArabic + ? selectedValue.nameAr + : selectedValue.nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + //hasLabelText: + // typeController.text != '' ? true : false, + //prefixIcon: Icon(Icons.add), + //showLabelText: true, + hintText: TranslationBase.of(context).dType, + //fontSize: 13.5, + //readOnly: true, + // hintColor: Colors.black, + //suffixIcon: EvaIcons.arrowDown, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + enabled: false, + isDropDown: true, + + controller: typeController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context).emptyMessage; + // else + // return null; + // }, + ), + if (isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == + null) + CustomValidationError(), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 5, + hasLabelText: + remarkController.text != '' ? true : false, + showLabelText: true, + controller: remarkController, + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; + }, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + ])), + ), + ], + ), + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: Colors.green, + title: (widget.isUpdate + ? 'Update Assessment Details' + : 'Add Assessment Details'), + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + setState(() { + isFormSubmitted = true; + }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment.appointmentId = + int.parse(appointmentIdController.text); + if (widget.mySelectedAssessment + .selectedDiagnosisCondition != + null && + widget.mySelectedAssessment + .selectedDiagnosisType != + null && + widget.mySelectedAssessment.selectedICD != null) { + await submitAssessment( + isUpdate: widget.isUpdate, + model: model, + mySelectedAssessment: + widget.mySelectedAssessment); + } + }, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ), + ), + ); + } + + submitAssessment( + {SOAPViewModel model, + MySelectedAssessment mySelectedAssessment, + bool isUpdate = false}) async { + if (isUpdate) { + PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: mySelectedAssessment.selectedICD.code, + prevIcdCode10ID: mySelectedAssessment.icdCode10ID); + + await model.patchAssessment(patchAssessmentReqModel); + } else { + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ + new IcdCodeDetails( + remarks: mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: mySelectedAssessment.selectedICD.code) + ]); + + await model.postAssessment(postAssessmentRequestModel); + } + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; + mySelectedAssessment.doctorName = doctorProfile.doctorName; + + if (!isUpdate) { + // widget.mySelectedAssessmentList.add(mySelectedAssessment); + widget.addSelectedAssessment(mySelectedAssessment, isUpdate); + } + Navigator.of(context).pop(); + } + + // widget.changePageViewIndex(3); + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/widgets/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 3ee67799..59569e22 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -6,10 +6,12 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../bottom_sheet_title.dart'; @@ -133,9 +135,48 @@ class _AddAllergiesState extends State { ), ), ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.11, + ), ]), ), - )), + ),bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: + TranslationBase.of(context).addAllergies, + padding: 10, + color: Color(0xFF359846), + onPressed: () { + widget.addAllergiesFun(myAllergiesListLocal); + }, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ),), ), ); } diff --git a/lib/widgets/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/widgets/patients/profile/soap_update/subjective/history/add_history_dialog.dart index 86b5b31d..e39bd72a 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -4,13 +4,15 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; -import 'PriorityBar.dart'; import '../bottom_sheet_title.dart'; +import 'PriorityBar.dart'; class AddHistoryDialog extends StatefulWidget { final Function changePageViewIndex; @@ -140,15 +142,55 @@ class _AddHistoryDialogState extends State { addSelectedHistories: (){ widget.addSelectedHistories(); }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ), - ], + isServiceSelected: (master) => + isServiceSelected(master), + ), ), + ], + ), + ), + ), + SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,) + ], + ) + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: + TranslationBase.of(context).addSelectedHistories, + padding: 10, + color: Color(0xFF359846), + onPressed: () { + widget.addSelectedHistories(); + }, ), ), - ], - )), + ), + ), + SizedBox( + height: 5, + ), + ], + ), ), ), )); 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 93aa9fb2..3ff18103 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -1,34 +1,26 @@ -import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; 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/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_assessment_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'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import 'SOAP_open_items.dart'; import 'SOAP_step_header.dart'; -import 'custom_validation_error.dart'; +import 'assessment/add_assessment_details.dart'; import 'expandable_SOAP_widget.dart'; class UpdateAssessmentPage extends StatefulWidget { @@ -170,158 +162,206 @@ class _UpdateAssessmentPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "ICD : ".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - Container( - child: AppText( - assessment.selectedICD.code - .trim() - .toUpperCase() ?? + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600), + children: [ + new TextSpan( + text: "ICD : ".toUpperCase(), + ), + new TextSpan( + text: assessment + .selectedICD.code + .trim() + .toUpperCase() ?? "", - fontWeight: FontWeight.w700, - fontSize: 11, ), - ), - ], + ], + ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .ICDName + - " : ", - fontSize: 13, - color: Colors.grey, - ), - Container( - width: MediaQuery.of(context) + Container( + width: MediaQuery.of(context) .size .width * - 0.29, - child: AppText( - assessment - .selectedICD.description - .toString(), - fontWeight: FontWeight.w700, - fontSize: 10, - ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .appointmentNo, - fontSize: 10, - color: Colors.grey, - ), - AppText( - assessment.appointmentId - .toString(), - fontSize: 11, - fontWeight: FontWeight.w700, + 0.50, + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 16, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: assessment + .selectedICD.description + .toString(), + ), + ], ), - ], + ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .condition + - " : ", - fontSize: 10, - color: Colors.grey, - ), - AppText( - projectViewModel.isArabic - ? assessment - .selectedDiagnosisCondition - .nameAr - : assessment - .selectedDiagnosisCondition - .nameEn, - fontSize: 11, - fontWeight: FontWeight.w700, - ), - ], + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .appointmentNo, + style: new TextStyle( + color: Color(0xFF575757), + ), + ), + new TextSpan( + text: assessment + .appointmentId.toString() + + ?? + "", + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), + ), + ], + ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .dType + - ' : ', - fontSize: 10, - color: Colors.grey, - ), - AppText( - projectViewModel.isArabic - ? assessment - .selectedDiagnosisType - .nameAr - : assessment - .selectedDiagnosisType - .nameEn, - fontSize: 11, - fontWeight: FontWeight.w700, - ), - ], + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .condition + + " : ", + style: new TextStyle( + color: Color(0xFF575757), + ), + ), + new TextSpan( + text: projectViewModel + .isArabic + ? assessment + .selectedDiagnosisCondition + .nameAr + : assessment + .selectedDiagnosisCondition + .nameEn, + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), + ), + ], + ), ), - if (assessment.doctorName != null) - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .doc, - fontSize: 10, - color: Colors.grey, + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .dType + + ' : ', + style: new TextStyle( + color: Color(0xFF575757), + ), ), - AppText( - assessment.doctorName ?? '', - fontSize: 11, - fontWeight: FontWeight.w700, + new TextSpan( + text: projectViewModel + .isArabic + ? assessment + .selectedDiagnosisType + .nameAr + : assessment + .selectedDiagnosisType + .nameEn, + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), ), ], ), + ), + if (assessment.doctorName != null) + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .doc + + ' : ', + style: new TextStyle( + color: Color(0xFF575757), + ), + ), + new TextSpan( + text: + assessment.doctorName ?? + '', + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), + ), + ], + ), + ), SizedBox( height: 6, ), + Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( - assessment.remark != null || - assessment.remark == - '' + (assessment.remark != null || + assessment.remark != + '') ? TranslationBase.of( context) .remarks + " : " : '', - fontSize: 10, - color: Colors.grey, + + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600 ), Container( width: MediaQuery.of(context) @@ -331,6 +371,7 @@ class _UpdateAssessmentPageState extends State { child: AppText( assessment.remark ?? "", fontSize: 11, + color: Color(0xFF2B353E), fontWeight: FontWeight.w700, ), ), @@ -340,37 +381,38 @@ class _UpdateAssessmentPageState extends State { ), Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.end, children: [ Row( children: [ - AppText( - assessment.createdOn != null - ? DateTime.parse( - assessment - .createdOn) - .day - .toString() - : DateTime.now() - .day - .toString(), - fontWeight: FontWeight.bold, - fontSize: 15, - ), - AppText(" "), - AppText( - Helpers.getMonth(assessment - .createdOn != - null - ? DateTime.parse( - assessment - .createdOn) - .month - : DateTime.now() - .month) - .toUpperCase(), - fontSize: 13, - color: Colors.grey, + Column( + children: [ + Texts( + assessment.createdOn != null + ? DateUtils + .getDayMonthYearDateFormatted( + DateTime.parse( + assessment + .createdOn)) + : DateUtils + .getDayMonthYearDateFormatted( + DateTime.now()), + fontWeight: FontWeight + .w600, + fontSize: 14, + ), Texts( + assessment.createdOn != null + ? DateUtils.getHour( + DateTime.parse( + assessment + .createdOn)) + : DateUtils.getHour( + DateTime.now()), + fontWeight: FontWeight + .w600, + fontSize: 14, + ), + ], ), ], ), @@ -387,27 +429,11 @@ class _UpdateAssessmentPageState extends State { assessment: assessment, model: model); }, - child: Icon(EvaIcons.edit2), + child: Icon( + DoctorApp.edit, size: 18,), ) ], ), - // Column( - // children: [ - // // SizedBox( - // // height: 60, - // // ), - // InkWell( - // onTap: () { - // openAssessmentDialog( - // context, - // isUpdate: true, - // assessment: assessment, - // model: model); - // }, - // child: Icon(EvaIcons.edit2), - // ) - // ], - // ), ], ), ); @@ -515,581 +541,3 @@ class _UpdateAssessmentPageState extends State { } } - -class AddAssessmentDetails extends StatefulWidget { - final MySelectedAssessment mySelectedAssessment; - final List mySelectedAssessmentList; - final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) - addSelectedAssessment; - final PatiantInformtion patientInfo; - final bool isUpdate; - AddAssessmentDetails( - {Key key, - this.mySelectedAssessment, - this.addSelectedAssessment, - this.patientInfo, - this.isUpdate = false, - this.mySelectedAssessmentList}); - - @override - _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); -} - -class _AddAssessmentDetailsState extends State { - TextEditingController remarkController = TextEditingController(); - TextEditingController appointmentIdController = TextEditingController(); - TextEditingController conditionController = TextEditingController(); - TextEditingController typeController = TextEditingController(); - TextEditingController icdNameController = TextEditingController(); - - GlobalKey key = new GlobalKey>(); - bool isFormSubmitted = false; - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - - remarkController.text = widget.mySelectedAssessment.remark ?? ""; - appointmentIdController.text = - widget.mySelectedAssessment.appointmentId.toString(); - if (widget.isUpdate) { - if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) - conditionController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr - : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn; - if (widget.mySelectedAssessment.selectedDiagnosisType != null) - typeController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment.selectedDiagnosisType.nameAr - : widget.mySelectedAssessment.selectedDiagnosisType.nameEn; - if (widget.mySelectedAssessment.selectedICD != null) - icdNameController.text = widget.mySelectedAssessment.selectedICD.code; - } - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( - fillColor: Colors.white, - - contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - filled: true, - hintStyle: TextStyle( - fontSize: 10, - color: Colors.grey.shade600, - ), - ); - } - - return FractionallySizedBox( - heightFactor: 0.75, - child: BaseView( - onModelReady: (model) async { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - if (model.listOfICD10.length == 0) { - await model.getMasterLookup(MasterKeysService.ICD10); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - SizedBox( - height: 16, - ), - Row( - - children: [ - Expanded( - child: AppText( - TranslationBase.of(context) - .addAssessmentDetails - .toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 13, - ), - ), - - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: AppTextFieldCustom( - height: 55.0, - hintText: - TranslationBase.of(context).appointmentNumber, - //fontSize: 13.5, - // hintColor: Colors.black, - //hasLabelText: appointmentIdController.text != '' - // ? true - // : false, - //showLabelText: true, - //fontWeight: FontWeight.w600, - //readOnly: true, - isDropDown: false, - enabled: false, - controller: appointmentIdController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, - ), - ), - SizedBox( - height: 10, - ), - Container( - height: 55.0, - child: InkWell( - onTap: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } - : null, - child: widget - .mySelectedAssessment.selectedICD == - null - ? AutoCompleteTextField( - - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .nameOrICD, - widget.mySelectedAssessment - .selectedICD != - null - ? widget.mySelectedAssessment - .selectedICD.nameEn - : null, - true, - icon: Icons.keyboard_arrow_down), - itemSubmitted: (item) => setState(() { - widget.mySelectedAssessment - .selectedICD = item; - icdNameController.text = item.code; - }), - key: key, - suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => - new Padding( - child: Texts(suggestion - .description + - " / " + - suggestion.code.toString()), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.code - .toLowerCase() - .startsWith( - input.toLowerCase()), - ) - : AppTextFieldCustom( - onClick: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } - : null, - //hasLabelText: - // icdNameController.text != '' - // ? true - // : false, - //showLabelText: true, - hintText: TranslationBase.of(context) - .nameOrICD, - - //fontSize: 13.5, - //readOnly: true, - //fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - controller: icdNameController, - //suffixIcon: EvaIcons.search, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, - - isDropDown: true, - enabled: false, - height: 55.0, - ) - - // TextField( - // decoration: textFieldSelectorDecoration( - // widget.mySelectedAssessment.selectedICD != - // null ? widget.mySelectedAssessment - // .selectedICD.code : "Name or ICD", - // widget.mySelectedAssessment.selectedICD != - // null ? projectViewModel.isArabic - // ? widget.mySelectedAssessment - // .selectedICD.nameAr - // : widget.mySelectedAssessment - // .selectedICD.nameEn : null, true, - // icon: EvaIcons.search), - // enabled: false, - // ), - ), - ), - if (isFormSubmitted && - widget.mySelectedAssessment.selectedICD == null) - CustomValidationError(), - SizedBox( - height: 7, - ), - AppTextFieldCustom( - height: 55.0, - onClick: model.listOfDiagnosisCondition != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase.of(context).ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - conditionController - .text = projectViewModel - .isArabic - ? widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameAr - : widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - //hasLabelText: - // conditionController.text != '' ? true : false, - //showLabelText: true, - hintText: TranslationBase.of(context).condition, - //fontSize: 13.5, - //readOnly: true, - //suffixIcon: EvaIcons.arrowDown, - // hintColor: Colors.black, - //fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - controller: conditionController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context).emptyMessage; - // else - // return null; - // }, - - isDropDown: true, - enabled: false, - ), - if (isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == - null) - CustomValidationError(), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: 55.0, - onClick: model.listOfDiagnosisType != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase.of(context).ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - // _selectedDiagnosisType = - // selectedValue; - widget.mySelectedAssessment - .selectedDiagnosisType = - selectedValue; - typeController.text = - projectViewModel.isArabic - ? selectedValue.nameAr - : selectedValue.nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - //hasLabelText: - // typeController.text != '' ? true : false, - //prefixIcon: Icon(Icons.add), - //showLabelText: true, - hintText: TranslationBase.of(context).dType, - //fontSize: 13.5, - //readOnly: true, - // hintColor: Colors.black, - //suffixIcon: EvaIcons.arrowDown, - //fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - enabled: false, - isDropDown: true, - - controller: typeController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context).emptyMessage; - // else - // return null; - // }, - ), - if (isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisType == - null) - CustomValidationError(), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 18, - minLines: 5, - hasLabelText: - remarkController.text != '' ? true : false, - showLabelText: true, - controller: remarkController, - onChanged: (value) { - widget.mySelectedAssessment.remark = - remarkController.text; - }, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - fontWeight: FontWeight.w700, - color: Colors.green, - title: (widget.isUpdate - ? 'Update Assessment Details' - : 'Add Assessment Details'), - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - setState(() { - isFormSubmitted = true; - }); - widget.mySelectedAssessment.remark = - remarkController.text; - widget.mySelectedAssessment.appointmentId = - int.parse(appointmentIdController.text); - if (widget.mySelectedAssessment - .selectedDiagnosisCondition != - null && - widget.mySelectedAssessment - .selectedDiagnosisType != - null && - widget.mySelectedAssessment.selectedICD != - null) { - await submitAssessment( - isUpdate: widget.isUpdate, - model: model, - mySelectedAssessment: - widget.mySelectedAssessment); - } - }, - ), - ])), - ), - ), - ))), - ); - } - - submitAssessment( - {SOAPViewModel model, - MySelectedAssessment mySelectedAssessment, - bool isUpdate = false}) async { - if (isUpdate) { - PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: mySelectedAssessment.selectedICD.code, - prevIcdCode10ID: mySelectedAssessment.icdCode10ID); - - await model.patchAssessment(patchAssessmentReqModel); - } else { - PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ - new IcdCodeDetails( - remarks: mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: mySelectedAssessment.selectedICD.code) - ]); - - await model.postAssessment(postAssessmentRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; - mySelectedAssessment.doctorName = doctorProfile.doctorName; - - if (!isUpdate) { - // widget.mySelectedAssessmentList.add(mySelectedAssessment); - widget.addSelectedAssessment(mySelectedAssessment, isUpdate); - } - Navigator.of(context).pop(); - } - - // widget.changePageViewIndex(3); - } -} - -class PatchAssessmentReqModel { - int patientMRN; - int appointmentNo; - int episodeID; - String icdcode10Id; - String prevIcdCode10ID; - int conditionId; - int diagnosisTypeId; - bool complexDiagnosis; - String remarks; - - PatchAssessmentReqModel( - {this.patientMRN, - this.appointmentNo, - this.episodeID, - this.icdcode10Id, - this.prevIcdCode10ID, - this.conditionId, - this.diagnosisTypeId, - this.complexDiagnosis, - this.remarks}); - - PatchAssessmentReqModel.fromJson(Map json) { - patientMRN = json['PatientMRN']; - appointmentNo = json['AppointmentNo']; - episodeID = json['EpisodeID']; - icdcode10Id = json['Icdcode10Id']; - prevIcdCode10ID = json['PrevIcdCode10ID']; - conditionId = json['ConditionId']; - diagnosisTypeId = json['DiagnosisTypeId']; - complexDiagnosis = json['ComplexDiagnosis']; - remarks = json['Remarks']; - } - - Map toJson() { - final Map data = new Map(); - data['PatientMRN'] = this.patientMRN; - data['AppointmentNo'] = this.appointmentNo; - data['EpisodeID'] = this.episodeID; - data['Icdcode10Id'] = this.icdcode10Id; - data['PrevIcdCode10ID'] = this.prevIcdCode10ID; - data['ConditionId'] = this.conditionId; - data['DiagnosisTypeId'] = this.diagnosisTypeId; - data['ComplexDiagnosis'] = this.complexDiagnosis; - data['Remarks'] = this.remarks; - return data; - } -} diff --git a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart index 13b065b0..07d5d7e4 100644 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart @@ -369,18 +369,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState SizedBox( height: 10, ), - if (widget.model.state == ViewState.Idle) - AppButton( - title: "Add Selected Allergy", - padding: 10, - color: Color(0xFF359846), - onPressed: () { - setState(() { - isSubmitted = true; - }); - widget.addSelectedAllergy(); - }, - ), ], ), ), diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index 1b44a016..f0ef63bd 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -154,15 +154,6 @@ class _MasterKeyCheckboxSearchWidgetState extends State