From c581638e004a2e9e0019da8e7a7c0790da343d5f Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 13 Dec 2020 14:27:04 +0200 Subject: [PATCH 01/13] refer_patient_screen 'not finshed' --- lib/config/localized_values.dart | 1 + lib/landing_page.dart | 4 +- .../profile/refer_patient_screen.dart | 191 ++++++++++-------- lib/util/translations_delegate_base.dart | 2 + lib/widgets/doctor/my_schedule_widget.dart | 59 ++++-- 5 files changed, 155 insertions(+), 102 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 78e85967..03306e37 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -248,4 +248,5 @@ const Map> localizedValues = { }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, + 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, }; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index c79d29d9..f802ddb8 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -40,9 +40,7 @@ class _LandingPageState extends State { appBar: AppBar( elevation: 0, backgroundColor: Hexcolor('#515B5D'), - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white)), + textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), title: Text(getText(currentTab).toUpperCase()), leading: Builder( builder: (BuildContext context) { diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index e12a9240..22ed20b5 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -69,7 +69,7 @@ class _ReferPatientState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).myReferralPatient, + appBarTitle: TranslationBase.of(context).referralPatient, body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError @@ -91,7 +91,7 @@ class _ReferPatientState extends State { RoundedContainer( margin: 10, showBorder: true, - raduis: 30, + raduis: 10, borderColor: Color(0xff707070), width: double.infinity, child: Padding( @@ -106,6 +106,7 @@ class _ReferPatientState extends State { Expanded( // add Expanded to have your dropdown button fill remaining space child: DropdownButton( + //hint: Text('Select Clinnic'), isExpanded: true, value: _selectedClinic, iconSize: 40, @@ -176,7 +177,7 @@ class _ReferPatientState extends State { RoundedContainer( margin: 10, showBorder: true, - raduis: 30, + raduis: 10, borderColor: Color(0xff707070), width: double.infinity, child: Padding( @@ -197,21 +198,37 @@ class _ReferPatientState extends State { elevation: 16, selectedItemBuilder: (BuildContext context) { - return patientsProv - .getDoctorNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); + return _selectedDoctor == '' + ? [ + Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + "eeeee", + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ) + ] + : patientsProv + .getDoctorNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ); + }).toList(); }, onChanged: (newValue) => { setState(() { @@ -262,13 +279,6 @@ class _ReferPatientState extends State { onChanged: (value) => {}, ), ), - AppText( - TranslationBase.of(context).priority, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), priorityBar(context), @@ -290,7 +300,7 @@ class _ReferPatientState extends State { RoundedContainer( margin: 10, showBorder: true, - raduis: 30, + raduis: 10, borderColor: Color(0xff707070), width: double.infinity, child: Padding( @@ -391,7 +401,7 @@ class _ReferPatientState extends State { ), AppButton( title: TranslationBase.of(context).send, - color: Color(PRIMARY_COLOR), + color: (Hexcolor("#B8382B")), onPressed: () => {referToDoctor(context)}, ) ], @@ -404,67 +414,78 @@ class _ReferPatientState extends State { Widget priorityBar(BuildContext _context) { List _priorities = [ - TranslationBase.of(context).veryUrgent, - TranslationBase.of(context).urgent, - TranslationBase.of(context).routine, + TranslationBase.of(context).veryUrgent.toUpperCase(), + TranslationBase.of(context).urgent.toUpperCase(), + TranslationBase.of(context).routine.toUpperCase(), ]; - return Container( - height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.9, - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _priorities.map((item) { - bool _isActive = _priorities[_activePriority] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Container( - height: 40, - width: 90, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: _isActive ? Hexcolor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - // backgroundColor:_isActive - // ? Hexcolor("#B8382B") - // : Colors.white,//sideColor, - - fontWeight: FontWeight.bold, + return Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.061999, + width: SizeConfig.screenWidth * 0.90, + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: BorderRadius.circular(10), + border: Border.all(width: 0.3), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _priorities.map((item) { + bool _isActive = + _priorities[_activePriority] == item ? true : false; + return Column(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.0559, + width: SizeConfig.screenWidth * 0.297, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8.0), + bottomLeft: Radius.circular(8.0), + topRight: Radius.circular(10.0), + bottomRight: Radius.circular(10.0), ), + color: _isActive ? Hexcolor("#B8382B") : Colors.white, ), - )), - ), - onTap: () { - print(_priorities.indexOf(item)); - setState(() { - _activePriority = _priorities.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - alignment: Alignment.center, - height: 3, - width: 90, - ) - : Container() - ]); - }).toList(), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + // backgroundColor:_isActive + // ? Hexcolor("#B8382B") + // : Colors.white,//sideColor, + + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () { + print(_priorities.indexOf(item)); + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + alignment: Alignment.center, + height: 3, + width: 90, + ) + : Container() + ]); + }).toList(), + ), ), ); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 1ea3be74..313012fb 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -275,6 +275,8 @@ class TranslationBase { localizedValues['moreThan3Letter'][locale.languageCode]; String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; + String get referralPatient => + localizedValues['referralPatient'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 68194a31..8011e6dc 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -13,19 +13,27 @@ class MyScheduleWidget extends StatelessWidget { @override Widget build(BuildContext context) { - List workingHours = Helpers.getWorkingHours(workingHoursTable.workingHours); + List workingHours = + Helpers.getWorkingHours(workingHoursTable.workingHours); return CardWithBgWidgetNew( widget: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Column( + children: [Text('${workingHoursTable.date.day}')], + ), Row( children: [ - AppText(workingHoursTable.dayName, - fontSize: 2.5 * SizeConfig.textMultiplier), AppText( - ' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}', - fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,), + workingHoursTable.dayName, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + AppText( + ' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}', + fontSize: 2.2 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ), ], ), SizedBox( @@ -44,27 +52,50 @@ class MyScheduleWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText('From',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), - SizedBox(height: 5,), - AppText(work.from,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + AppText( + 'From', + fontSize: 2.2 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + AppText( + work.from, + fontSize: 2.2 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) ], ), ), - Container(height: SizeConfig.realScreenWidth * 0.1 ,width: 0.8,color: Colors.grey, - margin: EdgeInsets.only(left: 15,right: 15),), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText('To',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), - SizedBox(height: 5,), - AppText(work.to,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + AppText( + 'To', + fontSize: 2.2 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + AppText( + work.to, + fontSize: 2.2 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) ], ), ), ], ) - ], ), ); From cbb8937b1d591099151cbdf07cca35f2973e4c46 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 14 Dec 2020 14:19:04 +0200 Subject: [PATCH 02/13] '12/14' --- lib/config/localized_values.dart | 6 +- lib/landing_page.dart | 4 +- .../profile/refer_patient_screen.dart | 623 +++++++++--------- pubspec.lock | 28 +- 4 files changed, 310 insertions(+), 351 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 84d2a7c7..4c6cd6f6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -242,7 +242,6 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' @@ -250,8 +249,5 @@ const Map> localizedValues = { 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, - 'replySuccessfully': { - 'en': 'Reply Successfully', - 'ar': 'تم الرد بنجاح' - }, + 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, }; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index f67957d3..9461e3a3 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -40,9 +40,7 @@ class _LandingPageState extends State { appBar: AppBar( elevation: 0, backgroundColor: HexColor('#515B5D'), - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white)), + textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), title: Text(getText(currentTab).toUpperCase()), leading: Builder( builder: (BuildContext context) { diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index dfb61d95..faa22ffe 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -76,324 +76,294 @@ class _ReferPatientState extends State { RoundedContainer( margin: 10, showBorder: true, - raduis: 10, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedClinic, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = null; - _selectedClinic = newValue; - var clinicInfo = model - .clinicsList - .where((i) => - i['ClinicDescription'] - .toString() - .contains( - _selectedClinic)) - .toList(); + raduis: 10, + borderColor: Color(0xff707070), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButton( + isExpanded: true, + value: _selectedClinic, + iconSize: 40, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model.getClinicNameList().map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + _selectedDoctor = null; + _selectedClinic = newValue; + var clinicInfo = model.clinicsList + .where((i) => i['ClinicDescription'] + .toString() + .contains(_selectedClinic)) + .toList(); - clinicId = clinicInfo[0]['ClinicID'] - .toString(); + clinicId = + clinicInfo[0]['ClinicID'].toString(); - model.getDoctorsList(clinicId); - }) - }, - items: model - .getClinicNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), + model.getDoctorsList(clinicId); + }) + }, + items: model.getClinicNameList().map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, ), - ), - ], + ); + }).toList(), ), ), - ), - //--------------------------------------------------------------------// - AppText( - TranslationBase.of(context).doctor, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), + ], + ), + ), + ), + //--------------------------------------------------------------------// + AppText( + TranslationBase.of(context).doctor, + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 10, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedDoctor, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getDoctorNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = newValue; - doctorsList = - model.doctorsList; + RoundedContainer( + margin: 10, + showBorder: true, + raduis: 10, + borderColor: Color(0xff707070), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButton( + isExpanded: true, + value: _selectedDoctor, + iconSize: 40, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model.getDoctorNameList().map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + _selectedDoctor = newValue; + doctorsList = model.doctorsList; - var doctorInfo = doctorsList - .where((i) => i['DoctorName'] - .toString() - .contains(_selectedDoctor)) - .toList(); - doctorId = doctorInfo[0]['DoctorID'] - .toString(); - }) - }, - items: model - .getDoctorNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), + var doctorInfo = doctorsList + .where((i) => i['DoctorName'] + .toString() + .contains(_selectedDoctor)) + .toList(); + doctorId = + doctorInfo[0]['DoctorID'].toString(); + }) + }, + items: model.getDoctorNameList().map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, ), - ), - ], + ); + }).toList(), ), ), - ), //-----------------------------/// - AppText( - TranslationBase.of(context).ext, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).ext, - controller: _extController, - inputFormatter: ONLY_NUMBERS, - textInputType: TextInputType.number, - onChanged: (value) => {}, - ), - ), - AppText( - TranslationBase.of(context).priority, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), + ], + ), + ), + ), //-----------------------------/// + AppText( + TranslationBase.of(context).ext, + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: AppTextFormField( + hintText: TranslationBase.of(context).ext, + controller: _extController, + inputFormatter: ONLY_NUMBERS, + textInputType: TextInputType.number, + onChanged: (value) => {}, + ), + ), + AppText( + TranslationBase.of(context).priority, + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), - priorityBar(context), + priorityBar(context), - AppText( - TranslationBase.of(context).referralFrequency + - getPriority(), - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), + AppText( + TranslationBase.of(context).referralFrequency + + getPriority(), + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), - AppText( - TranslationBase.of(context).referralFrequency, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 10, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedReferralFrequancy, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getReferralNamesList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedReferralFrequancy = newValue; - var freqInfo = model - .referalFrequancyList - .singleWhere((i) => i[ - 'Description'] - .toString() - .contains( - _selectedReferralFrequancy)); - freqId = freqInfo['ParameterCode'] - .toString(); - myFocusNode.requestFocus(); - }) - }, - items: model - .getReferralNamesList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), + AppText( + TranslationBase.of(context).referralFrequency, + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + RoundedContainer( + margin: 10, + showBorder: true, + raduis: 10, + borderColor: Color(0xff707070), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButton( + isExpanded: true, + value: _selectedReferralFrequancy, + iconSize: 40, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model + .getReferralNamesList() + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item, + fontSize: + SizeConfig.textMultiplier * 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + _selectedReferralFrequancy = newValue; + var freqInfo = model.referalFrequancyList + .singleWhere((i) => i['Description'] + .toString() + .contains( + _selectedReferralFrequancy)); + freqId = + freqInfo['ParameterCode'].toString(); + myFocusNode.requestFocus(); + }) + }, + items: model.getReferralNamesList().map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, ), - ), - ], + ); + }).toList(), ), ), - ), - AppText( - TranslationBase.of(context).clinicDetailsandRemarks, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).remarks, - focusNode: myFocusNode, - controller: _remarksController, - inputFormatter: ONLY_LETTERS, - textInputType: TextInputType.text, - onChanged: (value) => {}, + ], + ), + ), + ), + AppText( + TranslationBase.of(context).clinicDetailsandRemarks, + fontSize: 18, + fontWeight: FontWeight.bold, + marginLeft: 15, + marginTop: 15, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: AppTextFormField( + hintText: TranslationBase.of(context).remarks, + focusNode: myFocusNode, + controller: _remarksController, + inputFormatter: ONLY_LETTERS, + textInputType: TextInputType.text, + onChanged: (value) => {}, + ), + ), + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + children: [ + AppText( + TranslationBase.of(context).pleaseFill, + color: Colors.red, + fontWeight: FontWeight.bold, + margin: 10, + visibility: isValid == null ? false : !isValid, ), - ), - Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - children: [ - AppText( - TranslationBase.of(context).pleaseFill, - color: Colors.red, - fontWeight: FontWeight.bold, - margin: 10, - visibility: - isValid == null ? false : !isValid, - ), - // TODO replace AppButton with secondary button and add loading - AppButton( - title: TranslationBase - .of(context) - .send, - color: Color(PRIMARY_COLOR), - onPressed: () => - { - referToDoctor(context, model) - }, - title: TranslationBase.of(context).send, - color: (Hexcolor("#B8382B")), - onPressed: () => {referToDoctor(context)}, - ) - ], - )) - ], + // TODO replace AppButton with secondary button and add loading + AppButton( + title: TranslationBase.of(context).send, + color: Color(PRIMARY_COLOR), + onPressed: () => {referToDoctor(context, model)}, + ) + ], + )) + ], + ), ), - ), - ),); + ), + ); } Widget priorityBar(BuildContext _context) { @@ -436,30 +406,29 @@ class _ReferPatientState extends State { // ? Hexcolor("#B8382B") // : Colors.white,//sideColor, - fontWeight: FontWeight.bold, - ), + fontWeight: FontWeight.bold, ), - )), - ), - onTap: () { - print(_priorities.indexOf(item)); - setState(() { - _activePriority = _priorities.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - alignment: Alignment.center, - height: 3, - width: 90, - ) - : Container() - ]); - }).toList(), - ), + ), + )), + ), + onTap: () { + print(_priorities.indexOf(item)); + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + alignment: Alignment.center, + height: 3, + width: 90, + ) + : Container() + ]); + }).toList(), ), ); } @@ -488,10 +457,7 @@ class _ReferPatientState extends State { return; } - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; try { @@ -508,8 +474,7 @@ class _ReferPatientState extends State { selectedDoctorID: doctorId.toString(), projectID: patient.projectId); // TODO: Add Translation - DrAppToastMsg.showSuccesToast( - 'Reply Successfully'); + DrAppToastMsg.showSuccesToast('Reply Successfully'); Navigator.pop(context); } catch (e) { DrAppToastMsg.showErrorToast(e); diff --git a/pubspec.lock b/pubspec.lock index ae4f6a70..23540004 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "14.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "0.41.1" archive: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.4" + version: "0.4.5" build_daemon: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: build_modules url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" build_resolvers: dependency: transitive description: @@ -98,21 +98,21 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.10.7" + version: "1.10.9" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" build_web_compilers: dependency: "direct dev" description: name: build_web_compilers url: "https://pub.dartlang.org" source: hosted - version: "2.12.2" + version: "2.15.3" built_collection: dependency: transitive description: @@ -161,7 +161,7 @@ packages: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.4" cli_util: dependency: transitive description: @@ -426,7 +426,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -468,7 +468,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -622,7 +622,7 @@ packages: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.1.7" quiver: dependency: transitive description: @@ -725,7 +725,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: @@ -767,7 +767,7 @@ packages: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "0.1.1+3" typed_data: dependency: transitive description: @@ -860,5 +860,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.11.0-162.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0" From 749e870ea2ed937efbdbcabda36fc2afb0dacc0a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 28 Dec 2020 10:47:29 +0200 Subject: [PATCH 03/13] get procedures get prescription --- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 9 + lib/config/localized_values.dart | 20 +- .../model/post_prescrition_req_model.dart | 106 +++++ lib/core/model/prescription_model.dart | 157 +++++++ lib/core/model/prescription_req_model.dart | 18 + .../model/procedure/get_procedure_model.dart | 89 ++++ .../procedure/get_procedure_req_model.dart | 40 ++ .../procedure/post_procedure_req_model.dart | 87 ++++ lib/core/service/prescription_service.dart | 45 ++ lib/core/service/procedure_service.dart | 48 ++ .../viewModel/prescription_view_model.dart | 38 ++ lib/core/viewModel/procedure_View_model.dart | 23 + lib/landing_page.dart | 4 +- lib/locator.dart | 8 + ...list_doctor_working_hours_table_model.dart | 12 +- lib/routes.dart | 7 + .../patients/patient_search_screen.dart | 2 +- .../prescription/add_prescription_form.dart | 212 +++++++++ .../prescription_authorazation_form.dart | 0 .../prescription/prescription_screen.dart | 405 ++++++++++++++++ .../prescription/prescription_warnings.dart | 168 +++++++ lib/screens/procedures/procedure_screen.dart | 440 ++++++++++++++++++ lib/util/translations_delegate_base.dart | 30 +- lib/widgets/doctor/my_schedule_widget.dart | 86 ++-- .../profile/profile_medical_info_widget.dart | 28 +- lib/widgets/shared/TextFields.dart | 302 ++++++++---- lib/widgets/shared/app_buttons_widget.dart | 37 +- lib/widgets/shared/app_text_form_field.dart | 87 ++-- lib/widgets/shared/app_texts_widget.dart | 39 +- 30 files changed, 2307 insertions(+), 242 deletions(-) create mode 100644 lib/core/model/post_prescrition_req_model.dart create mode 100644 lib/core/model/prescription_model.dart create mode 100644 lib/core/model/prescription_req_model.dart create mode 100644 lib/core/model/procedure/get_procedure_model.dart create mode 100644 lib/core/model/procedure/get_procedure_req_model.dart create mode 100644 lib/core/model/procedure/post_procedure_req_model.dart create mode 100644 lib/core/service/prescription_service.dart create mode 100644 lib/core/service/procedure_service.dart create mode 100644 lib/core/viewModel/prescription_view_model.dart create mode 100644 lib/core/viewModel/procedure_View_model.dart create mode 100644 lib/screens/prescription/add_prescription_form.dart create mode 100644 lib/screens/prescription/prescription_authorazation_form.dart create mode 100644 lib/screens/prescription/prescription_screen.dart create mode 100644 lib/screens/prescription/prescription_warnings.dart create mode 100644 lib/screens/procedures/procedure_screen.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..d540a4ee 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -30,7 +30,7 @@ Helpers helpers = new Helpers(); * */ class BaseAppClient { //TODO change the post fun to nun static when you change all service - post( + post( String endPoint, { Map body, Function(dynamic response, int statusCode) onSuccess, diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..226da593 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -77,6 +77,13 @@ const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_PRESCRIPTION_LIST = + 'Services/DoctorApplication.svc/REST/GetPrescription'; + +const POST_PRESCRIPTION_LIST = + 'Services/DoctorApplication.svc/REST/PostPrescription'; +const GET_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/GetProcedure'; +const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure'; var selectedPatientType = 1; @@ -131,6 +138,8 @@ const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; +const VIDA_AUTH = + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiMmI5ZTZlYmYtZmYzMC00ZmEyLTgwYjUtZGJlODM2MmZlNmNhIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1NzU3MTYiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwNzk3Mjk1MCwiZXhwIjoxNjA4ODM2OTUwLCJpYXQiOjE2MDc5NzI5NTB9.nHDltbMuIA3o4Gqa7mQ88fowDy6Oey9fG1zF45dumec'; /// Timer Info const TIMER_MIN = 10; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d766a5d2..c42d0c06 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -255,17 +255,13 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - 'replySuccessfully': { - 'en': 'Reply Successfully', - 'ar': 'تم الرد بنجاح' - }, + 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, 'admissionNo': {'en': 'ADMISSION #: ', 'ar': 'قبول #:'}, @@ -274,5 +270,17 @@ const Map> localizedValues = { 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, - 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, + 'noPrescriptionListed': { + 'en': 'NO PRESCRIPTION LISTED', + 'ar': 'لم يتم سرد أي وصف' + }, + 'addNow': {'en': 'ADD Now', 'ar': 'اضف الآن'}, + 'orderType': {'en': 'Order Type', 'ar': 'نوع الطلب'}, + 'strength': {'en': 'Strength', 'ar': 'شدة'}, + 'doseTime': {'en': 'Dose Time', 'ar': 'وقت الجرعة'}, + 'indication': {'en': 'Indication', 'ar': 'دواعي الاستخدام'}, + 'duration': {'en': 'Duration', 'ar': 'المدة الزمنية'}, + 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, + 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, + 'route': {'en': 'Route', 'ar': 'المسار'}, }; diff --git a/lib/core/model/post_prescrition_req_model.dart b/lib/core/model/post_prescrition_req_model.dart new file mode 100644 index 00000000..892854aa --- /dev/null +++ b/lib/core/model/post_prescrition_req_model.dart @@ -0,0 +1,106 @@ +class PostPrescriptionReqModel { + String vidaAuthTokenID; + int clinicID; + int episodeID; + int appointmentNo; + int patientMRN; + List prescriptionRequestModel; + + PostPrescriptionReqModel( + {this.vidaAuthTokenID = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiYTYxZjAyZjItNzUwZS00MTZkLWEzOTQtZTRjZmViZGVjMDE5IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUzNTIiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODUzMDAyNywiZXhwIjoxNjA5Mzk0MDI3LCJpYXQiOjE2MDg1MzAwMjd9.M1NTREPgz5vQH_GTZ_KGb0xQW5HEDs47AtNR3jbqnms", + this.clinicID = 1, + this.episodeID = 200012117, + this.appointmentNo = 2016054573, + this.patientMRN = 3120690, + this.prescriptionRequestModel}); + + PostPrescriptionReqModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + clinicID = json['ClinicID']; + episodeID = json['EpisodeID']; + appointmentNo = json['AppointmentNo']; + patientMRN = json['PatientMRN']; + if (json['prescriptionRequestModel'] != null) { + prescriptionRequestModel = new List(); + json['prescriptionRequestModel'].forEach((v) { + prescriptionRequestModel.add(new PrescriptionRequestModel.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['ClinicID'] = this.clinicID; + data['EpisodeID'] = this.episodeID; + data['AppointmentNo'] = this.appointmentNo; + data['PatientMRN'] = this.patientMRN; + if (this.prescriptionRequestModel != null) { + data['prescriptionRequestModel'] = + this.prescriptionRequestModel.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PrescriptionRequestModel { + int itemId; + String doseStartDate; + int duration; + int dose; + int doseUnitId; + int route; + int frequency; + int doseTime; + bool covered; + bool approvalRequired; + String remarks; + String icdcode10Id; + + PrescriptionRequestModel( + {this.itemId = 4, + this.doseStartDate = "2020-12-20T13:07:41.769Z", + this.duration = 2, + this.dose = 1, + this.doseUnitId = 1, + this.route = 1, + this.frequency = 1, + this.doseTime = 1, + this.covered = true, + this.approvalRequired = true, + this.remarks = "test1", + this.icdcode10Id = "test3"}); + + PrescriptionRequestModel.fromJson(Map json) { + itemId = json['itemId']; + doseStartDate = json['doseStartDate']; + duration = json['duration']; + dose = json['dose']; + doseUnitId = json['doseUnitId']; + route = json['route']; + frequency = json['frequency']; + doseTime = json['doseTime']; + covered = json['covered']; + approvalRequired = json['approvalRequired']; + remarks = json['remarks']; + icdcode10Id = json['icdcode10Id']; + } + + Map toJson() { + final Map data = new Map(); + data['itemId'] = this.itemId; + data['doseStartDate'] = this.doseStartDate; + data['duration'] = this.duration; + data['dose'] = this.dose; + data['doseUnitId'] = this.doseUnitId; + data['route'] = this.route; + data['frequency'] = this.frequency; + data['doseTime'] = this.doseTime; + data['covered'] = this.covered; + data['approvalRequired'] = this.approvalRequired; + data['remarks'] = this.remarks; + data['icdcode10Id'] = this.icdcode10Id; + return data; + } +} diff --git a/lib/core/model/prescription_model.dart b/lib/core/model/prescription_model.dart new file mode 100644 index 00000000..9fcf3050 --- /dev/null +++ b/lib/core/model/prescription_model.dart @@ -0,0 +1,157 @@ +class PrescriptionModel { + List entityList; + dynamic rowcount; + dynamic statusMessage; + + PrescriptionModel({this.entityList, this.rowcount, this.statusMessage}); + + PrescriptionModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + dynamic appointmentNo; + dynamic clinicName; + dynamic createdBy; + dynamic createdOn; + dynamic doctorName; + dynamic doseDailyQuantity; + dynamic doseDailyUnitID; + dynamic doseDetail; + dynamic doseDurationDays; + dynamic doseTimingID; + dynamic episodeID; + dynamic frequencyID; + dynamic icdCode10ID; + dynamic indication; + dynamic isDispensed; + dynamic isMedicineCovered; + dynamic isSIG; + dynamic medicationName; + dynamic medicationPrice; + dynamic medicineCode; + dynamic orderTypeDescription; + dynamic qty; + dynamic quantity; + dynamic remarks; + dynamic routeID; + dynamic startDate; + dynamic status; + dynamic stopDate; + dynamic uom; + + EntityList( + {this.appointmentNo, + this.clinicName, + this.createdBy, + this.createdOn, + this.doctorName, + this.doseDailyQuantity, + this.doseDailyUnitID, + this.doseDetail, + this.doseDurationDays, + this.doseTimingID, + this.episodeID, + this.frequencyID, + this.icdCode10ID, + this.indication, + this.isDispensed, + this.isMedicineCovered, + this.isSIG, + this.medicationName, + this.medicationPrice, + this.medicineCode, + this.orderTypeDescription, + this.qty, + this.quantity, + this.remarks, + this.routeID, + this.startDate, + this.status, + this.stopDate, + this.uom}); + + EntityList.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + clinicName = json['clinicName']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + doseDailyQuantity = json['doseDailyQuantity']; + doseDailyUnitID = json['doseDailyUnitID']; + doseDetail = json['doseDetail']; + doseDurationDays = json['doseDurationDays']; + doseTimingID = json['doseTimingID']; + episodeID = json['episodeID']; + frequencyID = json['frequencyID']; + icdCode10ID = json['icdCode10ID']; + indication = json['indication']; + isDispensed = json['isDispensed']; + isMedicineCovered = json['isMedicineCovered']; + isSIG = json['isSIG']; + medicationName = json['medicationName']; + medicationPrice = json['medicationPrice']; + medicineCode = json['medicineCode']; + orderTypeDescription = json['orderTypeDescription']; + qty = json['qty']; + quantity = json['quantity']; + remarks = json['remarks']; + routeID = json['routeID']; + startDate = json['startDate']; + status = json['status']; + stopDate = json['stopDate']; + uom = json['uom']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['clinicName'] = this.clinicName; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['doseDailyQuantity'] = this.doseDailyQuantity; + data['doseDailyUnitID'] = this.doseDailyUnitID; + data['doseDetail'] = this.doseDetail; + data['doseDurationDays'] = this.doseDurationDays; + data['doseTimingID'] = this.doseTimingID; + data['episodeID'] = this.episodeID; + data['frequencyID'] = this.frequencyID; + data['icdCode10ID'] = this.icdCode10ID; + data['indication'] = this.indication; + data['isDispensed'] = this.isDispensed; + data['isMedicineCovered'] = this.isMedicineCovered; + data['isSIG'] = this.isSIG; + data['medicationName'] = this.medicationName; + data['medicationPrice'] = this.medicationPrice; + data['medicineCode'] = this.medicineCode; + data['orderTypeDescription'] = this.orderTypeDescription; + data['qty'] = this.qty; + data['quantity'] = this.quantity; + data['remarks'] = this.remarks; + data['routeID'] = this.routeID; + data['startDate'] = this.startDate; + data['status'] = this.status; + data['stopDate'] = this.stopDate; + data['uom'] = this.uom; + return data; + } +} diff --git a/lib/core/model/prescription_req_model.dart b/lib/core/model/prescription_req_model.dart new file mode 100644 index 00000000..3accb428 --- /dev/null +++ b/lib/core/model/prescription_req_model.dart @@ -0,0 +1,18 @@ +class PrescriptionReqModel { + String vidaAuthTokenID; + dynamic patientMRN; + + PrescriptionReqModel({this.vidaAuthTokenID, this.patientMRN}); + + PrescriptionReqModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + return data; + } +} diff --git a/lib/core/model/procedure/get_procedure_model.dart b/lib/core/model/procedure/get_procedure_model.dart new file mode 100644 index 00000000..bdb69b1c --- /dev/null +++ b/lib/core/model/procedure/get_procedure_model.dart @@ -0,0 +1,89 @@ +class GetProcedureModel { + List entityList; + int rowcount; + dynamic statusMessage; + + GetProcedureModel({this.entityList, this.rowcount, this.statusMessage}); + + GetProcedureModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + bool allowedClinic; + String category; + String categoryID; + String genderValidation; + String group; + String orderedValidation; + int price; + String procedureId; + String procedureName; + String specialPermission; + String subGroup; + String template; + + EntityList( + {this.allowedClinic, + this.category, + this.categoryID, + this.genderValidation, + this.group, + this.orderedValidation, + this.price, + this.procedureId, + this.procedureName, + this.specialPermission, + this.subGroup, + this.template}); + + EntityList.fromJson(Map json) { + allowedClinic = json['allowedClinic']; + category = json['category']; + categoryID = json['categoryID']; + genderValidation = json['genderValidation']; + group = json['group']; + orderedValidation = json['orderedValidation']; + price = json['price']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + specialPermission = json['specialPermission']; + subGroup = json['subGroup']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['allowedClinic'] = this.allowedClinic; + data['category'] = this.category; + data['categoryID'] = this.categoryID; + data['genderValidation'] = this.genderValidation; + data['group'] = this.group; + data['orderedValidation'] = this.orderedValidation; + data['price'] = this.price; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['specialPermission'] = this.specialPermission; + data['subGroup'] = this.subGroup; + data['template'] = this.template; + return data; + } +} diff --git a/lib/core/model/procedure/get_procedure_req_model.dart b/lib/core/model/procedure/get_procedure_req_model.dart new file mode 100644 index 00000000..1769f43f --- /dev/null +++ b/lib/core/model/procedure/get_procedure_req_model.dart @@ -0,0 +1,40 @@ +class GetProcedureReqModel { + int clinicId; + int patientMRN; + int pageSize; + int pageIndex; + List search; + dynamic categoryId; + String vidaAuthTokenID; + + GetProcedureReqModel( + {this.clinicId, + this.patientMRN, + this.pageSize, + this.pageIndex, + this.search, + this.categoryId, + this.vidaAuthTokenID}); + + GetProcedureReqModel.fromJson(Map json) { + clinicId = json['ClinicId']; + patientMRN = json['PatientMRN']; + pageSize = json['PageSize']; + pageIndex = json['PageIndex']; + search = json['Search'].cast(); + categoryId = json['CategoryId']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['ClinicId'] = this.clinicId; + data['PatientMRN'] = this.patientMRN; + data['PageSize'] = this.pageSize; + data['PageIndex'] = this.pageIndex; + data['Search'] = this.search; + data['CategoryId'] = this.categoryId; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/model/procedure/post_procedure_req_model.dart b/lib/core/model/procedure/post_procedure_req_model.dart new file mode 100644 index 00000000..52f62a11 --- /dev/null +++ b/lib/core/model/procedure/post_procedure_req_model.dart @@ -0,0 +1,87 @@ +class PostProcedureReqModel { + int patientMRN; + int appointmentNo; + int episodeID; + List procedures; + String vidaAuthTokenID; + + PostProcedureReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.procedures, + this.vidaAuthTokenID}); + + PostProcedureReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + if (json['Procedures'] != null) { + procedures = new List(); + json['Procedures'].forEach((v) { + procedures.add(new Procedures.fromJson(v)); + }); + } + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + if (this.procedures != null) { + data['Procedures'] = this.procedures.map((v) => v.toJson()).toList(); + } + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} + +class Procedures { + String procedure; + String category; + List controls; + + Procedures({this.procedure, this.category, this.controls}); + + Procedures.fromJson(Map json) { + procedure = json['Procedure']; + category = json['Category']; + if (json['Controls'] != null) { + controls = new List(); + json['Controls'].forEach((v) { + controls.add(new Controls.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['Procedure'] = this.procedure; + data['Category'] = this.category; + if (this.controls != null) { + data['Controls'] = this.controls.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Controls { + String code; + String controlValue; + + Controls({this.code, this.controlValue}); + + Controls.fromJson(Map json) { + code = json['Code']; + controlValue = json['ControlValue']; + } + + Map toJson() { + final Map data = new Map(); + data['Code'] = this.code; + data['ControlValue'] = this.controlValue; + return data; + } +} diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart new file mode 100644 index 00000000..46b93481 --- /dev/null +++ b/lib/core/service/prescription_service.dart @@ -0,0 +1,45 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PrescriptionService extends BaseService { + List _prescriptionList = List(); + List get prescriptionList => _prescriptionList; + + PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( + patientMRN: 1231755, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8", + ); + + PostPrescriptionReqModel _postPrescriptionReqModel = + PostPrescriptionReqModel(); + + Future getPrescription() async { + hasError = false; + _prescriptionList.clear(); + await baseAppClient.post(GET_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + _prescriptionList + .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _prescriptionReqModel.toJson()); + } + + Future postPrescription() async { + hasError = false; + //_prescriptionList.clear(); + await baseAppClient.post(POST_PRESCRIPTION_LIST, + onSuccess: (dynamic response, int statusCode) { + _prescriptionList + .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _postPrescriptionReqModel.toJson()); + } +} diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart new file mode 100644 index 00000000..4c795baf --- /dev/null +++ b/lib/core/service/procedure_service.dart @@ -0,0 +1,48 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class ProcedureService extends BaseService { + List _procedureList = List(); + List get procedureList => _procedureList; + + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( + clinicId: 0, + pageSize: 10, + pageIndex: 1, + patientMRN: 0, + //categoryId: null, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", + + search: ["lab"], + ); + + PostProcedureReqModel _postProcedureReqModel = PostProcedureReqModel(); + + Future getProcedure() async { + hasError = false; + _procedureList.clear(); + await baseAppClient.post(GET_PROCEDURE_LIST, + onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetProcedureModel.fromJson(response['ProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getProcedureReqModel.toJson()); + } + + Future postProcedure() async { + hasError = false; + _procedureList.clear(); + await baseAppClient.post(POST_PROCEDURE_LIST, + onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetProcedureModel.fromJson(response['ProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _postProcedureReqModel.toJson()); + } +} diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart new file mode 100644 index 00000000..4ab4b3f7 --- /dev/null +++ b/lib/core/viewModel/prescription_view_model.dart @@ -0,0 +1,38 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; + +class PrescriptionViewModel extends BaseViewModel { + bool hasError = false; + PrescriptionService _prescriptionService = locator(); + + List get prescriptionList => + _prescriptionService.prescriptionList; + + Future getPrescription() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getPrescription(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postPrescription() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.postPrescription(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart new file mode 100644 index 00000000..f65c0b2e --- /dev/null +++ b/lib/core/viewModel/procedure_View_model.dart @@ -0,0 +1,23 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; +import 'package:doctor_app_flutter/core/service/procedure_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; + +class ProcedureViewModel extends BaseViewModel { + bool hasError = false; + ProcedureService _procedureService = locator(); + List get procedureList => _procedureService.procedureList; + + Future getProcedure() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getProcedure(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 9461e3a3..edfc496c 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/screens/dashboard_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/message_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/services_screen.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart'; @@ -64,7 +65,8 @@ class _LandingPageState extends State { builder: Builder(builder: (context) => DashboardScreen()), ), MessagesScreen(), - MyScheduleScreen(), + //MyScheduleScreen(), + NewPrescriptionScreen(), ServicesScreen() ], ), diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..a12cc138 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,5 +1,9 @@ import 'package:doctor_app_flutter/core/service/patient_service.dart'; +import 'package:doctor_app_flutter/core/service/prescription_service.dart'; +import 'package:doctor_app_flutter/core/service/procedure_service.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_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:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; @@ -24,6 +28,8 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => PrescriptionService()); + locator.registerLazySingleton(() => ProcedureService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -32,4 +38,6 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => PrescriptionViewModel()); + locator.registerFactory(() => ProcedureViewModel()); } diff --git a/lib/models/doctor/list_doctor_working_hours_table_model.dart b/lib/models/doctor/list_doctor_working_hours_table_model.dart index cb103c8a..5f1630bc 100644 --- a/lib/models/doctor/list_doctor_working_hours_table_model.dart +++ b/lib/models/doctor/list_doctor_working_hours_table_model.dart @@ -5,10 +5,14 @@ class ListDoctorWorkingHoursTable { String dayName; String workingHours; - ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours}); + ListDoctorWorkingHoursTable({ + this.date, + this.dayName, + this.workingHours, + }); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = Helpers.convertStringToDate(json['Date']) ; + date = Helpers.convertStringToDate(json['Date']); dayName = json['DayName']; workingHours = json['WorkingHours']; } @@ -18,6 +22,7 @@ class ListDoctorWorkingHoursTable { data['Date'] = this.date; data['DayName'] = this.dayName; data['WorkingHours'] = this.workingHours; + return data; } } @@ -25,6 +30,5 @@ class ListDoctorWorkingHoursTable { class WorkingHours { String from; String to; - WorkingHours({this.from,this.to}); - + WorkingHours({this.from, this.to}); } diff --git a/lib/routes.dart b/lib/routes.dart index dff02129..13e1e31f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -37,6 +38,7 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; +import 'screens/prescription/prescription_screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -73,6 +75,8 @@ const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; // const String VIDEO_CALL = 'video-call'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; +const String ORDER_PRESCRIPTION = 'prescription/prescriptionsss'; +const String ORDER_PROCEDURE = 'procedure/procedure'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; var routes = { ROOT: (_) => RootPage(), @@ -109,5 +113,8 @@ var routes = { IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), + ORDER_PRESCRIPTION: (_) => NewPrescriptionScreen(), + ORDER_PROCEDURE: (_) => ProcedureScreen(), + // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() }; diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 204d2336..de61b8a5 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -545,7 +545,7 @@ class _PatientSearchScreenState extends State { ), ], ), - ) + ), ], )); } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart new file mode 100644 index 00000000..40704009 --- /dev/null +++ b/lib/screens/prescription/add_prescription_form.dart @@ -0,0 +1,212 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +void addPrescriptionForm(context) { + final GlobalKey _formKey = GlobalKey(); + final double spaceBetweenTextFileds = 12; + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext bc) { + return SingleChildScrollView( + child: Container( + height: 700, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText( + TranslationBase.of(context).medicines.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: _formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: + TranslationBase.of(context).searchMedicine, + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + ), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).orderType, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).strength, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).route, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).frequency, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).doseTime, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).indication, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).fromDate, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: TranslationBase.of(context).duration, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: + TranslationBase.of(context).instruction, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: + EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: + TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + prescriptionWarning(context); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + }); +} diff --git a/lib/screens/prescription/prescription_authorazation_form.dart b/lib/screens/prescription/prescription_authorazation_form.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart new file mode 100644 index 00000000..4ccebf39 --- /dev/null +++ b/lib/screens/prescription/prescription_screen.dart @@ -0,0 +1,405 @@ +import 'package:doctor_app_flutter/config/config.dart'; +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/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.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_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class NewPrescriptionScreen extends StatefulWidget { + @override + _NewPrescriptionScreenState createState() => _NewPrescriptionScreenState(); +} + +class _NewPrescriptionScreenState extends State { + int testNum = 0; + PatiantInformtion patient; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getPrescription(), + builder: (BuildContext context, PrescriptionViewModel model, + Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescription, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + if (model.prescriptionList.length > 0) + Row( + children: [ + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.patientId.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ) + ], + ), + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + if (model.prescriptionList.length != 0) + SizedBox( + height: model.prescriptionList[0].rowcount == 0 + ? 200.0 + : 10.0), + //model.prescriptionList == null + if (model.prescriptionList.length != 0) + model.prescriptionList[0].rowcount == 0 + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm(context); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(12.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + ' Add more medication', + fontWeight: FontWeight.w100, + fontSize: 12.5, + ), + Icon( + Icons.add, + color: Color(0XFFB8382C), + ) + ], + ), + ), + ), + onTap: () { + addPrescriptionForm(context); + }, + ), + SizedBox( + height: 15.0, + ), + ...List.generate( + model.prescriptionList[0].rowcount, + (index) => Container( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.2, + width: + MediaQuery.of(context) + .size + .width * + 0.09, + child: Column( + children: [ + AppText( + '8\nDEC', + color: Colors.green, + ) + ], + ), + ), + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.24, + width: + MediaQuery.of(context) + .size + .width * + 0.81, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Start Date:', + fontWeight: + FontWeight + .w900, + fontSize: 15.0, + ), + AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .startDate, + fontSize: 11.0, + ), + SizedBox( + width: 6.0, + ), + AppText( + 'Order Type:', + fontWeight: + FontWeight + .w900, + fontSize: 15.0, + ), + AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .orderTypeDescription, + fontSize: 13.0, + ), + ], + ), + SizedBox( + height: 2.5, + ), + Row( + children: [ + Container( + child: Expanded( + child: + AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .medicationName, + ), + ), + ) + ], + ), + Row( + children: [ + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .doseDetail, + fontSize: + 13.0, + ), + ) + ], + ), + SizedBox( + height: 3.0, + ), + Row( + children: [ + AppText( + 'Indication: ', + fontWeight: + FontWeight + .w900, + ), + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .indication, + fontSize: + 12.9), + ) + ], + ), + SizedBox( + height: 15.0, + ), + Row( + children: [ + AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .doctorName, + fontWeight: + FontWeight + .w900, + ) + ], + ), + Row( + children: [ + AppText(model + .prescriptionList[ + 0] + .entityList[ + index] + .remarks), + ], + ), + SizedBox( + height: 15.0, + ), + + Divider( + height: 0, + thickness: 1.0, + color: Colors.grey, + ), + // SizedBox( + // height: 40, + // ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + )), + ); + } +} diff --git a/lib/screens/prescription/prescription_warnings.dart b/lib/screens/prescription/prescription_warnings.dart new file mode 100644 index 00000000..44bcab0c --- /dev/null +++ b/lib/screens/prescription/prescription_warnings.dart @@ -0,0 +1,168 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +void prescriptionWarning(context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + height: 600, + child: Column( + children: [ + ...List.generate( + 5, + (index) => Container( + child: ExpansionTile( + title: AppText('Prescription warning and alerts(0)'), + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + 'DOSESCREENINGRESULTFORETCETC', + color: Color(0XFFB8382C), + ) + ], + ) + ], + ), + ), + ), + SizedBox( + height: 10.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: + Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Remarks', + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox( + height: 95.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'CONTINUE', + onPressed: () { + Navigator.pop(context); + authorizationForm(context); + }, + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + color: Colors.white, + title: 'remove', + fontColor: Colors.red, + onPressed: () { + Navigator.pop(context); + prescriptionWarning(context); + }, + ), + ], + ), + ), + ], + ), + ), + )); + }); +} + +void authorizationForm(context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return Container( + height: 500, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Prescription authorization'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 30.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Auth ID', + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Password', + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + obscureText: true, + ), + ), + SizedBox( + height: 190.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'CONTINUE', + onPressed: () { + Navigator.pop(context); + authorizationForm(context); + }, + ), + ], + ), + ), + ], + ), + ), + )); + }); +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart new file mode 100644 index 00000000..3af63004 --- /dev/null +++ b/lib/screens/procedures/procedure_screen.dart @@ -0,0 +1,440 @@ +import 'package:doctor_app_flutter/config/config.dart'; +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/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.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_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class ProcedureScreen extends StatefulWidget { + @override + _ProcedureScreenState createState() => _ProcedureScreenState(); +} + +class _ProcedureScreenState extends State { + int testNum = 1; + PatiantInformtion patient; + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + return BaseView( + onModelReady: (model) => model.getProcedure(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: 'ORDER PROCEDURE', + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(12.0), + child: Row( + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + children: [ + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.patientId.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ) + ], + ), + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + if (model.procedureList.length != 0) + SizedBox( + height: model.procedureList[0].rowcount == 0 + ? 200.0 + : 10.0), + //model.prescriptionList == null + if (model.procedureList.length != 0) + model.procedureList[0].rowcount == 0 + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addSelectedProcedure(context); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + 'NO ORDER FOR PROCEDURE LISTED', + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(16.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + ' Add more procedure', + fontWeight: FontWeight.w100, + fontSize: 12.5, + ), + Icon( + Icons.add, + color: Color(0XFFB8382C), + ) + ], + ), + ), + ), + onTap: () { + addSelectedProcedure(context); + }, + ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // child: AppTextFormField( + // labelText: 'Add more procedure', + // borderColor: Colors.white, + // //suffixIcon: Icons.search, + // + // //textInputType: TextInputType.number, + // inputFormatter: ONLY_NUMBERS, + // onTap: () { + // addSelectedProcedure(context); + // }, + // ), + // ), + SizedBox( + height: 35.0, + ), + ...List.generate( + model.procedureList[0].rowcount, + (index) => Container( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + Container( + height: 120.0, + width: 45.0, + child: Column( + children: [ + AppText( + '8\nDEC', + color: Colors.green, + ) + ], + ), + ), + Container( + height: 120, + width: 325.0, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Code #: ', + fontWeight: + FontWeight + .w900, + fontSize: 15.0, + ), + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .procedureId + .toString(), + fontSize: 13.0, + ), + SizedBox( + width: 12.0, + ), + AppText( + 'Order Type: ', + fontWeight: + FontWeight + .w900, + fontSize: 15.0, + ), + AppText( + 'Urgent', + fontSize: 13.0, + color: + Colors.red, + ), + ], + ), + Row( + children: [ + Container( + child: Expanded( + child: + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .procedureName, + fontWeight: + FontWeight + .w800, + ), + ), + ) + ], + ), + + Row( + children: [ + AppText( + 'Price: ', + fontWeight: + FontWeight + .w900, + ), + Expanded( + child: AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .price + .toString(), + fontSize: + 13.0), + ) + ], + ), + SizedBox( + height: 10.0, + ), + + Row( + children: [ + AppText( + 'Some short remark about the procedure', + fontSize: 13.5, + ), + ], + ), + SizedBox( + height: 10.0, + ), + + Divider( + height: 5.0, + thickness: 1.0, + color: Colors.grey, + ) + // SizedBox( + // height: 40, + // ), + ], + ), + ), + Container( + width: 30, + height: 120, + child: Column( + children: [ + Icon(Icons.edit) + ], + ), + ) + ], + ), + ], + ), + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + )), + ); + } +} + +void addSelectedProcedure(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return SingleChildScrollView( + child: Container( + height: 490, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 9.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Add Delected Procedures'.toUpperCase(), + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + ), + ), + SizedBox( + height: 280.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addMedication, + // onPressed: () { + // Navigator.pop(context); + // prescriptionWarning(context); + // }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }); +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 8a8fca1a..0449a050 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -33,7 +33,8 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode]; + String get replySuccessfully => + localizedValues['replySuccessfully'][locale.languageCode]; String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; @@ -79,7 +80,8 @@ class TranslationBase { localizedValues['patientServices'][locale.languageCode]; String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; + String get myReferralPatient => + localizedValues['myReferralPatient'][locale.languageCode]; String get myReferral => localizedValues['myReferral'][locale.languageCode]; String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; @@ -119,8 +121,10 @@ class TranslationBase { String get lab => localizedValues['lab'][locale.languageCode]; String get result => localizedValues['result'][locale.languageCode]; String get medicines => localizedValues['medicines'][locale.languageCode]; - String get prescription => localizedValues['prescription'][locale.languageCode]; - String get insuranceApprovals => localizedValues['insuranceApprovals'][locale.languageCode]; + String get prescription => + localizedValues['prescription'][locale.languageCode]; + String get insuranceApprovals => + localizedValues['insuranceApprovals'][locale.languageCode]; String get insurance => localizedValues['insurance'][locale.languageCode]; String get approvals => localizedValues['approvals'][locale.languageCode]; String get bodyMeasurements => @@ -142,7 +146,8 @@ class TranslationBase { String get pleaseEnterAnswer => localizedValues['pleaseEnterAnswer'][locale.languageCode]; String get replay => localizedValues['replay'][locale.languageCode]; - String get progressNote => localizedValues['progressNote'][locale.languageCode]; + String get progressNote => + localizedValues['progressNote'][locale.languageCode]; String get progress => localizedValues['progress'][locale.languageCode]; String get note => localizedValues['note'][locale.languageCode]; String get searchNote => localizedValues['searchNote'][locale.languageCode]; @@ -286,7 +291,8 @@ class TranslationBase { localizedValues['moreThan3Letter'][locale.languageCode]; String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; - String get admissionDetail => localizedValues['admissionDetail'][locale.languageCode]; + String get admissionDetail => + localizedValues['admissionDetail'][locale.languageCode]; String get dateTime => localizedValues['dateTime'][locale.languageCode]; String get admissionNo => localizedValues['admissionNo'][locale.languageCode]; String get losNo => localizedValues['losNo'][locale.languageCode]; @@ -295,6 +301,18 @@ class TranslationBase { String get bed => localizedValues['bed'][locale.languageCode]; String get referralPatient => localizedValues['referralPatient'][locale.languageCode]; + String get noPrescriptionListed => + localizedValues['noPrescriptionListed'][locale.languageCode]; + String get addNow => localizedValues['addNow'][locale.languageCode]; + String get orderType => localizedValues['orderType'][locale.languageCode]; + String get strength => localizedValues['strength'][locale.languageCode]; + String get doseTime => localizedValues['doseTime'][locale.languageCode]; + String get indication => localizedValues['indication'][locale.languageCode]; + String get duration => localizedValues['duration'][locale.languageCode]; + String get instruction => localizedValues['instruction'][locale.languageCode]; + String get addMedication => + localizedValues['addMedication'][locale.languageCode]; + String get route => localizedValues['route'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 8011e6dc..4e4c6b8c 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -13,15 +13,23 @@ class MyScheduleWidget extends StatelessWidget { @override Widget build(BuildContext context) { - List workingHours = - Helpers.getWorkingHours(workingHoursTable.workingHours); + List workingHours = Helpers.getWorkingHours( + workingHoursTable.workingHours, + ); return CardWithBgWidgetNew( widget: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( - children: [Text('${workingHoursTable.date.day}')], + children: [ + Divider( + height: 10, + color: Colors.grey, + thickness: 1.0, + ), + Text('${workingHoursTable.date.day}') + ], ), Row( children: [ @@ -36,63 +44,39 @@ class MyScheduleWidget extends StatelessWidget { ), ], ), - SizedBox( - height: 8, - ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: workingHours.map((work) { return Container( child: Column( children: [ - Divider(color: Colors.grey), Row( children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'From', - fontSize: 2.2 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), - AppText( - work.from, - fontSize: 2.2 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - height: SizeConfig.realScreenWidth * 0.1, - width: 0.8, - color: Colors.grey, - margin: EdgeInsets.only(left: 15, right: 15), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + work.from + ' - ', + fontSize: 2.0 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'To', - fontSize: 2.2 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), - AppText( - work.to, - fontSize: 2.2 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + work.to, + fontSize: 2.0 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ), + ], ), ], ) diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index b8136026..027ea51e 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -71,6 +71,20 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).insurance, nameLine2: TranslationBase.of(context).approvals, icon: 'lab.png'), + PatientProfileButton( + key: key, + patient: patient, + route: ORDER_PRESCRIPTION, + nameLine1: 'Order', + nameLine2: 'Prescription', + icon: 'lab.png'), + PatientProfileButton( + key: key, + patient: patient, + route: ORDER_PROCEDURE, + nameLine1: 'Order Test', + nameLine2: 'Or Procedures', + icon: 'lab.png'), Visibility( visible: selectedPatientType != 0 && selectedPatientType != 5 && @@ -152,7 +166,12 @@ class PatientProfileButton extends StatelessWidget { final PatiantInformtion patient; final String url = "assets/images/"; PatientProfileButton( - {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route}) + {Key key, + this.patient, + this.nameLine1, + this.nameLine2, + this.icon, + this.route}) : super(key: key); @override Widget build(BuildContext context) { @@ -166,18 +185,17 @@ class PatientProfileButton extends StatelessWidget { Container( alignment: Alignment.topLeft, padding: EdgeInsets.all(5), - child: - Column( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( + AppText( this.nameLine1, color: Color(0xFFB9382C), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 2, ), - AppText( + AppText( this.nameLine2, color: Colors.black, fontWeight: FontWeight.w600, diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 269ad660..bd06c1dc 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -2,21 +2,88 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +class NumberTextInputFormatter extends TextInputFormatter { + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + final int newTextLength = newValue.text.length; + int selectionIndex = newValue.selection.end; + int usedSubstringIndex = 0; + final StringBuffer newText = StringBuffer(); + if (newTextLength >= 1) { + newText.write('('); + if (newValue.selection.end >= 1) selectionIndex++; + } + if (newTextLength >= 4) { + newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + if (newValue.selection.end >= 3) selectionIndex += 2; + } + if (newTextLength >= 7) { + newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + if (newValue.selection.end >= 6) selectionIndex++; + } + if (newTextLength >= 11) { + newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + if (newValue.selection.end >= 10) selectionIndex++; + } + // Dump the rest. + if (newTextLength >= usedSubstringIndex) + newText.write(newValue.text.substring(usedSubstringIndex)); + return TextEditingValue( + text: newText.toString(), + selection: TextSelection.collapsed(offset: selectionIndex), + ); + } +} +final _mobileFormatter = NumberTextInputFormatter(); class TextFields extends StatefulWidget { - - TextFields({Key key, this.type, this.hintText, this.suffixIcon, this.autoFocus, this.onChanged, this.initialValue, this.minLines, this.maxLines, this.inputFormatters, this.padding, this.focus=false, this.maxLengthEnforced=true, - this.suffixIconColor, this.inputAction, this.onSubmit, this.keepPadding=true, this.textCapitalization = TextCapitalization.none, this.onTap, this.controller, this.keyboardType, this.validator, this.borderOnlyError=false, - this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false}) : super(key: key); + TextFields( + {Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.fillColor, + this.hintColor}) + : super(key: key); final String hintText; + final String initialValue; final String type; final bool autoFocus; final IconData suffixIcon; final Color suffixIconColor; - final IconData prefixIcon; + final Icon prefixIcon; final VoidCallback onTap; final TextEditingController controller; final TextInputType keyboardType; @@ -41,6 +108,8 @@ class TextFields extends StatefulWidget { final EdgeInsets padding; final bool focus; final bool borderOnlyError; + final Color hintColor; + final Color fillColor; @override _TextFieldsState createState() => _TextFieldsState(); @@ -63,8 +132,7 @@ class _TextFieldsState extends State { @override void didUpdateWidget(TextFields oldWidget) { - if (widget.focus) - _focusNode.requestFocus(); + if (widget.focus) _focusNode.requestFocus(); super.didUpdateWidget(oldWidget); } @@ -77,25 +145,50 @@ class _TextFieldsState extends State { Widget _buildSuffixIcon() { switch (widget.type) { case "password": - { return Padding( + return Padding( padding: const EdgeInsets.only(right: 8.0), - child: view ? - InkWell(onTap: () {this.setState(() { view= false; });}, child: Icon(EvaIcons.eye, size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) - : - InkWell(onTap: () {this.setState(() { view= true; });}, child: Icon(EvaIcons.eyeOff, size: 24.0, color: Colors.grey[500])) - );} - - break; + child: view + ? InkWell( + onTap: () { + this.setState( + () { + view = false; + }, + ); + }, + child: Icon( + EvaIcons.eye, + size: 24.0, + color: Color.fromRGBO(78, 62, 253, 1.0), + ), + ) + : InkWell( + onTap: () { + this.setState(() { + view = true; + }); + }, + child: Icon(EvaIcons.eyeOff, + size: 24.0, color: Colors.grey[500]), + ), + ); default: - if (widget.suffixIcon!=null) - return InkWell(onTap: widget.onSuffixTap, child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor!=null ? widget.suffixIconColor : Colors.grey[500])); + if (widget.suffixIcon != null) + return InkWell( + onTap: widget.onSuffixTap, + child: Icon(widget.suffixIcon, + size: 22.0, + color: widget.suffixIconColor != null + ? widget.suffixIconColor + : Colors.grey[500]), + ); else return null; } } bool _determineReadOnly() { - if (widget.readOnly!=null && widget.readOnly) { + if (widget.readOnly != null && widget.readOnly) { _focusNode.unfocus(); return true; } else { @@ -105,81 +198,106 @@ class _TextFieldsState extends State { @override Widget build(BuildContext context) { - return ( - AnimatedContainer( - duration: Duration(milliseconds: 300), - decoration: widget.bare ? null :BoxDecoration( - boxShadow: [BoxShadow(color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), offset: Offset(0.0, 13.0), blurRadius: focus ? 34.0 : 12.0)] - ), - child: TextFormField( - keyboardAppearance: Theme.of(context).brightness, - scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, - textCapitalization: widget.textCapitalization, - onFieldSubmitted: widget.inputAction==TextInputAction.next ? (widget.onSubmit!=null ? widget.onSubmit : (val) { _focusNode.nextFocus(); }) : widget.onSubmit, - textInputAction: widget.inputAction, - minLines: widget.minLines ?? 1, - maxLines: widget.maxLines ?? 1, - maxLengthEnforced: widget.maxLengthEnforced, - initialValue: widget.initialValue, - onChanged: widget.onChanged, - focusNode: _focusNode, - maxLength: widget.maxLength ?? null, - controller: widget.controller, - keyboardType: widget.keyboardType, - readOnly: _determineReadOnly(), - obscureText: widget.type=="password" && !view ? true : false, - autofocus: widget.autoFocus ?? false, - validator: widget.validator, - onSaved: widget.onSaved, - style: Theme.of(context).textTheme.body2.copyWith( fontSize: widget.fontSize, fontWeight: widget.fontWeight ), - inputFormatters: widget.inputFormatters, - decoration: InputDecoration( - counterText: "", - hintText: widget.hintText, - hintStyle: TextStyle(fontSize: widget.fontSize, fontWeight: widget.fontWeight, color: Theme.of(context).hintColor), - - contentPadding: widget.padding!=null ? widget.padding : EdgeInsets.symmetric(vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, horizontal: 16.0), - filled: true, - fillColor: widget.bare ? Colors.transparent : Theme.of(context).backgroundColor, - - suffixIcon: _buildSuffixIcon(), - prefixIcon: widget.type!="search" ? - widget.prefixIcon!=null ? - Padding( - padding: EdgeInsets.only(left: 28.0, top: 14.0, bottom: 14.0, right: 0), - child: Text("\$", style: TextStyle( fontSize: 14, fontWeight: FontWeight.w800),), - ) - : - null - : - Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - - errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), - errorBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) - ) - + return (AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration: widget.bare + ? null + : BoxDecoration(boxShadow: [ + // BoxShadow( + // color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), + // offset: Offset(0.0, 13.0), + // blurRadius: focus ? 34.0 : 12.0) + BoxShadow( + color: Color.fromRGBO(110, 68, 80, focus ? 0.20 : 0), + offset: Offset(0.0, 13.0), + blurRadius: focus ? 34.0 : 12.0) + ]), + child: TextFormField( + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + initialValue: widget.initialValue, + onChanged: widget.onChanged, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + style: Theme.of(context) + .textTheme + .bodyText1 + .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + counterText: "", + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.hintColor ?? Theme.of(context).hintColor, + ), + contentPadding: widget.padding != null + ? widget.padding + : EdgeInsets.symmetric( + vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, + horizontal: 16.0), + filled: true, + fillColor: widget.bare + ? Colors.transparent + : Theme.of(context).backgroundColor, + suffixIcon: _buildSuffixIcon(), + prefixIcon: widget.prefixIcon, + errorStyle: TextStyle( + fontSize: 14.0, + fontWeight: widget.fontWeight, + height: widget.borderOnlyError ? 0.0 : null), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0), ), ), - ) - ); + ), + )); } } diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index d01fe5af..78d0bfc4 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -4,28 +4,32 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'app_texts_widget.dart'; - -class AppButton extends StatefulWidget { - +class AppButton extends StatefulWidget { final GestureTapCallback onPressed; final String title; final IconData icon; final Color color; final double fontSize; final double padding; + final Color fontColor; - AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 13}); + AppButton( + {@required this.onPressed, + this.title, + this.icon, + this.color, + this.fontSize = 2, + this.padding = 13, + this.fontColor = Colors.white}); _AppButtonState createState() => _AppButtonState(); - } - class _AppButtonState extends State{ +class _AppButtonState extends State { @override Widget build(BuildContext context) { - return - RawMaterialButton( + return RawMaterialButton( fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), splashColor: widget.color, child: Padding( @@ -50,14 +54,15 @@ class AppButton extends StatefulWidget { ), AppText( widget.title.toUpperCase(), - color: Colors.white, - fontSize: SizeConfig.textMultiplier * widget.fontSize , - ), - ], - ), + color: widget.fontColor, + fontSize: SizeConfig.textMultiplier * widget.fontSize, + ), + ], ), - onPressed: widget.onPressed, - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))), + ), + onPressed: widget.onPressed, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6))), ); } -} \ No newline at end of file +} diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index a0e91748..4af8595e 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -15,6 +15,7 @@ class AppTextFormField extends FormField { FormFieldValidator validator, ValueChanged onChanged, GestureTapCallback onTap, + bool obscureText = false, TextEditingController controller, bool autovalidate = true, TextInputType textInputType, @@ -24,6 +25,7 @@ class AppTextFormField extends FormField { ValueChanged onFieldSubmitted, IconButton prefix, String labelText, + IconData suffixIcon, borderColor}) : super( onSaved: onSaved, @@ -33,44 +35,53 @@ class AppTextFormField extends FormField { return Column( children: [ SizedBox( - height: 40.0, - child: TextFormField( - focusNode: focusNode, - keyboardType: textInputType, - inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)), - ],onChanged: onChanged?? (value){ - state.didChange(value); - }, - textInputAction: textInputAction, - onFieldSubmitted: onFieldSubmitted, - decoration: InputDecoration( - hintText: hintText, - suffixIcon: prefix, - hintStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.8,), - contentPadding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - labelText: labelText, - labelStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.7,), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(6)), - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - borderRadius: BorderRadius.all(Radius.circular(6)), - ) - //BorderRadius.all(Radius.circular(20)); - ), - onTap: onTap, - controller: controller, - ), - ), - state.hasError + height: 40.0, + child: TextFormField( + obscureText: obscureText, + focusNode: focusNode, + keyboardType: textInputType, + inputFormatters: [ + WhitelistingTextInputFormatter(RegExp(inputFormatter)), + ], + onChanged: onChanged ?? + (value) { + state.didChange(value); + }, + textInputAction: textInputAction, + onFieldSubmitted: onFieldSubmitted, + decoration: InputDecoration( + hintText: hintText, + suffixIcon: prefix, + hintStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.8, + ), + contentPadding: + EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + labelText: labelText, + labelStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(6)), + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6)), + ) + //BorderRadius.all(Radius.circular(20)); + ), + onTap: onTap, + controller: controller, + ), + ), + state.hasError ? Text( state.errorText, style: TextStyle(color: Colors.red), diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index e52dab51..53527e40 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -42,28 +42,25 @@ class AppText extends StatefulWidget { class _AppTextState extends State { @override Widget build(BuildContext context) { - return Visibility( - visible: widget.visibility, - child: Container( - margin: widget.margin != null - ? EdgeInsets.all(widget.margin) - : EdgeInsets.only( - top: widget.marginTop, - right: widget.marginRight, - bottom: widget.marginBottom, - left: widget.marginLeft), - child: Text( - widget.data, - textAlign: widget.textAlign, - overflow: TextOverflow.clip, - style: TextStyle( - color: widget.color, - fontWeight: widget.fontWeight, - fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2), - fontFamily: widget.fontFamily, + return Container( + margin: widget.margin != null + ? EdgeInsets.all(widget.margin) + : EdgeInsets.only( + top: widget.marginTop, + right: widget.marginRight, + bottom: widget.marginBottom, + left: widget.marginLeft), + child: Text( + widget.data, + textAlign: widget.textAlign, + overflow: TextOverflow.clip, + style: TextStyle( + color: widget.color, + fontWeight: widget.fontWeight, + fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2), + fontFamily: widget.fontFamily, - // backgroundColor:widget.backGroundcolor - ), + // backgroundColor:widget.backGroundcolor ), ), ); From 697f17f2cdb671b3c3d24ba8cd6635801ee644ed Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 28 Dec 2020 12:45:03 +0200 Subject: [PATCH 04/13] prescription and procedure --- lib/config/localized_values.dart | 23 +++++--- lib/routes.dart | 4 +- lib/util/translations_delegate_base.dart | 57 ++++++++++++------- .../profile/profile_medical_info_widget.dart | 21 +++---- lib/widgets/shared/TextFields.dart | 27 +++++---- lib/widgets/shared/app_text_form_field.dart | 3 +- 6 files changed, 82 insertions(+), 53 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f199776b..6859ab23 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,4 +1,4 @@ -const Map> localizedValues = { +const Map> localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, @@ -202,7 +202,10 @@ const Map> localizedValues = { 'routine': {'en': 'Routine', 'ar': 'روتيني'}, 'send': {'en': 'Send', 'ar': 'ارسال'}, 'referralFrequency': {'en': 'Referral Frequency:', 'ar': 'تواتر الحالة:'}, - 'selectReferralFrequency': {'en': 'Select Referral Frequency:', 'ar': 'اختار تواتر الحالة:'}, + 'selectReferralFrequency': { + 'en': 'Select Referral Frequency:', + 'ar': 'اختار تواتر الحالة:' + }, 'clinicalDetailsAndRemarks': { 'en': 'Clinical Details and Remarks', 'ar': 'التفاصيل السرسرية والملاحظات' @@ -258,7 +261,6 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' @@ -274,13 +276,13 @@ const Map> localizedValues = { 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'next': {'en': 'Next', 'ar': 'التالي'}, - 'healthRecordInformation': {'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي'}, + 'healthRecordInformation': { + 'en': 'HEALTH RECORD INFORMATION', + 'ar': 'معلومات السجل الصحي' + }, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, - "empty-message": { - "en": "Please enter message", - "ar": "يرجى ادخال الموضوع" - }, + "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الموضوع"}, 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, 'referredFrom': {'en': "Referred From", 'ar': 'محال من'}, 'branch': {'en': "Branch", 'ar': 'الفرع'}, @@ -296,7 +298,10 @@ const Map> localizedValues = { 'summaryReport': {'en': "Summary Report", 'ar': 'تقرير موجز'}, 'accept': {'en': "ACCEPT", 'ar': 'قبول'}, 'reject': {'en': "REJECT", 'ar': 'رفض'}, - 'noAppointmentsErrorMsg': {'en': "There is no appointments for at this date", 'ar': 'لا توجد مواعيد في هذا التاريخ'}, + 'noAppointmentsErrorMsg': { + 'en': "There is no appointments for at this date", + 'ar': 'لا توجد مواعيد في هذا التاريخ' + }, 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, 'noPrescriptionListed': { 'en': 'NO PRESCRIPTION LISTED', diff --git a/lib/routes.dart b/lib/routes.dart index 680c8cfc..e73d53b4 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -76,7 +76,7 @@ const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; -const String CREATE_EPISODE = 'patients/create-episode'; +const String CREATE_EPISODE = 'patients/create-episode'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -117,7 +117,7 @@ var routes = { PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), - CREATE_EPISODE:(_)=>AddSOAPIndex(), + CREATE_EPISODE: (_) => AddSOAPIndex(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index f3bee55e..a686e60d 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -33,7 +33,8 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode]; + String get replySuccessfully => + localizedValues['replySuccessfully'][locale.languageCode]; String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; @@ -79,8 +80,10 @@ class TranslationBase { localizedValues['patientServices'][locale.languageCode]; String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; - String get referPatient => localizedValues['referPatient'][locale.languageCode]; + String get myReferralPatient => + localizedValues['myReferralPatient'][locale.languageCode]; + String get referPatient => + localizedValues['referPatient'][locale.languageCode]; String get myReferral => localizedValues['myReferral'][locale.languageCode]; String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; @@ -107,8 +110,10 @@ class TranslationBase { String get profile => localizedValues['profile'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get clinic => localizedValues['clinic'][locale.languageCode]; - String get clinicSelect => localizedValues['clinicSelect'][locale.languageCode]; - String get doctorSelect => localizedValues['doctorSelect'][locale.languageCode]; + String get clinicSelect => + localizedValues['clinicSelect'][locale.languageCode]; + String get doctorSelect => + localizedValues['doctorSelect'][locale.languageCode]; String get hospital => localizedValues['hospital'][locale.languageCode]; String get speciality => localizedValues['speciality'][locale.languageCode]; String get errorMessage => @@ -122,8 +127,10 @@ class TranslationBase { String get lab => localizedValues['lab'][locale.languageCode]; String get result => localizedValues['result'][locale.languageCode]; String get medicines => localizedValues['medicines'][locale.languageCode]; - String get prescription => localizedValues['prescription'][locale.languageCode]; - String get insuranceApprovals => localizedValues['insuranceApprovals'][locale.languageCode]; + String get prescription => + localizedValues['prescription'][locale.languageCode]; + String get insuranceApprovals => + localizedValues['insuranceApprovals'][locale.languageCode]; String get insurance => localizedValues['insurance'][locale.languageCode]; String get approvals => localizedValues['approvals'][locale.languageCode]; String get bodyMeasurements => @@ -145,7 +152,8 @@ class TranslationBase { String get pleaseEnterAnswer => localizedValues['pleaseEnterAnswer'][locale.languageCode]; String get replay => localizedValues['replay'][locale.languageCode]; - String get progressNote => localizedValues['progressNote'][locale.languageCode]; + String get progressNote => + localizedValues['progressNote'][locale.languageCode]; String get progress => localizedValues['progress'][locale.languageCode]; String get note => localizedValues['note'][locale.languageCode]; String get searchNote => localizedValues['searchNote'][locale.languageCode]; @@ -223,8 +231,10 @@ class TranslationBase { String get urgent => localizedValues['urgent'][locale.languageCode]; String get routine => localizedValues['routine'][locale.languageCode]; String get send => localizedValues['send'][locale.languageCode]; - String get referralFrequency => localizedValues['referralFrequency'][locale.languageCode]; - String get selectReferralFrequency => localizedValues['selectReferralFrequency'][locale.languageCode]; + String get referralFrequency => + localizedValues['referralFrequency'][locale.languageCode]; + String get selectReferralFrequency => + localizedValues['selectReferralFrequency'][locale.languageCode]; String get clinicalDetailsAndRemarks => localizedValues['clinicalDetailsAndRemarks'][locale.languageCode]; String get remarks => localizedValues['remarks'][locale.languageCode]; @@ -291,7 +301,8 @@ class TranslationBase { localizedValues['moreThan3Letter'][locale.languageCode]; String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; - String get admissionDetail => localizedValues['admissionDetail'][locale.languageCode]; + String get admissionDetail => + localizedValues['admissionDetail'][locale.languageCode]; String get dateTime => localizedValues['dateTime'][locale.languageCode]; String get admissionNo => localizedValues['admissionNo'][locale.languageCode]; String get losNo => localizedValues['losNo'][locale.languageCode]; @@ -299,25 +310,33 @@ class TranslationBase { String get room => localizedValues['room'][locale.languageCode]; String get bed => localizedValues['bed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; - String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + String get healthRecordInformation => + localizedValues['healthRecordInformation'][locale.languageCode]; + String get emptyMessage => + localizedValues['empty-message'][locale.languageCode]; String get referTo => localizedValues['referTo'][locale.languageCode]; - String get referredFrom => localizedValues['referredFrom'][locale.languageCode]; + String get referredFrom => + localizedValues['referredFrom'][locale.languageCode]; String get branch => localizedValues['branch'][locale.languageCode]; - String get chooseAppointment => localizedValues['chooseAppointment'][locale.languageCode]; - String get appointmentNo => localizedValues['appointmentNo'][locale.languageCode]; + String get chooseAppointment => + localizedValues['chooseAppointment'][locale.languageCode]; + String get appointmentNo => + localizedValues['appointmentNo'][locale.languageCode]; String get refer => localizedValues['refer'][locale.languageCode]; String get approved => localizedValues['approved'][locale.languageCode]; String get rejected => localizedValues['rejected'][locale.languageCode]; String get sameBranch => localizedValues['sameBranch'][locale.languageCode]; String get otherBranch => localizedValues['otherBranch'][locale.languageCode]; String get dr => localizedValues['dr'][locale.languageCode]; - String get previewHealth => localizedValues['previewHealth'][locale.languageCode]; - String get summaryReport => localizedValues['summaryReport'][locale.languageCode]; + String get previewHealth => + localizedValues['previewHealth'][locale.languageCode]; + String get summaryReport => + localizedValues['summaryReport'][locale.languageCode]; String get accept => localizedValues['accept'][locale.languageCode]; String get reject => localizedValues['reject'][locale.languageCode]; - String get noAppointmentsErrorMsg => localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; + String get noAppointmentsErrorMsg => + localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; String get referralPatient => localizedValues['referralPatient'][locale.languageCode]; String get noPrescriptionListed => diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 3008bf73..e6d3bdbd 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -11,9 +11,9 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'PatientProfileButton.dart'; /* - *@author: Elham Rababah - *@Date:22/4/2020 - *@param: + *@author: Elham Rababah + *@Date:22/4/2020 + *@param: *@return:ProfileMedicalInfoWidget *@desc: Profile Medical Info Widget */ @@ -27,13 +27,14 @@ class ProfileMedicalInfoWidget extends StatelessWidget { mainAxisSpacing: 20, crossAxisCount: 2, childAspectRatio: 1.5, - children: [ PatientProfileButton( - key: key, - patient: patient, - nameLine1: "Create New", - nameLine2: "Episode", - route: CREATE_EPISODE, - icon: 'heartbeat.png'), + children: [ + PatientProfileButton( + key: key, + patient: patient, + nameLine1: "Create New", + nameLine2: "Episode", + route: CREATE_EPISODE, + icon: 'heartbeat.png'), PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 0e6f6c2b..791da173 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -39,10 +39,6 @@ class NumberTextInputFormatter extends TextInputFormatter { final _mobileFormatter = NumberTextInputFormatter(); class TextFields extends StatefulWidget { - - TextFields({Key key, this.type, this.hintText, this.suffixIcon, this.autoFocus, this.onChanged, this.initialValue, this.minLines, this.maxLines, this.inputFormatters, this.padding, this.focus=false, this.maxLengthEnforced=true, - this.suffixIconColor, this.inputAction, this.onSubmit, this.keepPadding=true, this.textCapitalization = TextCapitalization.none, this.onTap, this.controller, this.keyboardType, this.validator, this.borderOnlyError=false, - this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false, this.onTapTextFields}) : super(key: key); TextFields( {Key key, this.type, @@ -77,7 +73,8 @@ class TextFields extends StatefulWidget { this.fontWeight = FontWeight.w700, this.autoValidate = false, this.fillColor, - this.hintColor}) + this.hintColor, + this.onTapTextFields}) : super(key: key); final String hintText; @@ -86,7 +83,7 @@ class TextFields extends StatefulWidget { final bool autoFocus; final IconData suffixIcon; final Color suffixIconColor; - final IconData prefixIcon; + final Icon prefixIcon; final VoidCallback onTap; final Function onTapTextFields; final TextEditingController controller; @@ -136,8 +133,7 @@ class _TextFieldsState extends State { @override void didUpdateWidget(TextFields oldWidget) { - if (widget.focus) - _focusNode.requestFocus(); + if (widget.focus) _focusNode.requestFocus(); super.didUpdateWidget(oldWidget); } @@ -178,15 +174,21 @@ class _TextFieldsState extends State { ), ); default: - if (widget.suffixIcon!=null) - return InkWell(onTap: widget.onSuffixTap, child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor!=null ? widget.suffixIconColor : Colors.grey[500])); + if (widget.suffixIcon != null) + return InkWell( + onTap: widget.onSuffixTap, + child: Icon(widget.suffixIcon, + size: 22.0, + color: widget.suffixIconColor != null + ? widget.suffixIconColor + : Colors.grey[500])); else return null; } } bool _determineReadOnly() { - if (widget.readOnly!=null && widget.readOnly) { + if (widget.readOnly != null && widget.readOnly) { _focusNode.unfocus(); return true; } else { @@ -211,7 +213,8 @@ class _TextFieldsState extends State { blurRadius: focus ? 34.0 : 12.0) ]), child: TextFormField( - onTap: widget.onTapTextFields,keyboardAppearance: Theme.of(context).brightness, + onTap: widget.onTapTextFields, + keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), autovalidate: widget.autoValidate, textCapitalization: widget.textCapitalization, diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index ed3092fa..6c6d3ecc 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -41,7 +41,8 @@ class AppTextFormField extends FormField { focusNode: focusNode, keyboardType: textInputType, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(inputFormatter)), + FilteringTextInputFormatter.allow( + RegExp(inputFormatter)), ], onChanged: onChanged ?? (value) { From 1491a04b3911261a4fa908b43f40f485208f52ad Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 12:54:34 +0200 Subject: [PATCH 05/13] PostPhysicalExam works --- lib/config/config.dart | 1 + lib/core/service/SOAP_service.dart | 12 ++ lib/core/viewModel/SOAP_view_model.dart | 11 ++ .../patients/profile/SOAP/objective_page.dart | 116 ++++++++++++++---- .../SOAP/subjective/subjective_page.dart | 7 +- 5 files changed, 123 insertions(+), 24 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5355dac4..8d6c0935 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -107,6 +107,7 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLoo const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 1a8c91a1..44b304fc 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'base/lookup-service.dart'; @@ -60,4 +61,15 @@ class SOAPService extends LookupService { super.error = error; }, body: postChiefComplaintRequestModel.toJson()); } + + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 3ff33389..f43306f0 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -83,5 +84,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index a1b91864..894f7745 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,9 +1,11 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -49,7 +51,9 @@ class _ObjectivePageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( + return BaseView( + // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + builder: (_, model, w) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -161,7 +165,12 @@ class _ObjectivePageState extends State { 0.070, decoration: containerBorderDecoration( - Colors.white, + examination + .isNormal + ? Color( + 0xFF515A5D) + : Colors + .white, Colors.grey), child: Center( child: Padding( @@ -173,17 +182,28 @@ class _ObjectivePageState extends State { style: TextStyle( fontSize: 12, color: - Colors.black, + examination + .isNormal + ? Colors.white + : Colors + .black, //Colors.black, fontWeight: - FontWeight - .bold, + FontWeight + .bold, ), ), ), )), ), - onTap: () {}), + onTap: () { + setState(() { + examination.isAbnormal = + !examination.isAbnormal; + examination.isNormal = + !examination.isNormal; + }); + }), SizedBox( width: 12, ), @@ -191,33 +211,49 @@ class _ObjectivePageState extends State { child: Center( child: Container( height: - screenSize.height * - 0.070, + screenSize.height * + 0.070, decoration: - containerBorderDecoration( - Color(0xFF515A5D), - Colors.black), + containerBorderDecoration( + examination + .isAbnormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), child: Center( child: Padding( padding: - const EdgeInsets - .all(8.0), + const EdgeInsets + .all(8.0), child: Text( "Abnormal", style: TextStyle( fontSize: 12, color: - Colors.white, + examination + .isAbnormal + ? Colors.white + : Colors + .black, //Colors.black, fontWeight: - FontWeight - .bold, + FontWeight + .bold, ), ), ), )), ), - onTap: () {}), + onTap: () { + setState(() { + examination.isAbnormal = + !examination.isAbnormal; + examination.isNormal = + !examination.isNormal; + }); + }), ], ), InkWell( @@ -267,9 +303,11 @@ class _ObjectivePageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - widget.changePageViewIndex(2); + title: TranslationBase + .of(context) + .next, + onPressed: () async { + await submitObjectivePage(model); }, ), SizedBox( @@ -279,7 +317,43 @@ class _ObjectivePageState extends State { ), ), ), - )); + ))); + } + + submitObjectivePage(SOAPViewModel model) async { + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalVM = []; + + postPhysicalExamRequestModel.listHisProgNotePhysicalVM.add( + ListHisProgNotePhysicalVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: exam.remark ?? '', + createdBy: 1485, + createdOn: DateTime.now().toIso8601String(), + editedBy: 1485, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + masterDescription: exam.selectedExamination, + )); + }); + + await model.postPhysicalExam(postPhysicalExamRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + } + // TODO move it back to else stat when it work. + widget.changePageViewIndex(2); + } removeExamination(MasterKeyModel masterKey) { diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index ae024b10..9100cb76 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -140,7 +140,8 @@ class _SubjectivePageState extends State { SizedBox( height: 20, ), - AddMedication(), + // TODO return it back when we need it. + // AddMedication(), ]), ), isExpand: isChiefExpand, @@ -305,9 +306,9 @@ class _SubjectivePageState extends State { remarks: allergy.remark, createdBy: 1485, // - createdOn: "2020-08-14T20:37:22.780Z", + createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", editedBy: 1485, - editedOn: "2020-08-14T20:37:22.780Z", + editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", isChecked: false, isUpdatedByNurse: false)); }); From 47a350a81152e9a4f9af8d3cb2aff53122ce2c1a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 28 Dec 2020 13:05:40 +0200 Subject: [PATCH 06/13] prscription and procedure --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 11 -- lib/util/translations_delegate_base.dart | 8 +- lib/widgets/shared/TextFields.dart | 30 ++++-- lib/widgets/shared/app_buttons_widget.dart | 110 +++++++++----------- lib/widgets/shared/app_text_form_field.dart | 8 +- 6 files changed, 80 insertions(+), 91 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 00ddd293..abf451b8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -113,7 +113,6 @@ const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure'; const GET_PATIENT_ARRIVAL_LIST = 'Services/DoctorApplication.svc/REST/PatientArrivalList'; - // SOAP const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; @@ -121,7 +120,8 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f786685a..50d32393 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -276,7 +276,6 @@ const Map> localizedValues = { "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, "sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."}, "sick-leave-days": {"en": "Sick leave days", "ar": "عدد ايام الاجازة."}, - 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, 'admissionNo': {'en': 'ADMISSION #: ', 'ar': 'قبول #:'}, @@ -313,7 +312,6 @@ const Map> localizedValues = { 'en': "EXTEND SICK LEAVE", 'ar': 'قم بتمديد الإجازة المرضية' }, - "empty-message": {"en": "Please enter Value", "ar": "يرجى ادخال القيمه"}, "chiefComplaintLength": { "en": "Chief Complaint length should be greater than 25", "ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25" @@ -323,11 +321,6 @@ const Map> localizedValues = { 'en': 'No Prescription Listed', 'ar': 'لا وصفة طبية مدرجة' }, - 'next': {'en': 'Next', 'ar': 'التالي'}, - 'healthRecordInformation': { - 'en': 'HEALTH RECORD INFORMATION', - 'ar': 'معلومات السجل الصحي' - }, 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, 'referredFrom': {'en': "Referred From", 'ar': 'محال من'}, 'branch': {'en': "Branch", 'ar': 'الفرع'}, @@ -360,8 +353,4 @@ const Map> localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, - 'noAppointmentsErrorMsg': { - 'en': "There is no appointments for at this date", - 'ar': 'لا توجد مواعيد في هذا التاريخ' - }, }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 120667b9..59eda9e0 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -344,14 +344,11 @@ class TranslationBase { String get noPrescription => localizedValues['no-priscription-listed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get healthRecordInformation => - localizedValues['healthRecordInformation'][locale.languageCode]; + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; - String get emptyMessage => - localizedValues['empty-message'][locale.languageCode]; String get chiefComplaintLength => localizedValues['chiefComplaintLength'][locale.languageCode]; @@ -378,8 +375,7 @@ class TranslationBase { String get reject => localizedValues['reject'][locale.languageCode]; String get noAppointmentsErrorMsg => localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; - String get noAppointmentsErrorMsg => - localizedValues['noAppointmentsErrorMsg'][locale.languageCode]; + String get referralPatient => localizedValues['referralPatient'][locale.languageCode]; String get noPrescriptionListed => diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 070f97a3..20885eb3 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -146,15 +146,29 @@ class _TextFieldsState extends State { Widget _buildSuffixIcon() { switch (widget.type) { case "password": - { return Padding( - padding: const EdgeInsets.only(right: 8.0), - child: view ? - InkWell(onTap: () {this.setState(() { view= false; });}, child: Icon(EvaIcons.eye, size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) - : - InkWell(onTap: () {this.setState(() { view= true; });}, child: Icon(EvaIcons.eyeOff, size: 24.0, color: Colors.grey[500])) - );} + { + return Padding( + padding: const EdgeInsets.only(right: 8.0), + child: view + ? InkWell( + onTap: () { + this.setState(() { + view = false; + }); + }, + child: Icon(EvaIcons.eye, + size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) + : InkWell( + onTap: () { + this.setState(() { + view = true; + }); + }, + child: Icon(EvaIcons.eyeOff, + size: 24.0, color: Colors.grey[500]))); + } - break; + break; default: if (widget.suffixIcon != null) return InkWell( diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index ba04e97d..38a66595 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -6,8 +6,6 @@ import 'package:hexcolor/hexcolor.dart'; import 'app_texts_widget.dart'; class AppButton extends StatefulWidget { - - final GestureTapCallback onPressed; final String title; final IconData icon; @@ -26,14 +24,7 @@ class AppButton extends StatefulWidget { this.fontSize = 2, this.padding = 13, this.loading = false, - this.disabled = false}); - AppButton( - {@required this.onPressed, - this.title, - this.icon, - this.color, - this.fontSize = 2, - this.padding = 13, + this.disabled = false, this.fontColor = Colors.white}); _AppButtonState createState() => _AppButtonState(); @@ -42,58 +33,57 @@ class AppButton extends StatefulWidget { class _AppButtonState extends State { @override Widget build(BuildContext context) { - returnIgnorePointer( - ignoring: widget.loading, - child: RawMaterialButton( - fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), - splashColor: widget.color, - child: Padding( - padding: EdgeInsets.only( - top: widget.padding, - bottom: widget.padding, - //right: SizeConfig.widthMultiplier * widget.padding, - //left: SizeConfig.widthMultiplier * widget.padding - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (widget.icon != null) - Icon( - widget.icon, - color: Colors.white, - ), - if (widget.icon != null) - SizedBox( - width: 5.0, - ), - widget.loading - ? Padding( - padding: EdgeInsets.all(2.6), - child: SizedBox( - height: 19.0, - width: 19.0, - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: - AlwaysStoppedAnimation( - Colors.grey[300], + return IgnorePointer( + ignoring: widget.loading, + child: RawMaterialButton( + fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), + splashColor: widget.color, + child: Padding( + padding: EdgeInsets.only( + top: widget.padding, + bottom: widget.padding, + //right: SizeConfig.widthMultiplier * widget.padding, + //left: SizeConfig.widthMultiplier * widget.padding + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.icon != null) + Icon( + widget.icon, + color: Colors.white, + ), + if (widget.icon != null) + SizedBox( + width: 5.0, + ), + widget.loading + ? Padding( + padding: EdgeInsets.all(2.6), + child: SizedBox( + height: 19.0, + width: 19.0, + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[300], + ), + ), ), + ) + : AppText( + widget.title.toUpperCase(), + color: widget.fontColor, + fontSize: SizeConfig.textMultiplier * widget.fontSize, ), - ), - ) - : AppText( - widget.title.toUpperCase(), - color: widget.fontColor, - fontSize: SizeConfig.textMultiplier * widget.fontSize, - ), - ], + ], + ), ), + onPressed: widget.onPressed, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6))), ), - onPressed: widget.onPressed, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(6))), - ), - ); + ); } -} \ No newline at end of file +} diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index 256eff5c..4c2573cd 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -43,8 +43,8 @@ class AppTextFormField extends FormField { keyboardType: textInputType, inputFormatters: [ FilteringTextInputFormatter.allow( - RegExp(inputFormatter)),], - + RegExp(inputFormatter)), + ], onChanged: onChanged ?? (value) { state.didChange(value); @@ -62,8 +62,8 @@ class AppTextFormField extends FormField { labelText: labelText, labelStyle: TextStyle( fontSize: SizeConfig.textMultiplier * 1.7, - - ),enabledBorder: OutlineInputBorder( + ), + enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(6)), borderSide: BorderSide( color: borderColor != null From f97d11183dd39b130e9f6ee9a1c5dfa71a3d9a46 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 14:42:04 +0200 Subject: [PATCH 07/13] progress Note --- .../post_progress_note_request_model.dart | 25 +++++++++ lib/models/patient/patiant_info_model.dart | 17 ------ .../patients/profile/SOAP/objective_page.dart | 13 +++-- .../patients/profile/SOAP/plan_page.dart | 53 ++++++++++++------- 4 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 lib/models/SOAP/post_progress_note_request_model.dart diff --git a/lib/models/SOAP/post_progress_note_request_model.dart b/lib/models/SOAP/post_progress_note_request_model.dart new file mode 100644 index 00000000..7bbea882 --- /dev/null +++ b/lib/models/SOAP/post_progress_note_request_model.dart @@ -0,0 +1,25 @@ +class PostProgressNoteRequestModel { + int appointmentNo; + int episodeId; + int patientMRN; + String planNote; + + PostProgressNoteRequestModel( + {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); + + PostProgressNoteRequestModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + episodeId = json['episodeId']; + patientMRN = json['patientMRN']; + planNote = json['planNote']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['episodeId'] = this.episodeId; + data['patientMRN'] = this.patientMRN; + data['planNote'] = this.planNote; + return data; + } +} diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 2b2fd876..9eec55ca 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,20 +1,3 @@ -import 'dart:convert'; - -//PatiantInformtion patiantInformtionFromJson(String str) => PatiantInformtion.fromJson(json.decode(str)); - -////String patiantInformtionToJson(PatiantInformtion data) => json.encode(data.toJson()); -//****************************** */ - -/* - *@author: Amjad Amireh - *@Date:27/4/2020 - *@param: - *@return:Patian information Model - - *@desc: - */ - - class PatiantInformtion { final List list; diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 894f7745..922314b9 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -303,13 +303,12 @@ class _ObjectivePageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase - .of(context) - .next, - onPressed: () async { - await submitObjectivePage(model); - }, - ), + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitObjectivePage(model); + }, + ), SizedBox( height: 30, ), diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 7b5ddcdc..9bf907d9 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -42,7 +44,9 @@ class _PlanPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( + return BaseView( + // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + builder: (_, model, w) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -98,7 +102,7 @@ class _PlanPageState extends State { hintText: "Add Progress Note", fontSize: 13.5, onTapTextFields: () { - openExaminationList(context); + openProgressNote(context); }, readOnly: true, // hintColor: Colors.black, @@ -159,10 +163,14 @@ class _PlanPageState extends State { ), Padding( padding: const EdgeInsets.all(0.0), - child: AppText( - "Some progress note about", - fontSize: 10, - color: Colors.grey, + child: Container( + width: MediaQuery.of(context).size.width * 0.6, + child: AppText( + progressNoteController.text, + fontSize: 10, + + color: Colors.grey, + ), ), ), ], @@ -207,7 +215,9 @@ class _PlanPageState extends State { Column( children: [ InkWell( - onTap: () {}, + onTap: () { + openProgressNote(context); + }, child: Icon(EvaIcons.edit2Outline), ) ], @@ -227,20 +237,22 @@ class _PlanPageState extends State { widget.changePageViewIndex(2); }, ), - SizedBox( - height: 30, + SizedBox( + height: 30, + ), + ], ), - ], + ), ), - ), - ), - )); + ),),); } - openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + openProgressNote(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -291,7 +303,7 @@ class _PlanPageState extends State { Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: TextFields( - hintText: "Remarks", + hintText: "Add progress note here", fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -300,7 +312,9 @@ class _PlanPageState extends State { controller: progressNoteController, validator: (value) { if (value == null) - return TranslationBase.of(context).emptyMessage; + return TranslationBase + .of(context) + .emptyMessage; else return null; }), @@ -310,6 +324,7 @@ class _PlanPageState extends State { AppButton( title: "Add".toUpperCase(), onPressed: () { + Navigator.of(context).pop(); }, ), ]), From b22fd3f7ba48aac707fd3c91e9107b1a07d2f482 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 15:59:06 +0200 Subject: [PATCH 08/13] fix listHisProgNotePhysicalExaminationVM --- .../post_physical_exam_request_model.dart | 26 +++++++++---------- .../patients/profile/SOAP/objective_page.dart | 10 ++++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index f9f23897..adc8daf7 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -1,31 +1,31 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class PostPhysicalExamRequestModel { - List listHisProgNotePhysicalVM; + List listHisProgNotePhysicalExaminationVM; - PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel.fromJson(Map json) { - if (json['listHisProgNotePhysicalVM'] != null) { - listHisProgNotePhysicalVM = new List(); - json['listHisProgNotePhysicalVM'].forEach((v) { - listHisProgNotePhysicalVM - .add(new ListHisProgNotePhysicalVM.fromJson(v)); + if (json['listHisProgNotePhysicalExaminationVM'] != null) { + listHisProgNotePhysicalExaminationVM = new List(); + json['listHisProgNotePhysicalExaminationVM'].forEach((v) { + listHisProgNotePhysicalExaminationVM + .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); - if (this.listHisProgNotePhysicalVM != null) { - data['listHisProgNotePhysicalVM'] = - this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + if (this.listHisProgNotePhysicalExaminationVM != null) { + data['listHisProgNotePhysicalExaminationVM'] = + this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); } return data; } } -class ListHisProgNotePhysicalVM { +class ListHisProgNotePhysicalExaminationVM { int episodeId; int appointmentNo; int examType; @@ -41,7 +41,7 @@ class ListHisProgNotePhysicalVM { bool notExamined; MasterKeyModel masterDescription; - ListHisProgNotePhysicalVM( + ListHisProgNotePhysicalExaminationVM( {this.episodeId, this.appointmentNo, this.examType, @@ -57,7 +57,7 @@ class ListHisProgNotePhysicalVM { this.notExamined, this.masterDescription}); - ListHisProgNotePhysicalVM.fromJson(Map json) { + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { episodeId = json['episodeId']; appointmentNo = json['appointmentNo']; examType = json['examType']; diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 922314b9..5f9d6f2c 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -322,12 +322,12 @@ class _ObjectivePageState extends State { submitObjectivePage(SOAPViewModel model) async { PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalVM == + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) - postPhysicalExamRequestModel.listHisProgNotePhysicalVM = []; + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalVM.add( - ListHisProgNotePhysicalVM( + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( patientMRN: 3120690, episodeId: 200012117, appointmentNo: 2016054573, @@ -341,6 +341,8 @@ class _ObjectivePageState extends State { isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, masterDescription: exam.selectedExamination, + notExamined: false + )); }); From dc4250a4def72b8846f7c4146eb5e03761fe3457 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 18:45:15 +0200 Subject: [PATCH 09/13] Post progress Note --- lib/config/config.dart | 1 + lib/core/service/SOAP_service.dart | 34 ++- lib/core/viewModel/SOAP_view_model.dart | 11 + .../post_progress_note_request_model.dart | 16 +- lib/util/helpers.dart | 5 +- .../patients/profile/SOAP/add_SOAP_index.dart | 11 +- .../patients/profile/SOAP/objective_page.dart | 57 ++-- .../patients/profile/SOAP/plan_page.dart | 282 +++++++++--------- 8 files changed, 230 insertions(+), 187 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 8d6c0935..bc2fd0db 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -108,6 +108,7 @@ const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 44b304fc..e5d2023c 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'base/lookup-service.dart'; @@ -56,20 +57,33 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postChiefComplaintRequestModel.toJson()); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); } - Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + Future postPhysicalExam( + PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { hasError = false; await baseAppClient.post(POST_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postPhysicalExamRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); + } + + Future postProgressNote( + PostProgressNoteRequestModel postProgressNoteRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postProgressNoteRequestModel.toJson()); } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index f43306f0..b9a96f6c 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -94,5 +95,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postProgressNote(postProgressNoteRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/models/SOAP/post_progress_note_request_model.dart b/lib/models/SOAP/post_progress_note_request_model.dart index 7bbea882..2217d4ee 100644 --- a/lib/models/SOAP/post_progress_note_request_model.dart +++ b/lib/models/SOAP/post_progress_note_request_model.dart @@ -8,18 +8,18 @@ class PostProgressNoteRequestModel { {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); PostProgressNoteRequestModel.fromJson(Map json) { - appointmentNo = json['appointmentNo']; - episodeId = json['episodeId']; - patientMRN = json['patientMRN']; - planNote = json['planNote']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + patientMRN = json['PatientMRN']; + planNote = json['PlanNote']; } Map toJson() { final Map data = new Map(); - data['appointmentNo'] = this.appointmentNo; - data['episodeId'] = this.episodeId; - data['patientMRN'] = this.patientMRN; - data['planNote'] = this.planNote; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['PatientMRN'] = this.patientMRN; + data['PlanNote'] = this.planNote; return data; } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 0c3f1b5f..c1d70cef 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -348,7 +348,8 @@ class Helpers { String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); sharedPref.setString(APP_Language, lang); - // Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); - Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + // TODO Fix it + // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } } diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 705bc85f..f1d81812 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -108,10 +108,13 @@ class _AddSOAPIndexState extends State ), ], ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, + Container( + width: MediaQuery.of(context).size.width *0.65, + child: AppText( + "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), ), ], ) diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 5f9d6f2c..add9ca16 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -320,38 +320,41 @@ class _ObjectivePageState extends State { } submitObjectivePage(SOAPViewModel model) async { - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + if(widget.mySelectedExamination.isNotEmpty){ + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - ListHisProgNotePhysicalExaminationVM( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - remarks: exam.remark ?? '', - createdBy: 1485, - createdOn: DateTime.now().toIso8601String(), - editedBy: 1485, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: exam.remark ?? '', + createdBy: 1485, + createdOn: DateTime.now().toIso8601String(), + editedBy: 1485, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + masterDescription: exam.selectedExamination, + notExamined: false - )); - }); + )); + }); - await model.postPhysicalExam(postPhysicalExamRequestModel); + await model.postPhysicalExam(postPhysicalExamRequestModel); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + } } + // TODO move it back to else stat when it work. widget.changePageViewIndex(2); diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 9bf907d9..3e5ca10a 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -1,5 +1,8 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -27,7 +30,9 @@ class _PlanPageState extends State { List progressNoteList; - TextEditingController progressNoteController = TextEditingController(); + TextEditingController progressNoteController = + TextEditingController(text: null); + BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { return BoxDecoration( @@ -40,6 +45,7 @@ class _PlanPageState extends State { )), ); } + @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; @@ -112,7 +118,8 @@ class _PlanPageState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; @@ -121,110 +128,117 @@ class _PlanPageState extends State { SizedBox( height: 20, ), - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + if (progressNoteController.text.isNotEmpty) + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - Padding( - padding: const EdgeInsets.all(0.0), - child: Container( - width: MediaQuery.of(context).size.width * 0.6, - child: AppText( - progressNoteController.text, - fontSize: 10, + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + Padding( + padding: const EdgeInsets.all(0.0), + child: Container( + width: MediaQuery + .of(context) + .size + .width * 0.6, + child: AppText( + progressNoteController.text, + fontSize: 10, - color: Colors.grey, + color: Colors.grey, + ), ), ), - ), - ], - ),SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Created By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah on 12 De", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Edited By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Rahim on 13 Dec", - fontSize: 10, - color: Colors.grey, - ), - ], - ), + ], + ), SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Created By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah on 12 De", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Edited By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Rahim on 13 Dec", + fontSize: 10, + color: Colors.grey, + ), + ], + ), - ], - ), - Column( - children: [ - InkWell( - onTap: () { - openProgressNote(context); - }, - child: Icon(EvaIcons.edit2Outline), - ) - ], - ), - ], - ), - ) + ], + ), + Column( + children: [ + InkWell( + onTap: () { + openProgressNote(context); + }, + child: Icon(EvaIcons.edit2Outline), + ) + ], + ), + ], + ), + ) ], ) ]), @@ -232,50 +246,46 @@ class _PlanPageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase.of(context).next, + title: TranslationBase + .of(context) + .next, + loading: model.state == ViewState.BusyLocal, onPressed: () { - widget.changePageViewIndex(2); + + submitPlan(model); + // widget.changePageViewIndex(2); }, ), - SizedBox( - height: 30, - ), - ], + SizedBox( + height: 30, ), - ), + ], ), - ),),); + ), + ), + ),),); } - openProgressNote(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); + submitPlan(SOAPViewModel model) async { + if (progressNoteController.text.isNotEmpty) { + PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + planNote: progressNoteController.text); + + + await model.postProgressNote(postProgressNoteRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + Navigator.of(context).pop(); + } } + } - ; + openProgressNote(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, From 1672d9a3a0ef83bfd777a3f120617b3d05a0034a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 20:42:24 +0200 Subject: [PATCH 10/13] add assessment_page code --- lib/core/enum/master_lookup_key.dart | 9 +- lib/core/service/base/lookup-service.dart | 17 + lib/core/viewModel/SOAP_view_model.dart | 2 + lib/models/SOAP/my_selected_assement.dart | 47 + .../patients/profile/SOAP/add_SOAP_index.dart | 4 +- .../profile/SOAP/assessment_page.dart | 931 ++++++++++-------- 6 files changed, 598 insertions(+), 412 deletions(-) create mode 100644 lib/models/SOAP/my_selected_assement.dart diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 03937710..a4010858 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -7,7 +7,9 @@ enum MasterKeysService { HistorySurgical, PhysicalExamination, AllergySeverity, - physiotherapyGoals + physiotherapyGoals, + DiagnosisCondition, + DiagnosisType } extension SelectedMasterKeysService on MasterKeysService { @@ -40,6 +42,11 @@ extension SelectedMasterKeysService on MasterKeysService { break; case MasterKeysService.physiotherapyGoals: return 117; + break;case MasterKeysService.DiagnosisCondition: + return 34; + break; + case MasterKeysService.DiagnosisType: + return 35; break; } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 02371dd8..2053eb15 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -31,6 +31,8 @@ class LookupService extends BaseService { List _physicalExaminationList = []; List listOfPhysiotherapyGoals = []; + List listOfDiagnosisType = []; + List listOfDiagnosisCondition = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -111,6 +113,21 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; + + case MasterKeysService.DiagnosisType: + listOfDiagnosisType.clear(); + entryList.forEach((v) { + listOfDiagnosisType + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.DiagnosisCondition: + listOfDiagnosisCondition.clear(); + entryList.forEach((v) { + listOfDiagnosisCondition + .add(MasterKeyModel.fromJson(v)); + }); + break; } } } \ No newline at end of file diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index b9a96f6c..e8cde824 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -32,6 +32,8 @@ class SOAPViewModel extends BaseViewModel { List get historySurgicalList => _SOAPService.historySurgicalList; List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; List get physicalExaminationList => _SOAPService.physicalExaminationList; + List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; + List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; diff --git a/lib/models/SOAP/my_selected_assement.dart b/lib/models/SOAP/my_selected_assement.dart new file mode 100644 index 00000000..b5f82379 --- /dev/null +++ b/lib/models/SOAP/my_selected_assement.dart @@ -0,0 +1,47 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAssessment { + MasterKeyModel selectedICD; + MasterKeyModel selectedDiagnosisCondition; + MasterKeyModel selectedDiagnosisType; + String remark; + int appointmentId; + + MySelectedAssessment( + {this.selectedICD, + this.selectedDiagnosisCondition, + this.selectedDiagnosisType, + this.remark, this.appointmentId}); + + MySelectedAssessment.fromJson(Map json) { + selectedICD = json['selectedICD'] != null + ? new MasterKeyModel.fromJson(json['selectedICD']) + : null; + selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition']) + : null; + selectedDiagnosisType = json['selectedDiagnosisType'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisType']) + : null; + remark = json['remark']; + appointmentId = json['appointmentId']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedICD != null) { + data['selectedICD'] = this.selectedICD.toJson(); + } + if (this.selectedDiagnosisCondition != null) { + data['selectedICD'] = this.selectedDiagnosisCondition.toJson(); + } + if (this.selectedDiagnosisType != null) { + data['selectedICD'] = this.selectedDiagnosisType.toJson(); + } + data['remark'] = this.remark; + data['appointmentId'] = this.appointmentId; + + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index f1d81812..a6f792c8 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -32,6 +33,7 @@ class _AddSOAPIndexState extends State List myAllergiesList= List(); List myHistoryList = List(); List mySelectedExamination = List(); + MySelectedAssessment mySelectedAssessment = new MySelectedAssessment(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -159,7 +161,7 @@ class _AddSOAPIndexState extends State children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), - AssessmentPage(changePageViewIndex: changePageViewIndex,), + AssessmentPage(changePageViewIndex: changePageViewIndex,mySelectedAssessment:mySelectedAssessment), PlanPage(changePageViewIndex: changePageViewIndex,) ], ), diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 2f747d52..3bd9f0f1 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,11 +1,16 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; @@ -14,8 +19,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; + final MySelectedAssessment mySelectedAssessment; - AssessmentPage({Key key, this.changePageViewIndex}); + AssessmentPage( + {Key key, this.changePageViewIndex, this.mySelectedAssessment}); @override _AssessmentPageState createState() => _AssessmentPageState(); @@ -33,61 +40,64 @@ class _AssessmentPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('ASSESSMENT', - variant: isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ SizedBox( - height: 20, + height: 30, ), - Column( - children: [ - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: TextFields( - hintText: "Add ASSESSMENT", - fontSize: 13.5, - onTapTextFields: () { - openAssessmentDialog(context); + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('ASSESSMENT', + variant: + isAssessmentExpand ? "bodyText" : '', + bold: isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: TextFields( + hintText: "Add ASSESSMENT", + fontSize: 13.5, + onTapTextFields: () { + openAssessmentDialog(context); + }, readOnly: true, // hintColor: Colors.black, suffixIcon: EvaIcons.plusCircleOutline, @@ -96,184 +106,247 @@ class _AssessmentPageState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; }), + ), + SizedBox( + height: 20, + ), + if(widget.mySelectedAssessment != null && + widget.mySelectedAssessment + .appointmentId != + null && widget.mySelectedAssessment + .selectedDiagnosisType != null && + widget.mySelectedAssessment + .selectedDiagnosisCondition != null) + Container( + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Appointment #: ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.mySelectedAssessment + .appointmentId + .toString(), + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Type : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.mySelectedAssessment + .selectedDiagnosisType + .nameEn, + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Doc : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 6, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + AppText( + "Some short remark about the allergy", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + + children: [ + AppText( + "ICD: ".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "R07.1".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + children: [ + InkWell( + onTap: () {}, + child: Icon(EvaIcons + .edit2Outline), + ) + ], + ), + ], + ), + ) + ], + ) + ]), + isExpand: isAssessmentExpand, + ), + DividerWithSpacesAround( + height: 30, + ), + AppButton( + title: TranslationBase + .of(context) + .next, + onPressed: () { + widget.changePageViewIndex(3); + }, ), SizedBox( - height: 20, + height: 30, ), - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Appointment #: ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "2019054946", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Typhoid Fever", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Type : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Possible Diagnosis", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Doc : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - SizedBox( - height: 6, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - AppText( - "Some short remark about the allergy", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - - children: [ - AppText( - "ICD: ".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "R07.1".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - children: [ - InkWell( - onTap: () {}, - child: Icon(EvaIcons.edit2Outline), - ) - ], - ), - ], - ), - ) ], - ) - ]), - isExpand: isAssessmentExpand, - ), - DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - widget.changePageViewIndex(3); - }, - ), - SizedBox( - height: 30, + ), + ), ), - ], - ), - ), - ), - )); + ))); } openAssessmentDialog(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddAssessmentDetails( + mySelectedAssessment: widget.mySelectedAssessment, + addSelectedAssessment: () { + setState(() { + Navigator.of(context).pop(); + }); + }); + }); + } + +} + +class AddAssessmentDetails extends StatefulWidget { + final MySelectedAssessment mySelectedAssessment; + final Function() addSelectedAssessment; + + const AddAssessmentDetails( + {Key key, this.mySelectedAssessment, this.addSelectedAssessment}) + : super(key: key); + + @override + _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); +} + +class _AddAssessmentDetailsState extends State { + MasterKeyModel _selectedDiagnosisCondition; + MasterKeyModel _selectedDiagnosisType; + TextEditingController remarkController = TextEditingController(); + TextEditingController appointmentIdController = TextEditingController( + text: "234567"); + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { //TODO: make one Input InputDecoration for all return InputDecoration( focusedBorder: OutlineInputBorder( @@ -296,199 +369,237 @@ class _AssessmentPageState extends State { ), ); } - - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return FractionallySizedBox( - heightFactor: 0.75, - widthFactor: 0.9, - - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Add Assessment Details".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { + return FractionallySizedBox( + heightFactor: 0.75, + child: BaseView( + onModelReady: (model) async { + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Add Assessment Details".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Appointment Number", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + readOnly: true, + controller: appointmentIdController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisCondition != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisCondition = + selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisCondition = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Condition", + _selectedDiagnosisCondition != null + ? _selectedDiagnosisCondition + .nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisCondition != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisCondition = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Condition", + _selectedDiagnosisCondition != null + ? _selectedDiagnosisCondition + .nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisType = + _selectedDiagnosisType; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Type", + _selectedDiagnosisType != null + ? _selectedDiagnosisType.nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 5, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { setState(() { - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment + .appointmentId = int.parse( + appointmentIdController.text); + + widget.addSelectedAssessment(); }); }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Appointment Number", - _referTo != null ? _referTo['name'] : null, - true), - enabled: false, - ), - ), + ), + ])), ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Name or ICD", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Condition", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Type", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 18, - minLines: 8, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () {}, - ), - ])), - ); - }); + ), + ))), + ); } } + From ab9740ccdd7a3da12a28a54def11a7754078b6a2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 20:51:16 +0200 Subject: [PATCH 11/13] remove Vida Auth from config --- lib/config/config.dart | 2 -- pubspec.lock | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 51dd4e37..edb34b5e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -180,8 +180,6 @@ const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; -const VIDA_AUTH = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiMmI5ZTZlYmYtZmYzMC00ZmEyLTgwYjUtZGJlODM2MmZlNmNhIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1NzU3MTYiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwNzk3Mjk1MCwiZXhwIjoxNjA4ODM2OTUwLCJpYXQiOjE2MDc5NzI5NTB9.nHDltbMuIA3o4Gqa7mQ88fowDy6Oey9fG1zF45dumec'; /// Timer Info const TIMER_MIN = 10; diff --git a/pubspec.lock b/pubspec.lock index 0135ce10..ce581365 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "14.0.0" + version: "12.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.41.1" + version: "0.40.6" archive: dependency: transitive description: @@ -112,7 +112,7 @@ packages: name: build_web_compilers url: "https://pub.dartlang.org" source: hosted - version: "2.15.3" + version: "2.12.2" built_collection: dependency: transitive description: @@ -475,7 +475,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -732,7 +732,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -867,5 +867,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.11.0-162.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" From 7c4e0d929f2eae3d824396a8286901d841fcfc4b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 29 Dec 2020 14:17:19 +0200 Subject: [PATCH 12/13] fix base app client --- ios/Podfile.lock | 56 ++++++++++++++++++++++++++++++--- lib/client/base_app_client.dart | 53 +++++++++++++++++-------------- 2 files changed, 82 insertions(+), 27 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0575cdb6..62e86469 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -7,6 +7,8 @@ PODS: - connectivity (0.0.1): - Flutter - Reachability + - connectivity_for_web (0.1.0): + - Flutter - connectivity_macos (0.0.1): - Flutter - device_info (0.0.1): @@ -22,17 +24,27 @@ PODS: - Flutter - local_auth (0.0.1): - Flutter + - maps_launcher (0.0.1): + - Flutter - MTBBarcodeScanner (5.0.11) - OpenTok (2.15.3) - - "permission_handler (5.0.0+hotfix.5)": + - path_provider_linux (0.0.1): + - Flutter + - path_provider_windows (0.0.1): + - Flutter + - "permission_handler (5.0.1+1)": - Flutter - Reachability (3.2) - shared_preferences (0.0.1): - Flutter + - shared_preferences_linux (0.0.1): + - Flutter - shared_preferences_macos (0.0.1): - Flutter - shared_preferences_web (0.0.1): - Flutter + - shared_preferences_windows (0.0.1): + - Flutter - speech_to_text (0.0.1): - Flutter - Try @@ -40,15 +52,20 @@ PODS: - Try (2.1.1) - url_launcher (0.0.1): - Flutter + - url_launcher_linux (0.0.1): + - Flutter - url_launcher_macos (0.0.1): - Flutter - url_launcher_web (0.0.1): - Flutter + - url_launcher_windows (0.0.1): + - Flutter DEPENDENCIES: - Alamofire - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) + - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) - Flutter (from `Flutter`) @@ -57,15 +74,22 @@ DEPENDENCIES: - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) + - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - OpenTok + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) + - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) SPEC REPOS: trunk: @@ -81,6 +105,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/barcode_scan/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" + connectivity_for_web: + :path: ".symlinks/plugins/connectivity_for_web/ios" connectivity_macos: :path: ".symlinks/plugins/connectivity_macos/ios" device_info: @@ -97,27 +123,42 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/imei_plugin/ios" local_auth: :path: ".symlinks/plugins/local_auth/ios" + maps_launcher: + :path: ".symlinks/plugins/maps_launcher/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + path_provider_windows: + :path: ".symlinks/plugins/path_provider_windows/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" shared_preferences_macos: :path: ".symlinks/plugins/shared_preferences_macos/ios" shared_preferences_web: :path: ".symlinks/plugins/shared_preferences_web/ios" + shared_preferences_windows: + :path: ".symlinks/plugins/shared_preferences_windows/ios" speech_to_text: :path: ".symlinks/plugins/speech_to_text/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_linux: + :path: ".symlinks/plugins/url_launcher_linux/ios" url_launcher_macos: :path: ".symlinks/plugins/url_launcher_macos/ios" url_launcher_web: :path: ".symlinks/plugins/url_launcher_web/ios" + url_launcher_windows: + :path: ".symlinks/plugins/url_launcher_windows/ios" SPEC CHECKSUMS: Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75 + connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 + connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec @@ -126,20 +167,27 @@ SPEC CHECKSUMS: hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb OpenTok: fde03ecc5ea31fe0a453242847c4ee1f47e1d735 - permission_handler: 6226fcb78b97c7c7458a95c7346a11d5184fec12 + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c + url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.0 diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ed14ecac..db4e7a56 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -41,6 +41,8 @@ class BaseAppClient { if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + body.containsKey('patientArrivalList'); + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; @@ -79,7 +81,7 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 || json == null) { + if (statusCode < 200 || statusCode >= 400 ) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); @@ -90,29 +92,12 @@ class BaseAppClient { // helpers.showErrorToast('Your session expired Please login agian'); // } else if (parsed['MessageStatus'] == 1) { - onSuccess(parsed, statusCode); + if(!parsed['IsAuthenticated']) + onFailure(getError(parsed), statusCode); + else + onSuccess(parsed, statusCode); } else { - String error = - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; - - if (parsed["ValidationErrors"] != null) { - error = - parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; - - if (parsed["ValidationErrors"]["ValidationErrors"] != null && - parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error + - parsed["ValidationErrors"]["ValidationErrors"][i] - ["Messages"][0] + - "\n"; - } - } - } - - onFailure(error, statusCode); + onFailure(getError(parsed), statusCode); } } } else { @@ -123,4 +108,26 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + + String getError(parsed){ + //TODO change this fun + String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; + if (parsed["ValidationErrors"] != null) { + + error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + + if (parsed["ValidationErrors"]["ValidationErrors"] != null && + parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + for (var i = 0; + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { + error = error + + parsed["ValidationErrors"]["ValidationErrors"][i] + ["Messages"][0] + + "\n"; + } + } + } + return error; + } } From df838831399006a140896369b94ef7fa9cd1a582 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 29 Dec 2020 14:17:35 +0200 Subject: [PATCH 13/13] fix base app client --- lib/client/base_app_client.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index db4e7a56..015cf0f5 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,9 +40,6 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - - body.containsKey('patientArrivalList'); - if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;