diff --git a/lib/routes.dart b/lib/routes.dart index da56ce33..4ce73a4e 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_pa import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/diabetic_chart.dart'; import 'package:doctor_app_flutter/screens/patients/profile/diagnosis/diagnosis_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/admission-orders/admission_orders_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/discharge_summary/discharge_summary.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'; @@ -78,7 +79,9 @@ const String PENDING_ORDERS = 'pending-orders'; const String ADMISSION_ORDERS = 'admission-orders'; const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; const String DIAGNOSIS_FOR_IN_PATIENT = 'get_diagnosis_for_in_patient'; + const String DIABETIC_CHART_VALUES = 'get_diabetic_chart_values'; +const String DISCHARGE_SUMMARY = 'discharge_summary'; //todo: change the routing way. var routes = { @@ -125,6 +128,7 @@ var routes = { GET_OPERATION_REPORT: (_) => OperationReportScreen(), PENDING_ORDERS: (_) => PendingOrdersScreen(), NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), + DISCHARGE_SUMMARY : (_) => DischargeSummaryPage(), DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), ADMISSION_ORDERS: (_) => AdmissionOrdersScreen(), DIABETIC_CHART_VALUES: (_) => DiabeticChart(), diff --git a/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart new file mode 100644 index 00000000..13c8590b --- /dev/null +++ b/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart @@ -0,0 +1,79 @@ +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'; + + +class AllDischargeSummary extends StatefulWidget { + final Function changeCurrentTab; + + const AllDischargeSummary({Key key, this.changeCurrentTab}) : super(key: key); + + @override + _AllDischargeSummaryState createState() => _AllDischargeSummaryState(); +} + +class _AllDischargeSummaryState extends State { + + int pageIndex = 1; + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getDoctorReply(isLocalBusy: false); + }, + 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( + 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/patients/profile/discharge_summary/discharge_Summary_widget.dart b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart new file mode 100644 index 00000000..8e555b62 --- /dev/null +++ b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart @@ -0,0 +1,272 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +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:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class DischargeSummaryWidget extends StatefulWidget { + final ListGtMyPatientsQuestions reply; + bool isShowMore = false; + + DischargeSummaryWidget({Key key, this.reply}); + + @override + _DischargeSummaryWidgetState createState() => _DischargeSummaryWidgetState(); +} + +class _DischargeSummaryWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + child: CardWithBgWidget( + bgColor: widget.reply.infoStatus == 99 + ? 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: [ + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + 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 + : 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.infoStatus == 99 + ? Color(0xFF2B353E) + : widget.reply.infoStatus == 4 + ? IN_PROGRESS_COLOR + : widget.reply.infoStatus == 3 + ? Color(0xFFD02127) + : Colors.green[600], + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 1.8 * SizeConfig.textMultiplier)), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + AppText( + AppDateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .day + .toString() + + " " + + AppDateUtils.getMonth( + AppDateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .month) + .toString() + .substring(0, 3) + + ' ' + + AppDateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .year + .toString(), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + AppText( + AppDateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .hour + .toString() + + ":" + + AppDateUtils.getDateTimeFromServerFormat( + widget.reply.createdOn) + .minute + .toString(), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + Helpers.capitalize(widget.reply.patientName), + fontSize: SizeConfig.textMultiplier * 2.5, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" + widget.reply.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ), + SizedBox( + width: 4, + ), + widget.reply.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ], + ), + SizedBox( + height: 20, + ), + + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + width: 60, + height: 60, + child: Image.asset( + widget.reply.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ], + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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)}", + ), + SizedBox( + height: 8, + ), + ], + ), + ], + ), + + Container( + width: MediaQuery.of(context).size.width * 0.5, + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + text: new TextSpan( + style: new TextStyle( + fontSize: 1.3 * SizeConfig.textMultiplier, + color: Color(0xFF575757)), + children: [ + new TextSpan( + text: + TranslationBase.of(context).requestType + + ": ", + style: TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 2.8, + color: Color(0xFF575757), + //TranslationBase.of(context).doctorResponse + " : ", + )), + new TextSpan( + text: + "${widget.reply.requestTypeDescription}", + style: TextStyle( + fontFamily: 'Poppins', + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + )), + ], + ), + ), + ), + ], + ) + ], + ), + // Container( + // alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight, + // child: Icon(FontAwesomeIcons.arrowRight, + // size: 20, color: Colors.black),) + ], + ), + // onTap: onTap, + )), + ), + ); + } +} diff --git a/lib/screens/patients/profile/discharge_summary/discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/discharge_summary.dart new file mode 100644 index 00000000..1530f917 --- /dev/null +++ b/lib/screens/patients/profile/discharge_summary/discharge_summary.dart @@ -0,0 +1,187 @@ +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/models/patient/patiant_info_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/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/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_discharge_summary.dart'; +import 'pending_discharge_summary.dart'; + +class DischargeSummaryPage extends StatefulWidget { + final Function changeCurrentTab; + + const DischargeSummaryPage({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; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return WillPopScope( + onWillPop: () async { + widget.changeCurrentTab(); + return false; + }, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).replay2, + isShowAppBar: true, + // appBarTitle: TranslationBase.of(context).progressNote, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + 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, + "Pending", + ), + tabWidget( + screenSize, + _activeTab == 1, + TranslationBase.of(context).all, + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PendingDischargeSummary(), + AllDischargeSummary(), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} + +Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); +} diff --git a/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart new file mode 100644 index 00000000..c0c36732 --- /dev/null +++ b/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart @@ -0,0 +1,88 @@ +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'; + + +class PendingDischargeSummary extends StatefulWidget { + final Function changeCurrentTab; + + const PendingDischargeSummary({Key key, this.changeCurrentTab}) + : super(key: key); + + @override + _PendingDischargeSummaryState createState() => + _PendingDischargeSummaryState(); +} + +class _PendingDischargeSummaryState extends State { + int pageIndex = 1; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getDoctorReply(isLocalBusy: false, isGettingNotReply: true); + }, + 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( + 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/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 69090bde..ca304986 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -115,10 +115,10 @@ class ProfileGridForInPatient extends StatelessWidget { PatientProfileCardModel( TranslationBase.of(context).discharge, TranslationBase.of(context).report, - null, + DISCHARGE_SUMMARY, 'patient/patient_sick_leave.png', - isInPatient: isInpatient, - isDisable: true), + isInPatient: isInpatient,) + , PatientProfileCardModel( TranslationBase.of(context).patientSick, TranslationBase.of(context).leave,