diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a9498b2a..0ef7fe31 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -49,7 +49,7 @@ const Map> localizedValues = { 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, - 'referPatient': {'en': 'Refer Patient', 'ar': 'إحالة مريض'}, + 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, @@ -666,6 +666,14 @@ const Map> localizedValues = { 'en': "You have to add chief complaint fields correctly .", 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" }, + 'referralStatus': { + 'en': "Referral Status : ", + 'ar': "حالة الإحالة :" + }, + 'referralRemark': { + 'en': "Referral Remark : ", + 'ar': "ملاحظة الإحالة :" + }, 'ICDName': { 'en': "ICDName", 'ar': "اسم ال ICD" diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index a1fc73fb..abe39224 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -131,7 +131,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.responseReferral(pendingReferral, isAccepted); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 4e656d6d..2def78db 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import '../../locator.dart'; @@ -13,7 +14,9 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignsService _vitalSignService = locator(); VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - List get patientVitalSignsHistory => _vitalSignService.patientVitalSignsHistory; + + List get patientVitalSignsHistory => + _vitalSignService.patientVitalSignsHistory; String heightCm = "0"; String weightKg = "0"; @@ -34,8 +37,16 @@ class VitalSignsViewModel extends BaseViewModel { } } - Future getPatientVitalSignHistory(PatiantInformtion patient, String from, String to) async { + Future getPatientVitalSignHistory( + PatiantInformtion patient, String from, String to) async { setState(ViewState.Busy); + if (from == null || from == "0") { + from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + if (to == null || to == "0") { + to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); + } + await _vitalSignService.getPatientVitalSignsHistory(patient, from, to); if (_vitalSignService.hasError) { error = _vitalSignService.error; @@ -48,9 +59,7 @@ class VitalSignsViewModel extends BaseViewModel { if (weightKg == "0" || weightKg == null || weightKg == 'null') { weightKg = element.weightKg.toString(); } - if (bodyMax == "0" || - bodyMax == null || - bodyMax == 'null') { + if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') { bodyMax = element.bodyMassIndex.toString(); } if (temperatureCelcius == "0" || @@ -84,24 +93,24 @@ class VitalSignsViewModel extends BaseViewModel { return "Normal"; } else if (bodyMassIndex <= 30) { return "Overweight"; - } else { // > 30.0 + } else { + // > 30.0 return "Obese"; } } - String getTempratureMethod(int temperatureCelciusMethod){ - // temperatureCelciusMethod ( vital sign response field )- master 2005 - if(temperatureCelciusMethod == 1){ + String getTempratureMethod(int temperatureCelciusMethod) { + // temperatureCelciusMethod ( vital sign response field )- master 2005 + if (temperatureCelciusMethod == 1) { return "Oral"; - } else if(temperatureCelciusMethod == 2){ + } else if (temperatureCelciusMethod == 2) { return "Axilla"; - } else if(temperatureCelciusMethod == 3){ + } else if (temperatureCelciusMethod == 3) { return "Rectal"; - } else if(temperatureCelciusMethod == 4){ + } else if (temperatureCelciusMethod == 4) { return "Tympanic"; - } else if(temperatureCelciusMethod == 5){ + } else if (temperatureCelciusMethod == 5) { return "Temporal"; } } - } diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 54d978e3..a5fab36e 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -41,97 +41,109 @@ class _MedicalFilePageState extends State { thickness: 1.0, color: Colors.grey, ), - if (model.medicalFileList.length != 0) - ListView.builder( - //physics: , - physics: NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .medicalFileList[0].entityList[0].timelines.length, - itemBuilder: (BuildContext ctxt, int index) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 8.0), - child: InkWell( - child: Container( - child: Column( - children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).branch + - ": ", - fontWeight: FontWeight.w700, - ), - AppText(model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .projectName), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .doctorName - .toUpperCase() + - ": ", - fontWeight: FontWeight.w700, - ), - Expanded( - child: AppText( + (model.medicalFileList.length != 0 && + model.medicalFileList != null) + ? ListView.builder( + //physics: , + physics: NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.medicalFileList[0].entityList[0] + .timelines.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 8.0), + child: InkWell( + child: Container( + child: Column( + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).branch + + ": ", + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .projectName), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .doctorName + .toUpperCase() + + ": ", + fontWeight: FontWeight.w700, + ), + Expanded( + child: AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName, + fontWeight: FontWeight.w700, + ), + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .clinicName + + ": ", + fontWeight: FontWeight.w700, + ), + AppText( model .medicalFileList[0] .entityList[0] .timelines[index] - .doctorName, - fontWeight: FontWeight.w700, + .clinicName, ), - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .clinicName + - ": ", - fontWeight: FontWeight.w700, - ), - AppText( - model.medicalFileList[0].entityList[0] - .timelines[index].clinicName, - ), - ], - ), - SizedBox(height: 10.0), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey.shade400, - ) - ], + ], + ), + SizedBox(height: 10.0), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey.shade400, + ) + ], + ), ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MedicalFileDetails( + age: patient.age, + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientMRN, + )), + ); + }, ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicalFileDetails( - age: patient.age, - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - encounterNumber: index, - pp: patient.patientMRN, - )), - ); - }, + ); + }) + : Center( + child: Container( + child: AppText( + 'THERES NO MEDICAL FILE FOR THIS Patient', ), - ); - }) + ), + ) ], ), ), diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index a0cb98b3..9d3c9f00 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; @@ -144,8 +146,11 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: () { - model.responseReferral(pendingReferral, true); + handler: () async { + await model.responseReferral(pendingReferral, true); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast(model.error); + } }, ), ), @@ -160,8 +165,11 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: () { - model.responseReferral(pendingReferral, false); + handler: () async { + await model.responseReferral(pendingReferral, true); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast(model.error); + } }, ), ), diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index c519d134..1d481904 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -22,6 +22,7 @@ import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dar import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:flutter/services.dart'; addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) { @@ -101,6 +102,7 @@ class _PrescriptionFormWidgetState extends State { TextEditingController instructionController = TextEditingController(); DateTime selectedDate; dynamic selectedDrug; + int strengthChar; GetMedicationResponseModel _selectedMedication; GlobalKey key = new GlobalKey>(); @@ -525,21 +527,33 @@ class _PrescriptionFormWidgetState extends State { Container( width: MediaQuery.of(context).size.width * - 0.650, + 0.550, child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter(4) + ], hintText: TranslationBase.of(context) .strength, controller: strengthController, keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty && - strengthController.text.length > - 4) - return TranslationBase.of(context) - .emptyMessage; - else - return null; + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 4) { + DrAppToastMsg.showErrorToast( + "Only 4 Digits allowed for strength"); + } }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, ), ), SizedBox( @@ -548,7 +562,7 @@ class _PrescriptionFormWidgetState extends State { Container( width: MediaQuery.of(context).size.width * - 0.250, + 0.350, child: InkWell( onTap: unitsList != null ? () { diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 4208c599..2b71ab8e 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -22,6 +22,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; class NewPrescriptionScreen extends StatefulWidget { @@ -32,15 +33,21 @@ class NewPrescriptionScreen extends StatefulWidget { class _NewPrescriptionScreenState extends State { PersistentBottomSheetController _controller; final _scaffoldKey = GlobalKey(); + TextEditingController strengthController = TextEditingController(); int testNum = 0; + int strengthChar; PatiantInformtion patient; dynamic route; dynamic doseTime; dynamic frequencyUpdate; + dynamic updatedDuration; + dynamic units; List doseTimeList; List routeList; List frequencyList; + List durationList; + List unitsList; @override void initState() { @@ -48,7 +55,12 @@ class _NewPrescriptionScreenState extends State { routeList = List(); doseTimeList = List(); frequencyList = List(); + durationList = List(); + unitsList = List(); + dynamic unit1 = {"id": 1, "name": "MG"}; + dynamic unit2 = {"id": 2, "name": "MCG"}; + dynamic unit3 = {"id": 3, "name": "GM"}; dynamic frequency1 = {"id": 2, "name": "2 Times a day"}; dynamic frequency2 = {"id": 3, "name": "3 Times a day"}; dynamic frequency3 = {"id": 4, "name": "4 Times a day"}; @@ -115,7 +127,39 @@ class _NewPrescriptionScreenState extends State { dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; dynamic route27 = {"id": 31, "name": "In Each Nostril"}; + dynamic duration1 = {"id": 1, "name": "For 1 Day"}; + dynamic duration2 = {"id": 2, "name": "For 2 Days"}; + dynamic duration3 = {"id": 3, "name": "For 3 Days"}; + dynamic duration4 = {"id": 4, "name": "For 4 Days"}; + dynamic duration5 = {"id": 5, "name": "For 5 Days"}; + dynamic duration6 = {"id": 6, "name": "For 6 Days"}; + dynamic duration7 = {"id": 7, "name": "For 7 Days"}; + dynamic duration8 = {"id": 8, "name": "For 8 Days"}; + dynamic duration9 = {"id": 9, "name": "For 9 Days"}; + dynamic duration10 = {"id": 10, "name": "For 10 Days"}; + dynamic duration11 = {"id": 14, "name": "For 14 Days"}; + dynamic duration12 = {"id": 21, "name": "For 21 Days"}; + dynamic duration13 = {"id": 30, "name": "For 30 Days"}; + dynamic duration14 = {"id": 45, "name": "For 45 Days"}; + dynamic duration15 = {"id": 60, "name": "For 60 Days"}; + dynamic duration16 = {"id": 90, "name": "For 90 Days"}; + durationList.add(duration1); + durationList.add(duration2); + durationList.add(duration3); + durationList.add(duration4); + durationList.add(duration5); + durationList.add(duration6); + durationList.add(duration7); + durationList.add(duration8); + durationList.add(duration9); + durationList.add(duration10); + durationList.add(duration11); + durationList.add(duration12); + durationList.add(duration13); + durationList.add(duration14); + durationList.add(duration15); + durationList.add(duration16); frequencyList.add(frequency1); frequencyList.add(frequency2); frequencyList.add(frequency3); @@ -182,6 +226,9 @@ class _NewPrescriptionScreenState extends State { routeList.add(route25); routeList.add(route26); routeList.add(route27); + unitsList.add(unit1); + unitsList.add(unit2); + unitsList.add(unit3); } Widget build(BuildContext context) { @@ -442,7 +489,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.282, + 0.295, width: MediaQuery.of( context) .size @@ -582,13 +629,18 @@ class _NewPrescriptionScreenState extends State { children: [ Expanded( child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .remarks, - fontSize: - 14.0, + Container( + height: + 30, + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .remarks, + fontSize: + 11.5, + ), ), ), ], @@ -792,213 +844,389 @@ class _NewPrescriptionScreenState extends State { builder: (BuildContext context) { return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { - return Container( - height: MediaQuery.of(context).size.height * 0.73, - child: Form( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - drugName.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 30.0, - ), - Column( - children: [ - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: routeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: routeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - route = selectedValue; - }); - if (route == null) { - route = route['id']; - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).route, - route != null ? route['name'] : null, - true), - enabled: false, - ), + return DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.6, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + drugName.toUpperCase(), + fontWeight: FontWeight.w900, ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: doseTimeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: doseTimeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - doseTime = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).doseTime, - doseTime != null - ? doseTime['name'] - : null, - true), - enabled: false, - ), + SizedBox( + height: 10.0, ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: frequencyList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: frequencyList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - frequencyUpdate = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).frequency, - frequencyUpdate != null - ? frequencyUpdate['name'] + Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * + 0.070, + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.550, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter( + 4) + ], + hintText: + TranslationBase.of(context) + .strength, + controller: strengthController, + keyboardType: TextInputType.number, + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 4) { + DrAppToastMsg.showErrorToast( + "Only 4 Digits allowed for strength"); + } + }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + width: 10.0, + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.3200, + child: InkWell( + onTap: unitsList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: unitsList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext + context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'UNIT Type', + units != null + ? units['name'] + : null, + true), + enabled: false, + ), + ), + ), + ], + ), + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: routeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: routeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: remarks, - controller: remarksController, - maxLines: 7, - minLines: 4, - ), - ), - SizedBox( - height: 12.0, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'update prescription'.toUpperCase(), - onPressed: () { - updatePrescription( - doseUnit: doseUnit, - doseStreangth: doseStreangth, - duration: duration, - startDate: startDate, - doseId: dose, - frequencyId: frequency, - routeId: rouat, - patient: patient, - model: model, - drugId: drugId, - remarks: remarksController.text, - route: route != null - ? route['id'].toString() - : rouat, - frequency: frequencyUpdate != null - ? frequencyUpdate['id'].toString() - : frequency, - dose: doseTime != null - ? doseTime['id'].toString() - : dose, - enteredRemarks: enteredRemarks); - Navigator.pop(context); - }, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).route, + route != null + ? route['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: doseTimeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: doseTimeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .doseTime, + doseTime != null + ? doseTime['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: frequencyList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: frequencyList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .frequency, + frequencyUpdate != null + ? frequencyUpdate['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: durationList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: durationList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .duration, + updatedDuration != null + ? updatedDuration['name'] + .toString() + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: remarks, + controller: remarksController, + maxLines: 7, + minLines: 4, + ), + ), + SizedBox( + height: 12.0, + ), + SizedBox( + height: MediaQuery.of(context).size.height * + 0.12, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'update prescription' + .toUpperCase(), + onPressed: () { + updatePrescription( + newDoseStreangth: + strengthController + .text.isNotEmpty + ? strengthController + .text + : doseStreangth, + newUnit: units != null + ? units['id'].toString() + : doseUnit, + doseUnit: doseUnit, + doseStreangth: doseStreangth, + duration: duration, + startDate: startDate, + doseId: dose, + frequencyId: frequency, + routeId: rouat, + patient: patient, + model: model, + newDuration: updatedDuration != + null + ? updatedDuration['id'] + .toString() + : duration, + drugId: drugId, + remarks: remarksController.text, + route: route != null + ? route['id'].toString() + : rouat, + frequency: frequencyUpdate != null + ? frequencyUpdate['id'] + .toString() + : frequency, + dose: doseTime != null + ? doseTime['id'].toString() + : dose, + enteredRemarks: enteredRemarks); + Navigator.pop(context); + }, + ), + ], + ), ), ], ), - ), - ], + ], + ), ), - ], - ), - ), - )); + )); + }); }); }); } @@ -1016,7 +1244,10 @@ class _NewPrescriptionScreenState extends State { String startDate, String doseUnit, String doseStreangth, + String newDoseStreangth, String duration, + String newDuration, + String newUnit, String enteredRemarks, PatiantInformtion patient}) async { //PrescriptionViewModel model = PrescriptionViewModel(); @@ -1031,10 +1262,13 @@ class _NewPrescriptionScreenState extends State { sss.add(PrescriptionRequestModel( covered: true, - dose: int.parse( - doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1, + dose: newDoseStreangth.isNotEmpty + ? int.parse(newDoseStreangth) + : int.parse( + doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1, itemId: drugId, - doseUnitId: int.parse(doseUnit), + doseUnitId: + newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), frequency: frequency.isNotEmpty ? int.parse(frequency) @@ -1043,7 +1277,9 @@ class _NewPrescriptionScreenState extends State { approvalRequired: true, icdcode10Id: "test2", doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), - duration: int.parse(duration), + duration: newDuration.isNotEmpty + ? int.parse(newDuration) + : int.parse(duration), doseStartDate: startDate)); updatePrescriptionReqModel.prescriptionRequestModel = sss; //postProcedureReqModel.procedures = controlsProcedure; diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index b78bf65d..05850316 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -1,14 +1,14 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; @@ -16,17 +16,12 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_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/dialogs/dailog-list-select.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -46,6 +41,7 @@ class _ProcedureScreenState extends State { } TextEditingController procedureController = TextEditingController(); + @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; @@ -269,8 +265,16 @@ class _ProcedureScreenState extends State { .spaceBetween, children: [ Container( - height: 120.0, - width: 45.0, + height: MediaQuery.of( + context) + .size + .height * + 0.18, + width: MediaQuery.of( + context) + .size + .width * + 0.135, child: Column( children: [ AppText( @@ -312,8 +316,16 @@ class _ProcedureScreenState extends State { ), Expanded( child: Container( - height: 120, - width: 325.0, + height: MediaQuery.of( + context) + .size + .height * + 0.2, + width: MediaQuery.of( + context) + .size + .width * + 0.05, child: Column( children: [ Row( @@ -415,26 +427,35 @@ class _ProcedureScreenState extends State { children: [ Expanded( child: - AppText( - model - .procedureList[ - 0] - .entityList[ - index] - .remarks - .toString(), - fontSize: - 13.5, + Container( + height: MediaQuery.of(context) + .size + .height * + 0.052, + width: MediaQuery.of(context) + .size + .width * + 0.10, + child: + AppText( + model + .procedureList[0] + .entityList[index] + .remarks + .toString(), + fontSize: + 11.5, + ), ), ), ], ), SizedBox( - height: 10.0, + height: 20.0, ), Divider( - height: 5.0, + height: 1.0, thickness: 1.0, color: Colors.grey, diff --git a/lib/util/dr_app_toast_msg.dart b/lib/util/dr_app_toast_msg.dart index 48addfba..e4cfa65b 100644 --- a/lib/util/dr_app_toast_msg.dart +++ b/lib/util/dr_app_toast_msg.dart @@ -29,7 +29,7 @@ class DrAppToastMsg { icon: ICON.CLOSE, fontSize: 16, imageSize: 35, - timeInSeconds: 185, + timeInSeconds: 9000, textColor: Colors.white); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c3c40e36..01c8d90b 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1038,6 +1038,10 @@ class TranslationBase { localizedValues['chiefComplaintErrorMsg'][locale.languageCode]; String get ICDName => localizedValues['ICDName'][locale.languageCode]; + String get referralStatus => + localizedValues['referralStatus'][locale.languageCode]; + String get referralRemark => + localizedValues['referralRemark'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 17f33793..fb8276c8 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -37,25 +37,36 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Center( child: AppText( - "${patientName}", + patientName != null ? "${patientName}" : "", color: Colors.black, fontWeight: FontWeight.bold, fontSize: 16, ), ), if (referralStatus != null) - Container( - color: Color(0xFF4BA821), - padding: EdgeInsets.all(4), - child: AppText( - referralStatus - /*referralStatus == "46" - ? TranslationBase.of(context).approved - : TranslationBase.of(context).rejected*/, - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, - ), + Row( + children: [ + AppText( + TranslationBase.of(context).referralStatus, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Container( + color: Color(0xFF4BA821), + padding: EdgeInsets.all(4), + child: AppText( + referralStatus + /*referralStatus == "46" + ? TranslationBase.of(context).approved + : TranslationBase.of(context).rejected*/ + , + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ], ), SizedBox( height: 8, @@ -83,11 +94,26 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( height: 8, ), - AppText( - "${TranslationBase.of(context).dr} $referralDoctorName", - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 12, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).referralDoctor} : ", + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Expanded( + child: AppText( + referralDoctorName != null + ? "${TranslationBase.of(context).dr} $referralDoctorName" + : "", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ], ), SizedBox( height: 8, @@ -112,11 +138,21 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( height: 8, ), - AppText( - remark, - color: Colors.grey, - fontWeight: FontWeight.normal, - fontSize: 12, + Row( + children: [ + AppText( + TranslationBase.of(context).referralRemark, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + remark, + color: Colors.grey, + fontWeight: FontWeight.normal, + fontSize: 12, + ), + ], ), SizedBox( height: 16,