From 604ff24a93ef6626d9f58c349ce06e90e5390633 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 14 Apr 2021 15:14:21 +0300 Subject: [PATCH 1/3] referral design fixes --- .../referral/my-referral-detail-screen.dart | 122 +++--- .../referral/my-referral-patient-screen.dart | 31 +- .../referral/refer-patient-screen.dart | 102 +++-- .../referral/referred-patient-screen.dart | 6 +- .../patient-referral-item-widget.dart | 353 +++--------------- .../profile_medical_info_widget_search.dart | 19 +- 6 files changed, 220 insertions(+), 413 deletions(-) diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index d1800285..53135600 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -10,19 +10,14 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_search.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import '../../../../routes.dart'; - class MyReferralDetailScreen extends StatelessWidget { PendingReferral pendingReferral; @@ -37,7 +32,7 @@ class MyReferralDetailScreen extends StatelessWidget { return BaseView( onModelReady: (model) => model.getPatientDetails( DateUtils.convertStringToDateFormat( - DateTime.now()/*.subtract(Duration(days: 350))*/.toString(), + DateTime.now() /*.subtract(Duration(days: 350))*/ .toString(), "yyyy-MM-dd"), DateUtils.convertStringToDateFormat( DateTime.now().toString(), "yyyy-MM-dd"), @@ -52,14 +47,13 @@ class MyReferralDetailScreen extends StatelessWidget { ? Column( children: [ Container( - padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5, top: 5), + 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), + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), margin: EdgeInsets.only(top: 50), child: Column( children: [ @@ -73,22 +67,27 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize(model.patientArrivalList[0].patientDetails.fullName)), + (Helpers.capitalize(model + .patientArrivalList[0] + .patientDetails + .fullName)), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, fontFamily: 'Poppins', ), ), - model.patientArrivalList[0].patientDetails.gender == 1 + model.patientArrivalList[0].patientDetails + .gender == + 1 ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) + DoctorApp.male_2, + color: Colors.blue, + ) : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), + DoctorApp.female_1, + color: Colors.pink, + ), ]), ), ], @@ -101,18 +100,6 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - /*ProfileWelcomeWidget( - AppText( - authProvider.selectedClinicName != null - ? authProvider.selectedClinicName - : authProvider - .doctorProfile.clinicDescription, - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.white, - textAlign: TextAlign.center, - ), - height: 100, - ),*/ SizedBox( height: 16, ), @@ -127,21 +114,31 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), PatientReferralItemWidget( - "${pendingReferral.patientID}", - patientName: pendingReferral.patientName, referralStatus: pendingReferral.referralStatus, - isReferredTo: false, + patientName: pendingReferral.patientName, + patientGender: + pendingReferral.patientDetails.gender, + referredDate: + pendingReferral.referredOn.split(" ")[0], + referredTime: + pendingReferral.referredOn.split(" ")[1], + patientID: "${pendingReferral.patientID}", isSameBranch: pendingReferral.isReferralDoctorSameBranch, + isReferral: true, + remark: pendingReferral.remarksFromSource, + nationality: pendingReferral + .patientDetails.nationalityName, + nationalityFlag: + pendingReferral.nationalityFlagUrl, + doctorAvatar: pendingReferral.doctorImageUrl, referralDoctorName: pendingReferral.referredByDoctorInfo, clinicDescription: null, - remark: pendingReferral.remarksFromSource, - referredOn: pendingReferral.referredOn, - patientInfo: pendingReferral, ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + padding: + const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( patient: model.patientArrivalList[0], @@ -174,7 +171,9 @@ class MyReferralDetailScreen extends StatelessWidget { if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); Navigator.pop(context); Navigator.pop(context); } @@ -198,7 +197,9 @@ class MyReferralDetailScreen extends StatelessWidget { if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); Navigator.pop(context); Navigator.pop(context); } @@ -211,26 +212,27 @@ class MyReferralDetailScreen extends StatelessWidget { ], ) : Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText("" , - fontSize: SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - fontFamily: 'Poppins', + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), ), - ), - ]), - ), - Container( + Expanded( + child: AppText( + "", + fontSize: SizeConfig.textMultiplier * 2.5, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + fontFamily: 'Poppins', + ), + ), + ]), + ), + Container( child: Center( child: AppText( TranslationBase.of(context).patientNoDetailErrMsg, @@ -240,8 +242,8 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), ), - ], - ), + ], + ), ), ); } diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index 986cf54f..bda285fe 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -51,23 +51,34 @@ class MyReferralPatientScreen extends StatelessWidget { }); }, child: PatientReferralItemWidget( - "${model.pendingReferral[index].patientID}", - patientInfo: model.pendingReferral[index], - patientName: - model.pendingReferral[index].patientName, referralStatus: model.pendingReferral[index].referralStatus, - isReferredTo: false, + patientName: + model.pendingReferral[index].patientName, + patientGender: model + .pendingReferral[index].patientDetails.gender, + referredDate: model + .pendingReferral[index].referredOn + .split(" ")[0], + referredTime: model + .pendingReferral[index].referredOn + .split(" ")[1], + patientID: + "${model.pendingReferral[index].patientID}", isSameBranch: model.pendingReferral[index] .isReferralDoctorSameBranch, + isReferral: true, + remark: + model.pendingReferral[index].remarksFromSource, + nationality: model.pendingReferral[index] + .patientDetails.nationalityName, + nationalityFlag: + model.pendingReferral[index].nationalityFlagUrl, + doctorAvatar: + model.pendingReferral[index].doctorImageUrl, referralDoctorName: model .pendingReferral[index].referredByDoctorInfo, clinicDescription: null, - remark: - model.pendingReferral[index].remarksFromSource, - referredOn: model.pendingReferral[index].referredOn, - answerFromTarget: - model.pendingReferral[index].answerFromTarget, infoIcon: InkWell( onTap: () { Navigator.of(context) diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 815ec93d..52170c9b 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -113,35 +113,58 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? referralForm(model, screenSize) : PatientReferralItemWidget( - "${model.patientReferral[model.patientReferral.length - 1].patientID}", + referralStatus: model + .patientReferral[ + model.patientReferral.length - 1] + .referralStatus, patientName: model .patientReferral[ model.patientReferral.length - 1] .patientName, - referralStatus: - "${model.patientReferral[model.patientReferral.length - 1].referralStatus}", - isReferredTo: true, - isSameBranch: model + patientGender: model .patientReferral[ model.patientReferral.length - 1] - .isReferralDoctorSameBranch, - referralDoctorName: model + .patientDetails + .gender, + referredDate: model .patientReferral[ model.patientReferral.length - 1] - .referredByDoctorInfo, - clinicDescription: null, + .referredOn + .split(" ")[0], + referredTime: model + .patientReferral[ + model.patientReferral.length - 1] + .referredOn + .split(" ")[1], + patientID: + "${model.patientReferral[model.patientReferral.length - 1].patientID}", + isSameBranch: model + .patientReferral[ + model.patientReferral.length - 1] + .isReferralDoctorSameBranch, + isReferral: true, remark: model .patientReferral[ model.patientReferral.length - 1] .remarksFromSource, - referredOn: model + nationality: model + .patientReferral[ + model.patientReferral.length - 1] + .patientDetails + .nationalityName, + nationalityFlag: model + .patientReferral[ + model.patientReferral.length - 1] + .nationalityFlagUrl, + doctorAvatar: model .patientReferral[ model.patientReferral.length - 1] - .referredOn, - answerFromTarget: model + .doctorImageUrl, + referralDoctorName: model .patientReferral[ model.patientReferral.length - 1] - .answerFromTarget, + .referredByDoctorInfo, + clinicDescription: null, ), ], ), @@ -154,24 +177,28 @@ class _PatientMakeReferralScreenState extends State { color: HexColor("#359846"), onPressed: () { setState(() { - if(_referTo == null){ - branchError = TranslationBase.of(context).fieldRequired; - }else { + if (_referTo == null) { + branchError = + TranslationBase.of(context).fieldRequired; + } else { branchError = null; } - if(_selectedBranch == null){ - hospitalError = TranslationBase.of(context).fieldRequired; - }else { + if (_selectedBranch == null) { + hospitalError = + TranslationBase.of(context).fieldRequired; + } else { hospitalError = null; } - if(_selectedClinic == null){ - clinicError = TranslationBase.of(context).fieldRequired; - }else { + if (_selectedClinic == null) { + clinicError = + TranslationBase.of(context).fieldRequired; + } else { clinicError = null; } - if(_selectedDoctor == null){ - doctorError = TranslationBase.of(context).fieldRequired; - }else { + if (_selectedDoctor == null) { + doctorError = + TranslationBase.of(context).fieldRequired; + } else { doctorError = null; } }); @@ -336,7 +363,8 @@ class _PatientMakeReferralScreenState extends State { GifLoaderDialogUtils.showMyDialog(context); await model .getClinicDoctors( - _selectedClinic['ClinicID'].toString(), _selectedBranch['facilityId']) + _selectedClinic['ClinicID'].toString(), + _selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { @@ -391,13 +419,16 @@ class _PatientMakeReferralScreenState extends State { }, ); } - : (){ - if(_selectedClinic == null){ - DrAppToastMsg.showErrorToast("You need to select a clinic first"); - } else if(model.doctorsList == null || model.doctorsList.length == 0){ - DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); - } - }, + : () { + if (_selectedClinic == null) { + DrAppToastMsg.showErrorToast( + "You need to select a clinic first"); + } else if (model.doctorsList == null || + model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast( + "There is no doctors for this clinic"); + } + }, ), SizedBox( height: 10, @@ -414,7 +445,7 @@ class _PatientMakeReferralScreenState extends State { Icons.calendar_today, color: Colors.black, ), - onClick: (){ + onClick: () { _selectDate(context, model); }, ), @@ -422,8 +453,7 @@ class _PatientMakeReferralScreenState extends State { height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).dietTypeRemarks, + hintText: TranslationBase.of(context).dietTypeRemarks, controller: _remarksController, inputType: TextInputType.multiline, minLines: 4, diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index d6a81603..7f59b0f8 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -46,7 +46,8 @@ class ReferredPatientScreen extends StatelessWidget { ), ...List.generate( model.listMyReferredPatientModel.length, - (index) => PatientReferralItemWidget( + (index) => + Container() /*PatientReferralItemWidget( "${model.getReferredPatientItem(index).patientId}", patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", @@ -71,7 +72,8 @@ class ReferredPatientScreen extends StatelessWidget { null ? DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy") : null, - ), + )*/ + , ), ], ), diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index ddc41c82..98d4f458 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -11,33 +11,38 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; class PatientReferralItemWidget extends StatelessWidget { + final String referralStatus; final String patientName; + final int patientGender; + final String referredDate; + final String referredTime; final String patientID; - final String referralStatus; - final isReferredTo; final isSameBranch; + final bool isReferral; + final String remark; + final String nationality; + final String nationalityFlag; + final String doctorAvatar; final String referralDoctorName; final String clinicDescription; - final String remark; - final String referredOn; - final String answerFromTarget; final Widget infoIcon; - final PendingReferral patientInfo; PatientReferralItemWidget( - this.patientID, { - this.patientName, - this.referralStatus, - this.isReferredTo = false, - this.isSameBranch, - this.referralDoctorName, - this.clinicDescription, - this.remark, - this.referredOn, - this.answerFromTarget, - this.infoIcon, - this.patientInfo, - }); + {this.referralStatus, + this.patientName, + this.patientGender, + this.referredDate, + this.referredTime, + this.patientID, + this.isSameBranch, + this.isReferral, + this.remark, + this.nationality, + this.nationalityFlag, + this.doctorAvatar, + this.referralDoctorName, + this.clinicDescription, + this.infoIcon}); @override Widget build(BuildContext context) { @@ -47,224 +52,6 @@ class PatientReferralItemWidget extends StatelessWidget { margin: EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0), child: Column( children: [ - // TODO should be removed by mousa - // Row( - // children: [ - // Expanded( - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // if (referralStatus != null) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).referralStatus, - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // Container( - // color: Color(0xFF4BA821), - // padding: EdgeInsets.all(4), - // child: AppText( - // referralStatus - // /*referralStatus == "46" - // ? TranslationBase.of(context).approved - // : TranslationBase.of(context).rejected*/ - // , - // color: Colors.white, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // children: [ - // AppText( - // isReferredTo - // ? "${TranslationBase.of(context).referTo}: " - // : "${TranslationBase.of(context).referredFrom}: ", - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // isSameBranch - // ? TranslationBase.of(context).sameBranch - // : TranslationBase.of(context).otherBranch, - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // AppText( - // "${TranslationBase.of(context).referralDoctor} : ", - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // Expanded( - // child: AppText( - // referralDoctorName != null - // ? "${TranslationBase.of(context).dr} $referralDoctorName" - // : "-", - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // if (clinicDescription != null) - // Row( - // children: [ - // AppText( - // "${TranslationBase.of(context).clinic}: ", - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // clinicDescription, - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // children: [ - // AppText( - // "${TranslationBase.of(context).patientID}: ", - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // patientID ?? '-', - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // children: [ - // AppText( - // "${TranslationBase.of(context).patientName}: ", - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // patientName ?? '-', - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // AppText( - // TranslationBase.of(context).referralRemark, - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // Expanded( - // child: AppText( - // remark, - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ), - // ], - // ), - // SizedBox( - // height: 8, - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).referredOn, - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // referredOn ?? '-', - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // if (answerFromTarget != null) - // SizedBox( - // height: 8, - // ), - // if (answerFromTarget != null) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).referralResponse, - // color: Colors.grey, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // AppText( - // answerFromTarget != "" ? answerFromTarget : '-', - // color: Colors.black, - // fontWeight: FontWeight.bold, - // fontSize: 12, - // ), - // ], - // ), - // SizedBox( - // height: 16, - // ), - // ], - // ), - // ), - // if (infoIcon != null) infoIcon, - // ], - // ), - // const Divider( - // color: Color(0xffCCCCCC), - // height: 1, - // thickness: 1, - // indent: 0, - // endIndent: 0, - // ), - // SizedBox( - // height: 8, - // ), Container( child: CardWithBgWidget( bgColor: referralStatus != null @@ -296,7 +83,7 @@ class PatientReferralItemWidget extends StatelessWidget { : Colors.grey[500], ), AppText( - referredOn, + referredDate, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier, @@ -309,7 +96,7 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Expanded( child: AppText( - patientInfo.patientName, + patientName, fontSize: SizeConfig.textMultiplier * 2.2, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, @@ -320,7 +107,7 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( width: 4, ), - /*patient.gender*/ 1 == 1 + patientGender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -333,7 +120,7 @@ class PatientReferralItemWidget extends StatelessWidget { width: 4, ), AppText( - referredOn, + referredTime, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -359,7 +146,7 @@ class PatientReferralItemWidget extends StatelessWidget { color: Color(0XFF575757), ), AppText( - patientInfo.patientID.toString(), + patientID, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -395,36 +182,25 @@ class PatientReferralItemWidget extends StatelessWidget { Row( children: [ AppText( - /*patient.nationalityName ?? - patient.nationality*/ - "Saudi", + nationality != null ? nationality : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontSize: 1.4 * SizeConfig.textMultiplier, ), - /* patient.nationality != null + nationalityFlag != null ? ClipRRect( - borderRadius: - BorderRadius - .circular( - 20.0), - child: Image.network( - patient - .nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: - (BuildContext - context, - Object - exception, - StackTrace - stackTrace) { - return Text( - 'No Image'); - }, - ))*/ - /*:*/ SizedBox() + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + nationalityFlag, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : SizedBox() ], ) ], @@ -442,7 +218,7 @@ class PatientReferralItemWidget extends StatelessWidget { ), Expanded( child: AppText( - patientInfo.remarksFromSource, + remark, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -457,7 +233,9 @@ class PatientReferralItemWidget extends StatelessWidget { Container( margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( - infoIcon != null ? 'assets/images/patient/ic_ref_arrow_up.png' : 'assets/images/patient/ic_ref_arrow_left.png', + isReferral + ? 'assets/images/patient/ic_ref_arrow_up.png' + : 'assets/images/patient/ic_ref_arrow_left.png', height: 50, width: 30, ), @@ -469,9 +247,10 @@ class PatientReferralItemWidget extends StatelessWidget { child: Container( width: 40, height: 40, - child: Image.asset( - 'assets/images/female_avatar.png', - fit: BoxFit.cover, + child: CircleAvatar( + radius: 25.0, + backgroundImage: NetworkImage(doctorAvatar), + backgroundColor: Colors.transparent, ), ), ), @@ -482,29 +261,13 @@ class PatientReferralItemWidget extends StatelessWidget { left: 10, top: 25, right: 10, bottom: 0), child: Column( children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - TextSpan( - text: TranslationBase.of(context) - .referralDoctor + - " : ", - style: TextStyle( - fontSize: 14, - fontFamily: 'Poppins')), - TextSpan( - text: referralDoctorName, - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 15)), - ], - ), - ) + AppText( + referralDoctorName, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), ], ), ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index 3b5896f8..95a8c567 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -100,6 +100,15 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).prescription, icon: 'patient/order_prescription.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PROCEDURE, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).procedures, + icon: 'patient/Order_Procedures.png'), PatientProfileButton( key: key, patient: patient, @@ -125,16 +134,6 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { // nameLine1: TranslationBase.of(context).admission, // nameLine2: TranslationBase.of(context).request, // icon: 'heartbeat.png'), - if (patientType == "1") - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), ], ), ); From 9f35f53fa280f4691866c508b36e644dc7798aee Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 14 Apr 2021 16:00:11 +0300 Subject: [PATCH 2/3] re-design --- .../profile/UCAF/UCAF-input-screen.dart | 30 ++- .../referral/my-referral-detail-screen.dart | 217 +++++++++++++++++- .../referral/my-referral-patient-screen.dart | 18 +- .../referral/referred-patient-screen.dart | 20 +- ...ent-profile-header-new-design-app-bar.dart | 4 +- .../patient-profile-header-new-design.dart | 4 +- 6 files changed, 264 insertions(+), 29 deletions(-) diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index c39464bd..fa94d3fa 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -419,16 +419,26 @@ class _UCAFInputScreenState extends State { ), ], ) - : Container( - child: Center( - child: AppText( - model.patientVitalSigns == null - ? TranslationBase.of(context).vitalSignEmptyMsg - : TranslationBase.of(context).chiefComplaintEmptyMsg, - fontWeight: FontWeight.normal, - color: HexColor("#B8382B"), - fontSize: SizeConfig.textMultiplier * 2.5, - ), + : Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + model.patientVitalSigns == null + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context).chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ) + ], ), ), ), diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 53135600..dcba8fba 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -90,6 +90,215 @@ class MyReferralDetailScreen extends StatelessWidget { ), ]), ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + pendingReferral.patientDetails.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + pendingReferral.referralStatus != null ? pendingReferral.referralStatus : "", + fontFamily: 'Poppins', + fontSize: 1.9 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, + color: pendingReferral.referralStatus != null + ? pendingReferral.referralStatus == 'Pending' + ? Color(0xffc4aa54) + : pendingReferral.referralStatus == 'Accepted' + ? Colors.green[700] + : Colors.red[700] + : Colors.grey[500], + ), + AppText( + pendingReferral.referredOn.split(" ")[0], + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Color(0XFF28353E), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).fileNumber, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + AppText( + "${pendingReferral.patientID}", + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + AppText( + pendingReferral.referredOn.split(" ")[1], + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).referredFrom, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + AppText( + pendingReferral.isReferralDoctorSameBranch + ? TranslationBase.of(context).sameBranch + : TranslationBase.of(context) + .otherBranch, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).remarks + " : ", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + Expanded( + child: AppText( + pendingReferral.remarksFromSource, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ), + ], + ), + ], + ), + ), + Row( + children: [ + AppText( + pendingReferral + .patientDetails.nationalityName != null ? pendingReferral + .patientDetails.nationalityName : "", + fontWeight: FontWeight.bold, + color: Color(0xFF2E303A), + fontSize: 1.4 * SizeConfig.textMultiplier, + ), + pendingReferral.nationalityFlagUrl != null + ? ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + pendingReferral.nationalityFlagUrl, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : SizedBox() + ], + ) + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 10, right: 0), + child: Image.asset('assets/images/patient/ic_ref_arrow_up.png', + height: 50, + width: 30, + ), + ), + Container( + margin: EdgeInsets.only( + left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: Container( + width: 40, + height: 40, + child: CircleAvatar( + radius: 25.0, + backgroundImage: NetworkImage(pendingReferral.doctorImageUrl), + backgroundColor: Colors.transparent, + ), + ), + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.only( + left: 10, top: 25, right: 10, bottom: 0), + child: Column( + children: [ + AppText( + pendingReferral.referredByDoctorInfo, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), ], ), ), @@ -103,7 +312,7 @@ class MyReferralDetailScreen extends StatelessWidget { SizedBox( height: 16, ), - Padding( + /*Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: AppText( @@ -112,8 +321,8 @@ class MyReferralDetailScreen extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 16, ), - ), - PatientReferralItemWidget( + ),*/ + /*PatientReferralItemWidget( referralStatus: pendingReferral.referralStatus, patientName: pendingReferral.patientName, patientGender: @@ -135,7 +344,7 @@ class MyReferralDetailScreen extends StatelessWidget { referralDoctorName: pendingReferral.referredByDoctorInfo, clinicDescription: null, - ), + ),*/ Padding( padding: const EdgeInsets.symmetric(horizontal: 16), diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index bda285fe..1d9bbbfd 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -27,9 +27,21 @@ class MyReferralPatientScreen extends StatelessWidget { appBarTitle: TranslationBase.of(context).referPatient, body: model.pendingReferral == null || model.pendingReferral.length == 0 ? Center( - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), ) : SingleChildScrollView( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 7f59b0f8..0c8732a9 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -20,23 +20,27 @@ class ReferredPatientScreen extends StatelessWidget { body: model.listMyReferredPatientModel == null || model.listMyReferredPatientModel.length == 0 ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), child: AppText( TranslationBase.of(context).referralEmptyMsg, color: Theme.of(context).errorColor, ), ) + ], + ), + ) : SingleChildScrollView( child: Container( child: Column( children: [ - /*Container( - height: 75, - child: AppText( - "This is where upper view for avatar.. etc placed", - fontWeight: FontWeight.normal, - fontSize: 16, - ), - ),*/ const Divider( color: Color(0xffCCCCCC), height: 1, diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index 5d67fd81..7ed8579b 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -210,11 +210,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget Row( children: [ AppText( - patient.nationalityName ?? patient.nationality??'', + patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', fontWeight: FontWeight.bold, fontSize: 12, ), - patient.nationality != null + patient.nationalityFlagURL != null ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart index 2453f382..0349fb6c 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design.dart @@ -208,11 +208,11 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { Row( children: [ AppText( - patient.nationalityName ?? patient.nationality??'', + patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', fontWeight: FontWeight.bold, fontSize: 12, ), - patient.nationality != null + patient.nationalityFlagURL != null ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( From 9645791164a29840e555ee58fd5337865317d865 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 14 Apr 2021 17:00:34 +0300 Subject: [PATCH 3/3] changeing add prescription behovior --- lib/core/service/prescription_service.dart | 4 +- lib/core/viewModel/medicine_view_model.dart | 19 +- .../viewModel/prescription_view_model.dart | 6 +- .../medicine/medicine_search_screen.dart | 261 +++++---- .../prescription/add_prescription_form.dart | 497 ++++++++++++------ .../procedures/add-procedure-form.dart | 453 ++++++++-------- lib/screens/procedures/add_lab_orders.dart | 64 ++- .../procedures/add_radiology_order.dart | 62 ++- lib/screens/procedures/procedure_screen.dart | 99 ++-- 9 files changed, 804 insertions(+), 661 deletions(-) diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 758f4595..67b3491c 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -112,9 +112,9 @@ class PrescriptionService extends LookupService { }, body: _drugRequestModel.toJson()); } - Future getMedicationList() async { + Future getMedicationList({String drug}) async { hasError = false; - _drugRequestModel.search = [""]; + _drugRequestModel.search = ["$drug"]; await baseAppClient.post(SEARCH_DRUG, onSuccess: (dynamic response, int statusCode) { allMedicationList = []; diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 9e83d63e..5a586ee0 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -15,7 +15,7 @@ class MedicineViewModel extends BaseViewModel { PrescriptionService _prescriptionService = locator(); get pharmacyItemsList => _medicineService.pharmacyItemsList; - get searchText=>_medicineService.searchText; + get searchText => _medicineService.searchText; get pharmaciesList => _medicineService.pharmaciesList; get medicationStrengthList => _prescriptionService.medicationStrengthList; @@ -34,7 +34,6 @@ class MedicineViewModel extends BaseViewModel { List get patientAssessmentList => _prescriptionService.patientAssessmentList; - List get allMedicationList => _prescriptionService.allMedicationList; List get itemMedicineList => _prescriptionService.itemMedicineList; @@ -55,6 +54,18 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getPrescription({int mrn}) async { + //hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getPrescription(mrn: mrn); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getMedicineItem(String itemName) async { setState(ViewState.Busy); await _medicineService.getMedicineItem(itemName); @@ -65,9 +76,9 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMedicationList() async { + Future getMedicationList({String drug}) async { setState(ViewState.Busy); - await _prescriptionService.getMedicationList(); + await _prescriptionService.getMedicationList(drug: drug); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 82b2f70c..5ced6617 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -95,9 +95,9 @@ class PrescriptionViewModel extends BaseViewModel { } } - Future getMedicationList() async { + Future getMedicationList({String drug}) async { setState(ViewState.Busy); - await _prescriptionService.getMedicationList(); + await _prescriptionService.getMedicationList(drug: drug); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -249,7 +249,7 @@ class PrescriptionViewModel extends BaseViewModel { await _prescriptionsService.getPrescriptions(patient); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; - if(patientType=="7") + if (patientType == "7") setState(ViewState.ErrorLocal); else setState(ViewState.Error); diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index a37debbf..9dea3448 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -115,164 +115,139 @@ class _MedicineSearchState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) async { - // if (model.allMedicationList.length == 0) - // await model.getMedicationList(); - }, - builder: (_, model, w) { - myController.text =model.searchText; - return AppScaffold( - // baseViewModel: model, - isShowAppBar: false, - appBarTitle: TranslationBase.of(context).searchMedicine, - body: SingleChildScrollView( - child: FractionallySizedBox( - widthFactor: 0.97, - child: SingleChildScrollView( - child: Container( - // height: SizeConfig.screenHeight, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: SizeConfig.screenHeight * .16, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(10), - child: AppTextFormField( - borderColor: Colors.white, - hintText: TranslationBase.of(context) - .searchMedicineNameHere, - controller: myController, - onSaved: (value) {}, - onFieldSubmitted: (value) { - searchMedicine(context, model); - }, - inputFormatter: ONLY_LETTERS, - ), - ), - ), - FractionallySizedBox( - widthFactor: 0.9, - child: Container( - child: Wrap( - alignment: WrapAlignment.center, - children: [ - // TODO change it secondary button and add loading - AppButton( - title: TranslationBase.of(context).search, - onPressed: () async{ - await searchMedicine(context, model); - - }, - ), - ], - ), - ), - ), - - Container( - margin: EdgeInsets.only( - left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase - .of(context) - .youCanFind + - (myController.text !=''?model.pharmacyItemsList.length - .toString():'0' )+ - " " + - TranslationBase - .of(context) - .itemsInSearch, - fontWeight: FontWeight.bold, - ), - ], + return BaseView(onModelReady: (model) async { + // if (model.allMedicationList.length == 0) + // await model.getMedicationList(); + }, builder: (_, model, w) { + myController.text = model.searchText; + return AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + appBarTitle: TranslationBase.of(context).searchMedicine, + body: SingleChildScrollView( + child: FractionallySizedBox( + widthFactor: 0.97, + child: SingleChildScrollView( + child: Container( + // height: SizeConfig.screenHeight, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.screenHeight * .16, + ), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + borderColor: Colors.white, + hintText: + TranslationBase.of(context).searchMedicineNameHere, + controller: myController, + onSaved: (value) {}, + onFieldSubmitted: (value) { + searchMedicine(context, model); + }, + inputFormatter: ONLY_LETTERS, + ), + ), + ), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Wrap( + alignment: WrapAlignment.center, + children: [ + // TODO change it secondary button and add loading + AppButton( + title: TranslationBase.of(context).search, + onPressed: () async { + await searchMedicine(context, model); + }, ), + ], + ), + ), + ), + Container( + margin: + EdgeInsets.only(left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).youCanFind + + (myController.text != '' + ? model.pharmacyItemsList.length.toString() + : '0') + + " " + + TranslationBase.of(context).itemsInSearch, + fontWeight: FontWeight.bold, ), - SizedBox( - height:10, - ), - if(myController.text !='') - Container( - height: MediaQuery - .of(context) - .size - .height * 0.5, - child: ListView.builder( - padding: const EdgeInsets.only(top:20), + ], + ), + ), + SizedBox( + height: 10, + ), + if (myController.text != '') + Container( + height: MediaQuery.of(context).size.height * 0.5, + child: ListView.builder( + padding: const EdgeInsets.only(top: 20), - scrollDirection: Axis.vertical, - // shrinkWrap: true, - itemCount: - model.pharmacyItemsList == - null - ? 0 - : model - .pharmacyItemsList.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: MedicineItemWidget( - label: model - .pharmacyItemsList[index] - ["ItemDescription"], - url: model - .pharmacyItemsList[index] - ["ImageSRCUrl"], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PharmaciesListScreen( - itemID: model - .pharmacyItemsList[ - index]["ItemID"], - url: model - .pharmacyItemsList[ - index]["ImageSRCUrl"]), - ), - ); - }, - ); - }, + scrollDirection: Axis.vertical, + // shrinkWrap: true, + itemCount: model.pharmacyItemsList == null + ? 0 + : model.pharmacyItemsList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: MedicineItemWidget( + label: model.pharmacyItemsList[index] + ["ItemDescription"], + url: model.pharmacyItemsList[index] + ["ImageSRCUrl"], ), - ), - ], + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmaciesListScreen( + itemID: model.pharmacyItemsList[index] + ["ItemID"], + url: model.pharmacyItemsList[index] + ["ImageSRCUrl"]), + ), + ); + }, + ); + }, + ), ), - )), - ), + ], + ), + )), ), - );} - - ); + ), + ); + }); } searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); if (myController.text.isNullOrEmpty()) { - helpers.showErrorToast(TranslationBase - .of(context) - .typeMedicineName); + helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); //"Type Medicine Name") return; } if (myController.text.length < 3) { - helpers.showErrorToast(TranslationBase - .of(context) - .moreThan3Letter); + helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); return; } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 819cc2f1..870ab53f 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -1,5 +1,6 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; @@ -15,11 +16,14 @@ import 'package:doctor_app_flutter/util/date-utils.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'; +import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -49,7 +53,8 @@ postProcedure( DateTime doseTime, String doseUnit, String icdCode, - PatiantInformtion patient,String patientType}) async { + PatiantInformtion patient, + String patientType}) async { PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); List sss = List(); @@ -103,6 +108,11 @@ class _PrescriptionFormWidgetState extends State { TextEditingController frequencyController = TextEditingController(); TextEditingController indicationController = TextEditingController(); TextEditingController instructionController = TextEditingController(); + + bool visbiltyPrescriptionForm = false; + bool visbiltySearch = true; + + final myController = TextEditingController(); DateTime selectedDate; dynamic selectedDrug; int strengthChar; @@ -198,9 +208,10 @@ class _PrescriptionFormWidgetState extends State { appointmentNo: widget.patient.appointmentNo); await model.getMedicationList(); await model.getMedicationStrength(); + await model.getPrescription(mrn: widget.patient.patientMRN); await model.getMedicationDuration(); - await model.getMedicationRoute(); - await model.getMedicationFrequency(); + //await model.getMedicationRoute(); + //await model.getMedicationFrequency(); await model.getMedicationDoseTime(); //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); @@ -231,14 +242,17 @@ class _PrescriptionFormWidgetState extends State { padding: EdgeInsets.symmetric( horizontal: 12.0, vertical: 10.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + //crossAxisAlignment: CrossAxisAlignment.start, //mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ AppText( 'New Prescription Order', @@ -267,125 +281,233 @@ class _PrescriptionFormWidgetState extends State { child: Column( //mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - height: MediaQuery.of(context).size.height * - 0.070, - color: Colors.white, - child: InkWell( - onTap: model.allMedicationList != null - ? () { - Helpers.hideKeyboard(context); - setState(() { - _selectedMedication = null; - model.getItem( - itemID: _selectedMedication - .itemId); - }); - } - : null, - child: _selectedMedication == null - ? AutoCompleteTextField< - GetMedicationResponseModel>( - onFocusChanged: (__) { - if (_selectedMedication != - null) { - model.getItem( - itemID: - _selectedMedication - .itemId); - uom = _selectedMedication.uom; - } else { - null; - } - if (_selectedMedication != - null && - duration != null && - frequency != null && - strengthController.text != - null) { - model.getBoxQuantity( - freq: frequency[ - 'parameterCode'], - duration: duration['id'], - itemCode: - _selectedMedication - .itemId, - strength: double.parse( - strengthController - .text)); - box = model.boxQuintity; + // Container( + // height: MediaQuery.of(context).size.height * + // 0.070, + // color: Colors.white, + // child: InkWell( + // onTap: model.allMedicationList != null + // ? () { + // Helpers.hideKeyboard(context); + // setState(() { + // _selectedMedication = null; + // model.getItem( + // itemID: _selectedMedication + // .itemId); + // }); + // } + // : null, + // child: _selectedMedication == null + // ? AutoCompleteTextField< + // GetMedicationResponseModel>( + // onFocusChanged: (__) { + // if (_selectedMedication != + // null) { + // model.getItem( + // itemID: + // _selectedMedication + // .itemId); + // uom = _selectedMedication.uom; + // } else { + // null; + // } + // if (_selectedMedication != + // null && + // duration != null && + // frequency != null && + // strengthController.text != + // null) { + // model.getBoxQuantity( + // freq: frequency[ + // 'parameterCode'], + // duration: duration['id'], + // itemCode: + // _selectedMedication + // .itemId, + // strength: double.parse( + // strengthController + // .text)); + // box = model.boxQuintity; + // + // return; + // } + // }, + // decoration: + // textFieldSelectorDecoration( + // TranslationBase.of(context) + // .searchMedicineNameHere, + // _selectedMedication != null + // ? _selectedMedication + // .genericName + // : null, + // true, + // ), + // itemSubmitted: (item) => setState( + // () => _selectedMedication = + // item), + // key: key, + // suggestions: + // model.allMedicationList, + // itemBuilder: (context, + // suggestion) => + // new Padding( + // child: Texts(suggestion + // .description + + // '/' + + // suggestion + // .genericName), + // padding: + // EdgeInsets.all(15.0)), + // itemSorter: (a, b) => 1, + // suggestionsAmount: 7, + // itemFilter: (suggestion, input) => + // suggestion.genericName.toLowerCase().startsWith( + // input.toLowerCase()) || + // suggestion.description + // .toLowerCase() + // .startsWith(input + // .toLowerCase()) || + // suggestion.keywords + // .toLowerCase() + // .startsWith( + // input.toLowerCase()), + // ) + // : TextField( + // onEditingComplete: () { + // model.getItem( + // itemID: _selectedMedication + // .itemId); + // }, + // decoration: textFieldSelectorDecoration( + // TranslationBase.of(context) + // .searchMedicineNameHere, + // _selectedMedication != null + // ? _selectedMedication + // .description + + // ('${_selectedMedication.genericName}') + // : null, + // false, + // suffixIcon: + // Icon(Icons.search)), + // enabled: false, + // ), + // ), + // ), + FractionallySizedBox( + widthFactor: 0.9, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(10), + child: AppTextFormField( + onTap: () { + visbiltyPrescriptionForm = false; + visbiltySearch = true; + }, + borderColor: Colors.white, + hintText: TranslationBase.of(context) + .searchMedicineNameHere, + controller: myController, + onSaved: (value) {}, + onFieldSubmitted: (value) { + searchMedicine(context, model); + }, + inputFormatter: ONLY_LETTERS, + ), + ), + ), + SizedBox( + height: 15.0, + ), + Visibility( + visible: visbiltySearch, + child: Container( + child: Column( + children: [ + FractionallySizedBox( + widthFactor: 0.8, + child: Container( + child: Wrap( + alignment: WrapAlignment.center, + children: [ + // TODO change it secondary button and add loading + AppButton( + title: TranslationBase.of( + context) + .search, + onPressed: () async { + await searchMedicine( + context, model); + }, + ), + ], + ), + ), + ), + if (myController.text != '') + Container( + height: MediaQuery.of(context) + .size + .height * + 0.5, + child: ListView.builder( + padding: const EdgeInsets.only( + top: 20), - return; - } - }, - decoration: - textFieldSelectorDecoration( - TranslationBase.of(context) - .searchMedicineNameHere, - _selectedMedication != null - ? _selectedMedication - .genericName - : null, - true, + scrollDirection: Axis.vertical, + // shrinkWrap: true, + itemCount: + model.allMedicationList == + null + ? 0 + : model + .allMedicationList + .length, + itemBuilder: + (BuildContext context, + int index) { + return InkWell( + child: MedicineItemWidget( + label: model + .allMedicationList[ + index] + .description + // url: model + // .pharmacyItemsList[ + // index]["ImageSRCUrl"], + ), + onTap: () { + model.getItem( + itemID: model + .allMedicationList[ + index] + .itemId); + visbiltyPrescriptionForm = + true; + visbiltySearch = false; + _selectedMedication = + model.allMedicationList[ + index]; + uom = _selectedMedication + .uom; + }, + ); + }, ), - itemSubmitted: (item) => setState( - () => _selectedMedication = - item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: Texts(suggestion - .description + - '/' + - suggestion - .genericName), - padding: - EdgeInsets.all(15.0)), - itemSorter: (a, b) => 1, - suggestionsAmount: 7, - itemFilter: (suggestion, input) => - suggestion.genericName.toLowerCase().startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith(input - .toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith( - input.toLowerCase()), - ) - : TextField( - onEditingComplete: () { - model.getItem( - itemID: _selectedMedication - .itemId); - }, - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .searchMedicineNameHere, - _selectedMedication != null - ? _selectedMedication - .description + - ('${_selectedMedication.genericName}') - : null, - false, - suffixIcon: - Icon(Icons.search)), - enabled: false, ), + ], + ), ), ), SizedBox( height: spaceBetweenTextFileds, ), Visibility( - visible: _selectedMedication == null - ? false - : true, + visible: visbiltyPrescriptionForm, child: Container( child: Column( children: [ @@ -1142,66 +1264,75 @@ class _PrescriptionFormWidgetState extends State { if (formKey.currentState .validate()) { Navigator.pop(context); - openDrugToDrug(model); + //openDrugToDrug(model); { - /*// var x = model - // .patientAssessmentList - // .map((value) => - // value.icdCode10ID) - // .toList() - // .join(','); + // var x = model + // .patientAssessmentList + // .map((value) => + // value.icdCode10ID) + // .toList() + // .join(','); - postProcedure( - icdCode: model - .patientAssessmentList - .isNotEmpty - ? model - .patientAssessmentList[ - 0] - .icdCode10ID - .isEmpty - ? "test" - : model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString() - : "TEST", - // icdCode: model - // .patientAssessmentList - // .map((value) => value - // .icdCode10ID - // .trim()) - // .toList() - // .join(' '), - dose: strengthController.text, - doseUnit: - units['parameterCode'] - .toString(), - patient: widget.patient, - doseTimeIn: - doseTime['id'].toString(), - model: widget.model, - duration: - duration['id'].toString(), - frequency: - frequency['parameterCode'] - .toString(), - route: route['parameterCode'] - .toString(), - drugId: _selectedMedication - .itemId - .toString(), - strength: - strengthController.text, - indication: - indicationController.text, - instruction: - instructionController - .text, - doseTime: selectedDate, - ); - */ + postProcedure( + icdCode: model + .patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : "test", + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: + strengthController + .text, + doseUnit: units[ + 'parameterCode'] + .toString(), + patient: + widget.patient, + doseTimeIn: + doseTime['id'] + .toString(), + model: widget.model, + duration: + duration['id'] + .toString(), + frequency: frequency[ + 'parameterCode'] + .toString(), + route: route[ + 'parameterCode'] + .toString(), + drugId: + _selectedMedication + .itemId + .toString(), + strength: + strengthController + .text, + indication: + indicationController + .text, + instruction: + instructionController + .text, + doseTime: + selectedDate, + ); } } @@ -1389,4 +1520,22 @@ class _PrescriptionFormWidgetState extends State { } return prescriptionDetails; } + + searchMedicine(context, MedicineViewModel model) async { + FocusScope.of(context).unfocus(); + // if (myController.text.isEmpty()) { + // helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); + // //"Type Medicine Name") + // return; + // } + if (myController.text.length < 3) { + helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); + return; + } + + //GifLoaderDialogUtils.showMyDialog(context); + + await model.getMedicationList(drug: myController.text); + //GifLoaderDialogUtils.hideDialog(context); + } } diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 31dabcd2..8fe7deea 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -12,6 +12,7 @@ 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/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; @@ -141,239 +142,237 @@ class _AddSelectedProcedureState extends State { return BaseView( onModelReady: (model) => model.getCategory(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => - NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - children: [ - Row( - children: [ - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - Row( - children: [ - AppText( - 'Please Select Category', - fontWeight: FontWeight.w700, - fontSize: 20, + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + 'Please Select Category', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.29, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, ), - ], - ), - ], - ), - SizedBox( - height: 10.0, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.categoryList != null && - model.categoryList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.categoryList, - attributeName: 'categoryName', - attributeValueId: 'categoryId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - selectedCategory = selectedValue; - model.getProcedureCategory( - categoryName: selectedCategory[ - 'categoryName'], - categoryID: selectedCategory[ - 'categoryId'] <= - 9 - ? "0" + - selectedCategory[ - 'categoryId'] - .toString() - : selectedCategory[ - 'categoryId'] - .toString()); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - //model.getProcedureCategory(); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .procedureCategorise, - selectedCategory != null - ? selectedCategory['categoryName'] - : null, - true, - suffixIcon: Icon( - Icons.search, - color: Colors.black, - )), - enabled: false, - ), + onTap: () { + Navigator.pop(context); + }, + ), + ], ), - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: selectedCategory != null - ? selectedCategory['categoryId'] == 02 || - selectedCategory['categoryId'] == 03 - ? EntityListCheckboxSearchWidget( - model: widget.model, - masterList: widget.model - .categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ) - : ProcedureListWidget( - model: widget.model, - masterList: widget.model - .categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ) - : null), - SizedBox( - height: 15.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - "Fill the mandatory procedure details"); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], + SizedBox( + height: 10.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = selectedValue; + model.getProcedureCategory( + categoryName: selectedCategory[ + 'categoryName'], + categoryID: selectedCategory[ + 'categoryId'] <= + 9 + ? "0" + + selectedCategory[ + 'categoryId'] + .toString() + : selectedCategory[ + 'categoryId'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, ), ), - ], - ) - ], + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: selectedCategory != null + ? selectedCategory['categoryId'] == 02 || + selectedCategory['categoryId'] == 03 + ? EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : ProcedureListWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : null), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), + SizedBox( + height: 100.0, + ), + ], + ) + ], + ), ), ), - ), - ); - }), + ); + }), + ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), ), ); } diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart index 678a345d..29f01858 100644 --- a/lib/screens/procedures/add_lab_orders.dart +++ b/lib/screens/procedures/add_lab_orders.dart @@ -209,39 +209,6 @@ class _AddSelectedLabOrderState extends State { isEntityListSelected: (master) => isEntityListSelected(master), )), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: - "Add Lab Order", //TranslationBase.of(context) - fontWeight: FontWeight.w700, - //.addSelectedProcedures, - color: Color(0xff359846), - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - "Fill the mandatory procedure details"); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), ], ), ), @@ -249,6 +216,37 @@ class _AddSelectedLabOrderState extends State { ); }), ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: "Add Lab Order", //TranslationBase.of(context) + fontWeight: FontWeight.w700, + //.addSelectedProcedures, + color: Color(0xff359846), + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), ), ); } diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart index 56776e86..9e614d44 100644 --- a/lib/screens/procedures/add_radiology_order.dart +++ b/lib/screens/procedures/add_radiology_order.dart @@ -169,7 +169,6 @@ class _AddSelectedRadiologyOrderState extends State { fontWeight: FontWeight.w700, fontSize: 20, ), - InkWell( child: Icon( Icons.close, @@ -208,37 +207,6 @@ class _AddSelectedRadiologyOrderState extends State { isEntityListSelected: (master) => isEntityListSelected(master), )), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'Add Radiology Order', - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - "Fill the mandatory procedure details"); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ) ], ), ), @@ -246,6 +214,36 @@ class _AddSelectedRadiologyOrderState extends State { ); }), ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'Add Radiology Order', + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), ), ); } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 9608524e..f07f4a92 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -25,7 +25,8 @@ class ProcedureScreen extends StatelessWidget { String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; return BaseView( - onModelReady: (model) => model.getProcedure(mrn: patient.patientId,patientType: patientType), + onModelReady: (model) => + model.getProcedure(mrn: patient.patientId, patientType: patientType), builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, @@ -41,27 +42,28 @@ 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( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - 'Order Test or', - style: "caption2", - color: Colors.black, - fontSize: 13, - ), - Texts( - 'Procedure', - bold: true, - fontSize: 22, - ), - ], + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'Order Test or', + style: "caption2", + color: Colors.black, + fontSize: 13, + ), + Texts( + 'Procedure', + bold: true, + fontSize: 22, + ), + ], + ), ), - ), - if( patient.patientStatusType == 43) + if (patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -81,10 +83,19 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if (patientType != null && patientType == '7' && patient.patientStatusType == 43) + if (patientType != null && + patientType == '7' && + patient.patientStatusType == 43) InkWell( onTap: () { - addSelectedProcedure(context, model, patient); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddSelectedProcedure( + patient: patient, + model: model, + )), + ); }, child: Container( width: double.maxFinite, @@ -143,41 +154,43 @@ class ProcedureScreen extends StatelessWidget { patient: patient, remarks: model .procedureList[0].entityList[index].remarks, - orderType: model.procedureList[0] - .entityList[index].orderType + 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 + categoreId: model + .procedureList[0].entityList[index].categoryID .toString(), procedureId: model.procedureList[0] .entityList[index].procedureId, - limetNo: model.procedureList[0] - .entityList[index].lineItemNo); + limetNo: model.procedureList[0].entityList[index] + .lineItemNo); // } else // helpers.showErrorToast( // 'You Cant Update This Procedure'); }, ), ), - if (model.procedureList.length!=0 && patient.patientStatusType != 43) - Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(height: 100,), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts('No Procedure Found'), - ) - - ], - ), - ) + if (model.procedureList.length != 0 && + patient.patientStatusType != 43) + Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts('No Procedure Found'), + ) + ], + ), + ) ], ), ),