From 1d6f95934245e82157a3f95480bd20b505e42975 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 7 Apr 2021 10:31:28 +0300 Subject: [PATCH 1/5] assessment (SOAP) new design --- .../soap_update/update_assessment_page.dart | 1336 +++++++++-------- 1 file changed, 728 insertions(+), 608 deletions(-) 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 ddb7b9d6..86016be9 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -16,6 +16,7 @@ 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/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'; @@ -35,10 +36,12 @@ class UpdateAssessmentPage extends StatefulWidget { final PatiantInformtion patientInfo; final Function changeLoadingState; - UpdateAssessmentPage({Key key, - this.changePageViewIndex, - this.mySelectedAssessmentList, - this.patientInfo, this.changeLoadingState}); + UpdateAssessmentPage( + {Key key, + this.changePageViewIndex, + this.mySelectedAssessmentList, + this.patientInfo, + this.changeLoadingState}); @override _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); @@ -51,7 +54,7 @@ class _UpdateAssessmentPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) async{ + onModelReady: (model) async { widget.mySelectedAssessmentList.clear(); GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -60,7 +63,7 @@ class _UpdateAssessmentPageState extends State { doctorID: '', appointmentNo: widget.patientInfo.appointmentNo); await model.getPatientAssessment(getAssessmentReqModel); - if(model.patientAssessmentList.isNotEmpty){ + if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisCondition); } @@ -83,70 +86,92 @@ class _UpdateAssessmentPageState extends State { masterKeys: MasterKeysService.DiagnosisCondition, id: element.conditionID, ); - if(diagnosisCondition !=null &&diagnosisType !=null && diagnosisCondition!=null) { - MySelectedAssessment temMySelectedAssessment = MySelectedAssessment( - appointmentId: element.appointmentNo, - remark: element.remarks, - selectedDiagnosisType: diagnosisType, - selectedDiagnosisCondition: diagnosisCondition, - selectedICD: selectedICD, - doctorID: element.doctorID, - doctorName: element.doctorName, - createdBy: element.createdBy, - createdOn: element.createdOn, - icdCode10ID: element.icdCode10ID - ); + if (diagnosisCondition != null && + diagnosisType != null && + diagnosisCondition != null) { + MySelectedAssessment temMySelectedAssessment = + MySelectedAssessment( + appointmentId: element.appointmentNo, + remark: element.remarks, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: element.doctorID, + doctorName: element.doctorName, + createdBy: element.createdBy, + createdOn: element.createdOn, + icdCode10ID: element.icdCode10ID); widget.mySelectedAssessmentList.add(temMySelectedAssessment); } - }); } widget.changeLoadingState(false); - }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, // baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, + child: Container( + color: Color(0xffF8F8F8), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: + Border.all(color: Colors.grey[200], width: 0.5), ), - HeaderBodyExpandableNotifier( + child: HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - Texts(TranslationBase.of(context).assessment.toUpperCase(), - variant: - isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], + Padding( + padding: EdgeInsets.all(12.0), + child: Row( + children: [ + Texts( + TranslationBase.of(context) + .assessment, + variant: isAssessmentExpand + ? "bodyText" + : '', + bold: + isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: Colors.black, + size: 10, + ) + ], + ), ), InkWell( onTap: () { setState(() { - isAssessmentExpand = !isAssessmentExpand; + isAssessmentExpand = + !isAssessmentExpand; }); }, child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) ], ), bodyWidget: Column(children: [ @@ -156,24 +181,23 @@ class _UpdateAssessmentPageState extends State { Column( children: [ Container( - margin: - EdgeInsets.only(left: 5, right: 5, top: 15), + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), child: TextFields( - hintText: TranslationBase.of(context).addAssessment, + hintText: TranslationBase.of(context) + .addAssessment, fontSize: 13.5, onTapTextFields: () { - openAssessmentDialog(context,isUpdate: false, - model: model); + openAssessmentDialog(context, + isUpdate: false, model: model); }, readOnly: true, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal - .appPrimaryColor, + suffixIcon: EvaIcons.plusSquare, + suffixIconColor: Colors.black, fontWeight: FontWeight.w600, validator: (value) { if (value == null) - return TranslationBase - .of(context) + return TranslationBase.of(context) .emptyMessage; else return null; @@ -182,182 +206,203 @@ class _UpdateAssessmentPageState extends State { SizedBox( height: 20, ), - Column( - children: widget.mySelectedAssessmentList.map(( - assessment) { + children: widget.mySelectedAssessmentList + .map((assessment) { return Container( margin: EdgeInsets.only( left: 5, right: 5, top: 15), child: Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - crossAxisAlignment: CrossAxisAlignment - .start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Column( - mainAxisAlignment: MainAxisAlignment - .start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ AppText( - - assessment.createdOn !=null?DateTime.parse(assessment.createdOn).day.toString():DateTime.now().day.toString(), - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - Helpers.getMonth(assessment.createdOn !=null?DateTime.parse(assessment.createdOn).month:DateTime.now().month).toUpperCase(), + "ICD : ".toUpperCase(), fontSize: 10, color: Colors.grey, ), + Container( + child: AppText( + assessment.selectedICD + .code + .trim() + .toUpperCase() ?? + "", + fontWeight: + FontWeight.w700, + fontSize: 11, + ), + ), ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ + ), Row( mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).ICDName +" : ", - fontWeight: FontWeight - .bold, + TranslationBase.of( + context) + .ICDName + + " : ", fontSize: 13, + color: Colors.grey, ), Container( - width: MediaQuery - .of(context) - .size - .width * 0.29, + width: + MediaQuery.of(context) + .size + .width * + 0.29, child: AppText( - assessment - .selectedICD.description + assessment.selectedICD + .description .toString(), + fontWeight: + FontWeight.w700, fontSize: 10, - color: Colors.grey, ), ), ], ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).appointmentNo, - fontWeight: FontWeight - .bold, - fontSize: 13, + TranslationBase.of( + context) + .appointmentNo, + fontSize: 10, + color: Colors.grey, ), AppText( - assessment - .appointmentId + assessment.appointmentId .toString(), - fontSize: 10, - color: Colors.grey, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ], ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).condition + " : ", - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - projectViewModel.isArabic?assessment - .selectedDiagnosisCondition - .nameAr : assessment - .selectedDiagnosisCondition - .nameEn, + TranslationBase.of( + context) + .condition + + " : ", fontSize: 10, color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ AppText( - TranslationBase.of(context).dType+' : ', - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - projectViewModel.isArabic?assessment - .selectedDiagnosisType - .nameAr:assessment - .selectedDiagnosisType - .nameEn, - fontSize: 10, - color: Colors.grey, + projectViewModel.isArabic + ? assessment + .selectedDiagnosisCondition + .nameAr + : assessment + .selectedDiagnosisCondition + .nameEn, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ], ), - if(assessment.doctorName != null) Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).doc, - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - assessment.doctorName??'', + TranslationBase.of( + context) + .dType + + ' : ', fontSize: 10, color: Colors.grey, ), + AppText( + projectViewModel.isArabic + ? assessment + .selectedDiagnosisType + .nameAr + : assessment + .selectedDiagnosisType + .nameEn, + fontSize: 11, + fontWeight: + FontWeight.w700, + ), ], ), + if (assessment.doctorName != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of( + context) + .doc, + fontSize: 10, + color: Colors.grey, + ), + AppText( + assessment.doctorName ?? + '', + fontSize: 11, + fontWeight: + FontWeight.w700, + ), + ], + ), SizedBox( height: 6, ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( - assessment.remark != null || - assessment.remark == '' - ? TranslationBase.of(context).remarks + " : " - : '', - fontWeight: FontWeight.bold, - fontSize: 13, - ), + assessment.remark != + null || + assessment + .remark == + '' + ? TranslationBase.of( + context) + .remarks + + " : " + : '', + fontSize: 10, + color: Colors.grey, + ), Container( - width: MediaQuery - .of(context) - .size - .width * 0.38, + width: + MediaQuery.of(context) + .size + .width * + 0.38, child: AppText( assessment.remark ?? "", - fontSize: 10, - color: Colors.grey, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ), ], @@ -365,89 +410,143 @@ class _UpdateAssessmentPageState extends State { ], ), Column( - crossAxisAlignment: CrossAxisAlignment - .start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( - children: [ AppText( - "ICD : ".toUpperCase(), - fontWeight: FontWeight - .bold, - fontSize: 13, + assessment.createdOn != + null + ? DateTime.parse( + assessment + .createdOn) + .day + .toString() + : DateTime.now() + .day + .toString(), + fontWeight: + FontWeight.bold, + fontSize: 15, ), - Container( - child: AppText( - assessment.selectedICD - .code.trim() - .toUpperCase() ?? - "", - fontSize: 10, - color: Colors.grey, - ), + AppText(" "), + AppText( + Helpers.getMonth(assessment + .createdOn != + null + ? DateTime.parse( + assessment + .createdOn) + .month + : DateTime.now() + .month) + .toUpperCase(), + fontSize: 13, + color: Colors.grey, ), ], - ) - ], - ), - Column( - children: [ + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.05, + ), InkWell( onTap: () { openAssessmentDialog( - context, isUpdate: true, + context, + isUpdate: true, assessment: assessment, model: model); }, - child: Icon(EvaIcons - .edit2Outline), + child: Icon(EvaIcons.edit2), ) ], ), + // Column( + // children: [ + // // SizedBox( + // // height: 60, + // // ), + // InkWell( + // onTap: () { + // openAssessmentDialog( + // context, + // isUpdate: true, + // assessment: assessment, + // model: model); + // }, + // child: Icon(EvaIcons.edit2), + // ) + // ], + // ), ], ), ); - }).toList(),) + }).toList(), + ) ], ) ]), isExpand: isAssessmentExpand, ), - DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase - .of(context) - .next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - if (widget.mySelectedAssessmentList.isEmpty) { - helpers.showErrorToast( - TranslationBase.of(context).assessmentErrorMsg); - } else { - widget.changePageViewIndex(3); - widget.changeLoadingState(true); - } - }, - ), - SizedBox( - height: 30, - ), - ], + ), + DividerWithSpacesAround( + height: 30, + ), + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: 'Previous', + color: Colors.white38, + fontColor: Colors.black, + fontWeight: FontWeight.w700, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.05, + ), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w700, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + if (widget.mySelectedAssessmentList.isEmpty) { + helpers.showErrorToast( + TranslationBase.of(context) + .assessmentErrorMsg); + } else { + widget.changePageViewIndex(3); + widget.changeLoadingState(true); + } + }, + ), + ), + ], + ), + SizedBox( + height: 30, + ), + ], + ), ), ), ), ))); } - openAssessmentDialog(BuildContext context, - { - MySelectedAssessment assessment, bool isUpdate, - SOAPViewModel model - }) { + {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { if (assessment == null) { assessment = MySelectedAssessment( remark: '', appointmentId: widget.patientInfo.appointmentNo); @@ -466,23 +565,26 @@ class _UpdateAssessmentPageState extends State { bool isUpdate) async { setState(() { widget.mySelectedAssessmentList.add(mySelectedAssessment); - }); }); }); } - } class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final List mySelectedAssessmentList; - final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) addSelectedAssessment; + 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}); - + {Key key, + this.mySelectedAssessment, + this.addSelectedAssessment, + this.patientInfo, + this.isUpdate = false, + this.mySelectedAssessmentList}); @override _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); @@ -505,54 +607,47 @@ class _AddAssessmentDetailsState extends State { 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; + 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: 10, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + 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: Theme.of(context).hintColor, - fontWeight: FontWeight.w700), + fontSize: 10, + color: Colors.grey.shade600, + ), ); } + return FractionallySizedBox( heightFactor: 0.75, child: BaseView( @@ -567,393 +662,422 @@ class _AddAssessmentDetailsState extends State { 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, - ), - AppText( - TranslationBase.of(context).addAssessmentDetails.toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 13, - ), - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).appointmentNumber, - fontSize: 13.5, - // hintColor: Colors.black, - hasLabelText: appointmentIdController.text != ''?true:false, - showLabelText: true, - fontWeight: FontWeight.w600, - readOnly: true, - controller: appointmentIdController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; + 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: [ + AppText( + TranslationBase.of(context) + .addAssessmentDetails + .toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 13, + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.42, + ), + 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; }), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.080, - child: InkWell( - onTap: model.listOfICD10 != null + 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; - }); - } + 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: EvaIcons.search), - 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()) - , - ) - : TextFields( - onTapTextFields: 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; - }) + //hasLabelText: + // icdNameController.text != '' + // ? true + // : false, + //showLabelText: true, + hintText: TranslationBase.of(context) + .nameOrICD, - // 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: 10, - ), - TextFields( - onTapTextFields: model - .listOfDiagnosisCondition != - null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment + //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 + selectedValue; + conditionController + .text = projectViewModel + .isArabic + ? widget + .mySelectedAssessment .selectedDiagnosisCondition .nameAr - : widget.mySelectedAssessment + : 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, - // 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; - }), - if(isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == null) - CustomValidationError(), - SizedBox( - height: 10, - ), - + }); + }, + ); + 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; + // }, - TextFields( - onTapTextFields: model - .listOfDiagnosisType != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - // _selectedDiagnosisType = - // selectedValue; - widget.mySelectedAssessment + 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 = + 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, - showLabelText: true, - hintText: TranslationBase - .of(context) - .dType, - fontSize: 13.5, - readOnly: true, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - 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( - title: (widget.isUpdate?TranslationBase.of(context).update:TranslationBase.of(context).add).toUpperCase(), - 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); - } - }, - ), - ])), - ), - ), - ))), + ? 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 { + {SOAPViewModel model, + MySelectedAssessment mySelectedAssessment, + bool isUpdate = false}) async { if (isUpdate) { - PatchAssessmentReqModel patchAssessmentReqModel = - PatchAssessmentReqModel( + 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, + conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, icdcode10Id: mySelectedAssessment.selectedICD.code, - prevIcdCode10ID: mySelectedAssessment.icdCode10ID - ); + 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 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, + 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); + helpers.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -963,17 +1087,15 @@ class _AddAssessmentDetailsState extends State { if (!isUpdate) { // widget.mySelectedAssessmentList.add(mySelectedAssessment); - widget.addSelectedAssessment(mySelectedAssessment,isUpdate); + widget.addSelectedAssessment(mySelectedAssessment, isUpdate); } Navigator.of(context).pop(); } - // widget.changePageViewIndex(3); } } - class PatchAssessmentReqModel { int patientMRN; int appointmentNo; @@ -987,14 +1109,14 @@ class PatchAssessmentReqModel { PatchAssessmentReqModel( {this.patientMRN, - this.appointmentNo, - this.episodeID, - this.icdcode10Id, - this.prevIcdCode10ID, - this.conditionId, - this.diagnosisTypeId, - this.complexDiagnosis, - this.remarks}); + this.appointmentNo, + this.episodeID, + this.icdcode10Id, + this.prevIcdCode10ID, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); PatchAssessmentReqModel.fromJson(Map json) { patientMRN = json['PatientMRN']; @@ -1022,5 +1144,3 @@ class PatchAssessmentReqModel { return data; } } - - From 11f2c30c6400f7622aec48c1c34a5a3fa8187056 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 7 Apr 2021 11:15:24 +0300 Subject: [PATCH 2/5] Fix vist date im medical file --- .../medical-file/medical_file_details.dart | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 1e2bc1f8..25ea1f22 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/core/viewModel/medical_file_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/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_profile_screen.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; @@ -14,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body. 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:provider/provider.dart'; class MedicalFileDetails extends StatefulWidget { String age; @@ -69,6 +72,7 @@ class _MedicalFileDetailsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getMedicalFile(mrn: pp), builder: @@ -184,7 +188,7 @@ class _MedicalFileDetailsState extends State { TranslationBase.of(context) .episode + ": ", - fontWeight: FontWeight.w700, + //fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && @@ -216,7 +220,7 @@ class _MedicalFileDetailsState extends State { TranslationBase.of(context) .visitDate + ": ", - fontWeight: FontWeight.w700, + //fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && @@ -230,15 +234,17 @@ class _MedicalFileDetailsState extends State { .length != 0) AppText( - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .appointmentDate - .toString(), + '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .date, + ), isArabic: projectViewModel.isArabic)}', + color: Colors.black, fontWeight: FontWeight.w700, + fontSize: 14, ), SizedBox(width: 35.0), // AppText( From 1fba6c839cf9dd6e9bc9b59c661ae932d9cce5c2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 7 Apr 2021 14:16:51 +0300 Subject: [PATCH 3/5] insurance approvals deatils fix --- lib/core/model/insurance_approval.dart | 373 +++++++++++++++++- .../insurance_approval_screen_patient.dart | 6 +- .../patients/insurance_approvals_details.dart | 160 +++++--- .../prescription/prescriptions_page.dart | 7 +- ...ent-profile-header-new-design-app-bar.dart | 290 ++++++-------- lib/widgets/shared/doctor_card_insurance.dart | 10 +- 6 files changed, 584 insertions(+), 262 deletions(-) diff --git a/lib/core/model/insurance_approval.dart b/lib/core/model/insurance_approval.dart index 9eef97bb..b8a9d2fe 100644 --- a/lib/core/model/insurance_approval.dart +++ b/lib/core/model/insurance_approval.dart @@ -1,27 +1,41 @@ -class InsuranceApprovalDetails { +class ApporvalDetails { + int approvalNo; + String procedureName; + //String procedureNameN; String status; + String isInvoicedDesc; - InsuranceApprovalDetails({ - this.procedureName, - this.status, - this.isInvoicedDesc, - }); + ApporvalDetails( + {this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc}); - InsuranceApprovalDetails.fromJson(Map json) { - try { - isInvoicedDesc = json['IsInvoicedDesc']; - status = json['Status']; - procedureName = json['ProcedureName']; - } catch (e) { - print(e); - } + ApporvalDetails.fromJson(Map json) { + approvalNo = json['ApprovalNo']; + + procedureName = json['ProcedureName']; + + status = json['Status']; + + isInvoicedDesc = json['IsInvoicedDesc']; + } + + Map toJson() { + final Map data = new Map(); + + data['ApprovalNo'] = this.approvalNo; + + data['ProcedureName'] = this.procedureName; + + data['Status'] = this.status; + + data['IsInvoicedDesc'] = this.isInvoicedDesc; + return data; } } class InsuranceApprovalModel { - InsuranceApprovalDetails approvalDetails; + List apporvalDetails; double versionID; int channel; int languageID; @@ -75,11 +89,11 @@ class InsuranceApprovalModel { //this.companyName, this.expiryDate, this.rceiptOn, - this.approvalDetails, + this.apporvalDetails, this.appointmentNo, this.doctorImage}); - InsuranceApprovalDetails x = InsuranceApprovalDetails(); + //InsuranceApprovalDetails x = InsuranceApprovalDetails(); InsuranceApprovalModel.fromJson(Map json) { try { @@ -108,8 +122,12 @@ class InsuranceApprovalModel { doctorName = json['DoctorName']; doctorImage = json['DoctorImageURL']; clinicName = json['ClinicName']; - approvalDetails = - InsuranceApprovalDetails.fromJson(json['ApporvalDetails'][0]); + if (json['ApporvalDetails'] != null) { + apporvalDetails = new List(); + json['ApporvalDetails'].forEach((v) { + apporvalDetails.add(new ApporvalDetails.fromJson(v)); + }); + } appointmentNo = json['AppointmentNo']; } catch (e) { print(e); @@ -143,3 +161,320 @@ class InsuranceApprovalModel { return data; } } + +// class InsuranceApprovalModel { +// String setupID; +// int projectID; +// int approvalNo; +// String approvalDate; +// int patientType; +// int patientID; +// int companyID; +// int subCategoryID; +// int doctorID; +// int clinicID; +// int approvalType; +// Null inpatientApprovalSubType; +// String validFrom; +// Null vaildDays; +// String validTo; +// Null isApprovalOnGross; +// Null isPackage; +// int requestedAmount; +// bool isDentalAllowedBackend; +// int patientTypeID; +// +// String companyApprovalNo; +// +// String submitOn; +// String receiptOn; +// +// int status; +// int eXuldAPPNO; +// String feedbackStatusOn; +// int authorizerID; +// String expiryDate; +// int appointmentNo; +// int admissionNo; +// +// int createdBy; +// String createdOn; +// int editedBy; +// String editedOn; +// +// String extendedOn; +// +// int noOrderAuthorizerID; +// bool isVerbalApproval; +// +// List apporvalDetails; +// String approvalStatusDescption; +// String clinicName; +// +// //Null companyName; +// String doctorImageURL; +// String doctorName; +// +// int doctorRate; +// String doctorTitle; +// int gender; +// String genderDescription; +// bool isActiveDoctorProfile; +// bool isExecludeDoctor; +// bool isInOutPatient; +// String isInOutPatientDescription; +// String isInOutPatientDescriptionN; +// bool isLiveCareAppointment; +// String projectName; +// +// String qR; +// List speciality; +// +// int totaUnUsedCount; +// int unUsedCount; +// +// InsuranceApprovalModel( +// {this.setupID, +// this.projectID, +// this.approvalNo, +// this.approvalDate, +// this.patientType, +// this.patientID, +// this.companyID, +// this.subCategoryID, +// this.doctorID, +// this.clinicID, +// this.approvalType, +// this.inpatientApprovalSubType, +// this.validFrom, +// this.vaildDays, +// this.validTo, +// this.isApprovalOnGross, +// this.isPackage, +// this.requestedAmount, +// this.patientTypeID, +// this.companyApprovalNo, +// this.eXuldAPPNO, +// this.submitOn, +// this.receiptOn, +// this.status, +// this.feedbackStatusOn, +// this.authorizerID, +// this.expiryDate, +// this.appointmentNo, +// this.admissionNo, +// this.createdBy, +// this.createdOn, +// this.editedBy, +// this.editedOn, +// this.extendedOn, +// this.noOrderAuthorizerID, +// this.isVerbalApproval, +// this.apporvalDetails, +// this.approvalStatusDescption, +// this.clinicName, +// this.doctorImageURL, +// this.doctorName, +// this.doctorRate, +// this.doctorTitle, +// this.gender, +// this.genderDescription, +// this.isActiveDoctorProfile, +// this.isExecludeDoctor, +// this.isInOutPatient, +// this.isInOutPatientDescription, +// this.isInOutPatientDescriptionN, +// this.isLiveCareAppointment, +// this.projectName, +// this.qR, +// this.speciality, +// this.totaUnUsedCount, +// this.unUsedCount, +// this.isDentalAllowedBackend}); +// +// InsuranceApprovalModel.fromJson(Map json) { +// eXuldAPPNO = json['EXuldAPPNO']; +// setupID = json['SetupID']; +// projectID = json['ProjectID']; +// approvalNo = json['ApprovalNo']; +// approvalDate = json['ApprovalDate']; +// patientType = json['PatientType']; +// patientID = json['PatientID']; +// companyID = json['CompanyID']; +// subCategoryID = json['SubCategoryID']; +// doctorID = json['DoctorID']; +// clinicID = json['ClinicID']; +// approvalType = json['ApprovalType']; +// inpatientApprovalSubType = json['InpatientApprovalSubType']; +// validFrom = json['ValidFrom']; +// vaildDays = json['VaildDays']; +// validTo = json['ValidTo']; +// isApprovalOnGross = json['IsApprovalOnGross']; +// isPackage = json['IsPackage']; +// requestedAmount = json['RequestedAmount']; +// +// companyApprovalNo = json['CompanyApprovalNo']; +// +// submitOn = json['SubmitOn']; +// receiptOn = json['ReceiptOn']; +// +// status = json['Status']; +// +// feedbackStatusOn = json['FeedbackStatusOn']; +// authorizerID = json['AuthorizerID']; +// expiryDate = json['ExpiryDate']; +// appointmentNo = json['AppointmentNo']; +// admissionNo = json['AdmissionNo']; +// +// createdBy = json['CreatedBy']; +// createdOn = json['CreatedOn']; +// editedBy = json['EditedBy']; +// editedOn = json['EditedOn']; +// +// extendedOn = json['ExtendedOn']; +// +// noOrderAuthorizerID = json['NoOrderAuthorizerID']; +// isVerbalApproval = json['isVerbalApproval']; +// +// if (json['ApporvalDetails'] != null) { +// apporvalDetails = new List(); +// json['ApporvalDetails'].forEach((v) { +// apporvalDetails.add(new ApporvalDetails.fromJson(v)); +// }); +// } +// approvalStatusDescption = json['ApprovalStatusDescption']; +// clinicName = json['ClinicName']; +// +// doctorImageURL = json['DoctorImageURL']; +// doctorName = json['DoctorName']; +// +// doctorRate = json['DoctorRate']; +// doctorTitle = json['DoctorTitle']; +// gender = json['Gender']; +// genderDescription = json['GenderDescription']; +// isActiveDoctorProfile = json['IsActiveDoctorProfile']; +// isExecludeDoctor = json['IsExecludeDoctor']; +// isInOutPatient = json['IsInOutPatient']; +// isInOutPatientDescription = json['IsInOutPatientDescription']; +// isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; +// isLiveCareAppointment = json['IsLiveCareAppointment']; +// projectName = json['ProjectName']; +// +// qR = json['QR']; +// speciality = json['Speciality'].cast(); +// +// totaUnUsedCount = json['TotaUnUsedCount']; +// unUsedCount = json['UnUsedCount']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['SetupID'] = this.setupID; +// data['ProjectID'] = this.projectID; +// data['ApprovalNo'] = this.approvalNo; +// data['ApprovalDate'] = this.approvalDate; +// data['PatientType'] = this.patientType; +// data['PatientID'] = this.patientID; +// data['CompanyID'] = this.companyID; +// data['SubCategoryID'] = this.subCategoryID; +// data['DoctorID'] = this.doctorID; +// data['ClinicID'] = this.clinicID; +// data['ApprovalType'] = this.approvalType; +// data['InpatientApprovalSubType'] = this.inpatientApprovalSubType; +// data['ValidFrom'] = this.validFrom; +// data['VaildDays'] = this.vaildDays; +// data['ValidTo'] = this.validTo; +// data['IsApprovalOnGross'] = this.isApprovalOnGross; +// data['IsPackage'] = this.isPackage; +// data['RequestedAmount'] = this.requestedAmount; +// +// data['CompanyApprovalNo'] = this.companyApprovalNo; +// +// data['SubmitOn'] = this.submitOn; +// data['ReceiptOn'] = this.receiptOn; +// +// data['Status'] = this.status; +// +// data['FeedbackStatusOn'] = this.feedbackStatusOn; +// data['AuthorizerID'] = this.authorizerID; +// data['ExpiryDate'] = this.expiryDate; +// data['AppointmentNo'] = this.appointmentNo; +// data['AdmissionNo'] = this.admissionNo; +// +// data['CreatedBy'] = this.createdBy; +// data['CreatedOn'] = this.createdOn; +// data['EditedBy'] = this.editedBy; +// data['EditedOn'] = this.editedOn; +// data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; +// +// data['ExtendedOn'] = this.extendedOn; +// +// data['NoOrderAuthorizerID'] = this.noOrderAuthorizerID; +// data['isVerbalApproval'] = this.isVerbalApproval; +// +// if (this.apporvalDetails != null) { +// data['ApporvalDetails'] = +// this.apporvalDetails.map((v) => v.toJson()).toList(); +// } +// data['ApprovalStatusDescption'] = this.approvalStatusDescption; +// data['ClinicName'] = this.clinicName; +// +// data['DoctorImageURL'] = this.doctorImageURL; +// data['DoctorName'] = this.doctorName; +// data['EXuldAPPNO'] = this.eXuldAPPNO; +// data['DoctorRate'] = this.doctorRate; +// data['DoctorTitle'] = this.doctorTitle; +// data['Gender'] = this.gender; +// data['GenderDescription'] = this.genderDescription; +// data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; +// data['IsExecludeDoctor'] = this.isExecludeDoctor; +// data['IsInOutPatient'] = this.isInOutPatient; +// data['IsInOutPatientDescription'] = this.isInOutPatientDescription; +// data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; +// data['IsLiveCareAppointment'] = this.isLiveCareAppointment; +// data['ProjectName'] = this.projectName; +// +// data['QR'] = this.qR; +// data['Speciality'] = this.speciality; +// +// data['TotaUnUsedCount'] = this.totaUnUsedCount; +// data['UnUsedCount'] = this.unUsedCount; +// return data; +// } +// } +// +// class ApporvalDetails { +// int approvalNo; +// +// String procedureName; +// //String procedureNameN; +// String status; +// +// String isInvoicedDesc; +// +// ApporvalDetails( +// {this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc}); +// +// ApporvalDetails.fromJson(Map json) { +// approvalNo = json['ApprovalNo']; +// +// procedureName = json['ProcedureName']; +// +// status = json['Status']; +// +// isInvoicedDesc = json['IsInvoicedDesc']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// +// data['ApprovalNo'] = this.approvalNo; +// +// data['ProcedureName'] = this.procedureName; +// +// data['Status'] = this.status; +// +// data['IsInvoicedDesc'] = this.isInvoicedDesc; +// return data; +// } +// } diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index 3f0bfedf..b342de9c 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -42,7 +42,8 @@ class _InsuranceApprovalScreenNewState return BaseView( onModelReady: patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo,projectId: patient.projectId) + appointmentNo: patient.appointmentNo, + projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( @@ -147,7 +148,8 @@ class _InsuranceApprovalScreenNewState .toString(), isPrescriptions: true, approvalStatus: model.insuranceApproval[index] - .approvalDetails?.status??'', + .approvalStatusDescption ?? + '', ), ), ), diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index 8903b704..add08730 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -37,7 +37,8 @@ class _InsuranceApprovalsDetailsState extends State { return BaseView( onModelReady: patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo,projectId: patient.projectId) + appointmentNo: patient.appointmentNo, + projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( @@ -93,12 +94,25 @@ class _InsuranceApprovalsDetailsState extends State { Row( children: [ Texts( - model.insuranceApproval[indexInsurance].approvalDetails!=null? - model.insuranceApproval[indexInsurance].approvalDetails.status ??"":"", - color: - model.insuranceApproval[indexInsurance].approvalDetails!=null? - "${model.insuranceApproval[indexInsurance].approvalDetails.status}" - == "Approved" ? Color(0xff359846) : Color(0xffD02127): Color(0xffD02127), + model.insuranceApproval[indexInsurance] + .approvalStatusDescption != + null + ? model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption ?? + "" + : "", + color: model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption != + null + ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == + "Approved" + ? Color(0xff359846) + : Color(0xffD02127) + : Color(0xffD02127), ), ], ), @@ -208,7 +222,6 @@ class _InsuranceApprovalsDetailsState extends State { Texts('Sample') ], ), - Row( children: [ Texts( @@ -293,59 +306,84 @@ class _InsuranceApprovalsDetailsState extends State { Padding( padding: const EdgeInsets.symmetric( horizontal: 8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of(context) - .size - .height * - 0.15, //130.0, - width: MediaQuery.of(context) - .size - .width * - 0.33, - child: Texts(model - .insuranceApproval[ - indexInsurance] - ?.approvalDetails - ?.procedureName??""), - ), - Container( - height: MediaQuery.of(context) - .size - .height * - 0.15, - width: MediaQuery.of(context) - .size - .width * - 0.33, - child: Texts(model - .insuranceApproval[ - indexInsurance] - ?.approvalDetails - ?.status??""), - ), - Container( - height: MediaQuery.of(context) - .size - .height * - 0.15, - width: MediaQuery.of(context) - .size - .width * - 0.21, - child: Texts(model - .insuranceApproval[ - indexInsurance] - ?.approvalDetails - ?.isInvoicedDesc??""), - ), - ], - ), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApproval[indexInsurance] + .apporvalDetails + .length, + itemBuilder: (BuildContext context, + int index) { + return Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.15, //130.0, + width: + MediaQuery.of(context) + .size + .width * + 0.33, + child: Texts(model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.procedureName ?? + ""), + ), + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.15, + width: + MediaQuery.of(context) + .size + .width * + 0.33, + child: Texts(model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.status ?? + ""), + ), + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.15, + width: + MediaQuery.of(context) + .size + .width * + 0.21, + child: Texts(model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.isInvoicedDesc ?? + ""), + ), + ], + ), + ); + }), ), Divider( color: Colors.black45, diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 0c33c6e5..62939fc5 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -32,7 +32,8 @@ class PrescriptionsPage extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType), + appBar: PatientProfileHeaderNewDesignAppBar( + patient, arrivalType ?? '0', patientType), body: FractionallySizedBox( widthFactor: 1.0, child: ListView( @@ -60,7 +61,9 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if (patientType != null && patientType == '7' && patient.patientStatusType == 43) + if (patientType != null && + patientType == '7' && + patient.patientStatusType == 43) InkWell( onTap: () { addPrescriptionForm( diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index 5a284435..d49798f4 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -10,13 +10,14 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; -class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with PreferredSizeWidget{ - +class PatientProfileHeaderNewDesignAppBar extends StatelessWidget + with PreferredSizeWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; - PatientProfileHeaderNewDesignAppBar(this.patient, this.patientType, this.arrivalType); + PatientProfileHeaderNewDesignAppBar( + this.patient, this.patientType, this.arrivalType); @override Widget build(BuildContext context) { @@ -28,14 +29,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred } return Container( padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5,), + left: 0, + right: 5, + bottom: 5, + ), decoration: BoxDecoration( color: Colors.white, ), height: 200, child: Container( - padding: EdgeInsets.only( - left: 10, right: 10, bottom: 10), + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), margin: EdgeInsets.only(top: 50), child: Column( children: [ @@ -49,12 +52,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred ), Expanded( child: AppText( - patient.firstName != null ? - (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize( - patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier *2.2, + patient.firstName != null + ? (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize(patient.lastName)) + : Helpers.capitalize(patient.patientDetails.fullName), + fontSize: SizeConfig.textMultiplier * 2.2, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, fontFamily: 'Poppins', @@ -62,13 +65,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred ), gender == 1 ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) + DoctorApp.male_2, + color: Colors.blue, + ) : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), + DoctorApp.female_1, + color: Colors.pink, + ), ]), ), Row(children: [ @@ -79,129 +82,97 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred height: 60, child: Image.asset( gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, ), ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SERVICES_PATIANT2[ - int.parse(patientType)] == - "patientArrivalList" - ? Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SERVICES_PATIANT2[int.parse(patientType)] == + "patientArrivalList" + ? Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - patient.patientStatusType == - 43 + patient.patientStatusType == 43 ? AppText( - TranslationBase.of( - context) - .arrivedP, - color: Colors.green, - fontWeight: - FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, - ) + TranslationBase.of(context).arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) : AppText( - TranslationBase.of( - context) - .notArrived, - color: - Colors.red[800], - fontWeight: - FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, - ), + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), arrivalType == '1' ? AppText( - patient.startTime != - null - ? patient - .startTime - : '', - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - ) + patient.startTime != null + ? patient.startTime + : '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) : AppText( - patient.arrivedOn!=null? DateUtils.convertStringToDateFormat( - patient.arrivedOn, - 'MM-dd-yyyy HH:mm'):'', - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - ) - ], - )) + patient.arrivedOn != null + ? DateUtils.convertStringToDateFormat( + patient.arrivedOn, + 'MM-dd-yyyy HH:mm') + : '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + ], + )) : SizedBox(), - if (SERVICES_PATIANT2[ - int.parse(patientType)] == + if (SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient") Container( child: Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .appointmentDate + + TranslationBase.of(context).appointmentDate + " : ", fontSize: 14, ), patient.startTime != null ? Container( - height: 15, - width: 60, - decoration: - BoxDecoration( - borderRadius: - BorderRadius - .circular( - 25), - color: HexColor( - "#20A169"), - ), - child: AppText( - patient.startTime, - color: Colors.white, - fontSize: 1.5 * - SizeConfig - .textMultiplier, - textAlign: TextAlign - .center, - fontWeight: - FontWeight.bold, - ), - ) + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + patient.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ) : SizedBox(), SizedBox( width: 3.5, ), Container( child: AppText( - convertDateFormat2(patient.appointmentDate.toString()?? ''), - fontSize: 1.5 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, + convertDateFormat2( + patient.appointmentDate.toString() ?? ''), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), ), SizedBox( @@ -214,34 +185,23 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred ), ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ RichText( text: TextSpan( style: TextStyle( - fontSize: 1.6 * - SizeConfig - .textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black), children: [ new TextSpan( - text: - TranslationBase.of( - context) - .fileNumber, + text: TranslationBase.of(context).fileNumber, style: TextStyle( - fontSize: 12, - fontFamily: - 'Poppins')), + fontSize: 12, fontFamily: 'Poppins')), new TextSpan( - text: patient.patientId - .toString(), + text: patient.patientId.toString(), style: TextStyle( - fontWeight: - FontWeight.w700, - fontFamily: - 'Poppins', + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', fontSize: 14)), ], ), @@ -249,32 +209,23 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred Row( children: [ AppText( - patient.nationalityName ?? - patient.nationality, + patient.nationalityName ?? patient.nationality, fontWeight: FontWeight.bold, fontSize: 12, ), patient.nationality != null ? ClipRRect( - borderRadius: - BorderRadius - .circular( - 20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: - (BuildContext - context, - Object - exception, - StackTrace - stackTrace) { - return Text( - 'No Image'); - }, - )) + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + patient.nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) : SizedBox() ], ) @@ -284,26 +235,19 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: 1.6 * - SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black, fontFamily: 'Poppins', ), children: [ new TextSpan( - text: TranslationBase.of( - context) - .age + - " : ", - style: TextStyle( - fontSize: 14)), + text: TranslationBase.of(context).age + " : ", + style: TextStyle(fontSize: 14)), new TextSpan( text: - "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", + "${DateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", style: TextStyle( - fontWeight: - FontWeight.w700, - fontSize: 14)), + fontWeight: FontWeight.w700, fontSize: 14)), ], ), ), @@ -330,10 +274,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred var date = new DateTime.fromMillisecondsSinceEpoch( int.parse(str.substring(startIndex + start.length, endIndex))); newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); } return newDate.toString(); @@ -357,7 +301,5 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with Preferred } @override - Size get preferredSize => Size(double.maxFinite,200); + Size get preferredSize => Size(double.maxFinite, 200); } - - diff --git a/lib/widgets/shared/doctor_card_insurance.dart b/lib/widgets/shared/doctor_card_insurance.dart index bd127bd1..42b001b3 100644 --- a/lib/widgets/shared/doctor_card_insurance.dart +++ b/lib/widgets/shared/doctor_card_insurance.dart @@ -56,7 +56,9 @@ class DoctorCardInsurance extends StatelessWidget { topLeft: Radius.circular(10), bottomLeft: Radius.circular(10), ), - color: approvalStatus == "Approved" ? Color(0xff359846) : Color(0xffD02127), + color: approvalStatus == "Approved" + ? Color(0xff359846) + : Color(0xffD02127), ), ), Expanded( @@ -99,9 +101,9 @@ class DoctorCardInsurance extends StatelessWidget { children: [ Expanded( child: Texts( - doctorName, - bold: true, - )), + doctorName, + bold: true, + )), ], ), Row( From 6e96dda6cd4f9b56dda3bbb68f8e12629c5efcb8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 7 Apr 2021 14:41:52 +0300 Subject: [PATCH 4/5] finish soap objective new design --- lib/config/localized_values.dart | 5 +- lib/util/translations_delegate_base.dart | 2 + .../objective/examination-item-card.dart | 93 +++ .../objective-add-examination-page.dart | 506 ++++++++++++ .../objective/update_objective_page.dart | 473 ++++++++++++ .../soap_update/update_objective_page.dart | 730 ------------------ .../soap_update/update_soap_index.dart | 2 +- lib/widgets/shared/app-textfield-custom.dart | 21 +- 8 files changed, 1097 insertions(+), 735 deletions(-) create mode 100644 lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart create mode 100644 lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart create mode 100644 lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart delete mode 100644 lib/widgets/patients/profile/soap_update/update_objective_page.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 980a2e9b..b0e694a8 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -824,8 +824,11 @@ const Map> localizedValues = { "accepted": {"en": "Accepted", "ar": "وافقت"}, "cancelled": {"en": "Cancelled", "ar": "ألغيت"}, "unReplied": {"en": "UnReplied", "ar": "لم يتم الرد"}, - "replied": {"en": "Replied", "ar": " تم الرد"},"typeHereToReply": { + "searchHere": {"en": "Search here", "ar": "إبحث هنا"}, + "replied": {"en": "Replied", "ar": " تم الرد"}, + "typeHereToReply": { "en": "Type here to reply", "ar": "اكتب هنا للرد" }, + "remove": {"en": "Remove", "ar": " حذف"}, }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 243f742e..6eba28fc 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1205,6 +1205,8 @@ class TranslationBase { String get unReplied => localizedValues['unReplied'][locale.languageCode]; String get replied => localizedValues['replied'][locale.languageCode]; String get typeHereToReply => localizedValues['typeHereToReply'][locale.languageCode]; + String get searchHere => localizedValues['searchHere'][locale.languageCode]; + String get remove => localizedValues['remove'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart b/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart new file mode 100644 index 00000000..ff5d0a6c --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart @@ -0,0 +1,93 @@ +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/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ExaminationIitemCard extends StatelessWidget { + final MySelectedExamination examination; + final Function removeExamination; + + ExaminationIitemCard(this.examination, this.removeExamination); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + color: Colors.white, + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: AppText( + projectViewModel.isArabic + ? examination.selectedExamination.nameAr != null && + examination.selectedExamination.nameAr != "" + ? examination.selectedExamination.nameAr + : examination.selectedExamination.nameEn + : examination.selectedExamination.nameEn, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + ), + )), + Row( + children: [ + AppText( + TranslationBase.of(context).remove, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: Colors.red.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + InkWell( + onTap: removeExamination, + child: Icon( + Icons.clear, + size: 20, + color: Colors.red.shade800, + ), + ) + ], + ), + ], + ), + AppText( + !examination.isNormal + ? examination.isAbnormal + ? TranslationBase.of(context).abnormal + : TranslationBase.of(context).notExamined + : TranslationBase.of(context).normal, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: !examination.isNormal + ? examination.isAbnormal + ? Colors.red.shade800 + : Colors.grey.shade800 + : Colors.green.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + SizedBox( + height: 4, + ), + Expanded( + child: AppText( + examination.remark, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + color: Colors.grey.shade500, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart b/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart new file mode 100644 index 00000000..225b6f61 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart @@ -0,0 +1,506 @@ +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/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.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-textfield-custom.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/borderedButton.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +// Author Mosa Abuzaid + +class AddExaminationPage extends StatefulWidget { + final List mySelectedExamination; + final Function addSelectedExamination; + final Function(MasterKeyModel) removeExamination; + + AddExaminationPage( + {this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}); + + @override + _AddExaminationPageState createState() => _AddExaminationPageState(); +} + +class _AddExaminationPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup(MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + backgroundColor: Color.fromRGBO(248, 248, 248, 1), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16), + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).addExamination}", + fontSize: SizeConfig.textMultiplier * 3.3, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Icon( + Icons.clear, + size: 40, + ), + ) + ], + ), + ), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(16.0), + padding: EdgeInsets.all(0.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + children: [ + ExaminationsListSearchWidget( + masterList: model.physicalExaminationList, + isServiceSelected: (master) => + isServiceSelected(master), + removeHistory: (history) { + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (selectedExamination) { + setState(() { + widget.mySelectedExamination + .add(selectedExamination); + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + Container( + padding: EdgeInsets.all(16), + color: Colors.white, + child: BorderedButton( + "${TranslationBase.of(context).addExamination}", + backgroundColor: HexColor("#359846"), + textColor: Colors.white, + vPadding: 12, + radius: 12, + fontWeight: FontWeight.w600, + fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + handler: () { + widget.addSelectedExamination(); + }, + ), + ) + ], + ), + ), + ); + } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable exam = widget.mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { + return true; + } + return false; + } +} + +class ExaminationsListSearchWidget extends StatefulWidget { + final Function(MasterKeyModel) removeHistory; + final Function(MySelectedExamination) addHistory; + final bool Function(MasterKeyModel) isServiceSelected; + final List masterList; + + ExaminationsListSearchWidget( + {this.removeHistory, + this.addHistory, + this.isServiceSelected, + this.masterList}); + + @override + _ExaminationsListSearchWidgetState createState() => + _ExaminationsListSearchWidgetState(); +} + +class _ExaminationsListSearchWidgetState + extends State { + int expandedIndex = -1; + List items = List(); + TextEditingController filteredSearchController = TextEditingController(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppTextFieldCustom( + height: MediaQuery.of(context).size.height * 0.080, + hintText: TranslationBase.of(context).searchExamination, + isDropDown: true, + hasBorder: false, + controller: filteredSearchController, + onChanged: (value) { + filterSearchResults(value); + }, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + ), + ), + DividerWithSpacesAround( + height: 2, + ), + ...items.mapIndexed((index, item) { + return AddExaminationWidget( + item: item, + addHistory: widget.addHistory, + removeHistory: widget.removeHistory, + isServiceSelected: widget.isServiceSelected, + isExpand: index == expandedIndex, + expandClick: () { + setState(() { + if (expandedIndex == index) { + expandedIndex = -1; + } else { + expandedIndex = index; + } + }); + }, + ); + }).toList(), + ], + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || + item.nameEn.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} + +class AddExaminationWidget extends StatefulWidget { + MasterKeyModel item; + final Function(MasterKeyModel) removeHistory; + final Function(MySelectedExamination) addHistory; + final bool Function(MasterKeyModel) isServiceSelected; + bool isExpand; + final Function expandClick; + + AddExaminationWidget({ + this.item, + this.removeHistory, + this.addHistory, + this.isServiceSelected, + this.isExpand, + this.expandClick, + }); + + @override + _AddExaminationWidgetState createState() => _AddExaminationWidgetState(); +} + +class _AddExaminationWidgetState extends State { + int status = 3; + TextEditingController remarksController = TextEditingController(); + MySelectedExamination examination = MySelectedExamination(); + + @override + void initState() { + + examination.selectedExamination = widget.item; + super.initState(); + } + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: CheckboxListTile( + title: AppText( + projectViewModel.isArabic + ? widget.item.nameAr != null && widget.item.nameAr != "" + ? widget.item.nameAr + : widget.item.nameEn + : widget.item.nameEn, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + ), + value: widget.isServiceSelected(widget.item), + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + if (widget.isServiceSelected(widget.item)) { + widget.removeHistory(widget.item); + widget.expandClick(); + } else { + examination.isNormal = status == 1; + examination.isAbnormal = status == 2; + examination.notExamined = status == 3; + examination.remark = remarksController.text; + widget.addHistory(examination); + widget.expandClick(); + } + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: InkWell( + onTap: widget.expandClick, + child: Icon(widget.isExpand + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ), + ], + ), + bodyWidget: Container( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 8), + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 1; + }); + examination.isNormal = true; + examination.isAbnormal = false; + examination.notExamined = false; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 1 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + AppText( + TranslationBase.of(context).normal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + )), + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 2; + }); + examination.isNormal = false; + examination.isAbnormal = true; + examination.notExamined = false; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 2 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + AppText( + TranslationBase.of(context).abnormal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + )), + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 3; + }); + examination.isNormal = false; + examination.isAbnormal = false; + examination.notExamined = true; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 3 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).notExamined, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + ], + )), + ], + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value){ + examination.remark = value; + }, + ), + ), + ], + ), + ), + isExpand: widget.isExpand, + ), + ); + } +} + +extension FicListExtension on List { + /// Maps each element of the list. + /// The [map] function gets both the original [item] and its [index]. + Iterable mapIndexed(E Function(int index, T item) map) sync* { + for (var index = 0; index < length; index++) { + yield map(index, this[index]); + } + } +} diff --git a/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart new file mode 100644 index 00000000..ba9368bb --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart @@ -0,0 +1,473 @@ +import 'package:doctor_app_flutter/config/config.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/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_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/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.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/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import 'examination-item-card.dart'; +import 'objective-add-examination-page.dart'; + +class UpdateObjectivePage extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + + final List mySelectedExamination; + final PatiantInformtion patientInfo; + + UpdateObjectivePage( + {Key key, + this.changePageViewIndex, + this.mySelectedExamination, + this.patientInfo, + this.changeLoadingState}); + + @override + _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); +} + +class _UpdateObjectivePageState extends State { + bool isSysExaminationExpand = false; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + widget.mySelectedExamination.clear(); + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + + await model.getPatientPhysicalExam(getPhysicalExamReqModel); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = MySelectedExamination( + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, + isAbnormal: element.isAbnormal); + widget.mySelectedExamination.add(tempEam); + }); + } + + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // baseViewModel: model, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + color: Color.fromRGBO(248, 248, 248, 1), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.95, + child: Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.all(12.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).physicalSystemExamination}", + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier * 2.0, + fontWeight: isSysExaminationExpand + ? FontWeight.w700 + : FontWeight.normal, + ), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: Icon(isSysExaminationExpand + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)) + ], + ), + bodyWidget: Column( + children: [ + InkWell( + onTap: () { + openExaminationList(context); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8, horizontal: 8.0), + margin: + EdgeInsets.symmetric(vertical: 8), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(8), + ), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).addExamination}", + fontSize: SizeConfig + .textMultiplier * + 1.8, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + AppText( + "${TranslationBase.of(context).searchHere}", + fontSize: SizeConfig + .textMultiplier * + 1.8, + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + ), + ], + )), + Icon( + Icons.add_box_rounded, + size: 25, + ) + ], + ), + ), + ), + Column( + children: widget.mySelectedExamination + .map((examination) { + return ExaminationIitemCard( + examination, () { + removeExamination(examination + .selectedExamination); + }); + }).toList(), + ) + ], + ), + isExpand: isSysExaminationExpand, + ), + ], + ), + ), + ), + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + widget.changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + color: HexColor("#A5A5A5"), + fontColor: HexColor("#5A5A5A"), + fontWeight: FontWeight.bold, + onPressed: () async { + await submitUpdateObjectivePage(model); + }, + ), + ), + ], + ), + ), + ], + ))); + } + + submitUpdateObjectivePage(SOAPViewModel model) async { + if (widget.mySelectedExamination.isNotEmpty) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; + + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + .add(ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + // masterDescription: exam.selectedExamination, + notExamined: exam.notExamined, + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew)); + }); + + if (model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changeLoadingState(true); + + widget.changePageViewIndex(2); + } + } else { + // widget.changeLoadingState(true); + // + // widget.changePageViewIndex(2); + + helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + } + } + + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.mySelectedExamination + .where((element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + + if (history.length > 0) + setState(() { + widget.mySelectedExamination.remove(history.first); + }); + } + + openExaminationList(BuildContext context) { + Navigator.push( + context, + FadePage( + page: AddExaminationPage( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey)), + ), + ); + /*showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddExaminationDailog( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey), + ); + });*/ + } +} + +class AddExaminationDailog extends StatefulWidget { + final List mySelectedExamination; + final Function addSelectedExamination; + final Function(MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, + this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + /*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_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart deleted file mode 100644 index 1ce5fbea..00000000 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ /dev/null @@ -1,730 +0,0 @@ -import 'package:doctor_app_flutter/config/config.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/auth_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_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/expandable_SOAP_widget.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_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/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.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:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -class UpdateObjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final Function changeLoadingState; - - final List mySelectedExamination; - final PatiantInformtion patientInfo; - - UpdateObjectivePage( - {Key key, - this.changePageViewIndex, - this.mySelectedExamination, - this.patientInfo, - this.changeLoadingState}); - - @override - _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); -} - -class _UpdateObjectivePageState extends State { - bool isSysExaminationExpand = false; - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 0.5, - )), - ); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - ProjectViewModel projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) async { - widget.mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: widget.patientInfo.appointmentNo); - - await model.getPatientPhysicalExam(getPhysicalExamReqModel); - if (model.patientPhysicalExamList.isNotEmpty) { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - model.patientPhysicalExamList.forEach((element) { - MasterKeyModel examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PhysicalExamination, - id: element.examId, - ); - MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - notExamined: element.notExamined, - isNew: element.isNew, - isAbnormal: element.isAbnormal); - widget.mySelectedExamination.add(tempEam); - }); - } - - widget.changeLoadingState(false); - }, - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - // baseViewModel: model, - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - color: Color.fromRGBO(248, 248, 248, 1), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.95, - child: Container( - margin: EdgeInsets.all(8.0), - padding: EdgeInsets.all(12.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.circular(12), - border: Border.fromBorderSide(BorderSide( - color: Colors.grey.shade400, - width: 0.4, - )), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).physicalSystemExamination}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.0, - fontWeight: isSysExaminationExpand ? FontWeight.w700 : FontWeight.normal, - ), - /*Texts( - TranslationBase.of(context) - .physicalSystemExamination, - variant: isSysExaminationExpand - ? "bodyText" - : '', - bold: isSysExaminationExpand - ? true - : false, - color: Colors.black),*/ - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isSysExaminationExpand = - !isSysExaminationExpand; - }); - }, - child: Icon(isSysExaminationExpand - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - child: TextFields( - hintText: TranslationBase.of(context) - .physicalSystemExamination, - fontSize: 13.5, - onTapTextFields: () { - openExaminationList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: - EvaIcons.plusCircleOutline, - suffixIconColor: - AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Column( - children: widget.mySelectedExamination - .map((examination) { - TextEditingController - remarksController = - TextEditingController( - text: examination.remark); - - return Container( - margin: EdgeInsets.only( - left: 15, right: 15, top: 15), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Texts( - (examination - .selectedExamination - .nameEn) - .toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Row( - children: [ - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .isNormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .grey), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - TranslationBase.of( - context) - .normal, - style: - TextStyle( - fontSize: - 12, - color: examination.isNormal - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isAbnormal = - false; - examination - .isNormal = - true; - examination - .notExamined = - false; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .isAbnormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .black), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - TranslationBase.of( - context) - .abnormal, - style: - TextStyle( - fontSize: - 12, - color: examination.isAbnormal - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isNormal = - false; - examination - .isAbnormal = - true; - examination - .notExamined = - false; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .notExamined - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .black), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - "Not Examined", - style: - TextStyle( - fontSize: - 12, - color: examination.notExamined - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isAbnormal = - false; - examination - .isNormal = - false; - examination - .notExamined = - true; - }); - }), - ], - ), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeExamination( - examination - .selectedExamination), - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hasLabelText: - remarksController - .text != - '' - ? true - : false, - showLabelText: true, - hintText: - TranslationBase.of( - context) - .remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 4, - controller: - remarksController, - onChanged: (val) { - examination.remark = val; - }, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ])); - }).toList(), - ) - ], - ) - ]), - isExpand: isSysExaminationExpand, - ), - ], - ), - ), - ), - ), - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), - fontColor: Colors.black, - onPressed: () { - widget.changePageViewIndex(0); - }, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - color: HexColor("#A5A5A5"), - fontColor: HexColor("#5A5A5A"), - fontWeight: FontWeight.bold, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, - ), - ), - ], - ), - ), - ], - ))); - } - - submitUpdateObjectivePage(SOAPViewModel model) async { - if (widget.mySelectedExamination.isNotEmpty) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; - - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - // masterDescription: exam.selectedExamination, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew)); - }); - - if (model.patientPhysicalExamList.isEmpty) { - await model.postPhysicalExam(postPhysicalExamRequestModel); - } else { - await model.patchPhysicalExam(postPhysicalExamRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changeLoadingState(true); - - widget.changePageViewIndex(2); - } - } else { - // widget.changeLoadingState(true); - // - // widget.changePageViewIndex(2); - - helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); - } - } - - removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.mySelectedExamination - .where((element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - - if (history.length > 0) - setState(() { - widget.mySelectedExamination.remove(history.first); - }); - } - - openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { - 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(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddExaminationDailog( - mySelectedExamination: widget.mySelectedExamination, - addSelectedExamination: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeExamination: (masterKey) => removeExamination(masterKey), - ); - }); - } -} - -class AddExaminationDailog extends StatefulWidget { - final List mySelectedExamination; - final Function addSelectedExamination; - final Function(MasterKeyModel) removeExamination; - - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) - : super(key: key); - - @override - _AddExaminationDailogState createState() => _AddExaminationDailogState(); -} - -class _AddExaminationDailogState extends State { - @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - 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), - ), - ]), - ))), - )), - ); - } - - isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - if (exam.length > 0) { - return true; - } - return false; - } -} diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 95d03cec..d6f75ad5 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_objective_page.dart'; +import 'file:///C:/Users/admin/AndroidStudioProjects/doctor_app_flutter/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_plan_page.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/widgets/shared/app-textfield-custom.dart b/lib/widgets/shared/app-textfield-custom.dart index 5cc6c417..caeb7ea2 100644 --- a/lib/widgets/shared/app-textfield-custom.dart +++ b/lib/widgets/shared/app-textfield-custom.dart @@ -9,6 +9,7 @@ class AppTextFieldCustom extends StatefulWidget { final String hintText; final TextEditingController controller; final bool isDropDown; + final bool hasBorder; final String dropDownText; final Icon suffixIcon; final Color dropDownColor; @@ -17,12 +18,14 @@ class AppTextFieldCustom extends StatefulWidget { final int minLines; final int maxLines; final List inputFormatters; + final Function(String) onChanged; AppTextFieldCustom({ this.height = 0, this.onClick, this.hintText, this.controller, + this.hasBorder = true, this.isDropDown = false, this.dropDownText, this.suffixIcon, @@ -32,6 +35,7 @@ class AppTextFieldCustom extends StatefulWidget { this.minLines = 1, this.maxLines = 1, this.inputFormatters, + this.onChanged, }); @override @@ -43,8 +47,9 @@ class _AppTextFieldCustomState extends State { Widget build(BuildContext context) { return Container( height: widget.height != 0 ? widget.height : null, - decoration: - containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)), + decoration: widget.hasBorder + ? containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)) + : null, padding: EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0), child: InkWell( onTap: widget.onClick ?? null, @@ -80,7 +85,17 @@ class _AppTextFieldCustomState extends State { enabled: widget.enabled, minLines: widget.minLines, maxLines: widget.maxLines, - inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], + inputFormatters: widget.inputFormatters != null + ? widget.inputFormatters + : [], + onChanged: (value) { + if (widget.onChanged != null){ + widget.onChanged(value); + setState(() { + + }); + } + }, ) : AppText( widget.dropDownText, From 1fb594617a85679eaa16905fcdbb34f9681a0bff Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 7 Apr 2021 14:54:36 +0300 Subject: [PATCH 5/5] bug fixes --- lib/config/config.dart | 1 - lib/core/service/sickleave_service.dart | 6 +++-- lib/screens/dashboard_screen.dart | 20 +++++++------- lib/screens/patients/patients_screen.dart | 26 +++++++++---------- .../reschedule-leaves/reschedule_leave.dart | 10 +++++-- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 59929f45..654f704a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -247,7 +247,6 @@ const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; - var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 8a5babd5..1ea8669a 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -136,8 +136,10 @@ class SickLeaveService extends BaseService { onSuccess: (dynamic response, int statusCode) { offTime = []; response['MasterLookUpList']['entityList'].forEach((item) => { - if (item['code'] == '1' || item['code'] == '2') - {offTime.add(item)} + //if (item['code'] == '1' || item['code'] == '2') + // { + offTime.add(item) + //}// }); }, onFailure: (String error, int statusCode) { diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 8714aaf8..b0c3bcde 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -801,7 +801,7 @@ class _DashboardScreenState extends State { MainAxisAlignment.start, children: [ AppText( - model.dashboardItemsList[4] + model.dashboardItemsList[6] .kPIName, fontSize: SizeConfig.textMultiplier * @@ -827,11 +827,11 @@ class _DashboardScreenState extends State { Axis.horizontal, children: new List.generate( model - .dashboardItemsList[4] + .dashboardItemsList[6] .summaryoptions .length, (int index) { return getActivityButton(model - .dashboardItemsList[4] + .dashboardItemsList[6] .summaryoptions[index]); }))) ], @@ -843,7 +843,7 @@ class _DashboardScreenState extends State { MainAxisAlignment.start, children: [ AppText( - model.dashboardItemsList[6] + model.dashboardItemsList[4] .kPIName, fontSize: SizeConfig.textMultiplier * @@ -869,11 +869,11 @@ class _DashboardScreenState extends State { Axis.horizontal, children: new List.generate( model - .dashboardItemsList[6] + .dashboardItemsList[4] .summaryoptions .length, (int index) { return getActivityButton(model - .dashboardItemsList[6] + .dashboardItemsList[4] .summaryoptions[index]); }))) ], @@ -1221,7 +1221,7 @@ class _DashboardScreenState extends State { Container( height: 150, margin: EdgeInsets.all(5), - width: ((SizeConfig.screenWidth * .55) / 5.3), + width: 40, child: SizedBox(), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.red[50]), @@ -1233,14 +1233,14 @@ class _DashboardScreenState extends State { margin: EdgeInsets.all(5), padding: EdgeInsets.all(10), height: max != 0 ? (150 * value.value) / max : 0, - width: ((SizeConfig.screenWidth * .55) / 5), + width: 40, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.red[300]))), Container( height: 150, - margin: EdgeInsets.only(left: 10, top: 5), - padding: EdgeInsets.all(8), + margin: EdgeInsets.only(left: 5, top: 5), + padding: EdgeInsets.all(10), child: RotatedBox( quarterTurns: 1, child: Center( diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 28e4434f..62485f0d 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -226,11 +226,11 @@ class _PatientsScreenState extends State { Widget build(BuildContext context) { authProvider = Provider.of(context); _locations = [ - TranslationBase.of(context).all, TranslationBase.of(context).today, TranslationBase.of(context).tomorrow, TranslationBase.of(context).nextWeek, ]; + //TranslationBase.of(context).all, projectsProvider = Provider.of(context); final routeArgs = ModalRoute.of(context).settings.arguments as Map; @@ -449,18 +449,18 @@ class _PatientsScreenState extends State { }, )), Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context) - .size - .height * - 0.03), - child: _locationBar(context) - // child: SERVICES_PATIANT2[ - // int.parse(patientType)] == - // "List_MyOutPatient" - // ? _locationBar(context) - // : Container(), - ), + padding: EdgeInsets.only( + top: MediaQuery.of(context) + .size + .height * + 0.03), + // child: _locationBar(context) + child: SERVICES_PATIANT2[ + int.parse(patientType)] == + "patientArrivalList" + ? _locationBar(context) + : Container(), + ), // Row( // mainAxisAlignment: // MainAxisAlignment.spaceEvenly, diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 7af6b72c..e2959c75 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -104,13 +104,19 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - + offTime = widget.updateData != null + ? widget.updateData.requisitionType.toString() + : offTime; return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( onModelReady: (model2) => { model2.getOffTime(), - model2.getReasons(18), + model2.getReasons(offTime == '1' + ? 18 + : offTime == '2' + ? 19 + : 102), model2.getCoveringDoctors() }, builder: (_, model2, w) => GestureDetector(