From c9fe9ccb633bff170837970cbf97ce5045836b57 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 7 Sep 2021 12:29:23 +0300 Subject: [PATCH 01/32] changing lists from list.generator to list builder to make it faster in big size --- lib/config/config.dart | 4 +- .../viewModel/authentication_view_model.dart | 2 +- .../doctor/my_referral_patient_screen.dart | 75 ----- lib/screens/patients/InPatientPage.dart | 257 ++++++++++-------- .../profile/UCAF/UCAF-detail-screen.dart | 42 ++- .../my-referral-inpatient-screen.dart | 129 +++++---- .../referral/referred-patient-screen.dart | 137 +++++----- 7 files changed, 333 insertions(+), 313 deletions(-) delete mode 100644 lib/screens/doctor/my_referral_patient_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 7002bc3a..def2806c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index d1d4a3e8..cad5fa87 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -253,7 +253,7 @@ class AuthenticationViewModel extends BaseViewModel { /// add  token to shared preferences in case of send activation code is success setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async { - // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart deleted file mode 100644 index 960bbdd9..00000000 --- a/lib/screens/doctor/my_referral_patient_screen.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/referral_view_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/doctor/my_referral_patient_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/shared/app_scaffold_widget.dart'; - -class MyReferralPatient extends StatefulWidget { - int expandedItemIndex = -1; - - @override - _MyReferralPatientState createState() => _MyReferralPatientState(); -} - -class _MyReferralPatientState extends State { - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getMyReferralPatient(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).myReferralPatient, - body: model.listMyReferralPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.listMyReferralPatientModel.length, - (index) => MyReferralPatientWidget( - myReferralPatientModel: model - .listMyReferralPatientModel[index], - model: model, - expandClick: () { - setState(() { - if (widget.expandedItemIndex == - index) { - widget.expandedItemIndex = -1; - } else { - widget.expandedItemIndex = index; - } - }); - }, - isExpand: - widget.expandedItemIndex == index, - ), - ) - ], - ), - ), - ], - ), - ], - ), - ), - )); - } -} diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 8314a653..3b59e546 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -16,7 +16,7 @@ import '../../routes.dart'; class InPatientPage extends StatefulWidget { final bool isMyInPatient; - final PatientSearchViewModel patientSearchViewModel; + final PatientSearchViewModel patientSearchViewModel; InPatientPage(this.isMyInPatient, this.patientSearchViewModel); @@ -25,7 +25,6 @@ class InPatientPage extends StatefulWidget { } class _InPatientPageState extends State { - TextEditingController _searchController = TextEditingController(); bool isSortDes = false; @@ -65,10 +64,9 @@ class _InPatientPageState extends State { onChanged: (value) { widget.patientSearchViewModel.filterSearchResults(value); }), - Positioned( right: 35, - top:5, + top: 5, child: IconButton( icon: Icon( isSortDes @@ -78,9 +76,10 @@ class _InPatientPageState extends State { ), iconSize: 20, // padding: EdgeInsets.only(bottom: 30), - onPressed: () { + onPressed: () { GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); + widget.patientSearchViewModel + .sortInPatient(isDes: isSortDes); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -89,105 +88,146 @@ class _InPatientPageState extends State { ], ), ), - widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? (widget.isMyInPatient && widget.patientSearchViewModel.myIinPatientList.length ==0 )?NoData():Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate( - widget.patientSearchViewModel.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + widget.patientSearchViewModel.state == ViewState.Idle + ? widget.patientSearchViewModel.filteredInPatientItems.length > 0 + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList + .length == + 0) + ? NoData() + : Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + itemCount: widget.patientSearchViewModel + .filteredInPatientItems.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel. - filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else if (widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else if (widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else + return SizedBox(); + }), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ) + : NoData() + : Center( + child: Container( + height: 300, + width: 300, + ), ), - ), - ), - ) - : NoData(): Center( - child: Container( - height: 300, - width: 300, - - ), - ), ], ), ); @@ -202,12 +242,11 @@ class NoData extends StatelessWidget { @override Widget build(BuildContext context) { return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: - TranslationBase.of(context).noDataAvailable)), - ), - ); + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); } } diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 081f1a6e..be08aec2 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -47,8 +47,7 @@ class _UcafDetailScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).ucaf, body: Column( children: [ @@ -234,10 +233,15 @@ class _UcafDetailScreenState extends State { case 0: if (model.patientAssessmentList != null) { return [ - ...List.generate( - model.patientAssessmentList.length, - (index) => DiagnosisWidget( - model, model.patientAssessmentList[index])).toList() + ListView.builder( + itemCount: model.patientAssessmentList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return DiagnosisWidget( + model, model.patientAssessmentList[index]); + }) ]; } else { return [ @@ -247,22 +251,30 @@ class _UcafDetailScreenState extends State { break; case 1: return [ - ...List.generate( - model.prescriptionList != null + ListView.builder( + itemCount: model.prescriptionList != null ? model.prescriptionList.entityList.length : 0, - (index) => MedicationWidget( - model, model.prescriptionList.entityList[index])).toList() + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return MedicationWidget( + model, model.prescriptionList.entityList[index]); + }) ]; break; case 2: if (model.orderProcedures != null) { return [ - ...List.generate( - model.orderProcedures.length, - (index) => - ProceduresWidget(model, model.orderProcedures[index])) - .toList() + ListView.builder( + itemCount: model.orderProcedures.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return ProceduresWidget(model, model.orderProcedures[index]); + }) ]; } else { return [ diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index cb6c1e5f..29697dc1 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -18,7 +18,8 @@ import 'my-referral-patient-screen.dart'; class MyReferralInPatientScreen extends StatefulWidget { @override - _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); + _MyReferralInPatientScreenState createState() => + _MyReferralInPatientScreenState(); } class _MyReferralInPatientScreenState extends State { @@ -76,51 +77,87 @@ class _MyReferralInPatientScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - if(patientType == PatientType.OUT_PATIENT) { - Navigator.push( - context, - FadePage( - page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]), - ), - ); - } else{ - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index], model), - ), - ); - } - - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode( - model.myReferralPatients[index].referralStatus, context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted( - model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic: "${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), - ), - ), - ), + ListView.builder( + itemCount: model.myReferralPatients.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + if (patientType == + PatientType.OUT_PATIENT) { + Navigator.push( + context, + FadePage( + page: MyReferralDetailScreen( + referralPatient: model + .myReferralPatients[index]), + ), + ); + } else { + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen( + model.myReferralPatients[index], + model), + ), + ); + } + }, + child: PatientReferralItemWidget( + referralStatus: + model.getReferralStatusNameByCode( + model.myReferralPatients[index] + .referralStatus, + context), + referralStatusCode: model + .myReferralPatients[index] + .referralStatus, + patientName: model + .myReferralPatients[index] + .patientName, + patientGender: model + .myReferralPatients[index].gender, + referredDate: AppDateUtils + .getDayMonthYearDateFormatted(model + .myReferralPatients[index] + .referralDate), + referredTime: AppDateUtils.getTimeHHMMA( + model.myReferralPatients[index] + .referralDate), + patientID: + "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic: + "${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index] + .referringDoctorRemarks, + nationality: model + .myReferralPatients[index] + .nationalityName, + nationalityFlag: model + .myReferralPatients[index] + .nationalityFlagURL, + doctorAvatar: model + .myReferralPatients[index] + .doctorImageURL, + referralDoctorName: model + .myReferralPatients[index] + .referringDoctorName, + clinicDescription: model + .myReferralPatients[index] + .referringClinicDescription, + infoIcon: Icon( + FontAwesomeIcons.arrowRight, + size: 25, + color: Colors.black), + ), + ); + }) ], ), ), diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 8dce7d60..354ee04f 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -13,7 +13,6 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ReferredPatientScreen extends StatefulWidget { - @override _ReferredPatientScreenState createState() => _ReferredPatientScreenState(); } @@ -69,79 +68,87 @@ class _ReferredPatientScreenState extends State { ), ) : Expanded( - child: SingleChildScrollView( + child: SingleChildScrollView( // DoctorApplication.svc/REST/GtMyReferredPatient child: Container( child: Column( children: [ - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen( - model.getReferredPatientItem(index), this.patientType), - ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model - .getReferredPatientItem(index) - .referralStatusDesc, - referralStatusCode: model - .getReferredPatientItem(index) - .referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: - model.getReferredPatientItem(index).gender, - referredDate: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "dd/MM/yyyy"), - referredTime: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "hh:mm a"), - patientID: - "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - isReferral: false, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - nationality: model - .getReferredPatientItem(index) - .nationalityName, - nationalityFlag: model - .getReferredPatientItem(index) - .nationalityFlagURL, - doctorAvatar: model - .getReferredPatientItem(index) - .doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), - ), + ListView.builder( + itemCount: + model.listMyReferredPatientModel.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen( + model.getReferredPatientItem(index), + this.patientType), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model + .getReferredPatientItem(index) + .referralStatusDesc, + referralStatusCode: model + .getReferredPatientItem(index) + .referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: model + .getReferredPatientItem(index) + .gender, + referredDate: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "dd/MM/yyyy"), + referredTime: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "hh:mm a"), + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + nationality: model + .getReferredPatientItem(index) + .nationalityName, + nationalityFlag: model + .getReferredPatientItem(index) + .nationalityFlagURL, + doctorAvatar: model + .getReferredPatientItem(index) + .doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), + ); + }, ), ], ), ), ), - ), + ), ], ), ), From 7ef7c8225c56b64f9ce1666970f1a89b47c7203c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 7 Sep 2021 15:25:14 +0300 Subject: [PATCH 02/32] fix replay status --- lib/screens/doctor/doctor_repaly_chat.dart | 24 +++++- lib/widgets/doctor/doctor_reply_widget.dart | 82 ++++++++++----------- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index 72f13d4e..52331e8e 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -187,7 +187,7 @@ class _DoctorReplayChatState extends State { children: [ AppText( - widget.reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.createdOn !=null?getFormattedDate(widget.reply.createdOn):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Colors.white, @@ -295,7 +295,7 @@ class _DoctorReplayChatState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - widget.reply.responseDate !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(widget.reply.responseDate)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + widget.reply.responseDate !=null?getFormattedDate(widget.reply.responseDate):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight .w500, color: Color(0xFF2B353E), @@ -445,4 +445,24 @@ class _DoctorReplayChatState extends State { ), )); } + + + getFormattedDate(date){ + return (AppDateUtils.getDateTimeFromServerFormat( + date) + .day + .toString() + + " " + + AppDateUtils.getMonth( + AppDateUtils.getDateTimeFromServerFormat( + date) + .month) + .toString() + .substring(0, 3) + + ' ' + + AppDateUtils.getDateTimeFromServerFormat( + date) + .year + .toString()); + } } diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 599e4e37..32e116af 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -31,14 +31,20 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( - bgColor: - widget.reply.status == 2 ? Colors.green[600] : Color(0xFFD02127), + bgColor: widget.reply.infoStatus == 0 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], hasBorder: false, widget: Container( child: InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(widget.reply.infoStatus != 0) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -49,18 +55,29 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: widget.reply.status == 2 - ? TranslationBase.of(context).active - : widget.reply.status == 1 - ? TranslationBase.of(context).onHold - : TranslationBase.of(context).cancelled, + text: widget.reply.infoStatus == 1 + ? TranslationBase.of(context).replayCallStatus + : widget.reply.infoStatus == 2 + ? TranslationBase.of(context).patientArrived + : widget.reply.infoStatus == 3 + ? TranslationBase.of(context) + .calledAndNoResponse + : widget.reply.infoStatus == 4 + ? TranslationBase.of(context) + .underProcess + : widget.reply.infoStatus == 6 + ? TranslationBase.of(context) + .textResponse + : '', style: TextStyle( - color: widget.reply.status == 2 - ? Colors.green[600] - : Color(0xFFD02127), + color: widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 2.0 * SizeConfig.textMultiplier)), + fontSize: 1.8 * SizeConfig.textMultiplier)), ], ), ), @@ -183,37 +200,13 @@ class _DoctorReplyWidgetState extends State { label: TranslationBase.of(context).fileNumber, value: widget.reply.patientID.toString(), ), - CustomRow( label: TranslationBase.of(context).age + " : ", value: "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", ), - CustomRow( - width: MediaQuery.of(context).size.width * .3, - label: TranslationBase.of(context).infoStatus + - ":", - value: widget.reply.infoStatus == 1 - ? TranslationBase.of(context) - .replayCallStatus - : widget.reply.infoStatus == 2 - ? TranslationBase.of(context) - .patientArrived - : widget.reply.infoStatus == 3 - ? TranslationBase.of(context) - .calledAndNoResponse - : widget.reply.infoStatus == 4 - ? TranslationBase.of(context) - .underProcess - : widget.reply.infoStatus == 6 - ? TranslationBase.of( - context) - .textResponse - : '', - ), - SizedBox( - height: 10, + height: 8, ), ], ), @@ -227,27 +220,28 @@ class _DoctorReplyWidgetState extends State { overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( - fontSize: - 1.3 * SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .requestType + - ": ", + text: + TranslationBase.of(context).requestType + + ": ", style: TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( text: - "${widget.reply.requestTypeDescription}", + "${widget.reply.requestTypeDescription}", style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), From c608b5601dd45cdf68f5c6dce9a1d5495aea4348 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 09:48:34 +0300 Subject: [PATCH 03/32] add arrow to patient card --- .../patients/patient_card/PatientCard.dart | 102 +++++++++--------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b86256fd..efc85f18 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -348,58 +348,62 @@ class PatientCard extends StatelessWidget { width: 10, ), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).fileNumber, - value: patientInfo.patientId.toString(), - ), - - //if (isInpatient) - - CustomRow( - label: TranslationBase.of(context).age + " : ", - value: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - ), - - if (isInpatient) - CustomRow( - label: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - value: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: TranslationBase.of(context).numOfDays + - " : ", - value: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: - TranslationBase.of(context).roomNo + " : ", - value: "${patientInfo.roomId}", - ), - - if (isFromLiveCare) - Column( - children: [ + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ CustomRow( - label: TranslationBase.of(context).clinic + - " : ", - value: patientInfo.clinicName, + label: TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), ), - ], + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", + ), + + if (isInpatient) + CustomRow( + label: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context) + .admissionDate + + " : ", + value: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context).numOfDays + + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: + TranslationBase.of(context).roomNo + " : ", + value: "${patientInfo.roomId}", + ), + + if (isFromLiveCare) + Column( + children: [ + CustomRow( + label: TranslationBase.of(context).clinic + + " : ", + value: patientInfo.clinicName, + ), + ], + ), + ]), ), - ])) + Icon(Icons.arrow_forward, size: 24,), + ], + )) ]), isFromLiveCare ? Row( From 92c791dd72de8dacef5b24e5e3d08a92d211a995 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 8 Sep 2021 12:31:59 +0300 Subject: [PATCH 04/32] improve add subjective info --- .../soap/SOAP_service.dart | 10 +- lib/core/viewModel/SOAP_view_model.dart | 257 ++++++++++-------- .../assessment/add_assessment_details.dart | 1 - .../subjective/medication/add_medication.dart | 1 - .../subjective/update_subjective_page.dart | 238 ++++++---------- 5 files changed, 229 insertions(+), 278 deletions(-) diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 57a54ed0..ec127f8b 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -85,7 +85,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = super.error+ "\n"+error; }, body: postAllergyRequestModel.toJson()); } @@ -97,13 +97,14 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error =super.error + "\n"+error; }, body: postHistoriesRequestModel.toJson()); } Future postChiefComplaint( PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { hasError = false; + super.error =""; await baseAppClient.post(POST_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); @@ -157,7 +158,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = "\n"+error; }, body: patchAllergyRequestModel.toJson()); } @@ -169,13 +170,14 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = error; + super.error = super.error +"\n"+error; }, body: patchHistoriesRequestModel.toJson()); } Future patchChiefComplaint( PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { hasError = false; + super.error =""; await baseAppClient.post(PATCH_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 78c309ca..83cd43e3 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -28,7 +28,9 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; @@ -199,38 +201,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postAllergy(postAllergyRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future postHistories( - PostHistoriesRequestModel postHistoriesRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postHistories(postHistoriesRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future postChiefComplaint( - PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - Future postPhysicalExam( PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); @@ -264,38 +234,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchAllergy(patchAllergyRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future patchHistories( - PostHistoriesRequestModel patchHistoriesRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchHistories(patchHistoriesRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - - Future patchChiefComplaint( - PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { - setState(ViewState.BusyLocal); - await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } - Future patchPhysicalExam( PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); @@ -361,28 +299,6 @@ class SOAPViewModel extends BaseViewModel { return allergiesString; } - Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, - {bool isFirst = false}) async { - setState(ViewState.Busy); - await _SOAPService.getPatientHistories(getHistoryReqModel, - isFirst: isFirst); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } - - Future getPatientChiefComplaint( - GetChiefComplaintReqModel getChiefComplaintReqModel) async { - setState(ViewState.Busy); - await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel); - if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } Future getPatientPhysicalExam( PatiantInformtion patientInfo, @@ -742,20 +658,16 @@ class SOAPViewModel extends BaseViewModel { } } if (allMedicationList.length == 0) { - await getMedicationList(); if (services == null) { - services = [ - _prescriptionService.getMedicationList() - ]; + services = [_prescriptionService.getMedicationList()]; } else { - services.add( - _prescriptionService.getMedicationList()); + services.add(_prescriptionService.getMedicationList()); } } final results = await Future.wait(services ?? []); - if (_SOAPService.hasError ||_prescriptionService.hasError ) { + if (_SOAPService.hasError || _prescriptionService.hasError) { error = _SOAPService.error + _prescriptionService.error; setState(ViewState.ErrorLocal); } else @@ -763,8 +675,7 @@ class SOAPViewModel extends BaseViewModel { } callAddAssessmentLookupsServices({bool allowSetState = true}) async { - if(allowSetState) - setState(ViewState.Busy); + if (allowSetState) setState(ViewState.Busy); var services; if (listOfDiagnosisCondition.length == 0) { if (services == null) { @@ -782,59 +693,177 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType) ]; } else { - services.add(_SOAPService.getMasterLookup( - MasterKeysService.DiagnosisType)); + services + .add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)); } } if (listOfICD10.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.ICD10) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.ICD10)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.ICD10)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.ICD10)); } } final results = await Future.wait(services ?? []); - if(allowSetState) { + if (allowSetState) { if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - } onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async { - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: - int.parse(patientInfo.appointmentNo.toString())); + appointmentNo: int.parse(patientInfo.appointmentNo.toString())); - var services = [ - _SOAPService.getPatientAssessment(getAssessmentReqModel) - ]; + var services = [_SOAPService.getPatientAssessment(getAssessmentReqModel)]; final results = await Future.wait(services); - if (patientAssessmentList.isNotEmpty) { await callAddAssessmentLookupsServices(allowSetState: false); } if (_SOAPService.hasError) { - error = _SOAPService.error; - setState(ViewState.ErrorLocal); + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + postSubjectServices( + {patientInfo, + String complaintsText, + String medicationText, + String illnessText, + List myHistoryList, + List myAllergiesList}) async { + var services; + + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + createPostChiefComplaintRequestModel( + patientInfo: patientInfo, + illnessText: illnessText, + medicationText: medicationText, + complaintsText: complaintsText); + if (patientChiefComplaintList.isEmpty) { + postChiefComplaintRequestModel.editedBy = ''; + services = [ + _SOAPService.postChiefComplaint(postChiefComplaintRequestModel) + ]; + } else { + postChiefComplaintRequestModel.editedBy = ''; + services = [ + _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel) + ]; + } + + if (myHistoryList.length != 0) { + PostHistoriesRequestModel postHistoriesRequestModel = + createPostHistoriesRequestModel( + patientInfo: patientInfo, myHistoryList: myHistoryList); + + if (patientHistoryList.isEmpty) { + services.add(_SOAPService.postHistories(postHistoriesRequestModel)); + } else { + services.add(_SOAPService.patchHistories(postHistoriesRequestModel)); + } + } + + if (myAllergiesList.length != 0) { + PostAllergyRequestModel postAllergyRequestModel =createPostAllergyRequestModel (myAllergiesList:myAllergiesList, patientInfo: patientInfo); + if (patientAllergiesList.isEmpty) { + services.add(_SOAPService.postAllergy(postAllergyRequestModel)); + } else { + services.add(_SOAPService.patchAllergy(postAllergyRequestModel)); + } + + } + + final results = await Future.wait(services); + + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); } else - setState(ViewState.Idle); + setState(ViewState.Idle); + } + + PostChiefComplaintRequestModel createPostChiefComplaintRequestModel( + {patientInfo, + String complaintsText, + String medicationText, + String illnessText}) { + return new PostChiefComplaintRequestModel( + admissionNo: patientInfo.admissionNo != null + ? int.parse(patientInfo.admissionNo) + : null, + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo ?? 0, + appointmentNo: patientInfo.appointmentNo ?? 0, + chiefComplaint: complaintsText, + currentMedication: medicationText, + hopi: illnessText, + isLactation: false, + ispregnant: false, + doctorID: '', + numberOfWeeks: 0); + } + + PostHistoriesRequestModel createPostHistoriesRequestModel( + {patientInfo, List myHistoryList}) { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(doctorID: ''); + myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: patientInfo.appointmentNo, + remarks: "", + historyId: history.selectedHistory.id, + historyType: history.selectedHistory.typeId, + isChecked: history.isChecked, + )); + }); + + return postHistoriesRequestModel; + } + + + PostAllergyRequestModel createPostAllergyRequestModel({myAllergiesList, patientInfo}){ + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); + myAllergiesList.forEach((allergy) { + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); + }); + return postAllergyRequestModel; } } diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index a0cdb39c..53447743 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -1,7 +1,6 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 553c2f17..db31fb95 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -1,7 +1,6 @@ // ignore: must_be_immutable import 'package:autocomplete_textfield/autocomplete_textfield.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/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 72579790..fd5e6b45 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -1,16 +1,9 @@ -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/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.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/screens/patients/profile/soap_update/soap_utils.dart'; @@ -33,13 +26,18 @@ class UpdateSubjectivePage extends StatefulWidget { final int currentIndex; UpdateSubjectivePage( - {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); + {Key key, + this.changePageViewIndex, + this.patientInfo, + this.changeLoadingState, + this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); } -class _UpdateSubjectivePageState extends State implements SubjectiveCallBack { +class _UpdateSubjectivePageState extends State + implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -55,7 +53,8 @@ class _UpdateSubjectivePageState extends State implements widget.changeLoadingState(true); if (model.patientHistoryList.isNotEmpty) { model.patientHistoryList.forEach((element) { - if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, @@ -63,11 +62,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, @@ -75,11 +78,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, @@ -87,11 +94,15 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, @@ -99,7 +110,10 @@ class _UpdateSubjectivePageState extends State implements if (history != null) { MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( - history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -108,15 +122,19 @@ class _UpdateSubjectivePageState extends State implements } getAllergies(SOAPViewModel model) async { - if (model.patientAllergiesList.isNotEmpty) { model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( - masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); MasterKeyModel selectedAllergySeverity; if (element.severity == 0) { selectedAllergySeverity = MasterKeyModel( - id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + id: 0, + typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), + nameAr: '', + nameEn: ''); } else { selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, @@ -124,15 +142,17 @@ class _UpdateSubjectivePageState extends State implements ); } - MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy( - allergy: selectedAllergy, - isChecked: element.isChecked, - createdBy: element.createdBy, - remark: element.remarks, - isLocal: false, - allergySeverity: selectedAllergySeverity); + MySelectedAllergy mySelectedAllergy = + SoapUtils.generateMySelectedAllergy( + allergy: selectedAllergy, + isChecked: element.isChecked, + createdBy: element.createdBy, + remark: element.remarks, + isLocal: false, + allergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) + myAllergiesList.add(mySelectedAllergy); }); } } @@ -148,11 +168,14 @@ class _UpdateSubjectivePageState extends State implements if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); + complaintsController.text = Helpers.parseHtmlString( + model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text = !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty - ? model.patientChiefComplaintList[0].currentMedication + '\n \n' - : model.patientChiefComplaintList[0].currentMedication; + medicationController.text = + !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication + + '\n \n' + : model.patientChiefComplaintList[0].currentMedication; } if (widget.patientInfo.admissionNo == null) { await getHistory(model); @@ -200,7 +223,8 @@ class _UpdateSubjectivePageState extends State implements isExpanded: isChiefExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( @@ -212,12 +236,15 @@ class _UpdateSubjectivePageState extends State implements }); }, child: Column( - children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], + children: [ + UpdateHistoryWidget(myHistoryList: myHistoryList) + ], ), isExpanded: isHistoryExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( @@ -241,7 +268,8 @@ class _UpdateSubjectivePageState extends State implements isExpanded: isAllergiesExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), @@ -253,7 +281,9 @@ class _UpdateSubjectivePageState extends State implements } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { + {SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); @@ -265,22 +295,15 @@ class _UpdateSubjectivePageState extends State implements if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length > 25) { - await postChiefComplaint(model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - if (myHistoryList.length != 0) { - await postHistories(model: model, myHistoryList: myHistoryList); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - if (myAllergiesList.length != 0) { - await postAllergy(myAllergiesList: myAllergiesList, model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } + await model.postSubjectServices( + patientInfo: widget.patientInfo, + complaintsText: complaintsController.text, + medicationText: medicationController.text, + illnessText: illnessController.text, + myHistoryList: myHistoryList, + myAllergiesList: myAllergiesList, + ); + widget.changeLoadingState(true); widget.changePageViewIndex(1); @@ -311,112 +334,11 @@ class _UpdateSubjectivePageState extends State implements } } - postAllergy( - {List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = - new PostAllergyRequestModel(); - - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == - null) - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); - }); - if (model.patientAllergiesList.isEmpty) { - await model.postAllergy(postAllergyRequestModel); - } else { - await model.patchAllergy(postAllergyRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - doctorID: '', - editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy: true); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - - postHistories( - {List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = - new PostHistoriesRequestModel(doctorID: ''); - myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) - postHistoriesRequestModel.listMedicalHistoryVM = []; - postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: "", - historyId: history.selectedHistory.id, - historyType: history.selectedHistory.typeId, - isChecked: history.isChecked, - )); - }); - - if (model.patientHistoryList.isEmpty) { - await model.postHistories(postHistoriesRequestModel); - } else { - await model.patchHistories(postHistoriesRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - - postChiefComplaint({SOAPViewModel model}) async { - formKey.currentState.save(); - if (formKey.currentState.validate()) { - PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( - admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo ?? 0, - appointmentNo: widget.patientInfo.appointmentNo ?? 0, - chiefComplaint: complaintsController.text, - currentMedication: medicationController.text, - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - doctorID: '', - numberOfWeeks: 0); - if (model.patientChiefComplaintList.isEmpty) { - postChiefComplaintRequestModel.editedBy = ''; - await model.postChiefComplaint(postChiefComplaintRequestModel); - } else { - postChiefComplaintRequestModel.editedBy = ''; - await model.patchChiefComplaint(postChiefComplaintRequestModel); - } - } - } - @override Function nextFunction(model) { - addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); + addSubjectiveInfo( + model: model, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList); } } From a855dfca232578a739e3143e1126496e3f819f1c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 8 Sep 2021 12:54:29 +0300 Subject: [PATCH 05/32] fix create episode design --- .../soap_update/shared_soap_widgets/SOAP_step_header.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart index 51afcd1f..8d29150e 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart @@ -21,7 +21,7 @@ class SOAPStepHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: SizeConfig.isHeightVeryShort?30: 15,), + SizedBox(height: SizeConfig.isHeightVeryShort?30:SizeConfig.isHeightShort?35: 15,), AppText( TranslationBase.of(context).createNew, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 3: 4), From aae1cba405c18ea087f7118e0be9ef3683676676 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 15:11:37 +0300 Subject: [PATCH 06/32] re-design UCAF to pager --- lib/config/config.dart | 4 +- .../viewModel/patient-ucaf-viewmodel.dart | 12 +- lib/routes.dart | 7 +- lib/screens/patients/InPatientPage.dart | 56 +++-- .../profile/UCAF/UCAF-detail-screen.dart | 144 ++++-------- .../profile/UCAF/UCAF-input-screen.dart | 80 ++----- .../profile/UCAF/ucaf_pager_screen.dart | 214 ++++++++++++++++++ 7 files changed, 322 insertions(+), 195 deletions(-) create mode 100644 lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index def2806c..7002bc3a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index b6887061..fab030d9 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel { List get orderProcedures => _ucafService.orderProcedureList; + Function saveUCAFOnTap; + String selectedLanguage; String heightCm = "0"; String weightKg = "0"; @@ -56,7 +58,7 @@ class UcafViewModel extends BaseViewModel { } Future getUCAFData(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); String from; String to; @@ -112,7 +114,7 @@ class UcafViewModel extends BaseViewModel { Future getPatientAssessment(PatiantInformtion patient) async { if (patientAssessmentList.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPatientAssessment(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -139,7 +141,7 @@ class UcafViewModel extends BaseViewModel { Future getOrderProcedures(PatiantInformtion patient) async { if (orderProcedures.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getOrderProcedures(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -152,7 +154,7 @@ class UcafViewModel extends BaseViewModel { Future getPrescription(PatiantInformtion patient) async { if (prescriptionList == null) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPrescription(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -190,7 +192,7 @@ class UcafViewModel extends BaseViewModel { } Future postUCAF(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.postUCAF(patient); if (_ucafService.hasError) { error = _ucafService.error; diff --git a/lib/routes.dart b/lib/routes.dart index 742ac118..712db98c 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -3,8 +3,6 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; @@ -22,6 +20,7 @@ import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import './screens/auth/login_screen.dart'; +import 'screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; @@ -109,8 +108,8 @@ var routes = { ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), ORDER_PROCEDURE: (_) => ProcedureScreen(), MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), - PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), - PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), + PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(), + // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), }; diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 3b59e546..b5723c5e 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -100,6 +100,7 @@ class _InPatientPageState extends State { margin: EdgeInsets.symmetric(horizontal: 16.0), child: SingleChildScrollView( child: Column( + // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ ListView.builder( @@ -118,15 +119,15 @@ class _InPatientPageState extends State { arrivalType: "1", isInpatient: true, isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = - FocusScope.of(context); + FocusScope.of(context); if (!currentFocus .hasPrimaryFocus) { currentFocus.unfocus(); @@ -145,10 +146,10 @@ class _InPatientPageState extends State { "isInpatient": true, "arrivalType": "1", "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget .patientSearchViewModel .doctorProfile @@ -157,12 +158,12 @@ class _InPatientPageState extends State { }, ); else if (widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID && + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID && widget.isMyInPatient) return PatientCard( patientInfo: widget @@ -172,15 +173,15 @@ class _InPatientPageState extends State { arrivalType: "1", isInpatient: true, isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = - FocusScope.of(context); + FocusScope.of(context); if (!currentFocus .hasPrimaryFocus) { currentFocus.unfocus(); @@ -199,10 +200,10 @@ class _InPatientPageState extends State { "isInpatient": true, "arrivalType": "1", "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget .patientSearchViewModel .doctorProfile @@ -222,12 +223,7 @@ class _InPatientPageState extends State { ), ) : NoData() - : Center( - child: Container( - height: 300, - width: 300, - ), - ), + : NoData(), ], ), ); diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index be08aec2..26a34ed2 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/order-procedure.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/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -22,33 +23,63 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UcafDetailScreen extends StatefulWidget { + final PatiantInformtion patient; + final UcafViewModel model; + final Function changeLoadingState; + + UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); + @override - _UcafDetailScreenState createState() => _UcafDetailScreenState(); + _UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model); } class _UcafDetailScreenState extends State { + + final PatiantInformtion patient; + final UcafViewModel model; + + UcafViewModel ucafModel; + int _activeTap = 0; + _UcafDetailScreenState(this.patient, this.model); + @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; + void initState() { + model.saveUCAFOnTap = () async{ + widget.changeLoadingState(true); + await ucafModel.postUCAF(patient); + widget.changeLoadingState(false); + if (ucafModel.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .postUcafSuccessMsg); + Navigator.of(context).popUntil((route) { + return route.settings.name == + PATIENTS_PROFILE; + }); + } else { + DrAppToastMsg.showErrorToast(ucafModel.error); + } + }; + super.initState(); + } + @override + Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async { + ucafModel = model; model.resetDataInFirst(); await model.getLanguage(); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar(patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: Column( children: [ Expanded( @@ -57,35 +88,6 @@ class _UcafDetailScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 2, - screenSize: screenSize, - ), - SizedBox( - height: 10, - ), Container( margin: EdgeInsets.symmetric( vertical: 16, horizontal: 16), @@ -106,64 +108,7 @@ class _UcafDetailScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - child: Row( - children: [ - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).cancel, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: Colors.white, - color: Colors.white, - fontColor: HexColor("#B8382B"), - fontSize: 2.2, - onPressed: () { - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - }, - ), - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).save, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: HexColor("#B8382B"), - color: HexColor("#B8382B"), - fontColor: Colors.white, - fontSize: 2.0, - onPressed: () async { - await model.postUCAF(patient); - if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .postUcafSuccessMsg); - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - } else { - DrAppToastMsg.showErrorToast(model.error); - } - }, - ), - ), - ), - ], - ), - ), + ], ), )); @@ -209,12 +154,18 @@ class _UcafDetailScreenState extends State { onTap: () async { print(__treatmentSteps.indexOf(item)); if (__treatmentSteps.indexOf(item) == 0) { + widget.changeLoadingState(true); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); } else if (__treatmentSteps.indexOf(item) == 1) { + widget.changeLoadingState(true); await model.getPrescription(patient); + widget.changeLoadingState(false); } if (__treatmentSteps.indexOf(item) == 2) { + widget.changeLoadingState(true); await model.getOrderProcedures(patient); + widget.changeLoadingState(false); } setState(() { _activeTap = __treatmentSteps.indexOf(item); @@ -288,6 +239,7 @@ class _UcafDetailScreenState extends State { ]; } } + } class DiagnosisWidget extends StatelessWidget { diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 3bbc6637..ab9a3c54 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -19,11 +19,20 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UCAFInputScreen extends StatefulWidget { + final PatiantInformtion patient; + final Function changeLoadingState; + + UCAFInputScreen(this.patient, {this.changeLoadingState}); + @override - _UCAFInputScreenState createState() => _UCAFInputScreenState(); + _UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient); } class _UCAFInputScreenState extends State { + final PatiantInformtion patient; + + _UCAFInputScreenState(this.patient); + bool _inPatient = false; bool _emergencyCase = false; final _durationOfIllnessController = TextEditingController(); @@ -53,21 +62,15 @@ class _UCAFInputScreenState extends State { @override Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; - - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getUCAFData(patient), + onModelReady: (model) async { + // widget.changeLoadingState(true); + await model.getUCAFData(patient); + widget.changeLoadingState(false); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: model.patientVitalSignsHistory.length > 0 && model.patientChiefComplaintList != null && model.patientChiefComplaintList.length > 0 @@ -79,31 +82,6 @@ class _UCAFInputScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 1, - screenSize: screenSize, - ), Container( margin: EdgeInsets.symmetric( vertical: 0, horizontal: 16), @@ -263,7 +241,7 @@ class _UCAFInputScreenState extends State { fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), - /* SizedBox( + /* SizedBox( height: 4, ), AppText( @@ -323,7 +301,7 @@ class _UCAFInputScreenState extends State { SizedBox( height: 8, ), - /* AppTextFieldCustom( + /* AppTextFieldCustom( hintText: TranslationBase.of(context).other, dropDownText: TranslationBase.of(context).none, enabled: false, @@ -400,21 +378,6 @@ class _UCAFInputScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#D02127"), - onPressed: () { - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, - arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType - }); - }, - ), - ), ], ) : Center( @@ -428,9 +391,10 @@ class _UCAFInputScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - model.patientVitalSignsHistory.length == 0 - ? TranslationBase.of(context).vitalSignEmptyMsg - : TranslationBase.of(context).chiefComplaintEmptyMsg, + model.patientVitalSignsHistory.length == 0 + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context) + .chiefComplaintEmptyMsg, fontWeight: FontWeight.normal, textAlign: TextAlign.center, color: HexColor("#B8382B"), diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart new file mode 100644 index 00000000..8c38ece7 --- /dev/null +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -0,0 +1,214 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import '../../../../routes.dart'; +import 'UCAF-detail-screen.dart'; +import 'UCAF-input-screen.dart'; + +class UCAFPagerScreen extends StatefulWidget { + const UCAFPagerScreen({Key key}) : super(key: key); + + @override + _UCAFPagerScreenState createState() => _UCAFPagerScreenState(); +} + +class _UCAFPagerScreenState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + bool _isLoading = true; + + PatiantInformtion patient; + String patientType; + String arrivalType; + + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + setState(() { + _currentIndex = pageIndex; + }); + } + + void changeLoadingState(bool isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + void initState() { + _controller = new PageController(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isLoading: _isLoading, + appBar: PatientProfileAppBar(patient), + appBarTitle: TranslationBase.of(context).ucaf, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientHeaderWidgetNoAvatar(patient), + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).patient}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + ), + AppText( + "${TranslationBase.of(context).ucaf}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + PageStepperWidget( + stepsCount: 2, + currentStepIndex: _currentIndex + 1, + screenSize: screenSize, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + UCAFInputScreen( + patient, + changeLoadingState: changeLoadingState, + ), + UcafDetailScreen( + patient, + model, + changeLoadingState: changeLoadingState, + ), + ]), + ), + ), + ], + ), + ), + ), + _isLoading + ? Container( + height: 0, + ) + : ucafButtons(model), + ], + ), + )); + } + + Widget ucafButtons(UcafViewModel model) { + switch (_currentIndex) { + case 0: + return Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: Color(0xFFD02127), + onPressed: () { + changePageViewIndex(1); + // Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: { + // 'patient': patient, + // 'patientType': patientType, + // 'arrivalType': arrivalType + // }); + }, + ), + ); + case 1: + return Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Colors.white, + color: Colors.white, + fontColor: Color(0xFFB8382B), + fontSize: 2.2, + onPressed: () { + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).save, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () { + model.saveUCAFOnTap(); + }, + ), + ), + ), + ], + ), + ); + default: + return Container(); + } + } +} From 1fd192e4bc2ba7fb369568546e1abee4523d83b4 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 8 Sep 2021 15:26:22 +0300 Subject: [PATCH 07/32] add pagination on in patient --- .../viewModel/PatientSearchViewModel.dart | 99 +++++-- lib/screens/home/home_screen.dart | 4 +- lib/screens/patients/InPatientPage.dart | 252 ------------------ .../In_patient/in_patient_list_page.dart | 250 +++++++++++++++++ .../in_patient_screen.dart} | 16 +- 5 files changed, 335 insertions(+), 286 deletions(-) delete mode 100644 lib/screens/patients/InPatientPage.dart create mode 100644 lib/screens/patients/In_patient/in_patient_list_page.dart rename lib/screens/patients/{PatientsInPatientScreen.dart => In_patient/in_patient_screen.dart} (96%) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 29bbc6aa..7f8437b2 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -14,26 +14,37 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); - SpecialClinicsService _specialClinicsService = locator(); + SpecialClinicsService _specialClinicsService = + locator(); List get patientList => _outPatientService.patientList; - List get specialClinicalCareMappingList => - _specialClinicsService.specialClinicalCareMappingList; + + List + get specialClinicalCareMappingList => + _specialClinicsService.specialClinicalCareMappingList; List filterData = []; DateTime selectedFromDate; DateTime selectedToDate; + int firstSubsetIndex = 0; + int inPatientPageSize = 20; + int lastSubsetIndex = 19; + searchData(String str) { var strExist = str.length > 0 ? true : false; if (strExist) { filterData = []; for (var i = 0; i < _outPatientService.patientList.length; i++) { - String firstName = _outPatientService.patientList[i].firstName.toUpperCase(); - String lastName = _outPatientService.patientList[i].lastName.toUpperCase(); - String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase(); - String patientID = _outPatientService.patientList[i].patientId.toString(); + String firstName = + _outPatientService.patientList[i].firstName.toUpperCase(); + String lastName = + _outPatientService.patientList[i].lastName.toUpperCase(); + String mobile = + _outPatientService.patientList[i].mobileNumber.toUpperCase(); + String patientID = + _outPatientService.patientList[i].patientId.toString(); if (firstName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) || @@ -49,7 +60,8 @@ class PatientSearchViewModel extends BaseViewModel { } } - getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { + getOutPatient(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -81,9 +93,11 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Idle); } - getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { + getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, + {bool isLocalBusy = false}) async { setState(ViewState.Busy); - await _outPatientService.getPatientFileInformation(patientSearchRequestModel); + await _outPatientService + .getPatientFileInformation(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; setState(ViewState.Error); @@ -102,21 +116,32 @@ class PatientSearchViewModel extends BaseViewModel { String dateTo; String dateFrom; if (OutPatientFilterType.Previous == outPatientFilterType) { - selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); - selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + selectedFromDate = DateTime( + DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); + selectedToDate = DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); - dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); + dateFrom = + AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); } else if (OutPatientFilterType.NextWeek == outPatientFilterType) { dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day + 6), + 'yyyy-MM-dd'); dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day + 1), + 'yyyy-MM-dd'); } else { dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); } PatientSearchRequestModel currentModel = PatientSearchRequestModel(); currentModel.patientID = patientSearchRequestModel.patientID; @@ -130,11 +155,13 @@ class PatientSearchViewModel extends BaseViewModel { filterData = _outPatientService.patientList; } - PatientInPatientService _inPatientService = locator(); + PatientInPatientService _inPatientService = + locator(); List get inPatientList => _inPatientService.inPatientList; - List get myIinPatientList => _inPatientService.myInPatientList; + List get myIinPatientList => + _inPatientService.myInPatientList; List filteredInPatientItems = List(); @@ -146,7 +173,8 @@ class PatientSearchViewModel extends BaseViewModel { } else { setState(ViewState.Busy); } - if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); + if (inPatientList.length == 0) + await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; if (isLocalBusy) { @@ -163,10 +191,12 @@ class PatientSearchViewModel extends BaseViewModel { sortInPatient({bool isDes = false}) { if (isDes) filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - b.admissionDateWithDateTimeForm.compareTo(a.admissionDateWithDateTimeForm)); + b.admissionDateWithDateTimeForm + .compareTo(a.admissionDateWithDateTimeForm)); else filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - a.admissionDateWithDateTimeForm.compareTo(b.admissionDateWithDateTimeForm)); + a.admissionDateWithDateTimeForm + .compareTo(b.admissionDateWithDateTimeForm)); setState(ViewState.Idle); } @@ -174,10 +204,30 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.BusyLocal); await getDoctorProfile(); filteredInPatientItems.clear(); - if (inPatientList.length > 0) filteredInPatientItems.addAll(inPatientList); + firstSubsetIndex = 0; + lastSubsetIndex = inPatientPageSize - 1; + if (inPatientList.length > 0) + filteredInPatientItems + .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); setState(ViewState.Idle); } + addOnFilteredList() { + if (lastSubsetIndex < inPatientList.length) { + firstSubsetIndex = firstSubsetIndex + + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 + ? inPatientList.length - lastSubsetIndex + : inPatientPageSize - 1); + lastSubsetIndex = lastSubsetIndex + + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 + ? inPatientList.length - lastSubsetIndex + : inPatientPageSize - 1); + filteredInPatientItems + .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + setState(ViewState.Idle); + } + } + void clearPatientList() { _inPatientService.inPatientList = []; _inPatientService.myInPatientList = []; @@ -208,7 +258,8 @@ class PatientSearchViewModel extends BaseViewModel { } } - getSpecialClinicalCareMappingList(clinicId, {bool isLocalBusy = false}) async { + getSpecialClinicalCareMappingList(clinicId, + {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 32a842d3..93fe0a21 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -12,7 +12,7 @@ import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; import 'package:doctor_app_flutter/screens/home/home_patient_card.dart'; import 'package:doctor_app_flutter/screens/live_care/live_care_patient_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/in_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; @@ -371,7 +371,7 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen( + page: InPatientScreen( specialClinic: model.getSpecialClinic( clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), ), diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart deleted file mode 100644 index 3b59e546..00000000 --- a/lib/screens/patients/InPatientPage.dart +++ /dev/null @@ -1,252 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.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/patient_card/PatientCard.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -import '../../routes.dart'; - -class InPatientPage extends StatefulWidget { - final bool isMyInPatient; - final PatientSearchViewModel patientSearchViewModel; - - InPatientPage(this.isMyInPatient, this.patientSearchViewModel); - - @override - _InPatientPageState createState() => _InPatientPageState(); -} - -class _InPatientPageState extends State { - TextEditingController _searchController = TextEditingController(); - - bool isSortDes = false; - - @override - void dispose() { - _searchController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - baseViewModel: widget.patientSearchViewModel, - isShowAppBar: false, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Container( - margin: EdgeInsets.all(16.0), - child: Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - widget.patientSearchViewModel.filterSearchResults(value); - }), - Positioned( - right: 35, - top: 5, - child: IconButton( - icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, - color: Colors.black, - ), - iconSize: 20, - // padding: EdgeInsets.only(bottom: 30), - onPressed: () { - GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel - .sortInPatient(isDes: isSortDes); - isSortDes = !isSortDes; - GifLoaderDialogUtils.hideDialog(context); - }, - ), - ) - ], - ), - ), - widget.patientSearchViewModel.state == ViewState.Idle - ? widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? (widget.isMyInPatient && - widget.patientSearchViewModel.myIinPatientList - .length == - 0) - ? NoData() - : Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.builder( - itemCount: widget.patientSearchViewModel - .filteredInPatientItems.length, - scrollDirection: Axis.vertical, - physics: ScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: widget - .patientSearchViewModel - .filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus - .hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget - .patientSearchViewModel - .filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget - .patientSearchViewModel - .doctorProfile - .doctorID, - }); - }, - ); - else if (widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: widget - .patientSearchViewModel - .filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus - .hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget - .patientSearchViewModel - .filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget - .patientSearchViewModel - .doctorProfile - .doctorID, - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], - ), - ), - ), - ) - : NoData() - : Center( - child: Container( - height: 300, - width: 300, - ), - ), - ], - ), - ); - } -} - -class NoData extends StatelessWidget { - const NoData({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable)), - ), - ); - } -} diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart new file mode 100644 index 00000000..56804071 --- /dev/null +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -0,0 +1,250 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.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/patient_card/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import '../../../routes.dart'; + +class InPatientListPage extends StatefulWidget { + final bool isMyInPatient; + final PatientSearchViewModel patientSearchViewModel; + + InPatientListPage(this.isMyInPatient, this.patientSearchViewModel); + + @override + _InPatientListPageState createState() => _InPatientListPageState(); +} + +class _InPatientListPageState extends State { + TextEditingController _searchController = TextEditingController(); + + bool isSortDes = false; + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + baseViewModel: widget.patientSearchViewModel, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Container( + margin: EdgeInsets.all(16.0), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + controller: _searchController, + onChanged: (value) { + widget.patientSearchViewModel.filterSearchResults(value); + }), + Positioned( + right: 35, + top: 5, + child: IconButton( + icon: Icon( + isSortDes + ? FontAwesomeIcons.sortAmountDown + : FontAwesomeIcons.sortAmountUp, + color: Colors.black, + ), + iconSize: 20, + // padding: EdgeInsets.only(bottom: 30), + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + widget.patientSearchViewModel + .sortInPatient(isDes: isSortDes); + isSortDes = !isSortDes; + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ) + ], + ), + ), + widget.patientSearchViewModel.state == ViewState.Idle + ? widget.patientSearchViewModel.filteredInPatientItems.length > 0 + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList + .length == + 0) + ? NoData() + : Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: NotificationListener( + child: ListView.builder( + itemCount: widget.patientSearchViewModel + .filteredInPatientItems.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else if (widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else + return SizedBox(); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 ) { + widget.patientSearchViewModel.addOnFilteredList(); + } + return; + }, + ), + ), + ) + : NoData() + : Center( + child: Container( + height: 300, + width: 300, + ), + ), + ], + ), + ); + } +} + +class NoData extends StatelessWidget { + const NoData({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); + } +} diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart similarity index 96% rename from lib/screens/patients/PatientsInPatientScreen.dart rename to lib/screens/patients/In_patient/in_patient_screen.dart index f094f71a..76052d23 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -14,19 +14,19 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils. import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'DischargedPatientPage.dart'; -import 'InPatientPage.dart'; +import '../DischargedPatientPage.dart'; +import 'in_patient_list_page.dart'; -class PatientInPatientScreen extends StatefulWidget { +class InPatientScreen extends StatefulWidget { GetSpecialClinicalCareListResponseModel specialClinic; - PatientInPatientScreen({Key key, this.specialClinic}); + InPatientScreen({Key key, this.specialClinic}); @override - _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); + _InPatientScreenState createState() => _InPatientScreenState(); } -class _PatientInPatientScreenState extends State +class _InPatientScreenState extends State with SingleTickerProviderStateMixin { TabController _tabController; int _activeTab = 0; @@ -266,8 +266,8 @@ class _PatientInPatientScreenState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - InPatientPage(false, model), - InPatientPage(true,model), + InPatientListPage(false, model), + InPatientListPage(true,model), DischargedPatient(), ], ), From 96ad55b55240508b79e4b317c6f1e3e274795dd2 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 15:31:30 +0300 Subject: [PATCH 08/32] re-design UCAF to pager --- lib/core/viewModel/patient-ucaf-viewmodel.dart | 6 +++++- lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart | 2 +- lib/screens/patients/profile/UCAF/UCAF-input-screen.dart | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index fab030d9..1dc34679 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -47,7 +47,11 @@ class UcafViewModel extends BaseViewModel { String respirationBeatPerMinute = "0"; String bloodPressure = "0 / 0"; - resetDataInFirst() { + resetDataInFirst({bool firstPage = true}) { + if(firstPage){ + _ucafService.patientVitalSignsHistory = []; + _ucafService.patientChiefComplaintList = []; + } _ucafService.patientAssessmentList = []; _ucafService.orderProcedureList = []; _ucafService.prescriptionList = null; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 26a34ed2..ea4511e3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -72,7 +72,7 @@ class _UcafDetailScreenState extends State { return BaseView( onModelReady: (model) async { ucafModel = model; - model.resetDataInFirst(); + model.resetDataInFirst(firstPage: false); await model.getLanguage(); await model.getPatientAssessment(patient); widget.changeLoadingState(false); diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index ab9a3c54..9960a1b3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -64,7 +64,7 @@ class _UCAFInputScreenState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - // widget.changeLoadingState(true); + model.resetDataInFirst(); await model.getUCAFData(patient); widget.changeLoadingState(false); }, From e9e86e4d8ca0db11004926772c052e59c1997560 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 8 Sep 2021 17:57:40 +0300 Subject: [PATCH 09/32] add filter on in patient screen by clinic and by all clinic --- .../viewModel/PatientSearchViewModel.dart | 33 ++++ .../In_patient/in_patient_list_page.dart | 158 +++++++++++++++--- .../In_patient/in_patient_screen.dart | 2 +- 3 files changed, 173 insertions(+), 20 deletions(-) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 7f8437b2..43d8b221 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -32,6 +32,8 @@ class PatientSearchViewModel extends BaseViewModel { int inPatientPageSize = 20; int lastSubsetIndex = 19; + List myInpatientClinicList = []; + searchData(String str) { var strExist = str.length > 0 ? true : false; if (strExist) { @@ -184,6 +186,8 @@ class PatientSearchViewModel extends BaseViewModel { } } else { setDefaultInPatientList(); + + generateMyInpatientClinicList(); setState(ViewState.Idle); } } @@ -212,6 +216,14 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Idle); } + generateMyInpatientClinicList() { + inPatientList.forEach((element) { + if(!myInpatientClinicList.contains(element.clinicDescription)) { + myInpatientClinicList.add(element.clinicDescription); + } + }); + } + addOnFilteredList() { if (lastSubsetIndex < inPatientList.length) { firstSubsetIndex = firstSubsetIndex + @@ -228,6 +240,27 @@ class PatientSearchViewModel extends BaseViewModel { } } + + filterByHospital({ int hospitalId}) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + if (inPatientList[i].projectId == hospitalId) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } + + filterByClinic({ String clinicName}) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + if (inPatientList[i].clinicDescription == clinicName) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } + void clearPatientList() { _inPatientService.inPatientList = []; _inPatientService.myInPatientList = []; diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 56804071..80acb88d 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_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/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; @@ -28,6 +29,9 @@ class _InPatientListPageState extends State { TextEditingController _searchController = TextEditingController(); bool isSortDes = false; + bool isAllClinic = true; + bool showBottomSheet = false; + String selectedClinicName; @override void dispose() { @@ -43,8 +47,73 @@ class _InPatientListPageState extends State { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Container( + // height: MediaQuery.of(context).size.height * 0.070, + // ), Container( - height: MediaQuery.of(context).size.height * 0.070, + margin: EdgeInsets.symmetric(horizontal: 14.0, vertical: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Radio( + value: 1, + groupValue: isAllClinic ? 1 : 2, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = true; + showBottomSheet = false; + }); + widget.patientSearchViewModel + .setDefaultInPatientList(); + }); + }, + activeColor: Colors.red, + ), + AppText("All Clinic", fontSize: 15,), + ], + ), + onTap: () { + setState(() { + isAllClinic = true; + showBottomSheet = false; + }); + widget.patientSearchViewModel.setDefaultInPatientList(); + }, + ), + InkWell( + onTap: () { + setState(() { + isAllClinic = false; + showBottomSheet = true; + }); + }, + child: Row( + children: [ + Radio( + value: 2, + groupValue: isAllClinic ? 1 : 2, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = false; + showBottomSheet = true; + }); + }); + }, + activeColor: Colors.red, + ), + AppText(selectedClinicName ?? "Select Clinic", fontSize: 15,), + Container( + margin: EdgeInsets.only(bottom: 10), + child: Icon(FontAwesomeIcons.sortDown)) + ], + )), + ], + ), ), Container( margin: EdgeInsets.all(16.0), @@ -103,7 +172,7 @@ class _InPatientListPageState extends State { itemCount: widget.patientSearchViewModel .filteredInPatientItems.length, scrollDirection: Axis.vertical, - physics: ScrollPhysics(), + // physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { if (!widget.isMyInPatient) @@ -116,16 +185,14 @@ class _InPatientListPageState extends State { isInpatient: true, isMyPatient: widget .patientSearchViewModel - .filteredInPatientItems[ - index] + .filteredInPatientItems[index] .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus - .hasPrimaryFocus) { + if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } @@ -133,8 +200,9 @@ class _InPatientListPageState extends State { PATIENTS_PROFILE, arguments: { "patient": widget - .patientSearchViewModel - .filteredInPatientItems[index], + .patientSearchViewModel + .filteredInPatientItems[ + index], "patientType": "1", "from": "0", "to": "0", @@ -155,8 +223,7 @@ class _InPatientListPageState extends State { ); else if (widget .patientSearchViewModel - .filteredInPatientItems[ - index] + .filteredInPatientItems[index] .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID && @@ -170,16 +237,14 @@ class _InPatientListPageState extends State { isInpatient: true, isMyPatient: widget .patientSearchViewModel - .filteredInPatientItems[ - index] + .filteredInPatientItems[index] .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus - .hasPrimaryFocus) { + if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } @@ -187,8 +252,9 @@ class _InPatientListPageState extends State { PATIENTS_PROFILE, arguments: { "patient": widget - .patientSearchViewModel - .filteredInPatientItems[index], + .patientSearchViewModel + .filteredInPatientItems[ + index], "patientType": "1", "from": "0", "to": "0", @@ -210,9 +276,13 @@ class _InPatientListPageState extends State { else return SizedBox(); }), - onNotification: (t) { - if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 ) { - widget.patientSearchViewModel.addOnFilteredList(); + onNotification: (t) { + if (isAllClinic) if (t + is ScrollUpdateNotification && + t.metrics.pixels >= + t.metrics.maxScrollExtent - 50) { + widget.patientSearchViewModel + .addOnFilteredList(); } return; }, @@ -228,6 +298,56 @@ class _InPatientListPageState extends State { ), ], ), + bottomSheet: !showBottomSheet + ? Container( + height: 0, + ) + : Container( + height: 500, + color: Colors.white, + child: ListView.builder( + itemCount: widget + .patientSearchViewModel.myInpatientClinicList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + setState(() { + isAllClinic = false; + showBottomSheet = false; + selectedClinicName = widget.patientSearchViewModel + .myInpatientClinicList[index]; + }); + widget.patientSearchViewModel.filterByClinic( + clinicName: widget.patientSearchViewModel + .myInpatientClinicList[index]); + }, + child: Row( + children: [ + Radio( + value: widget.patientSearchViewModel + .myInpatientClinicList[index], + groupValue: selectedClinicName, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = false; + showBottomSheet = false; + }); + widget.patientSearchViewModel + .filterByClinic(clinicName: value); + }); + }, + activeColor: Colors.red, + ), + AppText(widget.patientSearchViewModel + .myInpatientClinicList[index]), + ], + )); + }), + ), ); } } diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart index 76052d23..1a35ad53 100644 --- a/lib/screens/patients/In_patient/in_patient_screen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -221,7 +221,7 @@ class _InPatientScreenState extends State ), Expanded( child: Scaffold( - extendBodyBehindAppBar: true, + extendBodyBehindAppBar: false, appBar: PreferredSize( preferredSize: Size.fromHeight( MediaQuery.of(context).size.height * 0.070), From c5eac7952211521377bb0413309b8d0bb7929785 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 09:21:30 +0300 Subject: [PATCH 10/32] dilog list & procedure changes --- lib/config/config.dart | 4 +- .../get_ordered_procedure_request_model.dart | 6 +- .../procedure/procedure_service.dart | 76 +++++++----------- lib/core/viewModel/procedure_View_model.dart | 36 +++------ lib/screens/procedures/procedure_screen.dart | 66 ++++++---------- .../shared/dialogs/dailog-list-select.dart | 77 ++++++++++--------- 6 files changed, 109 insertions(+), 156 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 407d4ff6..b8e34330 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart index dfbd444c..5178ab14 100644 --- a/lib/core/model/procedure/get_ordered_procedure_request_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -1,18 +1,22 @@ class GetOrderedProcedureRequestModel { String vidaAuthTokenID; int patientMRN; + int appointmentNo; - GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); + GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN, this.appointmentNo}); GetOrderedProcedureRequestModel.fromJson(Map json) { vidaAuthTokenID = json['VidaAuthTokenID']; patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; } Map toJson() { final Map data = new Map(); data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + return data; } } diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 526b2b3e..16ed67fa 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -28,16 +28,12 @@ class ProcedureService extends BaseService { List templateList = List(); List _templateDetailsList = List(); - List get templateDetailsList => - _templateDetailsList; + List get templateDetailsList => _templateDetailsList; - GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(); + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); - ProcedureTempleteRequestModel _procedureTempleteRequestModel = - ProcedureTempleteRequestModel(); - ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, @@ -63,8 +59,7 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); - Future getProcedureTemplate( - {int doctorId, int projectId, int clinicId, String categoryID}) async { + Future getProcedureTemplate({int doctorId, int projectId, int clinicId, String categoryID}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( // tokenID: "@dm!n", patientID: 0, @@ -72,19 +67,18 @@ class ProcedureService extends BaseService { ); hasError = false; - await baseAppClient.post(GET_TEMPLETE_LIST/*GET_PROCEDURE_TEMPLETE*/, + await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/, onSuccess: (dynamic response, int statusCode) { - templateList.clear(); + templateList.clear(); response['DAPP_TemplateGetList'].forEach((template) { ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); - if(categoryID != null){ - if(categoryID == templateElement.categoryID){ + if (categoryID != null) { + if (categoryID == templateElement.categoryID) { templateList.add(templateElement); } } else { templateList.add(templateElement); } - }); // response['HIS_ProcedureTemplateList'].forEach((template) { // _templateList.add(ProcedureTempleteModel.fromJson(template)); @@ -95,21 +89,17 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteRequestModel.toJson()); } - Future getProcedureTemplateDetails( - {int doctorId, int projectId, int clinicId, int templateId}) async { + Future getProcedureTemplateDetails({int doctorId, int projectId, int clinicId, int templateId}) async { _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel( - templateID: templateId, searchType: 1, patientID: 0); + ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0); hasError = false; //insuranceApprovalInPatient.clear(); _templateDetailsList.clear(); - await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) { //prescriptionsList.clear(); response['HIS_ProcedureTemplateDetailsList'].forEach((template) { - _templateDetailsList - .add(ProcedureTempleteDetailsModel.fromJson(template)); + _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -117,15 +107,12 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteDetailsRequestModel.toJson()); } - Future getProcedure({int mrn}) async { - _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(patientMRN: mrn); + Future getProcedure({int mrn, int appointmentNo}) async { + _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn, appointmentNo: appointmentNo); hasError = false; _procedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { - _procedureList.add( - GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -135,8 +122,7 @@ class ProcedureService extends BaseService { Future getCategory() async { hasError = false; - await baseAppClient.post(GET_LIST_CATEGORISE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_LIST_CATEGORISE, onSuccess: (dynamic response, int statusCode) { categoryList = []; categoryList = response['listProcedureCategories']['entityList']; }, onFailure: (String error, int statusCode) { @@ -145,7 +131,7 @@ class ProcedureService extends BaseService { }, body: Map()); } - Future getProcedureCategory({String categoryName, String categoryID,patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], patientMRN: patientId, @@ -156,10 +142,8 @@ class ProcedureService extends BaseService { ); hasError = false; _categoriesList.clear(); - await baseAppClient.post(GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { + _categoriesList.add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -169,8 +153,7 @@ class ProcedureService extends BaseService { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(POST_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -178,12 +161,10 @@ class ProcedureService extends BaseService { }, body: postProcedureReqModel.toJson()); } - Future updateProcedure( - UpdateProcedureRequestModel updateProcedureRequestModel) async { + Future updateProcedure(UpdateProcedureRequestModel updateProcedureRequestModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(UPDATE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { print("ACCEPTED"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -191,14 +172,11 @@ class ProcedureService extends BaseService { }, body: updateProcedureRequestModel.toJson()); } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async { hasError = false; _valadteProcedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_VALIDATION, - onSuccess: (dynamic response, int statusCode) { - _valadteProcedureList.add( - ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_VALIDATION, onSuccess: (dynamic response, int statusCode) { + _valadteProcedureList.add(ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index fb96a61a..b576b7a4 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -23,8 +23,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' - as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -61,13 +60,13 @@ class ProcedureViewModel extends BaseViewModel { List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); - Future getProcedure({int mrn, String patientType}) async { + Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; await getDoctorProfile(); //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.getProcedure(mrn: mrn); + await _procedureService.getProcedure(mrn: mrn, appointmentNo: appointmentNo); if (_procedureService.hasError) { error = _procedureService.error; if (patientType == "7") @@ -78,15 +77,12 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory( - {String categoryName, String categoryID, patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { if (categoryName == null) return; hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, - categoryID: categoryID, - patientId: patientId); + categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -321,8 +317,7 @@ class ProcedureViewModel extends BaseViewModel { List entityList, ProcedureType procedureType}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel(); procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo; @@ -337,21 +332,13 @@ class ProcedureViewModel extends BaseViewModel { procedureValadteRequestModel.procedure = [element.procedureId]; List controls = List(); controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), + Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: procedureType == ProcedureType.PROCEDURE - ? element.type ?? "1" - : "0"), + Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); + controlsProcedure + .add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls)); }); postProcedureReqModel.procedures = controlsProcedure; @@ -371,8 +358,7 @@ class ProcedureViewModel extends BaseViewModel { Helpers.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { - Helpers.showErrorToast( - valadteProcedureList[0].entityList[0].warringMessages); + Helpers.showErrorToast(valadteProcedureList[0].entityList[0].warringMessages); } } } else { diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 3ca6d25d..de356935 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -35,12 +35,9 @@ class ProcedureScreen extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getProcedure( - mrn: patient.patientId, - patientType: patientType, - ), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => + model.getProcedure(mrn: patient.patientId, patientType: patientType, appointmentNo: patient.appointmentNo), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, @@ -56,8 +53,7 @@ class ProcedureScreen extends StatelessWidget { SizedBox( height: 12, ), - if (model.procedureList.length == 0 && - patient.patientStatusType != 43) + if (model.procedureList.length == 0 && patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -77,8 +73,7 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient.patientStatusType != null && patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -98,20 +93,19 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => BaseAddProcedureTabPage( - patient: patient, - model: model, - procedureType: ProcedureType.PROCEDURE, - ), settings: RouteSettings(name: 'AddProcedureTabPage') - ), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.PROCEDURE, + ), + settings: RouteSettings(name: 'AddProcedureTabPage')), ); }, child: Container( @@ -159,32 +153,21 @@ class ProcedureScreen extends StatelessWidget { ...List.generate( model.procedureList[0].rowcount, (index) => ProcedureCard( - categoryID: - model.procedureList[0].entityList[index].categoryID, + categoryID: model.procedureList[0].entityList[index].categoryID, entityList: model.procedureList[0].entityList[index], onTap: () { - if (model.procedureList[0].entityList[index].categoryID == - 2 || + if (model.procedureList[0].entityList[index].categoryID == 2 || model.procedureList[0].entityList[index].categoryID == 4) updateProcedureForm(context, model: model, patient: patient, - remarks: model - .procedureList[0].entityList[index].remarks, - orderType: model - .procedureList[0].entityList[index].orderType - .toString(), - orderNo: model - .procedureList[0].entityList[index].orderNo, - procedureName: model.procedureList[0] - .entityList[index].procedureName, - categoreId: model - .procedureList[0].entityList[index].categoryID - .toString(), - procedureId: model.procedureList[0] - .entityList[index].procedureId, - limetNo: model.procedureList[0].entityList[index] - .lineItemNo); + remarks: model.procedureList[0].entityList[index].remarks, + orderType: model.procedureList[0].entityList[index].orderType.toString(), + orderNo: model.procedureList[0].entityList[index].orderNo, + procedureName: model.procedureList[0].entityList[index].procedureName, + categoreId: model.procedureList[0].entityList[index].categoryID.toString(), + procedureId: model.procedureList[0].entityList[index].procedureId, + limetNo: model.procedureList[0].entityList[index].lineItemNo); // } else // Helpers.showErrorToast( // 'You Cant Update This Procedure'); @@ -194,8 +177,7 @@ class ProcedureScreen extends StatelessWidget { ), ), if (model.state == ViewState.ErrorLocal || - (model.procedureList.isNotEmpty && - model.procedureList[0].entityList.isEmpty)) + (model.procedureList.isNotEmpty && model.procedureList[0].entityList.isEmpty)) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -206,9 +188,7 @@ class ProcedureScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(22.0), - child: AppText(model.procedureList.isEmpty - ? model.error - : 'No Procedure Found '), + child: AppText(model.procedureList.isEmpty ? model.error : 'No Procedure Found '), ) ], ), diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 76932ecd..dfaf9143 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -71,43 +71,48 @@ class _ListSelectDialogState extends State { Widget createDialogList() { return Container( height: MediaQuery.of(context).size.height * 0.5, - child: SingleChildScrollView( - child: Column( - children: [ - if (widget.searchWidget != null) widget.searchWidget, - if(widget.usingSearch) - Container( + child: Column( + children: [ + if (widget.searchWidget != null) widget.searchWidget, + if (widget.usingSearch) + Container( height: MediaQuery.of(context).size.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - widget.hintSearchText ?? TranslationBase - .of(context) - .search, null, false, suffixIcon: Icon(Icons.search,)), - enabled: true, - keyboardType: TextInputType.text, - onChanged: (value) { - filterSearchResults(value); - }, - )), - ...items - .map((item) => RadioListTile( - title: Text("${item[widget.attributeName].toString()}"), - groupValue: widget.selectedValue[widget.attributeValueId] - .toString(), - value: item[widget.attributeValueId].toString(), - activeColor: Colors.blue.shade700, - selected: item[widget.attributeValueId].toString() == - widget.selectedValue[widget.attributeValueId] - .toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) - .toList() - ], - ), + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + widget.hintSearchText ?? TranslationBase.of(context).search, null, false, + suffixIcon: Icon( + Icons.search, + )), + enabled: true, + keyboardType: TextInputType.text, + onChanged: (value) { + filterSearchResults(value); + }, + )), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + ...items + .map((item) => RadioListTile( + title: Text("${item[widget.attributeName].toString()}"), + groupValue: widget.selectedValue[widget.attributeValueId].toString(), + value: item[widget.attributeValueId].toString(), + activeColor: Colors.blue.shade700, + selected: item[widget.attributeValueId].toString() == + widget.selectedValue[widget.attributeValueId].toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ), + ], ), ); } From 9317173c052c912b0010901325760b10a8c8b009 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 11:03:43 +0300 Subject: [PATCH 11/32] add filtration on level of clinic --- .../viewModel/PatientSearchViewModel.dart | 120 +++++++++++++----- .../In_patient/in_patient_list_page.dart | 28 ++-- 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 43d8b221..07975bc3 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -186,30 +186,48 @@ class PatientSearchViewModel extends BaseViewModel { } } else { setDefaultInPatientList(); - generateMyInpatientClinicList(); setState(ViewState.Idle); } } - sortInPatient({bool isDes = false}) { - if (isDes) - filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - b.admissionDateWithDateTimeForm - .compareTo(a.admissionDateWithDateTimeForm)); - else - filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => - a.admissionDateWithDateTimeForm - .compareTo(b.admissionDateWithDateTimeForm)); + sortInPatient({bool isDes = false, bool isAllClinic}) { + if (isAllClinic + ? inPatientList.length > 0 + : filteredInPatientItems.length > 0) { + List localInPatient = + isAllClinic ? [...inPatientList] : [...filteredInPatientItems]; + if (isDes) + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b + .admissionDateWithDateTimeForm + .compareTo(a.admissionDateWithDateTimeForm)); + else + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a + .admissionDateWithDateTimeForm + .compareTo(b.admissionDateWithDateTimeForm)); + + if (isAllClinic) { + resetInPatientPagination(); + filteredInPatientItems + .addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex)); + } else { + filteredInPatientItems.clear(); + filteredInPatientItems.addAll(localInPatient); + } + } setState(ViewState.Idle); } - Future setDefaultInPatientList() async { - setState(ViewState.BusyLocal); - await getDoctorProfile(); + resetInPatientPagination() { filteredInPatientItems.clear(); firstSubsetIndex = 0; lastSubsetIndex = inPatientPageSize - 1; + } + + Future setDefaultInPatientList() async { + setState(ViewState.BusyLocal); + await getDoctorProfile(); + resetInPatientPagination(); if (inPatientList.length > 0) filteredInPatientItems .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); @@ -218,7 +236,7 @@ class PatientSearchViewModel extends BaseViewModel { generateMyInpatientClinicList() { inPatientList.forEach((element) { - if(!myInpatientClinicList.contains(element.clinicDescription)) { + if (!myInpatientClinicList.contains(element.clinicDescription)) { myInpatientClinicList.add(element.clinicDescription); } }); @@ -240,8 +258,7 @@ class PatientSearchViewModel extends BaseViewModel { } } - - filterByHospital({ int hospitalId}) { + filterByHospital({int hospitalId}) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { if (inPatientList[i].projectId == hospitalId) { @@ -251,7 +268,7 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } - filterByClinic({ String clinicName}) { + filterByClinic({String clinicName}) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { if (inPatientList[i].clinicDescription == clinicName) { @@ -266,28 +283,61 @@ class PatientSearchViewModel extends BaseViewModel { _inPatientService.myInPatientList = []; } - void filterSearchResults(String query) { + void filterSearchResults(String query, {bool isAllClinic}) { var strExist = query.length > 0 ? true : false; - if (strExist) { - filteredInPatientItems = []; - for (var i = 0; i < inPatientList.length; i++) { - String firstName = inPatientList[i].firstName.toUpperCase(); - String lastName = inPatientList[i].lastName.toUpperCase(); - String mobile = inPatientList[i].mobileNumber.toUpperCase(); - String patientID = inPatientList[i].patientId.toString(); - - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { - filteredInPatientItems.add(inPatientList[i]); + if (isAllClinic) { + if (strExist) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + String firstName = inPatientList[i].firstName.toUpperCase(); + String lastName = inPatientList[i].lastName.toUpperCase(); + String mobile = inPatientList[i].mobileNumber.toUpperCase(); + String patientID = inPatientList[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(inPatientList[i]); + } } + notifyListeners(); + } else { + if (inPatientList.length > 0) filteredInPatientItems.clear(); + filteredInPatientItems.addAll(inPatientList); + notifyListeners(); } - notifyListeners(); } else { - if (inPatientList.length > 0) filteredInPatientItems.clear(); - filteredInPatientItems.addAll(inPatientList); - notifyListeners(); + List localFilteredInPatientItems = [ + ...filteredInPatientItems + ]; + + if (strExist) { + filteredInPatientItems.clear(); + for (var i = 0; i < localFilteredInPatientItems.length; i++) { + String firstName = + localFilteredInPatientItems[i].firstName.toUpperCase(); + String lastName = + localFilteredInPatientItems[i].lastName.toUpperCase(); + String mobile = + localFilteredInPatientItems[i].mobileNumber.toUpperCase(); + String patientID = + localFilteredInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(localFilteredInPatientItems[i]); + } + } + notifyListeners(); + } else { + if (localFilteredInPatientItems.length > 0) + filteredInPatientItems.clear(); + filteredInPatientItems.addAll(localFilteredInPatientItems); + notifyListeners(); + } } } diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 80acb88d..f52b4819 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -30,6 +30,7 @@ class _InPatientListPageState extends State { bool isSortDes = false; bool isAllClinic = true; + bool hasQuery = false; bool showBottomSheet = false; String selectedClinicName; @@ -47,11 +48,8 @@ class _InPatientListPageState extends State { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Container( - // height: MediaQuery.of(context).size.height * 0.070, - // ), Container( - margin: EdgeInsets.symmetric(horizontal: 14.0, vertical: 10), + margin: EdgeInsets.only(left: 10.0,right: 10, top: 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -73,7 +71,10 @@ class _InPatientListPageState extends State { }, activeColor: Colors.red, ), - AppText("All Clinic", fontSize: 15,), + AppText( + "All Clinic", + fontSize: 15, + ), ], ), onTap: () { @@ -106,7 +107,10 @@ class _InPatientListPageState extends State { }, activeColor: Colors.red, ), - AppText(selectedClinicName ?? "Select Clinic", fontSize: 15,), + AppText( + selectedClinicName ?? "Select Clinic", + fontSize: 15, + ), Container( margin: EdgeInsets.only(bottom: 10), child: Icon(FontAwesomeIcons.sortDown)) @@ -116,7 +120,7 @@ class _InPatientListPageState extends State { ), ), Container( - margin: EdgeInsets.all(16.0), + margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top:5), child: Stack( children: [ AppTextFieldCustom( @@ -131,7 +135,11 @@ class _InPatientListPageState extends State { ), controller: _searchController, onChanged: (value) { - widget.patientSearchViewModel.filterSearchResults(value); + setState(() { + hasQuery = true; + }); + widget.patientSearchViewModel + .filterSearchResults(value, isAllClinic: isAllClinic); }), Positioned( right: 35, @@ -148,7 +156,7 @@ class _InPatientListPageState extends State { onPressed: () { GifLoaderDialogUtils.showMyDialog(context); widget.patientSearchViewModel - .sortInPatient(isDes: isSortDes); + .sortInPatient(isDes: isSortDes, isAllClinic:isAllClinic); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -277,7 +285,7 @@ class _InPatientListPageState extends State { return SizedBox(); }), onNotification: (t) { - if (isAllClinic) if (t + if (isAllClinic && !hasQuery) if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50) { From 763686fc76d65bb481a89b163e630887a53abd1b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 11:04:19 +0300 Subject: [PATCH 12/32] adding missing fields for medication --- .../get_medication_for_inpatient_model.dart | 23 ++++++++++++++- .../procedure/procedure_service.dart | 4 ++- .../prescription_item_in_patient_page.dart | 29 ++++++++++--------- .../prescription/prescriptions_page.dart | 2 +- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart index 7c6d0db5..8ba07f2a 100644 --- a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart +++ b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart @@ -30,6 +30,11 @@ class GetMedicationForInPatientModel { dynamic strength; String pHRItemDescription; String pHRItemDescriptionN; + String doctorName; + String uomDescription; + String routeDescription; + String directionDescription; + String refillDescription; GetMedicationForInPatientModel( {this.setupID, @@ -62,11 +67,22 @@ class GetMedicationForInPatientModel { this.editedOn, this.strength, this.pHRItemDescription, - this.pHRItemDescriptionN}); + this.pHRItemDescriptionN, + this.doctorName, + this.uomDescription, + this.routeDescription, + this.directionDescription, + this.refillDescription}); GetMedicationForInPatientModel.fromJson(Map json) { setupID = json['SetupID']; projectID = json['ProjectID']; + doctorName = json['DoctorName']; + refillDescription = json['RefillDescription']; + directionDescription = json['DirectionDescription']; + routeDescription = json['RouteDescription']; + + uomDescription = json['UOMDescription']; admissionNo = json['AdmissionNo']; patientID = json['PatientID']; orderNo = json['OrderNo']; @@ -101,6 +117,11 @@ class GetMedicationForInPatientModel { Map toJson() { final Map data = new Map(); data['SetupID'] = this.setupID; + data['DoctorName'] = this.doctorName; + data['RefillDescription'] = this.refillDescription; + data['RouteDescription'] = this.routeDescription; + data['DirectionDescription'] = this.directionDescription; + data['UOMDescription'] = this.uomDescription; data['ProjectID'] = this.projectID; data['AdmissionNo'] = this.admissionNo; data['PatientID'] = this.patientID; diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 16ed67fa..56a92de5 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -108,7 +108,9 @@ class ProcedureService extends BaseService { } Future getProcedure({int mrn, int appointmentNo}) async { - _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn, appointmentNo: appointmentNo); + _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel( + patientMRN: mrn, + ); hasError = false; _procedureList.clear(); await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index fce49f77..84f38748 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -91,7 +91,8 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).direction, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.directionID.toString() ?? '')), + Expanded( + child: AppText(" " + prescriptions.directionDescription.toString() ?? '')), ], ), Row( @@ -100,7 +101,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).route, color: Colors.grey, ), - AppText(" " + prescriptions.routeId.toString() ?? ''), + AppText(" " + prescriptions.routeDescription.toString() ?? ''), ], ), Row( @@ -109,7 +110,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).refill, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.refillID.toString() ?? '')), + Expanded(child: AppText(" " + prescriptions.refillDescription.toString() ?? '')), ], ), Row( @@ -150,7 +151,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { 'UOM', color: Colors.grey, ), - AppText(" " + prescriptions.unitofMeasurement.toString() ?? ''), + AppText(" " + prescriptions.uomDescription.toString() ?? ''), ], ), Row( @@ -177,18 +178,18 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).processed, color: Colors.grey, ), - // AppText(" " + prescriptions.editedBy.toString() ?? ''), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).dailyDoses, - color: Colors.grey, - ), - AppText(" " + prescriptions.dose.toString() ?? ''), + AppText(" " + prescriptions.doctorName.toString() ?? ''), ], ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).num, + // color: Colors.grey, + // ), + // AppText(" " + prescriptions.dose.toString() ?? ''), + // ], + // ), SizedBox( height: 12, ), diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index e7225e9a..0c3c5123 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -196,7 +196,7 @@ class PrescriptionsPage extends StatelessWidget { appointmentDate: AppDateUtils.getDateTimeFromServerFormat( model.medicationForInPatient[index].prescriptionDatetime, ), - createdBy: model.medicationForInPatient[index].createdBy.toString(), + createdBy: model.medicationForInPatient[index].doctorName.toString(), )); }), if (model.medicationForInPatient.length == 0) From a1f972909134bc57b86408fc7728005380e3c1ef Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 11:48:44 +0300 Subject: [PATCH 13/32] in patient list improve performace --- .../viewModel/PatientSearchViewModel.dart | 8 ++++ .../In_patient/in_patient_list_page.dart | 27 +++++++---- .../patients/patient_card/PatientCard.dart | 48 ++++++++++++------- 3 files changed, 56 insertions(+), 27 deletions(-) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 07975bc3..0333f7df 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -258,6 +258,14 @@ class PatientSearchViewModel extends BaseViewModel { } } + removeOnFilteredList() { + if (lastSubsetIndex-inPatientPageSize - 1 > 0) { + filteredInPatientItems + .removeAt(lastSubsetIndex-inPatientPageSize - 1); + setState(ViewState.Idle); + } + } + filterByHospital({int hospitalId}) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index f52b4819..9106de0f 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -48,8 +48,9 @@ class _InPatientListPageState extends State { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(!widget.isMyInPatient) Container( - margin: EdgeInsets.only(left: 10.0,right: 10, top: 10), + margin: EdgeInsets.only(left: 10.0, right: 10, top: 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -120,7 +121,7 @@ class _InPatientListPageState extends State { ), ), Container( - margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top:5), + margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 5), child: Stack( children: [ AppTextFieldCustom( @@ -155,8 +156,8 @@ class _InPatientListPageState extends State { // padding: EdgeInsets.only(bottom: 30), onPressed: () { GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel - .sortInPatient(isDes: isSortDes, isAllClinic:isAllClinic); + widget.patientSearchViewModel.sortInPatient( + isDes: isSortDes, isAllClinic: isAllClinic); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -286,11 +287,19 @@ class _InPatientListPageState extends State { }), onNotification: (t) { if (isAllClinic && !hasQuery) if (t - is ScrollUpdateNotification && - t.metrics.pixels >= - t.metrics.maxScrollExtent - 50) { - widget.patientSearchViewModel - .addOnFilteredList(); + is ScrollUpdateNotification) { + if (t.metrics.pixels >= + t.metrics.maxScrollExtent - 50) { + widget.patientSearchViewModel + .addOnFilteredList(); + } + + if (t.metrics.pixels <= + t.metrics.minScrollExtent - 50) { + widget.patientSearchViewModel + .removeOnFilteredList(); + } + } return; }, diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index efc85f18..c5200c75 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -349,21 +349,22 @@ class PatientCard extends StatelessWidget { ), Expanded( child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ CustomRow( - label: TranslationBase.of(context).fileNumber, + label: + TranslationBase.of(context).fileNumber, value: patientInfo.patientId.toString(), ), CustomRow( - label: TranslationBase.of(context).age + " : ", + label: + TranslationBase.of(context).age + " : ", value: "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", ), - if (isInpatient) CustomRow( label: patientInfo.admissionDate == null @@ -377,33 +378,46 @@ class PatientCard extends StatelessWidget { ), if (patientInfo.admissionDate != null) CustomRow( - label: TranslationBase.of(context).numOfDays + + label: TranslationBase.of(context) + .numOfDays + " : ", value: "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", ), + if (patientInfo.admissionDate != null) + CustomRow( + // TODO Elham* add translation + label: + "Clinic Name" + + " : ", + value: "${patientInfo.clinicDescription}", + ), if (patientInfo.admissionDate != null) CustomRow( label: - TranslationBase.of(context).roomNo + " : ", + TranslationBase.of(context).roomNo + + " : ", value: "${patientInfo.roomId}", ), - if (isFromLiveCare) Column( children: [ CustomRow( - label: TranslationBase.of(context).clinic + + label: TranslationBase.of(context) + .clinic + " : ", value: patientInfo.clinicName, ), ], ), ]), - ), - Icon(Icons.arrow_forward, size: 24,), - ], - )) + ), + Icon( + Icons.arrow_forward, + size: 24, + ), + ], + )) ]), isFromLiveCare ? Row( @@ -458,5 +472,3 @@ class PatientCard extends StatelessWidget { )); } } - - From 6a96a9cb283195b001908d6589e952a31a42358b Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 9 Sep 2021 12:08:10 +0300 Subject: [PATCH 14/32] fix bug sick leave --- lib/screens/patients/InPatientPage.dart | 0 lib/screens/sick-leave/add-sickleave.dart | 124 ++++++++++++++++------ 2 files changed, 89 insertions(+), 35 deletions(-) delete mode 100644 lib/screens/patients/InPatientPage.dart diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index db8dd3c2..3cdeb180 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -22,6 +22,7 @@ import 'package:provider/provider.dart'; class AddSickLeavScreen extends StatelessWidget { PatiantInformtion patient; + @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); @@ -31,8 +32,10 @@ class AddSickLeavScreen extends StatelessWidget { bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) async { - await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId); - await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); + await model + .getSickLeavePatient(patient.patientMRN ?? patient.patientId); + await model + .getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -79,17 +82,21 @@ class AddSickLeavScreen extends StatelessWidget { }, child: Container( width: SizeConfig.screenWidth, - margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), + margin: EdgeInsets.only( + left: 20, right: 20, top: 10, bottom: 10), padding: EdgeInsets.all(20), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( child: Container( - decoration: - BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: + BorderRadius.circular(10)), padding: EdgeInsets.all(3), child: IconButton( icon: Icon( @@ -106,7 +113,9 @@ class AddSickLeavScreen extends StatelessWidget { ), )), Padding( - child: AppText(TranslationBase.of(context).noSickLeaveApplied, + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 16, @@ -122,7 +131,8 @@ class AddSickLeavScreen extends StatelessWidget { : SizedBox(), model.getAllSIckLeavePatient.length > 0 ? Column( - children: model.getAllSIckLeavePatient.map((SickLeavePatientModel item) { + children: model.getAllSIckLeavePatient + .map((SickLeavePatientModel item) { return RoundedContainer( margin: EdgeInsets.all(10), child: Column( @@ -141,7 +151,8 @@ class AddSickLeavScreen extends StatelessWidget { // ))), padding: EdgeInsets.all(10), child: Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( flex: 4, @@ -150,7 +161,8 @@ class AddSickLeavScreen extends StatelessWidget { // MainAxisAlignment.start, children: [ Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.all(3), @@ -168,7 +180,8 @@ class AddSickLeavScreen extends StatelessWidget { // : TranslationBase // .of(context) // .all, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, // color: item.status == 1 // ? Colors.yellow[800] // : item.status == 2 @@ -179,25 +192,48 @@ class AddSickLeavScreen extends StatelessWidget { ), Row( children: [ - AppText(TranslationBase.of(context).daysSickleave + ": "), + AppText(TranslationBase + .of(context) + .daysSickleave + + ": "), AppText( - item.sickLeaveDays.toString() ?? item.noOfDays.toString(), - fontWeight: FontWeight.bold, + (item.sickLeaveDays + .toString() != + null && + item.sickLeaveDays + .toString() != + "null") + ? item.sickLeaveDays + .toString() + : item.noOfDays + .toString(), + fontWeight: + FontWeight.bold, ), ], ), Row( children: [ AppText( - TranslationBase.of(context).startDate + ' ' ?? "", + TranslationBase.of( + context) + .startDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.startDate) - : DateTime.parse(item.startDate)), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils + .convertStringToDate(item + .startDate) + : DateTime.parse( + item.startDate)), + fontWeight: + FontWeight.bold, ), ) ], @@ -205,18 +241,30 @@ class AddSickLeavScreen extends StatelessWidget { Row( children: [ AppText( - TranslationBase.of(context).endDate + ' ' ?? "", + TranslationBase.of( + context) + .endDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.endDate ?? "") - .add(Duration( - days: item.noOfDays ?? item.sickLeaveDays)) - : DateTime.parse(item.startDate ?? "") - .add(Duration(days: item.noOfDays ?? ""))), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils.convertStringToDate( + item.endDate ?? + "") + .add(Duration( + days: item.noOfDays ?? + item + .sickLeaveDays)) + : DateTime.parse( + item.startDate ?? "") + .add(Duration(days: item.noOfDays ?? ""))), + fontWeight: + FontWeight.bold, ), ) ], @@ -246,7 +294,8 @@ class AddSickLeavScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noSickLeave), + child: AppText( + TranslationBase.of(context).noSickLeave), ) ], ), @@ -255,7 +304,8 @@ class AddSickLeavScreen extends StatelessWidget { ])))); } - openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { // showModalBottomSheet( // context: context, // builder: (context) { @@ -265,9 +315,13 @@ class AddSickLeavScreen extends StatelessWidget { context, FadePage( page: SickLeaveScreen( - appointmentNo: - isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo, - patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN, + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, + //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, isExtended: isExtend, extendedData: extendedData, patient: patient))); From 37cd34f5687857d659e0fa0d57ad5a2940b68a28 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 12:10:49 +0300 Subject: [PATCH 15/32] move no data widget to separate file --- lib/screens/patients/In_patient/NoData.dart | 20 +++++++++++++++++ .../In_patient/in_patient_list_page.dart | 22 +++++-------------- 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 lib/screens/patients/In_patient/NoData.dart diff --git a/lib/screens/patients/In_patient/NoData.dart b/lib/screens/patients/In_patient/NoData.dart new file mode 100644 index 00000000..0c48cd2a --- /dev/null +++ b/lib/screens/patients/In_patient/NoData.dart @@ -0,0 +1,20 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +class NoData extends StatelessWidget { + const NoData({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 9106de0f..152d87db 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../../routes.dart'; +import 'NoData.dart'; class InPatientListPage extends StatefulWidget { final bool isMyInPatient; @@ -90,6 +91,7 @@ class _InPatientListPageState extends State { onTap: () { setState(() { isAllClinic = false; + if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) showBottomSheet = true; }); }, @@ -102,7 +104,8 @@ class _InPatientListPageState extends State { setState(() { setState(() { isAllClinic = false; - showBottomSheet = true; + if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) + showBottomSheet = true; }); }); }, @@ -320,7 +323,7 @@ class _InPatientListPageState extends State { height: 0, ) : Container( - height: 500, + height: MediaQuery.of(context).size.height * 0.5, color: Colors.white, child: ListView.builder( itemCount: widget @@ -369,19 +372,4 @@ class _InPatientListPageState extends State { } } -class NoData extends StatelessWidget { - const NoData({ - Key key, - }) : super(key: key); - @override - Widget build(BuildContext context) { - return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable)), - ), - ); - } -} From ba275eaed4883831ed1e9953fcfda11a8babeb72 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 12:47:08 +0300 Subject: [PATCH 16/32] adding cashed network image --- .../patients/patient_card/PatientCard.dart | 213 +++++++----------- pubspec.lock | 85 ++++++- pubspec.yaml | 4 + 3 files changed, 167 insertions(+), 135 deletions(-) diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b86256fd..ed6fe74e 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'ShowTimer.dart'; @@ -81,8 +82,7 @@ class PatientCard extends StatelessWidget { ? Row( children: [ AppText( - TranslationBase.of(context) - .arrivedP, + TranslationBase.of(context).arrivedP, color: Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -102,12 +102,8 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Confirmed' - : 'Booked', - color: patientInfo.status == 2 - ? Colors.green - : Colors.grey, + patientInfo.status == 2 ? 'Confirmed' : 'Booked', + color: patientInfo.status == 2 ? Colors.green : Colors.grey, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 10, @@ -118,8 +114,7 @@ class PatientCard extends StatelessWidget { ? Row( children: [ AppText( - TranslationBase.of(context) - .notArrived, + TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -139,27 +134,19 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Confirmed' - : 'Booked', - color: patientInfo.status == 2 - ? Colors.green - : Colors.grey, + patientInfo.status == 2 ? 'Confirmed' : 'Booked', + color: patientInfo.status == 2 ? Colors.green : Colors.grey, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 10, ), ], ) - : !isFromSearch && - !isFromLiveCare && - patientInfo.patientStatusType == - null + : !isFromSearch && !isFromLiveCare && patientInfo.patientStatusType == null ? Row( children: [ AppText( - TranslationBase.of(context) - .notArrived, + TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -179,13 +166,8 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Booked' - : 'Confirmed', - color: - patientInfo.status == 2 - ? Colors.grey - : Colors.green, + patientInfo.status == 2 ? 'Booked' : 'Confirmed', + color: patientInfo.status == 2 ? Colors.grey : Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 12, @@ -195,17 +177,13 @@ class PatientCard extends StatelessWidget { : SizedBox(), this.arrivalType == '1' ? AppText( - patientInfo.startTime != null - ? patientInfo.startTime - : patientInfo.startTimes, + patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes, fontFamily: 'Poppins', fontWeight: FontWeight.w400, ) : patientInfo.arrivedOn != null ? AppText( - AppDateUtils.getDayMonthYearDate( - AppDateUtils - .convertStringToDate( + AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.arrivedOn, )) + " " + @@ -214,10 +192,8 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w400, fontSize: 15, ) - : (patientInfo.appointmentDate != - null && - patientInfo - .appointmentDate.isNotEmpty) + : (patientInfo.appointmentDate != null && + patientInfo.appointmentDate.isNotEmpty) ? AppText( "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.appointmentDate, @@ -256,13 +232,10 @@ class PatientCard extends StatelessWidget { // width: MediaQuery.of(context).size.width*0.51, child: AppText( isFromLiveCare - ? Helpers.capitalize( - patientInfo.fullName) - : (Helpers.capitalize( - patientInfo.firstName) + + ? Helpers.capitalize(patientInfo.fullName) + : (Helpers.capitalize(patientInfo.firstName) + " " + - Helpers.capitalize( - patientInfo.lastName)), + Helpers.capitalize(patientInfo.lastName)), fontSize: 16, color: Color(0xff2e303a), fontWeight: FontWeight.w700, @@ -300,25 +273,19 @@ class PatientCard extends StatelessWidget { fontSize: 14, textOverflow: TextOverflow.ellipsis, ), - patientInfo.nationality != null || - patientInfo.nationalityId != null + patientInfo.nationality != null || patientInfo.nationalityId != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), - child: Image.network( - patientInfo.nationalityFlagURL != null + borderRadius: BorderRadius.circular(20.0), + child: CachedNetworkImage( + imageUrl: patientInfo.nationalityFlagURL != null ? patientInfo.nationalityFlagURL : '', height: 25, width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return AppText( - 'No Image', - fontSize: 10, - ); - }, + errorWidget: (context, url, error) => AppText( + 'No Image', + fontSize: 7.5, + ), )) : SizedBox() ], @@ -348,58 +315,51 @@ class PatientCard extends StatelessWidget { width: 10, ), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).fileNumber, - value: patientInfo.patientId.toString(), - ), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + CustomRow( + label: TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), + ), - //if (isInpatient) + //if (isInpatient) - CustomRow( - label: TranslationBase.of(context).age + " : ", - value: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - ), + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", + ), - if (isInpatient) - CustomRow( - label: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - value: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: TranslationBase.of(context).numOfDays + - " : ", - value: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: - TranslationBase.of(context).roomNo + " : ", - value: "${patientInfo.roomId}", - ), + if (isInpatient) + CustomRow( + label: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context).admissionDate + " : ", + value: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context).numOfDays + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context).roomNo + " : ", + value: "${patientInfo.roomId}", + ), - if (isFromLiveCare) - Column( - children: [ - CustomRow( - label: TranslationBase.of(context).clinic + - " : ", - value: patientInfo.clinicName, - ), - ], + if (isFromLiveCare) + Column( + children: [ + CustomRow( + label: TranslationBase.of(context).clinic + " : ", + value: patientInfo.clinicName, ), - ])) + ], + ), + ])) ]), isFromLiveCare ? Row( @@ -416,36 +376,29 @@ class PatientCard extends StatelessWidget { ], ) : !isInpatient && !isFromSearch - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ + ? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + patientInfo.appointmentType == 'Regular' && patientInfo.visitTypeId == 100 + ? 'assets/images/livecare.png' + : patientInfo.appointmentType == 'Walkin' + ? 'assets/images/walkin.png' + : 'assets/images/booked.png', + height: 25, + width: 35, + )), + ]) + : (isInpatient == true) + ? Row(mainAxisAlignment: MainAxisAlignment.end, children: [ Container( padding: EdgeInsets.all(4), child: Image.asset( - patientInfo.appointmentType == - 'Regular' && - patientInfo.visitTypeId == 100 - ? 'assets/images/livecare.png' - : patientInfo.appointmentType == - 'Walkin' - ? 'assets/images/walkin.png' - : 'assets/images/booked.png', + 'assets/images/inpatient.png', height: 25, width: 35, )), ]) - : (isInpatient == true) - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(4), - child: Image.asset( - 'assets/images/inpatient.png', - height: 25, - width: 35, - )), - ]) : SizedBox() ], ), @@ -454,5 +407,3 @@ class PatientCard extends StatelessWidget { )); } } - - diff --git a/pubspec.lock b/pubspec.lock index e2215d0c..53035a4a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -141,6 +141,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.1" characters: dependency: transitive description: @@ -433,6 +440,20 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" flutter_device_type: dependency: "direct main" description: @@ -595,6 +616,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.19" imei_plugin: dependency: "direct main" description: @@ -664,7 +692,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -693,6 +721,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" open_iconic_flutter: dependency: transitive description: @@ -728,6 +763,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.4" + path_provider: + dependency: transitive + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.28" path_provider_linux: dependency: transitive description: @@ -735,6 +777,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1+2" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+8" path_provider_platform_interface: dependency: transitive description: @@ -854,6 +903,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.5" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.25.0" scratch_space: dependency: transitive description: @@ -950,13 +1006,27 @@ packages: relative: true source: path version: "0.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.2+4" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3+3" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -985,6 +1055,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0-nullsafety.1" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0+2" term_glyph: dependency: transitive description: @@ -1154,5 +1231,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" - flutter: ">=1.22.0 <2.0.0" + dart: ">=2.10.2 <=2.11.0-213.1.beta" + flutter: ">=1.22.2 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index cf5ced70..66f0df91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -96,6 +96,10 @@ dependencies: # Html Editor Enhanced html_editor_enhanced: ^1.3.0 + #Network Image + cached_network_image: ^2.5.0 + + # Badges badges: ^1.1.4 From 9598c09ea265028baa7355d4da7c0b77556195bd Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 9 Sep 2021 13:11:25 +0300 Subject: [PATCH 17/32] scroll problem --- .../In_patient/in_patient_list_page.dart | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 80acb88d..c7b99200 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -32,13 +32,21 @@ class _InPatientListPageState extends State { bool isAllClinic = true; bool showBottomSheet = false; String selectedClinicName; + ScrollController _scrollController; @override void dispose() { _searchController.dispose(); + _scrollController.dispose(); super.dispose(); } + @override + void initState() { + _scrollController = new ScrollController(); + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -167,13 +175,14 @@ class _InPatientListPageState extends State { : Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.0), - child: NotificationListener( + child: NotificationListener( child: ListView.builder( itemCount: widget.patientSearchViewModel .filteredInPatientItems.length, scrollDirection: Axis.vertical, // physics: ScrollPhysics(), shrinkWrap: true, + controller: _scrollController, itemBuilder: (context, index) { if (!widget.isMyInPatient) return PatientCard( @@ -276,14 +285,19 @@ class _InPatientListPageState extends State { else return SizedBox(); }), - onNotification: (t) { - if (isAllClinic) if (t + onNotification: (notification) { + if (isAllClinic) if (notification is ScrollUpdateNotification && - t.metrics.pixels >= - t.metrics.maxScrollExtent - 50) { + notification.metrics.pixels >= + notification.metrics.maxScrollExtent - 50) { widget.patientSearchViewModel .addOnFilteredList(); } + // print("scroll position scroll ${_scrollController.position.pixels}"); + // if(_scrollController.position.pixels > widget.patientSearchViewModel + // .filteredInPatientItems.length / 4){ + // _scrollController.jumpTo(0); + // } return; }, ), From ce199f7d9860ad6d7ad4c0f8966efce0256c5fad Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 15:07:18 +0300 Subject: [PATCH 18/32] separate in patient and my in patient to 2 files --- .../viewModel/PatientSearchViewModel.dart | 151 ++++++--- .../In_patient/in_patient_list_page.dart | 307 ++++++------------ .../In_patient/list_of_all_in_patient.dart | 124 +++++++ .../In_patient/list_of_my_inpatient.dart | 76 +++++ 4 files changed, 392 insertions(+), 266 deletions(-) create mode 100644 lib/screens/patients/In_patient/list_of_all_in_patient.dart create mode 100644 lib/screens/patients/In_patient/list_of_my_inpatient.dart diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 0333f7df..84fe8b44 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -30,9 +30,9 @@ class PatientSearchViewModel extends BaseViewModel { int firstSubsetIndex = 0; int inPatientPageSize = 20; - int lastSubsetIndex = 19; + int lastSubsetIndex = 20; - List myInpatientClinicList = []; + List InpatientClinicList = []; searchData(String str) { var strExist = str.length > 0 ? true : false; @@ -88,10 +88,8 @@ class PatientSearchViewModel extends BaseViewModel { sortOutPatient({bool isDes = false}) { if (isDes) filterData = filterData.reversed.toList(); - // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>b.appointmentDateWithDateTimeForm.compareTo(a.appointmentDateWithDateTimeForm)); else filterData = filterData.reversed.toList(); - // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>a.appointmentDateWithDateTimeForm.compareTo(b.appointmentDateWithDateTimeForm)); setState(ViewState.Idle); } @@ -166,6 +164,7 @@ class PatientSearchViewModel extends BaseViewModel { _inPatientService.myInPatientList; List filteredInPatientItems = List(); + List filteredMyInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false, bool isLocalBusy = false}) async { @@ -186,17 +185,22 @@ class PatientSearchViewModel extends BaseViewModel { } } else { setDefaultInPatientList(); - generateMyInpatientClinicList(); + generateInpatientClinicList(); setState(ViewState.Idle); } } - sortInPatient({bool isDes = false, bool isAllClinic}) { - if (isAllClinic - ? inPatientList.length > 0 - : filteredInPatientItems.length > 0) { - List localInPatient = - isAllClinic ? [...inPatientList] : [...filteredInPatientItems]; + sortInPatient({bool isDes = false, bool isAllClinic, bool isMyInPatient}) { + if (isMyInPatient + ? myIinPatientList.length > 0 + : isAllClinic + ? inPatientList.length > 0 + : filteredInPatientItems.length > 0) { + List localInPatient = isMyInPatient + ? [...filteredMyInPatientItems] + : isAllClinic + ? [...inPatientList] + : [...filteredInPatientItems]; if (isDes) localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b .admissionDateWithDateTimeForm @@ -205,8 +209,10 @@ class PatientSearchViewModel extends BaseViewModel { localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a .admissionDateWithDateTimeForm .compareTo(b.admissionDateWithDateTimeForm)); - - if (isAllClinic) { + if (isMyInPatient) { + filteredMyInPatientItems.clear(); + filteredMyInPatientItems.addAll(localInPatient); + } else if (isAllClinic) { resetInPatientPagination(); filteredInPatientItems .addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex)); @@ -231,13 +237,17 @@ class PatientSearchViewModel extends BaseViewModel { if (inPatientList.length > 0) filteredInPatientItems .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + + if (myIinPatientList.length > 0) { + filteredMyInPatientItems.addAll(myIinPatientList); + } setState(ViewState.Idle); } - generateMyInpatientClinicList() { + generateInpatientClinicList() { inPatientList.forEach((element) { - if (!myInpatientClinicList.contains(element.clinicDescription)) { - myInpatientClinicList.add(element.clinicDescription); + if (!InpatientClinicList.contains(element.clinicDescription)) { + InpatientClinicList.add(element.clinicDescription); } }); } @@ -259,9 +269,8 @@ class PatientSearchViewModel extends BaseViewModel { } removeOnFilteredList() { - if (lastSubsetIndex-inPatientPageSize - 1 > 0) { - filteredInPatientItems - .removeAt(lastSubsetIndex-inPatientPageSize - 1); + if (lastSubsetIndex - inPatientPageSize - 1 > 0) { + filteredInPatientItems.removeAt(lastSubsetIndex - inPatientPageSize - 1); setState(ViewState.Idle); } } @@ -291,61 +300,95 @@ class PatientSearchViewModel extends BaseViewModel { _inPatientService.myInPatientList = []; } - void filterSearchResults(String query, {bool isAllClinic}) { + void filterSearchResults(String query, + {bool isAllClinic, bool isMyInPatient}) { var strExist = query.length > 0 ? true : false; - if (isAllClinic) { - if (strExist) { - filteredInPatientItems = []; - for (var i = 0; i < inPatientList.length; i++) { - String firstName = inPatientList[i].firstName.toUpperCase(); - String lastName = inPatientList[i].lastName.toUpperCase(); - String mobile = inPatientList[i].mobileNumber.toUpperCase(); - String patientID = inPatientList[i].patientId.toString(); - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { - filteredInPatientItems.add(inPatientList[i]); - } - } - notifyListeners(); - } else { - if (inPatientList.length > 0) filteredInPatientItems.clear(); - filteredInPatientItems.addAll(inPatientList); - notifyListeners(); - } - } else { - List localFilteredInPatientItems = [ - ...filteredInPatientItems + if (isMyInPatient) { + List localFilteredMyInPatientItems = [ + ...myIinPatientList ]; if (strExist) { - filteredInPatientItems.clear(); - for (var i = 0; i < localFilteredInPatientItems.length; i++) { + filteredMyInPatientItems.clear(); + for (var i = 0; i < localFilteredMyInPatientItems.length; i++) { String firstName = - localFilteredInPatientItems[i].firstName.toUpperCase(); + localFilteredMyInPatientItems[i].firstName.toUpperCase(); String lastName = - localFilteredInPatientItems[i].lastName.toUpperCase(); + localFilteredMyInPatientItems[i].lastName.toUpperCase(); String mobile = - localFilteredInPatientItems[i].mobileNumber.toUpperCase(); + localFilteredMyInPatientItems[i].mobileNumber.toUpperCase(); String patientID = - localFilteredInPatientItems[i].patientId.toString(); + localFilteredMyInPatientItems[i].patientId.toString(); if (firstName.contains(query.toUpperCase()) || lastName.contains(query.toUpperCase()) || mobile.contains(query) || patientID.contains(query)) { - filteredInPatientItems.add(localFilteredInPatientItems[i]); + filteredMyInPatientItems.add(localFilteredMyInPatientItems[i]); } } notifyListeners(); } else { - if (localFilteredInPatientItems.length > 0) - filteredInPatientItems.clear(); - filteredInPatientItems.addAll(localFilteredInPatientItems); + if (myIinPatientList.length > 0) filteredMyInPatientItems.clear(); + filteredMyInPatientItems.addAll(myIinPatientList); notifyListeners(); } + } else { + if (isAllClinic) { + if (strExist) { + filteredInPatientItems = []; + for (var i = 0; i < inPatientList.length; i++) { + String firstName = inPatientList[i].firstName.toUpperCase(); + String lastName = inPatientList[i].lastName.toUpperCase(); + String mobile = inPatientList[i].mobileNumber.toUpperCase(); + String patientID = inPatientList[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(inPatientList[i]); + } + } + notifyListeners(); + } else { + if (inPatientList.length > 0) filteredInPatientItems.clear(); + filteredInPatientItems.addAll(inPatientList); + notifyListeners(); + } + } else { + List localFilteredInPatientItems = [ + ...filteredInPatientItems + ]; + + if (strExist) { + filteredInPatientItems.clear(); + for (var i = 0; i < localFilteredInPatientItems.length; i++) { + String firstName = + localFilteredInPatientItems[i].firstName.toUpperCase(); + String lastName = + localFilteredInPatientItems[i].lastName.toUpperCase(); + String mobile = + localFilteredInPatientItems[i].mobileNumber.toUpperCase(); + String patientID = + localFilteredInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || + lastName.contains(query.toUpperCase()) || + mobile.contains(query) || + patientID.contains(query)) { + filteredInPatientItems.add(localFilteredInPatientItems[i]); + } + } + notifyListeners(); + } else { + if (localFilteredInPatientItems.length > 0) + filteredInPatientItems.clear(); + filteredInPatientItems.addAll(localFilteredInPatientItems); + notifyListeners(); + } + } } } diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 152d87db..cb3d4856 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -1,20 +1,16 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.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/patient_card/PatientCard.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_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/errors/error_message.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import '../../../routes.dart'; import 'NoData.dart'; +import 'list_of_all_in_patient.dart'; +import 'list_of_my_inpatient.dart'; class InPatientListPage extends StatefulWidget { final bool isMyInPatient; @@ -49,82 +45,88 @@ class _InPatientListPageState extends State { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if(!widget.isMyInPatient) - Container( - margin: EdgeInsets.only(left: 10.0, right: 10, top: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Radio( - value: 1, - groupValue: isAllClinic ? 1 : 2, - onChanged: (value) { - setState(() { - setState(() { - isAllClinic = true; - showBottomSheet = false; - }); - widget.patientSearchViewModel - .setDefaultInPatientList(); - }); - }, - activeColor: Colors.red, - ), - AppText( - "All Clinic", - fontSize: 15, - ), - ], - ), - onTap: () { - setState(() { - isAllClinic = true; - showBottomSheet = false; - }); - widget.patientSearchViewModel.setDefaultInPatientList(); - }, - ), - InkWell( - onTap: () { - setState(() { - isAllClinic = false; - if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) - showBottomSheet = true; - }); - }, + if (!widget.isMyInPatient) + Container( + margin: EdgeInsets.only(left: 10.0, right: 10, top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( child: Row( children: [ Radio( - value: 2, + value: 1, groupValue: isAllClinic ? 1 : 2, onChanged: (value) { setState(() { setState(() { - isAllClinic = false; - if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) - showBottomSheet = true; + isAllClinic = true; + showBottomSheet = false; }); + widget.patientSearchViewModel + .setDefaultInPatientList(); }); }, activeColor: Colors.red, ), AppText( - selectedClinicName ?? "Select Clinic", + "All Clinic", fontSize: 15, ), - Container( - margin: EdgeInsets.only(bottom: 10), - child: Icon(FontAwesomeIcons.sortDown)) ], - )), - ], + ), + onTap: () { + setState(() { + isAllClinic = true; + showBottomSheet = false; + }); + widget.patientSearchViewModel.setDefaultInPatientList(); + }, + ), + InkWell( + onTap: () { + setState(() { + isAllClinic = false; + if (widget.patientSearchViewModel.InpatientClinicList + .length > + 0) showBottomSheet = true; + }); + }, + child: Row( + children: [ + Radio( + value: 2, + groupValue: isAllClinic ? 1 : 2, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = false; + if (widget.patientSearchViewModel + .InpatientClinicList.length > + 0) showBottomSheet = true; + }); + }); + }, + activeColor: Colors.red, + ), + AppText( + selectedClinicName ?? "Select Clinic", + fontSize: 15, + ), + Container( + margin: EdgeInsets.only(bottom: 10), + child: Icon(FontAwesomeIcons.sortDown)) + ], + )), + ], + ), ), - ), Container( - margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 5), + margin: EdgeInsets.only( + left: 16, + right: 16, + bottom: 16, + top: widget.isMyInPatient ? 15 : 5), child: Stack( children: [ AppTextFieldCustom( @@ -143,7 +145,7 @@ class _InPatientListPageState extends State { hasQuery = true; }); widget.patientSearchViewModel - .filterSearchResults(value, isAllClinic: isAllClinic); + .filterSearchResults(value, isAllClinic: isAllClinic, isMyInPatient:widget.isMyInPatient); }), Positioned( right: 35, @@ -160,7 +162,7 @@ class _InPatientListPageState extends State { onPressed: () { GifLoaderDialogUtils.showMyDialog(context); widget.patientSearchViewModel.sortInPatient( - isDes: isSortDes, isAllClinic: isAllClinic); + isDes: isSortDes, isAllClinic: isAllClinic, isMyInPatient:widget.isMyInPatient); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -170,146 +172,26 @@ class _InPatientListPageState extends State { ), ), widget.patientSearchViewModel.state == ViewState.Idle - ? widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? (widget.isMyInPatient && - widget.patientSearchViewModel.myIinPatientList - .length == - 0) - ? NoData() - : Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: NotificationListener( - child: ListView.builder( - itemCount: widget.patientSearchViewModel - .filteredInPatientItems.length, - scrollDirection: Axis.vertical, - // physics: ScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: widget - .patientSearchViewModel - .filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget - .patientSearchViewModel - .doctorProfile - .doctorID, - }); - }, - ); - else if (widget - .patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: widget - .patientSearchViewModel - .filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget - .patientSearchViewModel - .doctorProfile - .doctorID, - }); - }, - ); - else - return SizedBox(); - }), - onNotification: (t) { - if (isAllClinic && !hasQuery) if (t - is ScrollUpdateNotification) { - if (t.metrics.pixels >= - t.metrics.maxScrollExtent - 50) { - widget.patientSearchViewModel - .addOnFilteredList(); - } - - if (t.metrics.pixels <= - t.metrics.minScrollExtent - 50) { - widget.patientSearchViewModel - .removeOnFilteredList(); - } - - } - return; - }, - ), - ), - ) - : NoData() + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList.length > 0) + ? ListOfMyInpatient( + isAllClinic: isAllClinic, + hasQuery: hasQuery, + patientSearchViewModel: widget.patientSearchViewModel) + : widget.patientSearchViewModel.filteredInPatientItems + .length > + 0 + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList + .length == + 0) + ? NoData() + : ListOfAllInPatient( + isAllClinic: isAllClinic, + hasQuery: hasQuery, + patientSearchViewModel: + widget.patientSearchViewModel) + : NoData() : Center( child: Container( height: 300, @@ -326,8 +208,8 @@ class _InPatientListPageState extends State { height: MediaQuery.of(context).size.height * 0.5, color: Colors.white, child: ListView.builder( - itemCount: widget - .patientSearchViewModel.myInpatientClinicList.length, + itemCount: + widget.patientSearchViewModel.InpatientClinicList.length, scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, @@ -338,17 +220,17 @@ class _InPatientListPageState extends State { isAllClinic = false; showBottomSheet = false; selectedClinicName = widget.patientSearchViewModel - .myInpatientClinicList[index]; + .InpatientClinicList[index]; }); widget.patientSearchViewModel.filterByClinic( clinicName: widget.patientSearchViewModel - .myInpatientClinicList[index]); + .InpatientClinicList[index]); }, child: Row( children: [ Radio( value: widget.patientSearchViewModel - .myInpatientClinicList[index], + .InpatientClinicList[index], groupValue: selectedClinicName, onChanged: (value) { setState(() { @@ -363,7 +245,7 @@ class _InPatientListPageState extends State { activeColor: Colors.red, ), AppText(widget.patientSearchViewModel - .myInpatientClinicList[index]), + .InpatientClinicList[index]), ], )); }), @@ -373,3 +255,4 @@ class _InPatientListPageState extends State { } + diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart new file mode 100644 index 00000000..4908a848 --- /dev/null +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -0,0 +1,124 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:flutter/material.dart'; + +import '../../../routes.dart'; +import 'NoData.dart'; + +class ListOfAllInPatient extends StatelessWidget { + const ListOfAllInPatient({ + Key key, + @required this.isAllClinic, + @required this.hasQuery, + this.patientSearchViewModel, + }) : super(key: key); + + final bool isAllClinic; + final bool hasQuery; + + final PatientSearchViewModel patientSearchViewModel; + + @override + Widget build(BuildContext context) { + return Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: patientSearchViewModel.filteredInPatientItems.length == 0 + ? NoData() + :NotificationListener( + child: ListView.builder( + itemCount: + patientSearchViewModel.filteredInPatientItems.length, + scrollDirection: Axis.vertical, + // physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + // if (!isMyInPatient) + return PatientCard( + patientInfo: patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: patientSearchViewModel + .filteredInPatientItems[index].doctorId == + patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": patientSearchViewModel + .filteredInPatientItems[index].doctorId == + patientSearchViewModel.doctorProfile.doctorID, + }); + }, + ); + // else if (widget.patientSearchViewModel + // .filteredInPatientItems[index].doctorId == + // widget.patientSearchViewModel.doctorProfile.doctorID && + // widget.isMyInPatient) + // return PatientCard( + // patientInfo: widget + // .patientSearchViewModel.filteredInPatientItems[index], + // patientType: "1", + // arrivalType: "1", + // isInpatient: true, + // isMyPatient: widget.patientSearchViewModel + // .filteredInPatientItems[index].doctorId == + // widget.patientSearchViewModel.doctorProfile.doctorID, + // onTap: () { + // FocusScopeNode currentFocus = FocusScope.of(context); + // if (!currentFocus.hasPrimaryFocus) { + // currentFocus.unfocus(); + // } + // + // Navigator.of(context) + // .pushNamed(PATIENTS_PROFILE, arguments: { + // "patient": widget.patientSearchViewModel + // .filteredInPatientItems[index], + // "patientType": "1", + // "from": "0", + // "to": "0", + // "isSearch": false, + // "isInpatient": true, + // "arrivalType": "1", + // "isMyPatient": widget.patientSearchViewModel + // .filteredInPatientItems[index].doctorId == + // widget + // .patientSearchViewModel.doctorProfile.doctorID, + // }); + // }, + // ); + // else + // return SizedBox(); + }), + onNotification: (t) { + if (isAllClinic && !hasQuery) if (t + is ScrollUpdateNotification) { + if (t.metrics.pixels >= t.metrics.maxScrollExtent - 50) { + patientSearchViewModel.addOnFilteredList(); + } + + if (t.metrics.pixels <= t.metrics.minScrollExtent - 50) { + patientSearchViewModel.removeOnFilteredList(); + } + } + return; + }, + ), + ), + ); + } +} diff --git a/lib/screens/patients/In_patient/list_of_my_inpatient.dart b/lib/screens/patients/In_patient/list_of_my_inpatient.dart new file mode 100644 index 00000000..306f99ac --- /dev/null +++ b/lib/screens/patients/In_patient/list_of_my_inpatient.dart @@ -0,0 +1,76 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:flutter/material.dart'; + +import '../../../routes.dart'; +import 'NoData.dart'; +class ListOfMyInpatient extends StatelessWidget { + const ListOfMyInpatient({ + Key key, + @required this.isAllClinic, + @required this.hasQuery, + this.patientSearchViewModel, + }) : super(key: key); + + final bool isAllClinic; + final bool hasQuery; + final PatientSearchViewModel patientSearchViewModel; + + @override + Widget build(BuildContext context) { + return Expanded( + child:Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: patientSearchViewModel.filteredMyInPatientItems.length == 0 + ? NoData():NotificationListener( + child: ListView.builder( + itemCount: patientSearchViewModel.filteredMyInPatientItems.length, + scrollDirection: Axis.vertical, + // physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return PatientCard( + patientInfo: patientSearchViewModel.filteredMyInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: true, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": + patientSearchViewModel.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": true, + }); + }, + ); + }), + onNotification: (t) { + if (isAllClinic && !hasQuery) if (t is ScrollUpdateNotification) { + //TODO Elham* + // if (t.metrics.pixels >= t.metrics.maxScrollExtent - 50) { + // patientSearchViewModel.addOnFilteredList(); + // } + // + // if (t.metrics.pixels <= t.metrics.minScrollExtent - 50) { + // patientSearchViewModel.removeOnFilteredList(); + // } + } + return; + }, + ), + ), + ); + } +} From de5621a629f115f7f4bc4c906e54ff9d6c027dad Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 15:18:07 +0300 Subject: [PATCH 19/32] fix issue after merge the dev --- .../In_patient/in_patient_list_page.dart | 13 +++++----- .../In_patient/list_of_all_in_patient.dart | 24 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 876c31ba..251054e1 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -152,8 +152,9 @@ class _InPatientListPageState extends State { setState(() { hasQuery = true; }); - widget.patientSearchViewModel - .filterSearchResults(value, isAllClinic: isAllClinic, isMyInPatient:widget.isMyInPatient); + widget.patientSearchViewModel.filterSearchResults(value, + isAllClinic: isAllClinic, + isMyInPatient: widget.isMyInPatient); }), Positioned( right: 35, @@ -170,7 +171,9 @@ class _InPatientListPageState extends State { onPressed: () { GifLoaderDialogUtils.showMyDialog(context); widget.patientSearchViewModel.sortInPatient( - isDes: isSortDes, isAllClinic: isAllClinic, isMyInPatient:widget.isMyInPatient); + isDes: isSortDes, + isAllClinic: isAllClinic, + isMyInPatient: widget.isMyInPatient); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -197,6 +200,7 @@ class _InPatientListPageState extends State { : ListOfAllInPatient( isAllClinic: isAllClinic, hasQuery: hasQuery, + scrollController: _scrollController, patientSearchViewModel: widget.patientSearchViewModel) : NoData() @@ -261,6 +265,3 @@ class _InPatientListPageState extends State { ); } } - - - diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart index 4908a848..9c648e66 100644 --- a/lib/screens/patients/In_patient/list_of_all_in_patient.dart +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -11,22 +11,26 @@ class ListOfAllInPatient extends StatelessWidget { @required this.isAllClinic, @required this.hasQuery, this.patientSearchViewModel, + this.scrollController, }) : super(key: key); final bool isAllClinic; final bool hasQuery; + final ScrollController scrollController; + final PatientSearchViewModel patientSearchViewModel; @override Widget build(BuildContext context) { return Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: patientSearchViewModel.filteredInPatientItems.length == 0 - ? NoData() - :NotificationListener( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: patientSearchViewModel.filteredInPatientItems.length == 0 + ? NoData() + : NotificationListener( child: ListView.builder( + controller: scrollController, itemCount: patientSearchViewModel.filteredInPatientItems.length, scrollDirection: Axis.vertical, @@ -104,21 +108,21 @@ class ListOfAllInPatient extends StatelessWidget { // else // return SizedBox(); }), - onNotification: (t) { - if (isAllClinic && !hasQuery) if (t + onNotification: (notification) { + if (isAllClinic && !hasQuery) if (notification is ScrollUpdateNotification) { - if (t.metrics.pixels >= t.metrics.maxScrollExtent - 50) { + if (notification.metrics.pixels >= notification.metrics.maxScrollExtent - 50) { patientSearchViewModel.addOnFilteredList(); } - if (t.metrics.pixels <= t.metrics.minScrollExtent - 50) { + if (notification.metrics.pixels <= notification.metrics.minScrollExtent - 50) { patientSearchViewModel.removeOnFilteredList(); } } return; }, ), - ), + ), ); } } From f2dbfaf2be3cf0e77e26845e2ff82079c1c52f8f Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 15:30:46 +0300 Subject: [PATCH 20/32] fix issue after merge the dev --- lib/screens/patients/In_patient/in_patient_list_page.dart | 8 -------- .../patients/In_patient/list_of_all_in_patient.dart | 7 +------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 251054e1..61abf434 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -30,20 +30,13 @@ class _InPatientListPageState extends State { bool hasQuery = false; bool showBottomSheet = false; String selectedClinicName; - ScrollController _scrollController; @override void dispose() { _searchController.dispose(); - _scrollController.dispose(); super.dispose(); } - @override - void initState() { - _scrollController = new ScrollController(); - super.initState(); - } @override Widget build(BuildContext context) { @@ -200,7 +193,6 @@ class _InPatientListPageState extends State { : ListOfAllInPatient( isAllClinic: isAllClinic, hasQuery: hasQuery, - scrollController: _scrollController, patientSearchViewModel: widget.patientSearchViewModel) : NoData() diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart index 9c648e66..6aa13094 100644 --- a/lib/screens/patients/In_patient/list_of_all_in_patient.dart +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -11,13 +11,11 @@ class ListOfAllInPatient extends StatelessWidget { @required this.isAllClinic, @required this.hasQuery, this.patientSearchViewModel, - this.scrollController, }) : super(key: key); final bool isAllClinic; final bool hasQuery; - final ScrollController scrollController; final PatientSearchViewModel patientSearchViewModel; @@ -28,16 +26,13 @@ class ListOfAllInPatient extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 16.0), child: patientSearchViewModel.filteredInPatientItems.length == 0 ? NoData() - : NotificationListener( + : NotificationListener( child: ListView.builder( - controller: scrollController, itemCount: patientSearchViewModel.filteredInPatientItems.length, scrollDirection: Axis.vertical, - // physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { - // if (!isMyInPatient) return PatientCard( patientInfo: patientSearchViewModel .filteredInPatientItems[index], From 6eecb4a61478113a030f1d46dbeea2d964ec9e8b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 15:44:34 +0300 Subject: [PATCH 21/32] adding cashed network image --- .../patients/patient_card/PatientCard.dart | 166 +++++++----------- .../profile/profile-welcome-widget.dart | 30 ++-- 2 files changed, 83 insertions(+), 113 deletions(-) diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index 22deda0c..4bc5d2cd 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -82,8 +82,7 @@ class PatientCard extends StatelessWidget { ? Row( children: [ AppText( - TranslationBase.of(context) - .arrivedP, + TranslationBase.of(context).arrivedP, color: Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -135,27 +134,19 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Confirmed' - : 'Booked', - color: patientInfo.status == 2 - ? Colors.green - : Colors.grey, + patientInfo.status == 2 ? 'Confirmed' : 'Booked', + color: patientInfo.status == 2 ? Colors.green : Colors.grey, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 10, ), ], ) - : !isFromSearch && - !isFromLiveCare && - patientInfo.patientStatusType == - null + : !isFromSearch && !isFromLiveCare && patientInfo.patientStatusType == null ? Row( children: [ AppText( - TranslationBase.of(context) - .notArrived, + TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -175,13 +166,8 @@ class PatientCard extends StatelessWidget { width: 8, ), AppText( - patientInfo.status == 2 - ? 'Booked' - : 'Confirmed', - color: - patientInfo.status == 2 - ? Colors.grey - : Colors.green, + patientInfo.status == 2 ? 'Booked' : 'Confirmed', + color: patientInfo.status == 2 ? Colors.grey : Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 12, @@ -191,17 +177,13 @@ class PatientCard extends StatelessWidget { : SizedBox(), this.arrivalType == '1' ? AppText( - patientInfo.startTime != null - ? patientInfo.startTime - : patientInfo.startTimes, + patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes, fontFamily: 'Poppins', fontWeight: FontWeight.w400, ) : patientInfo.arrivedOn != null ? AppText( - AppDateUtils.getDayMonthYearDate( - AppDateUtils - .convertStringToDate( + AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.arrivedOn, )) + " " + @@ -210,10 +192,8 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w400, fontSize: 15, ) - : (patientInfo.appointmentDate != - null && - patientInfo - .appointmentDate.isNotEmpty) + : (patientInfo.appointmentDate != null && + patientInfo.appointmentDate.isNotEmpty) ? AppText( "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( patientInfo.appointmentDate, @@ -252,13 +232,10 @@ class PatientCard extends StatelessWidget { // width: MediaQuery.of(context).size.width*0.51, child: AppText( isFromLiveCare - ? Helpers.capitalize( - patientInfo.fullName) - : (Helpers.capitalize( - patientInfo.firstName) + + ? Helpers.capitalize(patientInfo.fullName) + : (Helpers.capitalize(patientInfo.firstName) + " " + - Helpers.capitalize( - patientInfo.lastName)), + Helpers.capitalize(patientInfo.lastName)), fontSize: 16, color: Color(0xff2e303a), fontWeight: FontWeight.w700, @@ -296,25 +273,19 @@ class PatientCard extends StatelessWidget { fontSize: 14, textOverflow: TextOverflow.ellipsis, ), - patientInfo.nationality != null || - patientInfo.nationalityId != null + patientInfo.nationality != null || patientInfo.nationalityId != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), - child: Image.network( - patientInfo.nationalityFlagURL != null + borderRadius: BorderRadius.circular(20.0), + child: CachedNetworkImage( + imageUrl: patientInfo.nationalityFlagURL != null ? patientInfo.nationalityFlagURL : '', height: 25, width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return AppText( - 'No Image', - fontSize: 10, - ); - }, + errorWidget: (context, url, error) => AppText( + 'No Image', + fontSize: 10, + ), )) : SizedBox() ], @@ -345,54 +316,55 @@ class PatientCard extends StatelessWidget { ), Expanded( child: Row( - children: [ - Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - CustomRow( - label: TranslationBase.of(context).fileNumber, - value: patientInfo.patientId.toString(), - - ), - CustomRow( - label: TranslationBase.of(context).age + " : ", - value: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - ), - - if (isInpatient) - CustomRow( - label: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context).admissionDate + " : ", - value: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: TranslationBase.of(context).numOfDays + " : ", - value: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: TranslationBase.of(context).roomNo + " : ", - value: "${patientInfo.roomId}", - ), - - if (isFromLiveCare) - Column( - children: [ + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomRow( - label: TranslationBase.of(context).clinic + " : ", - value: patientInfo.clinicName, + label: TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), ), - ], - ), - ]), + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", ), - Icon(Icons.arrow_forward, size: 24,), - ], - )) + if (isInpatient) + CustomRow( + label: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context).admissionDate + " : ", + value: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context).numOfDays + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: TranslationBase.of(context).roomNo + " : ", + value: "${patientInfo.roomId}", + ), + if (isFromLiveCare) + Column( + children: [ + CustomRow( + label: TranslationBase.of(context).clinic + " : ", + value: patientInfo.clinicName, + ), + ], + ), + ]), + ), + Icon( + Icons.arrow_forward, + size: 24, + ), + ], + )) ]), isFromLiveCare ? Row( @@ -440,5 +412,3 @@ class PatientCard extends StatelessWidget { )); } } - - diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 53228bc2..0a405d8d 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -1,13 +1,14 @@ import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:cached_network_image/cached_network_image.dart'; class ProfileWelcomeWidget extends StatelessWidget { final Widget clinicWidget; final double height; final bool isClinic; - ProfileWelcomeWidget(this.clinicWidget, - {this.height = 150, this.isClinic = false}); + + ProfileWelcomeWidget(this.clinicWidget, {this.height = 150, this.isClinic = false}); @override Widget build(BuildContext context) { @@ -27,24 +28,23 @@ class ProfileWelcomeWidget extends StatelessWidget { SizedBox( width: 20, ), - if(authenticationViewModel.doctorProfile!=null) - CircleAvatar( - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: Image.network( - authenticationViewModel.doctorProfile.doctorImageURL, - fit: BoxFit.fill, - width: 75, - height: 75, + if (authenticationViewModel.doctorProfile != null) + CircleAvatar( + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + imageUrl: authenticationViewModel.doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 75, + height: 75, + ), ), + backgroundColor: Colors.transparent, ), - backgroundColor: Colors.transparent, - ), SizedBox( height: 20, ), - ], )), ); From 99868a058c03bad7806ccc49ba11b57df390b814 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 12 Sep 2021 10:30:25 +0300 Subject: [PATCH 22/32] fix in patient issues --- .../In_patient/in_patient_list_page.dart | 133 ++++++++++++------ .../In_patient/list_of_all_in_patient.dart | 38 ----- .../In_patient/list_of_my_inpatient.dart | 12 +- pubspec.lock | 6 +- 4 files changed, 96 insertions(+), 93 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 61abf434..b184234b 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -1,5 +1,7 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -37,7 +39,6 @@ class _InPatientListPageState extends State { super.dispose(); } - @override Widget build(BuildContext context) { return AppScaffold( @@ -209,50 +210,100 @@ class _InPatientListPageState extends State { height: 0, ) : Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), height: MediaQuery.of(context).size.height * 0.5, - color: Colors.white, - child: ListView.builder( - itemCount: - widget.patientSearchViewModel.InpatientClinicList.length, - scrollDirection: Axis.vertical, - physics: ScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - setState(() { - isAllClinic = false; - showBottomSheet = false; - selectedClinicName = widget.patientSearchViewModel - .InpatientClinicList[index]; - }); - widget.patientSearchViewModel.filterByClinic( - clinicName: widget.patientSearchViewModel - .InpatientClinicList[index]); - }, - child: Row( - children: [ - Radio( - value: widget.patientSearchViewModel - .InpatientClinicList[index], - groupValue: selectedClinicName, - onChanged: (value) { + padding: EdgeInsets.only(top: 13, left: 10, right: 10), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + setState(() { + showBottomSheet = false; + }); + }, + child: Icon(DoctorApp.close_1, + size: SizeConfig.getTextMultiplierBasedOnWidth() * + 4.5, + color: Color(0xFF2B353E))) + ], + ), + Row( + children: [ + AppText( + "Select Clinic :", + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 18, + ), + ], + ), + SizedBox( + height: 10, + ), + Expanded( + child: ListView.builder( + itemCount: widget + .patientSearchViewModel.InpatientClinicList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { setState(() { - setState(() { - isAllClinic = false; - showBottomSheet = false; - }); - widget.patientSearchViewModel - .filterByClinic(clinicName: value); + isAllClinic = false; + showBottomSheet = false; + selectedClinicName = widget + .patientSearchViewModel + .InpatientClinicList[index]; }); + widget.patientSearchViewModel.filterByClinic( + clinicName: widget.patientSearchViewModel + .InpatientClinicList[index]); }, - activeColor: Colors.red, - ), - AppText(widget.patientSearchViewModel - .InpatientClinicList[index]), - ], - )); - }), + child: Row( + children: [ + Radio( + value: widget.patientSearchViewModel + .InpatientClinicList[index], + groupValue: selectedClinicName, + onChanged: (value) { + setState(() { + setState(() { + isAllClinic = false; + showBottomSheet = false; + selectedClinicName = widget + .patientSearchViewModel + .InpatientClinicList[index]; + }); + widget.patientSearchViewModel + .filterByClinic(clinicName: value); + }); + }, + activeColor: Colors.red, + ), + AppText( + widget.patientSearchViewModel + .InpatientClinicList[index], + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ], + )); + }), + ), + SizedBox( + height: 20, + ), + ], + ), ), ); } diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart index 6aa13094..169e9da6 100644 --- a/lib/screens/patients/In_patient/list_of_all_in_patient.dart +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -64,44 +64,6 @@ class ListOfAllInPatient extends StatelessWidget { }); }, ); - // else if (widget.patientSearchViewModel - // .filteredInPatientItems[index].doctorId == - // widget.patientSearchViewModel.doctorProfile.doctorID && - // widget.isMyInPatient) - // return PatientCard( - // patientInfo: widget - // .patientSearchViewModel.filteredInPatientItems[index], - // patientType: "1", - // arrivalType: "1", - // isInpatient: true, - // isMyPatient: widget.patientSearchViewModel - // .filteredInPatientItems[index].doctorId == - // widget.patientSearchViewModel.doctorProfile.doctorID, - // onTap: () { - // FocusScopeNode currentFocus = FocusScope.of(context); - // if (!currentFocus.hasPrimaryFocus) { - // currentFocus.unfocus(); - // } - // - // Navigator.of(context) - // .pushNamed(PATIENTS_PROFILE, arguments: { - // "patient": widget.patientSearchViewModel - // .filteredInPatientItems[index], - // "patientType": "1", - // "from": "0", - // "to": "0", - // "isSearch": false, - // "isInpatient": true, - // "arrivalType": "1", - // "isMyPatient": widget.patientSearchViewModel - // .filteredInPatientItems[index].doctorId == - // widget - // .patientSearchViewModel.doctorProfile.doctorID, - // }); - // }, - // ); - // else - // return SizedBox(); }), onNotification: (notification) { if (isAllClinic && !hasQuery) if (notification diff --git a/lib/screens/patients/In_patient/list_of_my_inpatient.dart b/lib/screens/patients/In_patient/list_of_my_inpatient.dart index 306f99ac..f5f7c070 100644 --- a/lib/screens/patients/In_patient/list_of_my_inpatient.dart +++ b/lib/screens/patients/In_patient/list_of_my_inpatient.dart @@ -44,7 +44,7 @@ class ListOfMyInpatient extends StatelessWidget { Navigator.of(context) .pushNamed(PATIENTS_PROFILE, arguments: { "patient": - patientSearchViewModel.filteredInPatientItems[index], + patientSearchViewModel.filteredMyInPatientItems[index], "patientType": "1", "from": "0", "to": "0", @@ -57,16 +57,6 @@ class ListOfMyInpatient extends StatelessWidget { ); }), onNotification: (t) { - if (isAllClinic && !hasQuery) if (t is ScrollUpdateNotification) { - //TODO Elham* - // if (t.metrics.pixels >= t.metrics.maxScrollExtent - 50) { - // patientSearchViewModel.addOnFilteredList(); - // } - // - // if (t.metrics.pixels <= t.metrics.minScrollExtent - 50) { - // patientSearchViewModel.removeOnFilteredList(); - // } - } return; }, ), diff --git a/pubspec.lock b/pubspec.lock index 53035a4a..43aefcb2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -692,7 +692,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -1026,7 +1026,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" sticky_headers: dependency: "direct main" description: @@ -1231,5 +1231,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.2 <=2.11.0-213.1.beta" + dart: ">=2.10.2 <2.11.0" flutter: ">=1.22.2 <2.0.0" From 5e90f14a89b426314a5cbd48c8fb5f158080eaba Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 12 Sep 2021 10:59:44 +0300 Subject: [PATCH 23/32] add translation --- lib/config/localized_values.dart | 3 ++- lib/screens/patients/In_patient/in_patient_list_page.dart | 6 +++--- lib/util/translations_delegate_base.dart | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9ef70508..9c5a0b8b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -708,5 +708,6 @@ const Map> localizedValues = { "requestType":{ "en":"Request Type", "ar":"نوع الطلب"}, - "special": {"en": "Special", "ar": "خاص"} + "special": {"en": "Special", "ar": "خاص"}, + "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} }; diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index b184234b..3b4681a0 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -72,7 +72,7 @@ class _InPatientListPageState extends State { activeColor: Colors.red, ), AppText( - "All Clinic", + "${TranslationBase.of(context).allClinic}", fontSize: 15, ), ], @@ -112,7 +112,7 @@ class _InPatientListPageState extends State { activeColor: Colors.red, ), AppText( - selectedClinicName ?? "Select Clinic", + selectedClinicName ?? TranslationBase.of(context).clinicSelect, fontSize: 15, ), Container( @@ -236,7 +236,7 @@ class _InPatientListPageState extends State { Row( children: [ AppText( - "Select Clinic :", + "${TranslationBase.of(context).clinicSelect} :", fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 18, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 118efbfb..ebab8f65 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1102,6 +1102,7 @@ class TranslationBase { String get textResponse => localizedValues['textResponse'][locale.languageCode]; String get special => localizedValues['special'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; + String get allClinic => localizedValues['allClinic'][locale.languageCode]; } From c74dca14043ad7376f8df8cab191eb21c6034c10 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 12 Sep 2021 11:32:41 +0300 Subject: [PATCH 24/32] fix select clinic --- lib/screens/patients/In_patient/in_patient_list_page.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 3b4681a0..84c54a6e 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -64,6 +64,7 @@ class _InPatientListPageState extends State { setState(() { isAllClinic = true; showBottomSheet = false; + selectedClinicName = null; }); widget.patientSearchViewModel .setDefaultInPatientList(); @@ -80,6 +81,7 @@ class _InPatientListPageState extends State { onTap: () { setState(() { isAllClinic = true; + selectedClinicName = null; showBottomSheet = false; }); widget.patientSearchViewModel.setDefaultInPatientList(); @@ -88,7 +90,7 @@ class _InPatientListPageState extends State { InkWell( onTap: () { setState(() { - isAllClinic = false; + if (widget.patientSearchViewModel.InpatientClinicList .length > 0) showBottomSheet = true; @@ -102,7 +104,6 @@ class _InPatientListPageState extends State { onChanged: (value) { setState(() { setState(() { - isAllClinic = false; if (widget.patientSearchViewModel .InpatientClinicList.length > 0) showBottomSheet = true; From 6ca3baf7cb3288755e7cf01b60730131dc6c4575 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 12 Sep 2021 12:35:24 +0300 Subject: [PATCH 25/32] solve lab results design issue --- .../patients/DischargedPatientPage.dart | 6 +- .../profile/lab_result/LabResultWidget.dart | 102 ++++++++++-------- .../profile/lab_result/labs_home_page.dart | 64 ++++++----- lib/widgets/shared/card_with_bg_widget.dart | 9 +- lib/widgets/shared/doctor_card.dart | 9 +- pubspec.lock | 6 +- 6 files changed, 109 insertions(+), 87 deletions(-) diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 7f314c0e..8fba00d0 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -323,7 +323,11 @@ class _DischargedPatientState extends State { ), ], ), - ) + ), + Icon( + Icons.arrow_forward, + size: 24, + ), ], ) ], diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index ecbaa919..153dfc6e 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -121,43 +121,6 @@ class LabResultWidget extends StatelessWidget { (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: - patientLabResultList[index].description, - patientLabOrder: patientLabOrder, - patient: patient, - isInpatient: isInpatient, - ), - // page: LabResultHistoryPage( - // filterName: patientLabResultList[index].description, - // patientLabOrder: patientLabOrder, - // patient: patient, - // ), - ), - ); - }, - // child: AppText( - // " (show details)", - // color: Colors.blue, - // fontSize: 12, - // ), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, - fontSize: 12, - ), - ], - ), - ), Row( children: [ Expanded( @@ -191,20 +154,67 @@ class LabResultWidget extends StatelessWidget { ), ), Expanded( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: AppText( - patientLabResultList[index].referanceRange, - textAlign: TextAlign.center, - isCopyable: true, + child: Column( + children: [ + Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + patientLabResultList[index].referanceRange, + textAlign: TextAlign.center, + isCopyable: true, + ), + ), ), - ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: + patientLabResultList[index].description, + patientLabOrder: patientLabOrder, + patient: patient, + isInpatient: isInpatient, + ), + // page: LabResultHistoryPage( + // filterName: patientLabResultList[index].description, + // patientLabOrder: patientLabOrder, + // patient: patient, + // ), + ), + ); + }, + // child: AppText( + // " (show details)", + // color: Colors.blue, + // fontSize: 12, + // ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).showMoreBtn, + textDecoration: TextDecoration.underline, + color: Colors.blue, + fontSize: 12, + ), + ], + ), + ) + ], ), ), ], ), + // SizedBox( + // height: 12, + // ), Divider(), ], )) diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 48c35952..2c6dbb0c 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrde import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.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/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -136,37 +137,44 @@ class _LabsHomePageState extends State { Radius.circular(8.0), ), color: Colors.white), - child: Row( + child: Stack( children: [ - Container( - width: 20, - height: 160, - decoration: BoxDecoration( - color: model.patientLabOrdersList[index].isLiveCareAppointment - ? Colors.red[900] - : !model.patientLabOrdersList[index].isInOutPatient - ? Colors.black - : Color(0xffa9a089), - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), - topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0), - bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)), + Positioned( + bottom: 1, + top: 1, + left: 1, + child: Container( + width: 20, + decoration: BoxDecoration( + color: model.patientLabOrdersList[index].isLiveCareAppointment + ? Colors.red[900] + : !model.patientLabOrdersList[index].isInOutPatient + ? Colors.black + : Color(0xffa9a089), + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0), + bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)), + ), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Text( + model.patientLabOrdersList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !model.patientLabOrdersList[index].isInOutPatient + ? TranslationBase.of(context).inPatientLabel.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), + style: TextStyle(color: Colors.white), + ), + )), ), - child: RotatedBox( - quarterTurns: 3, - child: Center( - child: Text( - model.patientLabOrdersList[index].isLiveCareAppointment - ? TranslationBase.of(context).liveCare.toUpperCase() - : !model.patientLabOrdersList[index].isInOutPatient - ? TranslationBase.of(context).inPatientLabel.toUpperCase() - : TranslationBase.of(context).outpatient.toUpperCase(), - style: TextStyle(color: Colors.white), - ), - )), ), - Expanded( + Container( + color: Colors.white, + padding: EdgeInsets.all(0), + margin: EdgeInsets.only(left: 20), child: DoctorCard( isNoMargin: true, onTap: () => Navigator.push( diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index d414f557..c8e187a1 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -26,7 +25,7 @@ class CardWithBgWidget extends StatelessWidget { Radius.circular(10.0), ), border: Border.all( - color: hasBorder ? HexColor('#707070') : Colors.transparent, + color: hasBorder ? Color(0xFF707070) : Colors.transparent, width: hasBorder ? 0.30 : 0), ), child: Material( @@ -37,8 +36,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), - + color: bgColor ?? Color(0xFF58434F), borderRadius: BorderRadius.only( topRight: Radius.circular(10), bottomRight: Radius.circular(10),),), @@ -52,8 +50,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( child: Container( decoration: BoxDecoration( - color: bgColor ?? HexColor('#58434F'), - + color: bgColor ?? Color(0xFF58434F), borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10),),), diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index faa4379a..5bd12bb8 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -157,6 +157,7 @@ class DoctorCard extends StatelessWidget { ), if (branch != null) Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).branch + @@ -164,9 +165,11 @@ class DoctorCard extends StatelessWidget { fontSize: 14, color: Colors.grey[500], ), - AppText( - branch, - fontSize: 14, + Expanded( + child: AppText( + branch, + fontSize: 14, + ), ) ], ) diff --git a/pubspec.lock b/pubspec.lock index 53035a4a..43aefcb2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -692,7 +692,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -1026,7 +1026,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" sticky_headers: dependency: "direct main" description: @@ -1231,5 +1231,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.2 <=2.11.0-213.1.beta" + dart: ">=2.10.2 <2.11.0" flutter: ">=1.22.2 <2.0.0" From 702bb5b8daca4c11e85ede82792516b49ff68b2e Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 12 Sep 2021 14:26:06 +0300 Subject: [PATCH 26/32] fix design --- lib/config/localized_values.dart | 1 + .../patients/In_patient/InPatientHeader.dart | 42 +++ .../In_patient/in_patient_screen.dart | 240 +++++++----------- .../patient_search/patient_search_header.dart | 1 - lib/util/translations_delegate_base.dart | 1 + .../patients/patient_card/PatientCard.dart | 3 +- 6 files changed, 137 insertions(+), 151 deletions(-) create mode 100644 lib/screens/patients/In_patient/InPatientHeader.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9c5a0b8b..0a58a4bc 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -42,6 +42,7 @@ const Map> localizedValues = { "referral": {"en": "Referral", "ar": "الإحالة"}, "inPatient": {"en": "InPatients", "ar": "مرضاي"}, "myInPatient": {"en": "My\nInPatients", "ar": "مرضاي\nالمنومين"}, + "myInPatientTitle": {"en": "My InPatients", "ar": "مرضاي المنومين"}, "inPatientLabel": {"en": "InPatients", "ar": "المريض المنوم"}, "inPatientAll": {"en": "All InPatients", "ar": "جميع المرضى المنومين"}, "operations": {"en": "Operations", "ar": "عمليات"}, diff --git a/lib/screens/patients/In_patient/InPatientHeader.dart b/lib/screens/patients/In_patient/InPatientHeader.dart new file mode 100644 index 00000000..a8ef8b10 --- /dev/null +++ b/lib/screens/patients/In_patient/InPatientHeader.dart @@ -0,0 +1,42 @@ +import 'package:doctor_app_flutter/config/size_config.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'; + +class InPatientHeader extends StatelessWidget with PreferredSizeWidget{ + const InPatientHeader() : super(); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + Expanded( + child: AppText( + TranslationBase + .of(context) + .inPatient, + fontSize: SizeConfig.textMultiplier * 2.8, + fontWeight: FontWeight.bold, + color: Color(0xFF2B353E), + ), + ), + ]), + ), + ); + } + + @override + Size get preferredSize => Size(double.maxFinite,85); +} \ No newline at end of file diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart index 1a35ad53..b959153f 100644 --- a/lib/screens/patients/In_patient/in_patient_screen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -33,7 +34,6 @@ class _InPatientScreenState extends State int selectedMapId; - @override void initState() { super.initState(); @@ -55,170 +55,114 @@ class _InPatientScreenState extends State @override Widget build(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; + final screenSize = MediaQuery.of(context).size; PatientSearchRequestModel requestModel = PatientSearchRequestModel(); ProjectViewModel projectsProvider = Provider.of(context); - return BaseView( onModelReady: (model) async { model.clearPatientList(); if (widget.specialClinic != null) { - await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + await model + .getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); requestModel.nursingStationID = model.specialClinicalCareMappingList[0].nursingStationID; - } requestModel.clinicID = 0; await model.getInPatientList(requestModel); }, - builder: (_, model, w) => - AppScaffold( + builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: false, + isShowAppBar: true, + appBar: InPatientHeader(), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - TranslationBase - .of(context) - .inPatient, - fontSize: SizeConfig.textMultiplier * 2.8, - fontWeight: FontWeight.bold, - color: Color(0xFF2B353E), - ), - ), - if (model.specialClinicalCareMappingList.isNotEmpty && - widget.specialClinic != null && - _activeTab != 2) - Container( - width: MediaQuery.of(context).size.width * .3, - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - isExpanded: true, - value: selectedMapId == null ? model - .specialClinicalCareMappingList[0] - .nursingStationID : selectedMapId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .specialClinicalCareMappingList - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .center, - children: [ - Container( - padding: - EdgeInsets.all(2), - margin: - EdgeInsets.all(2), - decoration: - new BoxDecoration( - color: - Colors.red[800], - borderRadius: - BorderRadius - .circular( - 20), - ), - constraints: - BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: Center( - child: AppText( - model - .specialClinicalCareMappingList - .length - .toString(), - color: - Colors.white, - fontSize: - projectsProvider - .isArabic - ? 10 - : 11, - textAlign: - TextAlign - .center, - ), - )), - ], + if (model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null && + _activeTab != 2) + Container( + width: MediaQuery.of(context).size.width * .3, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null + ? model.specialClinicalCareMappingList[0].nursingStationID + : selectedMapId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model.specialClinicalCareMappingList.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(2), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + model + .specialClinicalCareMappingList.length + .toString(), + color: Colors.white, + fontSize: + projectsProvider.isArabic ? 10 : 11, + textAlign: TextAlign.center, ), - AppText(item.description, - fontSize: 12, - color: Colors.black, - fontWeight: - FontWeight.bold, - textAlign: TextAlign.end), - ], - ); - }).toList(); - }, - onChanged: (newValue) async { - setState(() { - selectedMapId = newValue; - }); - model.clearPatientList(); - GifLoaderDialogUtils.showMyDialog( - context); + )), + ], + ), + AppText(item.description, + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + selectedMapId = newValue; + }); + model.clearPatientList(); + GifLoaderDialogUtils.showMyDialog(context); - PatientSearchRequestModel requestModel = PatientSearchRequestModel( - nursingStationID: selectedMapId, clinicID: 0); - await model.getInPatientList(requestModel, isLocalBusy: true); - GifLoaderDialogUtils.hideDialog( - context); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - }, - items: model - .specialClinicalCareMappingList - .map((item) { - return DropdownMenuItem( - child: AppText( - item.description, - textAlign: TextAlign.left, - ), - value: item.nursingStationID, - ); - }).toList(), - )), - ) - ]), + PatientSearchRequestModel requestModel = + PatientSearchRequestModel( + nursingStationID: selectedMapId, clinicID: 0); + await model.getInPatientList(requestModel, + isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + items: model.specialClinicalCareMappingList.map((item) { + return DropdownMenuItem( + child: AppText( + item.description, + textAlign: TextAlign.left, + ), + value: item.nursingStationID, + ); + }).toList(), + )), ), - ), Expanded( child: Scaffold( extendBodyBehindAppBar: false, @@ -249,8 +193,8 @@ class _InPatientScreenState extends State tabWidget(screenSize, _activeTab == 0, TranslationBase.of(context).inPatientAll, counter: model.inPatientList.length), - tabWidget( - screenSize, _activeTab == 1, TranslationBase.of(context).inPatient, + tabWidget(screenSize, _activeTab == 1, + TranslationBase.of(context).myInPatientTitle, counter: model.myIinPatientList.length), tabWidget(screenSize, _activeTab == 2, TranslationBase.of(context).discharged), @@ -267,7 +211,7 @@ class _InPatientScreenState extends State controller: _tabController, children: [ InPatientListPage(false, model), - InPatientListPage(true,model), + InPatientListPage(true, model), DischargedPatient(), ], ), diff --git a/lib/screens/patients/patient_search/patient_search_header.dart b/lib/screens/patients/patient_search/patient_search_header.dart index b9afab7d..7df6905f 100644 --- a/lib/screens/patients/patient_search/patient_search_header.dart +++ b/lib/screens/patients/patient_search/patient_search_header.dart @@ -38,6 +38,5 @@ class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget { } @override - Size get preferredSize => Size(double.maxFinite,65); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ebab8f65..fab2c7b5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -91,6 +91,7 @@ class TranslationBase { String get inPatient => localizedValues['inPatient'][locale.languageCode]; String get myInPatient => localizedValues['myInPatient'][locale.languageCode]; + String get myInPatientTitle => localizedValues['myInPatientTitle'][locale.languageCode]; String get inPatientLabel => localizedValues['inPatientLabel'][locale.languageCode]; String get inPatientAll => localizedValues['inPatientAll'][locale.languageCode]; diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index 850bc18e..ef69903b 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -352,9 +352,8 @@ class PatientCard extends StatelessWidget { ), if (patientInfo.admissionDate != null) CustomRow( - // TODO Elham* add translation label: - "Clinic Name" + + TranslationBase.of(context).clinicName + " : ", value: "${patientInfo.clinicDescription}", ), From a731851a92924485e2089f14785ff61da9ef33c0 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 12 Sep 2021 16:17:11 +0300 Subject: [PATCH 27/32] Medication for in-patient hot fix --- .../prescription/prescriptions_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart index 9937286b..06de5a74 100644 --- a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart @@ -194,7 +194,7 @@ class PrescriptionsService extends BaseService { isDentalAllowedBackend: false, admissionNo: int.parse(patient.admissionNo), tokenID: "@dm!n", - projectID: 15, + projectID: patient.projectId, ); await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient, onSuccess: (dynamic response, int statusCode) { From 5a821e3d64424fcc3ea45a54ef0a5c550c6851f0 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 13 Sep 2021 10:57:09 +0300 Subject: [PATCH 28/32] remove create episode in case of in patinet --- .../patients/profile/profile_screen/patient_profile_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 5df41821..0c66b493 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -212,7 +212,7 @@ class _PatientProfileScreenState extends State ), ], ), - if ((isInpatient) + if ((isInpatient && !isDischargedPatient) ? true : isFromLiveCare ? patient.episodeNo != null From 777bdb8a0d5c1b35f645beb78b63493c69b1f0f4 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 13 Sep 2021 14:39:15 +0300 Subject: [PATCH 29/32] fix login issue --- lib/screens/auth/verification_methods_screen.dart | 6 +++--- pubspec.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index f5893836..85c5090a 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -460,7 +460,7 @@ class _VerificationMethodsScreenState extends State { if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.hideDialog(context); - this.startSMSService(authMethodType); + this.startSMSService(authMethodType,isSilentLogin: true); } else { checkActivationCode(isSilentLogin: true); } @@ -503,7 +503,7 @@ class _VerificationMethodsScreenState extends State { } } - startSMSService(AuthMethodTypes type) { + startSMSService(AuthMethodTypes type,{isSilentLogin: false}) { new SMSOTP( context, type, @@ -515,7 +515,7 @@ class _VerificationMethodsScreenState extends State { return AppLoaderWidget(); }); - this.checkActivationCode(value: value,isSilentLogin: false); + this.checkActivationCode(value: value,isSilentLogin: isSilentLogin); }, () => { diff --git a/pubspec.lock b/pubspec.lock index 53035a4a..43aefcb2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -692,7 +692,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -1026,7 +1026,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" sticky_headers: dependency: "direct main" description: @@ -1231,5 +1231,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.2 <=2.11.0-213.1.beta" + dart: ">=2.10.2 <2.11.0" flutter: ">=1.22.2 <2.0.0" From 8d8200ab9b17f6de1429cdbb5d8c64a0d787b231 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 13 Sep 2021 15:01:26 +0300 Subject: [PATCH 30/32] favorite prescription hot fix --- .../procedures/add-favourite-procedure.dart | 174 +++++++++--------- 1 file changed, 88 insertions(+), 86 deletions(-) diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 236ec5e2..7f4e49b2 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen. import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; @@ -46,10 +47,8 @@ class _AddFavouriteProcedureState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => - model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, baseViewModel: model, body: Column( @@ -57,97 +56,100 @@ class _AddFavouriteProcedureState extends State { Container( height: MediaQuery.of(context).size.height * 0.070, ), - if (model.templateList.length != 0) - Expanded( - child: EntityListCheckboxSearchFavProceduresWidget( - isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), - model: model, - removeFavProcedure: (item) { - setState(() { - entityList.remove(item); - }); - }, - addFavProcedure: (history) { - setState(() { - entityList.add(history); - }); - }, - isEntityFavListSelected: (master) => - isEntityListSelected(master), - groupProcedures: groupProcedures, - selectProcedures: (selectedProcedure) { - setState(() { - groupProcedures = selectedProcedure; - }); - }, - ), - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.procedureType.getAddButtonTitle(context) ?? - TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - if(widget.procedureType == ProcedureType.PRESCRIPTION){ - if (groupProcedures == null) { - DrAppToastMsg.showErrorToast( - 'Please Select item ', - ); - return; - } - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PrescriptionCheckOutScreen( - patient: widget.patient, - model: widget.prescriptionModel, - groupProcedures: groupProcedures, - ), settings: RouteSettings(name: 'PrescriptionCheckOutScreen') - ), - ); - } else { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ProcedureCheckOutScreen( - items: entityList, - model: model, - patient: widget.patient, - addButtonTitle: widget.procedureType.getAddButtonTitle(context), - toolbarTitle: widget.procedureType.getToolbarLabel(context), - ), settings: RouteSettings(name: 'ProcedureCheckOutScreen') - ), - ); - } - }, + (model.templateList.length != 0) + ? Expanded( + child: EntityListCheckboxSearchFavProceduresWidget( + isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), + model: model, + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + isEntityFavListSelected: (master) => isEntityListSelected(master), + groupProcedures: groupProcedures, + selectProcedures: (selectedProcedure) { + setState(() { + groupProcedures = selectedProcedure; + }); + }, + ), + ) + : Container( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 50.0), + child: AppText('You Don\'t have favorite prescription'), + ), ), - ], - ), - ), ], ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.procedureType.getAddButtonTitle(context) ?? + TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + disabled: model.templateList.length == 0 ? true : false, + fontWeight: FontWeight.w700, + onPressed: () { + if (widget.procedureType == ProcedureType.PRESCRIPTION) { + if (groupProcedures == null) { + DrAppToastMsg.showErrorToast( + 'Please Select item ', + ); + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionCheckOutScreen( + patient: widget.patient, + model: widget.prescriptionModel, + groupProcedures: groupProcedures, + ), + settings: RouteSettings(name: 'PrescriptionCheckOutScreen')), + ); + } else { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).fillTheMandatoryProcedureDetails, + ); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProcedureCheckOutScreen( + items: entityList, + model: model, + patient: widget.patient, + addButtonTitle: widget.procedureType.getAddButtonTitle(context), + toolbarTitle: widget.procedureType.getToolbarLabel(context), + ), + settings: RouteSettings(name: 'ProcedureCheckOutScreen')), + ); + } + }, + ), + ], + ), + ), ), ); } bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { Iterable history = entityList.where( - (element) => - masterKey.templateID == element.templateID && - masterKey.procedureName == element.procedureName); + (element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); if (history.length > 0) { return true; } From b119590e3900dec57565d002f46c63b6cb3de135 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 13 Sep 2021 17:56:59 +0300 Subject: [PATCH 31/32] Doctor replay add info status 99 --- lib/config/localized_values.dart | 5 +- .../service/home/doctor_reply_service.dart | 65 +++--- .../viewModel/doctor_replay_view_model.dart | 12 +- lib/landing_page.dart | 2 +- .../doctor/replay/request_doctor_reply.dart | 5 + .../doctor_replay/all_doctor_questions.dart | 101 ++++++++++ .../doctor_repaly_chat.dart | 0 .../doctor_replay/doctor_reply_screen.dart | 185 ++++++++++++++++++ .../doctor_replay}/doctor_reply_widget.dart | 9 +- .../not_replaied_doctor_questions.dart} | 75 ++++--- lib/util/translations_delegate_base.dart | 1 + 11 files changed, 388 insertions(+), 72 deletions(-) create mode 100644 lib/screens/doctor/doctor_replay/all_doctor_questions.dart rename lib/screens/doctor/{ => doctor_replay}/doctor_repaly_chat.dart (100%) create mode 100644 lib/screens/doctor/doctor_replay/doctor_reply_screen.dart rename lib/{widgets/doctor => screens/doctor/doctor_replay}/doctor_reply_widget.dart (97%) rename lib/screens/doctor/{doctor_reply_screen.dart => doctor_replay/not_replaied_doctor_questions.dart} (60%) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0a58a4bc..434921a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -703,9 +703,8 @@ const Map> localizedValues = { "patientArrived": {"en": "Patient Arrived", "ar": "وصل المريض"}, "calledAndNoResponse": {"en": "Called And No Response", "ar": "تم الاتصال ولا يوجد رد"}, "underProcess": {"en": "Under Process", "ar": "تحت التجهيز"}, - "textResponse": {"en": "Text Response", "ar": "استجابة النص" - } - , + "textResponse": {"en": "Text Response", "ar": "استجابة النص"}, + "notReplied": {"en": "Not Replied", "ar": "لم يتم يرد"}, "requestType":{ "en":"Request Type", "ar":"نوع الطلب"}, diff --git a/lib/core/service/home/doctor_reply_service.dart b/lib/core/service/home/doctor_reply_service.dart index cdb45f1b..c3f4584d 100644 --- a/lib/core/service/home/doctor_reply_service.dart +++ b/lib/core/service/home/doctor_reply_service.dart @@ -8,39 +8,56 @@ import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patien import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; class DoctorReplyService extends BaseService { - - List get listDoctorWorkingHoursTable => _listDoctorWorkingHoursTable; + List get listDoctorWorkingHoursTable => + _listDoctorWorkingHoursTable; + List get listDoctorNotRepliedQuestions => + _listDoctorNotRepliedQuestions; List _listDoctorWorkingHoursTable = []; - - + List _listDoctorNotRepliedQuestions = []; List _listMyReferralPatientModel = []; - List get listMyReferralPatientModel => _listMyReferralPatientModel; + + List get listMyReferralPatientModel => + _listMyReferralPatientModel; int notRepliedCount = 0; - Future getDoctorReply(RequestDoctorReply _requestDoctorReply,{bool clearData = false}) async { + Future getDoctorReply(RequestDoctorReply _requestDoctorReply, + {bool clearData = false, bool isGettingNotReply = false}) async { hasError = false; - await baseAppClient.post(GT_MY_PATIENT_QUESTION, - onSuccess: (dynamic response, int statusCode) { - if(clearData) + await baseAppClient.post( + GT_MY_PATIENT_QUESTION, + onSuccess: (dynamic response, int statusCode) { + if (clearData) { + if(isGettingNotReply) + _listDoctorNotRepliedQuestions.clear(); + else _listDoctorWorkingHoursTable.clear(); - response['List_GtMyPatientsQuestions'].forEach((v) { - _listDoctorWorkingHoursTable - .add(ListGtMyPatientsQuestions.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestDoctorReply.toJson(),); + } + + + response['List_GtMyPatientsQuestions'].forEach((v) { + + if(isGettingNotReply) + _listDoctorNotRepliedQuestions.add(ListGtMyPatientsQuestions.fromJson(v)); + else + _listDoctorWorkingHoursTable + .add(ListGtMyPatientsQuestions.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestDoctorReply.toJson(), + ); } Future createDoctorResponse( - CreateDoctorResponseModel createDoctorResponseModel) async { - hasError = false; + CreateDoctorResponseModel createDoctorResponseModel) async { + hasError = false; await baseAppClient.post( CREATE_DOCTOR_RESPONSE, body: createDoctorResponseModel.toJson(), - onSuccess: (dynamic body, int statusCode) { - }, + onSuccess: (dynamic body, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -48,14 +65,12 @@ class DoctorReplyService extends BaseService { ); } - Future getNotRepliedCount() async { - hasError = false; + hasError = false; await baseAppClient.post( GET_DOCTOR_NOT_REPLIED_COUNTS, body: {}, - onSuccess: (dynamic body - , int statusCode) { + onSuccess: (dynamic body, int statusCode) { notRepliedCount = body["DoctorNotRepliedCounts"]; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModel/doctor_replay_view_model.dart b/lib/core/viewModel/doctor_replay_view_model.dart index 17607d80..707fb805 100644 --- a/lib/core/viewModel/doctor_replay_view_model.dart +++ b/lib/core/viewModel/doctor_replay_view_model.dart @@ -12,9 +12,14 @@ class DoctorReplayViewModel extends BaseViewModel { List get listDoctorWorkingHoursTable => _doctorReplyService.listDoctorWorkingHoursTable; + List get listDoctorNotRepliedQuestions => + _doctorReplyService.listDoctorNotRepliedQuestions; Future getDoctorReply( - {int pageSize = 10, int pageIndex = 1, bool isLocalBusy = true}) async { + {int pageSize = 10, + int pageIndex = 1, + bool isLocalBusy = true, + bool isGettingNotReply = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -23,8 +28,11 @@ class DoctorReplayViewModel extends BaseViewModel { await getDoctorProfile(); RequestDoctorReply _requestDoctorReply = RequestDoctorReply(pageIndex: pageIndex, pageSize: pageSize); + if (isGettingNotReply) + _requestDoctorReply.infoStatus = 99; //to get the not replied only - await _doctorReplyService.getDoctorReply(_requestDoctorReply, clearData:!isLocalBusy ); + await _doctorReplyService.getDoctorReply(_requestDoctorReply, + clearData: !isLocalBusy, isGettingNotReply: isGettingNotReply); if (_doctorReplyService.hasError) { error = _doctorReplyService.error; if (isLocalBusy) { diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 5bce4f71..72b5c857 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/home/home_screen.dart'; import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart'; diff --git a/lib/models/doctor/replay/request_doctor_reply.dart b/lib/models/doctor/replay/request_doctor_reply.dart index 1c3948cb..82384586 100644 --- a/lib/models/doctor/replay/request_doctor_reply.dart +++ b/lib/models/doctor/replay/request_doctor_reply.dart @@ -15,6 +15,7 @@ class RequestDoctorReply { bool patientOutSA; int pageIndex; int pageSize; + int infoStatus; RequestDoctorReply( {this.projectID, @@ -30,6 +31,7 @@ class RequestDoctorReply { this.isLoginForDoctorApp, this.patientOutSA, this.pageIndex, + this.infoStatus, this.pageSize}); RequestDoctorReply.fromJson(Map json) { @@ -47,6 +49,7 @@ class RequestDoctorReply { patientOutSA = json['PatientOutSA']; pageIndex = json['PageIndex']; pageSize = json['PageSize']; + pageSize = json['InfoStatus']; } Map toJson() { @@ -65,6 +68,8 @@ class RequestDoctorReply { data['PatientOutSA'] = this.patientOutSA; data['PageIndex'] = this.pageIndex; data['PageSize'] = this.pageSize; + if(this.infoStatus != null) + data['InfoStatus'] = this.infoStatus; return data; } } diff --git a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart new file mode 100644 index 00000000..428a6f1c --- /dev/null +++ b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart @@ -0,0 +1,101 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_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/screens/doctor/doctor_replay/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +import 'doctor_repaly_chat.dart'; + +class AllDoctorQuestions extends StatefulWidget { + final Function changeCurrentTab; + + const AllDoctorQuestions({Key key, this.changeCurrentTab}) : super(key: key); + + @override + _AllDoctorQuestionsState createState() => _AllDoctorQuestionsState(); +} + +class _AllDoctorQuestionsState extends State { + + int pageIndex = 1; + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getDoctorReply(isLocalBusy: false); + }, + builder: (_, model, w) => WillPopScope( + onWillPop: () async { + widget.changeCurrentTab(); + return false; + }, + child: AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: model.listDoctorWorkingHoursTable.isEmpty + ?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) + : Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: NotificationListener( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.listDoctorWorkingHoursTable.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return Column( + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat( + reply: + model.listDoctorWorkingHoursTable[ + index], + previousModel: model, + ), + settings: RouteSettings( + name: 'DoctorReplayChat'), + )); + }, + child: DoctorReplyWidget( + reply: model + .listDoctorWorkingHoursTable[index]), + ), + if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) + DrAppCircularProgressIndeicator() + + ], + ); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && + model.state != ViewState.BusyLocal) { + setState(() { + pageIndex++; + }); + model.getDoctorReply(pageIndex: pageIndex); + } + return; + }, + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart similarity index 100% rename from lib/screens/doctor/doctor_repaly_chat.dart rename to lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart new file mode 100644 index 00000000..8b51319c --- /dev/null +++ b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart @@ -0,0 +1,185 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_repaly_chat.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_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/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'all_doctor_questions.dart'; +import 'not_replaied_Doctor_Questions.dart'; + +/* + *@author: Mohammad Aljammal + *@Date:28/4/2020 + *@param: + *@return: + *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service + */ +class DoctorReplyScreen extends StatefulWidget { + final Function changeCurrentTab; + + const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key); + + @override + _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); +} + +class _DoctorReplyScreenState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + int _activeTab = 0; + int pageIndex = 1; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return WillPopScope( + onWillPop: () async { + widget.changeCurrentTab(); + return false; + }, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Scaffold( + extendBodyBehindAppBar: false, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + "Not Replied", + ), + tabWidget( + screenSize, + _activeTab == 1, + TranslationBase.of(context).all, + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + NotRepliedDoctorQuestions(), + AllDoctorQuestions(), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} + +Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); +} diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart similarity index 97% rename from lib/widgets/doctor/doctor_reply_widget.dart rename to lib/screens/doctor/doctor_replay/doctor_reply_widget.dart index 32e116af..f2e53275 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart @@ -31,7 +31,7 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( - bgColor: widget.reply.infoStatus == 0 + bgColor: widget.reply.infoStatus == 99 ? Color(0xFF2B353E) : widget.reply.infoStatus == 4 ? IN_PROGRESS_COLOR @@ -55,7 +55,8 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: widget.reply.infoStatus == 1 + text: widget.reply.infoStatus == 99 + ? TranslationBase.of(context).notReplied:widget.reply.infoStatus == 1 ? TranslationBase.of(context).replayCallStatus : widget.reply.infoStatus == 2 ? TranslationBase.of(context).patientArrived @@ -70,7 +71,9 @@ class _DoctorReplyWidgetState extends State { .textResponse : '', style: TextStyle( - color: widget.reply.infoStatus == 4 + color: widget.reply.infoStatus == 99 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 ? IN_PROGRESS_COLOR : widget.reply.infoStatus == 3 ? Color(0xFFD02127) diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart similarity index 60% rename from lib/screens/doctor/doctor_reply_screen.dart rename to lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart index 0f310c64..0a1b05c3 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart @@ -1,43 +1,35 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/doctor/doctor_repaly_chat.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/doctor/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_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/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:flutter/cupertino.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; -/* - *@author: Mohammad Aljammal - *@Date:28/4/2020 - *@param: - *@return: - *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service - */ -class DoctorReplyScreen extends StatefulWidget { +import 'doctor_repaly_chat.dart'; + +class NotRepliedDoctorQuestions extends StatefulWidget { final Function changeCurrentTab; - const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key); + const NotRepliedDoctorQuestions({Key key, this.changeCurrentTab}) + : super(key: key); @override - _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); + _NotRepliedDoctorQuestionsState createState() => + _NotRepliedDoctorQuestionsState(); } -class _DoctorReplyScreenState extends State { +class _NotRepliedDoctorQuestionsState extends State { int pageIndex = 1; @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) { - model.getDoctorReply(isLocalBusy: false); + model.getDoctorReply(isLocalBusy: false, isGettingNotReply: true); }, builder: (_, model, w) => WillPopScope( onWillPop: () async { @@ -48,17 +40,18 @@ class _DoctorReplyScreenState extends State { baseViewModel: model, appBarTitle: TranslationBase.of(context).replay2, isShowAppBar: false, - body: model.listDoctorWorkingHoursTable.isEmpty - ? DrAppEmbeddedError(error: TranslationBase.of(context).noItem) + body: model.listDoctorNotRepliedQuestions.isEmpty + ? ErrorMessage(error: TranslationBase.of(context).noItem) : Column( - children: [ - Expanded( - child: Container( + children: [ + Expanded( + child: Container( padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), child: NotificationListener( child: ListView.builder( scrollDirection: Axis.vertical, - itemCount: model.listDoctorWorkingHoursTable.length, + itemCount: + model.listDoctorNotRepliedQuestions.length, shrinkWrap: true, itemBuilder: (BuildContext ctxt, int index) { return Column( @@ -70,9 +63,9 @@ class _DoctorReplyScreenState extends State { MaterialPageRoute( builder: (BuildContext context) => DoctorReplayChat( - reply: - model.listDoctorWorkingHoursTable[ - index], + reply: model + .listDoctorNotRepliedQuestions[ + index], previousModel: model, ), settings: RouteSettings( @@ -80,30 +73,36 @@ class _DoctorReplyScreenState extends State { )); }, child: DoctorReplyWidget( - reply: model - .listDoctorWorkingHoursTable[index]), + reply: + model.listDoctorNotRepliedQuestions[ + index]), ), - if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) + if (model.state == ViewState.BusyLocal && + index == + model.listDoctorNotRepliedQuestions + .length - + 1) DrAppCircularProgressIndeicator() - ], ); }), - onNotification: (t) { - if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && + onNotification: (t) { + if (t is ScrollUpdateNotification && + t.metrics.pixels >= + t.metrics.maxScrollExtent - 50 && model.state != ViewState.BusyLocal) { setState(() { pageIndex++; }); - model.getDoctorReply(pageIndex: pageIndex); + model.getDoctorReply(pageIndex: pageIndex, isGettingNotReply: true); } return; }, ), ), - ), - ], - ), + ), + ], + ), ), ), ); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index fab2c7b5..0297aa45 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1104,6 +1104,7 @@ class TranslationBase { String get special => localizedValues['special'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; String get allClinic => localizedValues['allClinic'][locale.languageCode]; + String get notReplied => localizedValues['notReplied'][locale.languageCode]; } From 4923b66065dfe2f917fd425939cf841ff5ebb310 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 14 Sep 2021 15:11:00 +0300 Subject: [PATCH 32/32] fix cashing issue --- .../doctor_replay/all_doctor_questions.dart | 118 ++++++++------- .../doctor_replay/doctor_reply_widget.dart | 2 + .../not_replaied_doctor_questions.dart | 136 +++++++++--------- lib/widgets/shared/user-guid/CusomRow.dart | 5 +- 4 files changed, 126 insertions(+), 135 deletions(-) diff --git a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart index 428a6f1c..5166d2b1 100644 --- a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart @@ -29,71 +29,65 @@ class _AllDoctorQuestionsState extends State { onModelReady: (model) { model.getDoctorReply(isLocalBusy: false); }, - builder: (_, model, w) => WillPopScope( - onWillPop: () async { - widget.changeCurrentTab(); - return false; - }, - child: AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).replay2, - isShowAppBar: false, - body: model.listDoctorWorkingHoursTable.isEmpty - ?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) - : Column( - children: [ - Expanded( - child: Container( - padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - child: NotificationListener( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: model.listDoctorWorkingHoursTable.length, - shrinkWrap: true, - itemBuilder: (BuildContext ctxt, int index) { - return Column( - children: [ - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - DoctorReplayChat( - reply: - model.listDoctorWorkingHoursTable[ - index], - previousModel: model, - ), - settings: RouteSettings( - name: 'DoctorReplayChat'), - )); - }, - child: DoctorReplyWidget( - reply: model - .listDoctorWorkingHoursTable[index]), - ), - if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) - DrAppCircularProgressIndeicator() + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: model.listDoctorWorkingHoursTable.isEmpty + ?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem) + : Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: NotificationListener( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.listDoctorWorkingHoursTable.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return Column( + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat( + reply: + model.listDoctorWorkingHoursTable[ + index], + previousModel: model, + ), + settings: RouteSettings( + name: 'DoctorReplayChat'), + )); + }, + child: DoctorReplyWidget( + reply: model + .listDoctorWorkingHoursTable[index]), + ), + if(model.state == ViewState.BusyLocal && index == model.listDoctorWorkingHoursTable.length-1) + DrAppCircularProgressIndeicator() - ], - ); - }), - onNotification: (t) { - if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && - model.state != ViewState.BusyLocal) { - setState(() { - pageIndex++; - }); - model.getDoctorReply(pageIndex: pageIndex); - } - return; - }, - ), + ], + ); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 && + model.state != ViewState.BusyLocal) { + setState(() { + pageIndex++; + }); + model.getDoctorReply(pageIndex: pageIndex); + } + return; + }, ), ), - ], - ), + ), + ], ), ), ); diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart index f2e53275..69bb9ab2 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart @@ -202,9 +202,11 @@ class _DoctorReplyWidgetState extends State { CustomRow( label: TranslationBase.of(context).fileNumber, value: widget.reply.patientID.toString(), + isCopyable:false, ), CustomRow( label: TranslationBase.of(context).age + " : ", + isCopyable:false, value: "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", ), diff --git a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart index 0a1b05c3..5b21809f 100644 --- a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart @@ -31,79 +31,73 @@ class _NotRepliedDoctorQuestionsState extends State { onModelReady: (model) { model.getDoctorReply(isLocalBusy: false, isGettingNotReply: true); }, - builder: (_, model, w) => WillPopScope( - onWillPop: () async { - widget.changeCurrentTab(); - return false; - }, - child: AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).replay2, - isShowAppBar: false, - body: model.listDoctorNotRepliedQuestions.isEmpty - ? ErrorMessage(error: TranslationBase.of(context).noItem) - : Column( - children: [ - Expanded( - child: Container( - padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - child: NotificationListener( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: - model.listDoctorNotRepliedQuestions.length, - shrinkWrap: true, - itemBuilder: (BuildContext ctxt, int index) { - return Column( - children: [ - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - DoctorReplayChat( - reply: model - .listDoctorNotRepliedQuestions[ - index], - previousModel: model, - ), - settings: RouteSettings( - name: 'DoctorReplayChat'), - )); - }, - child: DoctorReplyWidget( - reply: - model.listDoctorNotRepliedQuestions[ - index]), - ), - if (model.state == ViewState.BusyLocal && - index == - model.listDoctorNotRepliedQuestions - .length - - 1) - DrAppCircularProgressIndeicator() - ], - ); - }), - onNotification: (t) { - if (t is ScrollUpdateNotification && - t.metrics.pixels >= - t.metrics.maxScrollExtent - 50 && - model.state != ViewState.BusyLocal) { - setState(() { - pageIndex++; - }); - model.getDoctorReply(pageIndex: pageIndex, isGettingNotReply: true); - } - return; - }, - ), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: false, + body: model.listDoctorNotRepliedQuestions.isEmpty + ? ErrorMessage(error: TranslationBase.of(context).noItem) + : Column( + children: [ + Expanded( + child: Container( + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: NotificationListener( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: + model.listDoctorNotRepliedQuestions.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return Column( + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat( + reply: model + .listDoctorNotRepliedQuestions[ + index], + previousModel: model, + ), + settings: RouteSettings( + name: 'DoctorReplayChat'), + )); + }, + child: DoctorReplyWidget( + reply: + model.listDoctorNotRepliedQuestions[ + index]), + ), + if (model.state == ViewState.BusyLocal && + index == + model.listDoctorNotRepliedQuestions + .length - + 1) + DrAppCircularProgressIndeicator() + ], + ); + }), + onNotification: (t) { + if (t is ScrollUpdateNotification && + t.metrics.pixels >= + t.metrics.maxScrollExtent - 50 && + model.state != ViewState.BusyLocal) { + setState(() { + pageIndex++; + }); + model.getDoctorReply(pageIndex: pageIndex, isGettingNotReply: true); + } + return; + }, ), ), - ], - ), - ), + ), + ], + ), ), ); } diff --git a/lib/widgets/shared/user-guid/CusomRow.dart b/lib/widgets/shared/user-guid/CusomRow.dart index 3768d34e..b66d4926 100644 --- a/lib/widgets/shared/user-guid/CusomRow.dart +++ b/lib/widgets/shared/user-guid/CusomRow.dart @@ -7,7 +7,7 @@ class CustomRow extends StatelessWidget { const CustomRow({ Key key, this.label, - this.value, this.labelSize, this.valueSize, this.width, + this.value, this.labelSize, this.valueSize, this.width, this.isCopyable= true, }) : super(key: key); final String label; @@ -15,6 +15,7 @@ class CustomRow extends StatelessWidget { final double labelSize; final double valueSize; final double width; + final bool isCopyable; @override Widget build(BuildContext context) { @@ -35,7 +36,7 @@ class CustomRow extends StatelessWidget { fontSize: valueSize??SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, - isCopyable: true, + isCopyable: isCopyable, ), ], );