diff --git a/lib/config/config.dart b/lib/config/config.dart index 0283577e..c8af8ad9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4d3c0e78..d1e67692 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1003,7 +1003,9 @@ const Map> localizedValues = { "verified": {"en": "Verified", "ar": "تم التحقق"}, "endCall": {"en": "End Call", "ar": "انهاء"}, "favoriteTemplates": {"en": "Favorite Templates", "ar": "القوالب المفضلة"}, - "allProcedures": {"en": "All Procedures", "ar": "كل الإجراءات"}, - "allRadiology": {"en": "All Radiology", "ar": "كل الأشعة"}, - "allLab": {"en": "All Lab", "ar": "كل المختبرات"}, + "allProcedures": {"en": "All Procedures", "ar": "جميع الإجراءات"}, + "allRadiology": {"en": "All Radiology", "ar": "جميع الأشعة"}, + "allLab": {"en": "All Lab", "ar": "جميع المختبرات"}, + "allPrescription": {"en": "All Prescription", "ar": "جميع الوصفات"}, + "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, }; diff --git a/lib/screens/prescription/add_favourite_prescription.dart b/lib/screens/prescription/add_favourite_prescription.dart index 118df049..f9e175f6 100644 --- a/lib/screens/prescription/add_favourite_prescription.dart +++ b/lib/screens/prescription/add_favourite_prescription.dart @@ -18,7 +18,8 @@ class AddFavPrescription extends StatefulWidget { final PatiantInformtion patient; final String categoryID; - const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) : super(key: key); + const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) + : super(key: key); @override _AddFavPrescriptionState createState() => _AddFavPrescriptionState(); @@ -30,11 +31,14 @@ class _AddFavPrescriptionState extends State { List entityList = List(); ProcedureTempleteDetailsModel groupProcedures; + @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.categoryID), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( + onModelReady: (model) => + model.getProcedureTemplate(categoryID: widget.categoryID), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( isShowAppBar: false, baseViewModel: model, body: Column( @@ -59,7 +63,8 @@ class _AddFavPrescriptionState extends State { entityList.add(history); }); }, - isEntityFavListSelected: (master) => isEntityListSelected(master), + isEntityFavListSelected: (master) => + isEntityListSelected(master), groupProcedures: groupProcedures, selectProcedures: (valasd) { setState(() { @@ -109,7 +114,9 @@ class _AddFavPrescriptionState extends State { bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { Iterable history = entityList.where( - (element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); + (element) => + masterKey.templateID == element.templateID && + masterKey.procedureName == element.procedureName); if (history.length > 0) { return true; } diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index b56befdb..dd02b57e 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.da import 'package:doctor_app_flutter/screens/prescription/prescription_home_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; @@ -50,7 +52,8 @@ class PrescriptionsPage extends StatelessWidget { SizedBox( height: 12, ), - if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43) + if (model.prescriptionsList.isNotEmpty && + patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -70,7 +73,8 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && patient.patientStatusType == 43) + if (patient.patientStatusType != null && + patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -90,20 +94,25 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => PrescriptionHomeScreen( + builder: (context) => + BaseAddProcedureTabPage( patient: patient, - model: model, + prescriptionModel: model, + procedureType: + ProcedureType.PRESCRIPTION, )), ); }, - label: TranslationBase.of(context).applyForNewPrescriptionsOrder, + label: TranslationBase.of(context) + .applyForNewPrescriptionsOrder, ), ...List.generate( model.prescriptionsList.length, @@ -112,7 +121,8 @@ class PrescriptionsPage extends StatelessWidget { context, FadePage( page: PrescriptionItemsPage( - prescriptions: model.prescriptionsList[index], + prescriptions: + model.prescriptionsList[index], patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -120,16 +130,22 @@ class PrescriptionsPage extends StatelessWidget { ), ), child: DoctorCard( - doctorName: model.prescriptionsList[index].doctorName, - profileUrl: model.prescriptionsList[index].doctorImageURL, + doctorName: + model.prescriptionsList[index].doctorName, + profileUrl: model + .prescriptionsList[index].doctorImageURL, branch: model.prescriptionsList[index].name, - clinic: model.prescriptionsList[index].clinicDescription, + clinic: model.prescriptionsList[index] + .clinicDescription, isPrescriptions: true, - appointmentDate: AppDateUtils.getDateTimeFromServerFormat( - model.prescriptionsList[index].appointmentDate, + appointmentDate: + AppDateUtils.getDateTimeFromServerFormat( + model.prescriptionsList[index] + .appointmentDate, ), ))), - if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43) + if (model.prescriptionsList.isEmpty && + patient.patientStatusType != 43) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -140,7 +156,8 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noPrescriptionsFound), + child: AppText(TranslationBase.of(context) + .noPrescriptionsFound), ) ], ), @@ -165,29 +182,38 @@ class PrescriptionsPage extends StatelessWidget { FadePage( page: PrescriptionItemsInPatientPage( prescriptionIndex: index, - prescriptions: model.inPatientPrescription[index], + prescriptions: model + .inPatientPrescription[index], patient: patient, patientType: patientType, arrivalType: arrivalType, - startOn: AppDateUtils.getDateTimeFromServerFormat( - model.inPatientPrescription[index].startDatetime, + startOn: AppDateUtils + .getDateTimeFromServerFormat( + model.inPatientPrescription[index] + .startDatetime, ), - stopOn: AppDateUtils.getDateTimeFromServerFormat( - model.inPatientPrescription[index].stopDatetime, + stopOn: AppDateUtils + .getDateTimeFromServerFormat( + model.inPatientPrescription[index] + .stopDatetime, ), ), ), ), child: InPatientDoctorCard( - doctorName: model.inPatientPrescription[index].itemDescription, + doctorName: model.inPatientPrescription[index] + .itemDescription, profileUrl: 'sss', branch: 'hamza', clinic: 'basheer', isPrescriptions: true, - appointmentDate: AppDateUtils.getDateTimeFromServerFormat( - model.inPatientPrescription[index].prescriptionDatetime, + appointmentDate: + AppDateUtils.getDateTimeFromServerFormat( + model.inPatientPrescription[index] + .prescriptionDatetime, ), - createdBy: model.inPatientPrescription[index].createdByName, + createdBy: model.inPatientPrescription[index] + .createdByName, ))), if (model.inPatientPrescription.length == 0) Center( @@ -200,7 +226,8 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noPrescriptionsFound), + child: AppText(TranslationBase.of(context) + .noPrescriptionsFound), ) ], ), diff --git a/lib/screens/procedures/ProcedureType.dart b/lib/screens/procedures/ProcedureType.dart index 44ac0a9d..ad896a1f 100644 --- a/lib/screens/procedures/ProcedureType.dart +++ b/lib/screens/procedures/ProcedureType.dart @@ -5,10 +5,10 @@ enum ProcedureType { PROCEDURE, LAB_RESULT, RADIOLOGY, + PRESCRIPTION, } extension procedureType on ProcedureType { - String getFavouriteTabName(BuildContext context) { return TranslationBase.of(context).favoriteTemplates; } @@ -21,6 +21,8 @@ extension procedureType on ProcedureType { return TranslationBase.of(context).allLab; case ProcedureType.RADIOLOGY: return TranslationBase.of(context).allRadiology; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).allPrescription; default: return ""; } @@ -34,6 +36,8 @@ extension procedureType on ProcedureType { return TranslationBase.of(context).addLabOrder; case ProcedureType.RADIOLOGY: return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).addPrescription; default: return ""; } @@ -47,6 +51,8 @@ extension procedureType on ProcedureType { return TranslationBase.of(context).addLabOrder; case ProcedureType.RADIOLOGY: return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).addPrescription; default: return ""; } @@ -58,8 +64,8 @@ extension procedureType on ProcedureType { return null; case ProcedureType.LAB_RESULT: return "02"; - case ProcedureType.RADIOLOGY: - return "03"; + case ProcedureType.PRESCRIPTION: + return "55"; default: return null; } @@ -77,5 +83,4 @@ extension procedureType on ProcedureType { return null; } } - } diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 66118508..ebbf9b5b 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_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/prescription/prescription_checkout_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -17,12 +19,14 @@ import 'ProcedureType.dart'; class AddFavouriteProcedure extends StatefulWidget { final ProcedureViewModel model; + final PrescriptionViewModel prescriptionModel; final PatiantInformtion patient; final ProcedureType procedureType; AddFavouriteProcedure({ Key key, this.model, + this.prescriptionModel, this.patient, @required this.procedureType, }); @@ -37,6 +41,7 @@ class _AddFavouriteProcedureState extends State { ProcedureViewModel model; PatiantInformtion patient; List entityList = List(); + ProcedureTempleteDetailsModel groupProcedures; @override Widget build(BuildContext context) { @@ -55,6 +60,7 @@ class _AddFavouriteProcedureState extends State { if (model.templateList.length != 0) Expanded( child: EntityListCheckboxSearchFavProceduresWidget( + isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), model: model, removeFavProcedure: (item) { setState(() { @@ -68,6 +74,12 @@ class _AddFavouriteProcedureState extends State { }, isEntityFavListSelected: (master) => isEntityListSelected(master), + groupProcedures: groupProcedures, + selectProcedures: (valasd) { + setState(() { + groupProcedures = valasd; + }); + }, ), ), Container( @@ -81,26 +93,45 @@ class _AddFavouriteProcedureState extends State { color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } + if(widget.procedureType == ProcedureType.PRESCRIPTION){ + if (groupProcedures == null) { + DrAppToastMsg.showErrorToast( + 'Please Select item ', + ); + return; + } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ProcedureCheckOutScreen( - items: entityList, - model: model, - patient: widget.patient, - addButtonTitle: widget.procedureType.getAddButtonTitle(context), - toolbarTitle: widget.procedureType.getToolbarLabel(context), + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionCheckOutScreen( + patient: widget.patient, + model: widget.prescriptionModel, + groupProcedures: groupProcedures, + ), ), - ), - ); + ); + } else { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProcedureCheckOutScreen( + items: entityList, + model: model, + patient: widget.patient, + addButtonTitle: widget.procedureType.getAddButtonTitle(context), + toolbarTitle: widget.procedureType.getToolbarLabel(context), + ), + ), + ); + } }, ), ], diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 58efaaca..e9ab695b 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -1,8 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_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/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.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/network_base_view.dart'; @@ -15,11 +16,16 @@ import 'add-procedure-page.dart'; class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureViewModel model; + final PrescriptionViewModel prescriptionModel; final PatiantInformtion patient; final ProcedureType procedureType; const BaseAddProcedureTabPage( - {Key key, this.model, this.patient, this.procedureType}) + {Key key, + this.model, + this.prescriptionModel, + this.patient, + @required this.procedureType}) : super(key: key); @override @@ -153,15 +159,25 @@ class _BaseAddProcedureTabPageState extends State controller: _tabController, children: [ AddFavouriteProcedure( - model: model, - patient: patient, - procedureType: procedureType, - ), - AddProcedurePage( - model: model, + model: this.model, + prescriptionModel: + widget.prescriptionModel, patient: patient, procedureType: procedureType, ), + if (widget.procedureType == + ProcedureType.PRESCRIPTION) + PrescriptionFormWidget( + widget.prescriptionModel, + widget.patient, + widget.prescriptionModel + .prescriptionList) + else + AddProcedurePage( + model: this.model, + patient: patient, + procedureType: procedureType, + ), ], ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 78041705..16ae07bd 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1361,6 +1361,8 @@ class TranslationBase { String get allProcedures => localizedValues['allProcedures'][locale.languageCode]; String get allRadiology => localizedValues['allRadiology'][locale.languageCode]; String get allLab => localizedValues['allLab'][locale.languageCode]; + String get allPrescription => localizedValues['allPrescription'][locale.languageCode]; + String get addPrescription => localizedValues['addPrescription'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {