diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 83923ea7..3a39c5e9 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -42,6 +42,8 @@ class BaseAppClient { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + if (body['DoctorID'] == "") + body['DoctorID'] = null; body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ef5aaaa5..3048a39d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -504,9 +504,36 @@ const Map> localizedValues = { 'itemExist': {'en': "This item already exist", 'ar': "هذا العنصر موجود"}, 'selectAllergy': {'en': "Select Allergy", 'ar': "أختر الحساسية"}, 'selectSeverity': {'en': "Select Severity", 'ar': "أختر الدرجه"}, - 'medications': {'en': "Medications", 'ar':"الأدوية" }, - 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, - 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, - 'referralEmptyMsg': {'en': "There is no referral data", 'ar':"لا توجد بيانات إحالة" }, - 'referralSuccessMsg': {'en': "You make referral successfully", 'ar':"You make referral successfully" }, + 'leaveCreated': {'en': "Leave has been created", 'ar': "تم إنشاء الإجازة"}, + 'medications': {'en': "Medications", 'ar': "الأدوية"}, + 'procedures': {'en': "Procedures", 'ar': "الإجراءات"}, + 'vitalSignEmptyMsg': { + 'en': "There is no vital signs for this patient", + 'ar': "لا توجد علامات حيوية لهذا المريض" + }, + 'referralEmptyMsg': { + 'en': "There is no referral data", + 'ar': "لا توجد بيانات إحالة" + }, + 'referralSuccessMsg': { + 'en': "You make referral successfully", + 'ar': "You make referral successfully" + }, + 'fromTime': {'en': "From Time", 'ar': "من وقت"}, + 'toTime': {'en': "To Time", 'ar': "الى وقت"}, + 'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"}, + 'condition': {'en': "Condition", 'ar': "الحالة"}, + 'id': {'en': "ID", 'ar': "بطاقة هوية"}, + 'quantity': {'en': "Quantity", 'ar': "الكمية"}, + 'codeNo': {'en': "Code #", 'ar': "# الرمز"}, + 'covered': {'en': "Covered", 'ar': "مغطى"}, + 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, + 'uncoveredByDoctor': { + 'en': "Uncovered By Doctor", + 'ar': "غير مغطى من قبل الدكتور" + }, + 'chiefComplaintEmptyMsg': { + 'en': "There is no Chief Complaint", + 'ar': "ليس هناك شكوى رئيس" + }, }; diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index e776720c..06fbce41 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -1,5 +1,58 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +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'; class UcafService extends BaseService { + List patientChiefComplaintList = []; + VitalSignData patientVitalSigns; + + Future getPatientChiefComplaint(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + body['DoctorID'] = ""; + + await baseAppClient.post (GET_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if(response['VitalSignsList'] != null){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } } \ No newline at end of file diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 31c8721d..8d0cfc31 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -11,43 +11,8 @@ class VitalSignsService extends BaseService{ List patientVitalSignOrderdSubList = []; VitalSignData patientVitalSigns; - /*Future getPatientVitalSign(patient) async { - hasError = false; - await baseAppClient.post( - GET_PATIENT_VITAL_SIGN, - onSuccess: (dynamic response, int statusCode) { - patientVitalSignList = []; - response['List_DoctorPatientVitalSign'].forEach((v) { - patientVitalSignList.add(new VitalSignResModel.fromJson(v)); - }); - - if (patientVitalSignList.length > 0) { - List patientVitalSignOrderdSubListTemp = []; - patientVitalSignOrderdSubListTemp = patientVitalSignList; - patientVitalSignOrderdSubListTemp - .sort((VitalSignResModel a, VitalSignResModel b) { - return b.vitalSignDate.microsecondsSinceEpoch - - a.vitalSignDate.microsecondsSinceEpoch; - }); - patientVitalSignOrderdSubList.clear(); - int length = patientVitalSignOrderdSubListTemp.length >= 20 - ? 20 - : patientVitalSignOrderdSubListTemp.length; - for (int x = 0; x < length; x++) { - patientVitalSignOrderdSubList - .add(patientVitalSignOrderdSubListTemp[x]); - } - } - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: patient, - ); - } // Vit*/ - Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; @@ -59,7 +24,7 @@ class VitalSignsService extends BaseService{ onSuccess: (dynamic response, int statusCode) { if(response['VitalSignsList'] != null){ if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ - patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); } } }, diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index c4aa8abf..63a7496c 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -21,6 +21,9 @@ class SickLeaveService extends BaseService { List get getAllRescheduleLeave => _getReScheduleLeave; List _getReScheduleLeave = []; + dynamic get postReschedule => _postReschedule; + dynamic _postReschedule; + Future getStatistics(appoNo, patientMRN) async { hasError = false; await baseAppClient.post( @@ -171,15 +174,17 @@ class SickLeaveService extends BaseService { ); } - addReschedule(request) async { + Future addReschedule(request) async { hasError = false; await baseAppClient.post( ADD_RESCHDEULE, onSuccess: (dynamic response, int statusCode) { - Future.value(response); + // return Future.value(response); + _postReschedule = response; }, onFailure: (String error, int statusCode) { + _postReschedule = null; hasError = true; super.error = error; }, @@ -193,9 +198,11 @@ class SickLeaveService extends BaseService { await baseAppClient.post( UPDATE_RESCHDEULE, onSuccess: (dynamic response, int statusCode) { - Future.value(response); + _postReschedule = response; + // return Future.value(response); }, onFailure: (String error, int statusCode) { + _postReschedule = null; hasError = true; super.error = error; }, diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index cf11854b..c120e2ab 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -1,9 +1,30 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +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 '../../locator.dart'; class UcafViewModel extends BaseViewModel { UcafService _ucafService = locator(); + + List get patientChiefComplaintList => _ucafService.patientChiefComplaintList; + VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns; + + Future getUCAFData(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _ucafService.getPatientVitalSign(patient); + await _ucafService.getPatientChiefComplaint(patient); + + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } \ No newline at end of file diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index f53def7b..4282141c 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -95,7 +95,7 @@ class VitalSignsViewModel extends BaseViewModel { ); } - String getBMI(double bodyMassIndex) { + String getBMI(var bodyMassIndex) { if (bodyMassIndex <= 18.5) { return "Underweight"; } else if (bodyMassIndex <= 25.0) { diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index d5aba154..8e1c68d9 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -16,6 +16,7 @@ class SickLeaveViewModel extends BaseViewModel { List get allReasons => _sickLeaveService.getReasons; List get coveringDoctors => _sickLeaveService.coveringDoctorsList; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; + get postSechedule => _sickLeaveService.postReschedule; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -99,6 +100,7 @@ class SickLeaveViewModel extends BaseViewModel { Future addReschedule(request) async { setState(ViewState.Busy); await _sickLeaveService.addReschedule(request); + if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart index 9996b65a..e5b45502 100644 --- a/lib/models/SOAP/my_selected_allergy.dart +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -4,9 +4,10 @@ class MySelectedAllergy { MasterKeyModel selectedAllergySeverity; MasterKeyModel selectedAllergy; String remark; + bool isChecked; MySelectedAllergy( - {this.selectedAllergySeverity, this.selectedAllergy, this.remark}); + {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked}); MySelectedAllergy.fromJson(Map json) { selectedAllergySeverity = json['selectedAllergySeverity'] != null @@ -16,6 +17,7 @@ class MySelectedAllergy { ? new MasterKeyModel.fromJson(json['selectedAllergy']) : null; remark = json['remark']; + remark = json['isChecked']; } Map toJson() { @@ -27,6 +29,7 @@ class MySelectedAllergy { data['selectedAllergy'] = this.selectedAllergy.toJson(); } data['remark'] = this.remark; + data['isChecked'] = this.remark; return data; } } diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart index 5d20e017..c5e503c2 100644 --- a/lib/models/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -5,7 +5,7 @@ class VitalSignData { int bloodPressureHigher; int bloodPressureLower; int bloodPressurePatientPosition; - double bodyMassIndex; + var bodyMassIndex; int fio2; int headCircumCm; int heightCm; diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index ad693f47..1e3b4739 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -124,10 +124,12 @@ class _MedicalFilePageState extends State { 'Doctor : '.toUpperCase(), fontWeight: FontWeight.w700, ), - AppText( - model.medicalFileList[0].entityList[0] - .timelines[index].doctorName, - fontWeight: FontWeight.w700, + Expanded( + child: AppText( + model.medicalFileList[0].entityList[0] + .timelines[index].doctorName, + fontWeight: FontWeight.w700, + ), ), ], ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 33b2606c..602bd180 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -466,25 +466,17 @@ class _PatientsScreenState extends State { height: 10.0, ), - Padding( - padding: EdgeInsets.symmetric( - vertical: - 5.5, - horizontal: - 22.5), - child: - AppText( + AppText( item.firstName + - " " + - item.lastName, + " " + + item.lastName, fontSize: - 2.0 * SizeConfig.textMultiplier, + 2.0 * SizeConfig.textMultiplier, fontWeight: - FontWeight.bold, + FontWeight.bold, backGroundcolor: - Colors.white, + Colors.white, ), - ), ], ), Row( diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 302b77a8..f9c2470a 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -5,6 +6,7 @@ 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/PatientHeaderWidgetNoAvatar.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:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -14,7 +16,6 @@ class UcafDetailScreen extends StatefulWidget { } class _UcafDetailScreenState extends State { - int _activeTap = 0; @override @@ -45,7 +46,7 @@ class _UcafDetailScreenState extends State { SizedBox( height: 16, ), - getSelectedTreatmentStepItem(context), + ...getSelectedTreatmentStepItem(context), ], ), ), @@ -64,8 +65,8 @@ class _UcafDetailScreenState extends State { ]; return Container( height: screenSize.height * 0.070, - decoration: - Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: Helpers.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -105,8 +106,296 @@ class _UcafDetailScreenState extends State { ); } - Widget getSelectedTreatmentStepItem(BuildContext _context) { - return Container(); + List getSelectedTreatmentStepItem(BuildContext _context) { + switch (_activeTap) { + case 0: + return [...List.generate(2, (index) => DiagnosisWidget()).toList()]; + case 1: + return [...List.generate(2, (index) => MedicationWidget()).toList()]; + case 2: + return [...List.generate(2, (index) => ProceduresWidget()).toList()]; + default: + return [ + Container(), + ]; + } + } +} + +class DiagnosisWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).diagnoseType}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Preliminary Diagnosis", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "B34.2 | CORONA VIRUS INFECTION, UNSPECIFIED SITE", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "174.00 Same", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} + +class MedicationWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).id}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).price}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "35.6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "3", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "EVE SKIN CREAM WITH HONEY -170GM", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "Every other day for 5 days", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); } +} + +class ProceduresWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).codeNo}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "019054846", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "1", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "SCAN - RENAL MASS PROTOCOL", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).covered}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + color: Colors.green, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).approvalRequired}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).uncoveredByDoctor}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } } diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index e0c2f9a7..0116ce46 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -14,6 +14,7 @@ import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; +import '../../../QR_reader_screen.dart'; class UCAFInputScreen extends StatefulWidget { @override @@ -55,312 +56,338 @@ class _UCAFInputScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) => model.getUCAFData(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: SingleChildScrollView( - child: Column( - children: [ - PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + body: model.patientVitalSigns != null && + model.patientChiefComplaintList != null && + model.patientChiefComplaintList.length > 0 + ? SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - CheckboxListTile( - title: AppText( - TranslationBase.of(context).inPatient, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _inPatient, - onChanged: (newValue) { - setState(() { - _inPatient = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).emergencyCase, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _emergencyCase, - onChanged: (newValue) { - setState(() { - _emergencyCase = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), + PatientHeaderWidgetNoAvatar(patient), Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).durationOfIllness, - null, - false), - enabled: true, - controller: _durationOfIllnessController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "BP (H/L)", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "120/80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "37.5(C), 98.6(F)", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats} :", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CheckboxListTile( + title: AppText( + TranslationBase.of(context).inPatient, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - AppText( - "80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, + value: _inPatient, + onChanged: (newValue) { + setState(() { + _inPatient = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).emergencyCase, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - ], - ), - ], - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).chiefComplaintsAndSymptoms, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 8, - ), - AppText( - TranslationBase.of(context) - .patientFeelsPainInHisBackAndCough, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).additionalTextComplaints, - null, - false), - enabled: true, - controller: _additionalComplaintsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).otherConditions, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ...List.generate( - conditionsData.length, - (index) => CheckboxListTile( - title: AppText( - conditionsData[index]['name'], - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, + value: _emergencyCase, + onChanged: (newValue) { + setState(() { + _emergencyCase = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .durationOfIllness, + null, + false), + enabled: true, + controller: _durationOfIllnessController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "BP (H/L)", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bloodPressureHigher}/${model.patientVitalSigns.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], ), - value: conditionsData[index]['isChecked'], - onChanged: (newValue) { - setState(() { - conditionsData[index]['isChecked'] = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).other, - null, - false), - enabled: true, - controller: _otherController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).how, - null, - false), - enabled: true, - controller: _howController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Row( - children: [ - Expanded( - child: Container( + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.temperatureCelcius}(C), ${model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32}(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .chiefComplaintsAndSymptoms, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .patientFeelsPainInHisBackAndCough, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .additionalTextComplaints, + helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint), + false), + enabled: false, + controller: _additionalComplaintsController, + keyboardType: TextInputType.text, + /*minLines: 4, + maxLines: 6,*/ + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherConditions, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ...List.generate( + conditionsData.length, + (index) => CheckboxListTile( + title: AppText( + conditionsData[index]['name'], + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: conditionsData[index]['isChecked'], + onChanged: (newValue) { + setState(() { + conditionsData[index]['isChecked'] = + newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + )), + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).when, + TranslationBase.of(context).other, null, false), enabled: true, - controller: _whenController, + controller: _otherController, keyboardType: TextInputType.text, )), - ), - SizedBox( - width: 4, - ), - Expanded( - child: Container( + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).where, + TranslationBase.of(context).how, null, false), enabled: true, - controller: _whereController, + controller: _howController, keyboardType: TextInputType.text, )), - ), - ], - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).specifyPossibleLineManagement, - null, - false), - enabled: true, - controller: _managementsLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context) - .significantSigns, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).backAbdomen, - null, - false), - enabled: true, - controller: _signsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: (){ - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); - }, + SizedBox( + height: 8, + ), + Row( + children: [ + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).when, + null, + false), + enabled: true, + controller: _whenController, + keyboardType: TextInputType.text, + )), + ), + SizedBox( + width: 4, + ), + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).where, + null, + false), + enabled: true, + controller: _whereController, + keyboardType: TextInputType.text, + )), + ), + ], + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .specifyPossibleLineManagement, + null, + false), + enabled: true, + controller: _managementsLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).significantSigns, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).backAbdomen, + null, + false), + enabled: true, + controller: _signsController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 16, + ), + AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_UCAF_DETAIL, + arguments: {'patient': patient}); + }, + ), + ], + ), ), ], ), + ) + : Container( + child: Center( + child: AppText( + model.patientVitalSigns == null + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context).chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ), ), - ], - ), - ), ), ); } diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart index c66555c1..a53a3619 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -415,43 +415,57 @@ class _TemperatureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (C):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (C):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (F):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (F):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -534,44 +548,59 @@ class _PulseWidgetState extends State { children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).pulseBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).rhythm}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseRhythm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).rhythm}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseRhythm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -628,43 +657,57 @@ class _RespirationWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).respBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).respBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).patternOfRespiration}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationPattern}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patternOfRespiration}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationPattern}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -721,43 +764,57 @@ class _BloodPressureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffLocation}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffLocation}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).cuffLocation}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureCuffLocation}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -766,44 +823,54 @@ class _BloodPressureWidgetState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).patientPosition}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressurePatientPosition}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patientPosition}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressurePatientPosition}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffSize}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffSize}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffSize}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffSize}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), @@ -953,43 +1020,47 @@ class _PainScaleWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).painScale}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.painScore}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.painScore}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).painManagement}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.isPainManagementDone}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painManagement}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.isPainManagementDone}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 9c3bda7f..405f240b 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -696,11 +696,11 @@ class _PrescriptionFormWidgetState extends State { selectDate(BuildContext context, PrescriptionViewModel model) async { DateTime selectedDate; - selectedDate = DateTime.now().add(Duration(hours: 1)); + selectedDate = DateTime.now().add(Duration(hours: 15)); final DateTime picked = await showDatePicker( context: context, initialDate: selectedDate, - firstDate: DateTime.now().add(Duration(hours: 5)), + firstDate: DateTime.now().add(Duration(hours: 15)), lastDate: DateTime(2040), initialEntryMode: DatePickerEntryMode.calendar, ); diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index a4739247..685259b4 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -45,23 +45,49 @@ class AddRescheduleLeavScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppTextFormField( - hintText: - TranslationBase.of(context).requestLeave, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon( - Icons.add_circle, - color: Colors.red, - )), - textInputType: TextInputType.text, + InkWell( + child: Row( + children: [ + Expanded( + flex: 4, + child: AppText( + TranslationBase.of(context) + .requestLeave), + ), + IconButton( + icon: Icon( + Icons.add_circle, + color: Colors.red, + )) + ], + ) + // AppTextFormField( + // hintText: + // TranslationBase.of(context).requestLeave, + // borderColor: Colors.white, + // prefix: IconButton( + // icon: Icon( + // Icons.add_circle, + // color: Colors.red, + // )), + // // textInputType: TextInputType.text, + // readOnly: true, + // onTap: () { + // openLeave( + // context, + // false, + // ); + // return false; + // }, + // inputFormatter: ONLY_LETTERS, + // ) + , onTap: () { openLeave( context, false, ); }, - inputFormatter: ONLY_LETTERS, ) ], ), @@ -158,7 +184,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { AppText(getDoctor( model .coveringDoctors, - item.doctorId)) + item.coveringDoctorId)) ]) : SizedBox(), AppText( @@ -272,8 +298,8 @@ class AddRescheduleLeavScreen extends StatelessWidget { getDoctor(model, doctorId) { var obj; - obj = model.where((i) => i['doctorID'] == doctorId).toList(); - print(obj); + obj = model.where((i) => i['doctorID'].toString() == doctorId).toList(); + //print(obj); return obj.length > 0 ? obj[0]['doctorName'] : ""; } @@ -281,7 +307,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { getReasons(model, reasonID) { var obj; obj = model.where((i) => i['id'] == reasonID).toList(); - print(obj); + //print(obj); return obj.length > 0 ? projectsProvider.isArabic == true diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index c74395a3..6f3299d1 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -6,8 +6,10 @@ import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -23,6 +25,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; Helpers helpers = Helpers(); @@ -39,21 +42,32 @@ class _RescheduleLeaveScreen extends State { TextEditingController _toDateController = new TextEditingController(); TextEditingController _toDateController2 = new TextEditingController(); ProjectViewModel projectsProvider; + SickLeaveViewModel sickLeaveViewModel; String _selectedClinic; Map profile = {}; - var offTime = '2'; + var offTime = '1'; var date; var doctorID; var reason; var fromDate; var toDate; var clinicID; + var fromTime; + var toTime; TextEditingController _controller4; + TextEditingController _controller5; void _presentDatePicker(id) { + var date = new DateTime.now(); + var initialDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); + var firstDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); showDatePicker( context: context, - initialDate: DateTime.now(), - firstDate: DateTime.now(), + initialDate: initialDate, + firstDate: firstDate, lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { @@ -69,6 +83,13 @@ class _RescheduleLeaveScreen extends State { _toDateController2.text = df.format(pickedDate); } }); + + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + toDate = pickedDate; + }); }); } @@ -82,6 +103,7 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); + return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( @@ -130,10 +152,12 @@ class _RescheduleLeaveScreen extends State { child: DropdownButton( focusColor: Colors.grey, isExpanded: true, + dropdownColor: + Colors.grey, value: getClinicName( model) ?? "", - iconSize: 40, + iconSize: 0, elevation: 16, selectedItemBuilder: (BuildContext @@ -151,8 +175,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + color: Colors + .grey[500], ), ], ); @@ -234,7 +258,7 @@ class _RescheduleLeaveScreen extends State { child: DropdownButtonHideUnderline( child: DropdownButton( - focusColor: Colors.grey, + // focusColor: Colors.grey, isExpanded: true, value: offTime == null ? model2.allOffTime[0] @@ -256,8 +280,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + // color: + // Colors.grey, ), ], ); @@ -313,24 +337,26 @@ class _RescheduleLeaveScreen extends State { CrossAxisAlignment.start, children: [ AppTextFormField( - hintText: TranslationBase.of( - context) - .fromDate, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons - .calendar_today)), - textInputType: - TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker( - 'fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - fromDate = value; - }), + hintText: + TranslationBase.of(context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today)), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) ], )), Row( @@ -351,32 +377,24 @@ class _RescheduleLeaveScreen extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - // new AppTextFormField( - // readOnly: true, - // hintText: "", - // borderColor: Colors.white, - // onSaved: (value) {}, - // inputFormatter: ONLY_NUMBERS), - DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, type: DateTimePickerType.time, controller: _controller4, - //initialValue: _initialValue, - // icon: Icon(Icons.access_time), - - //use24HourFormat: false, - //locale: Locale('en', 'US'), - onChanged: (val) => () { - print(val); - }, + onChanged: (val) => + fromTime = val, validator: (val) { print(val); // setState( // () => _valueToValidate4 = val); return null; }, - onSaved: (val) => {}, + onSaved: (val) => + fromTime = val, ) ], ), @@ -399,17 +417,15 @@ class _RescheduleLeaveScreen extends State { CrossAxisAlignment.start, children: [ DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .toTime, type: DateTimePickerType.time, - controller: _controller4, - //initialValue: _initialValue, - // icon: Icon(Icons.access_time), - - //use24HourFormat: false, - //locale: Locale('en', 'US'), - onChanged: (val) => () { - print(val); - }, + controller: _controller5, + onChanged: (val) => + toTime = val, validator: (val) { print(val); // setState( @@ -417,7 +433,7 @@ class _RescheduleLeaveScreen extends State { return null; }, onSaved: (val) => - {print(val)}, + toTime = val, ) ], ), @@ -481,7 +497,7 @@ class _RescheduleLeaveScreen extends State { AppTextFormField( hintText: TranslationBase .of(context) - .fromDate, + .toDate, borderColor: Colors.white, prefix: IconButton( icon: Icon( @@ -560,8 +576,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + // color: + // Colors.grey, ), ], ); @@ -654,8 +670,6 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, ), ], ); @@ -731,9 +745,10 @@ class _RescheduleLeaveScreen extends State { getProfile() async { Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; if (widget.updateData != null) { - this.profile = p; this.clinicID = widget.updateData.clinicId; _toDateController.text = widget.updateData.dateTimeFrom; @@ -749,16 +764,34 @@ class _RescheduleLeaveScreen extends State { return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } - addRecheduleLeave(model) { - final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + addRecheduleLeave(model) async { + final df = new DateFormat('yyyy-MM-ddTHH:MM:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + var fromDates = fromDate; + var toDates = toDate; + if (offTime == '1') { + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); + } else { + fromDate = df.format(fromDates); + toDate = df.format(toDates); + } Map request = { "Requisition": { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], - "doctorId": this.profile['ClinicID'], - "dateTimeFrom": df.format(fromDate), - "dateTimeTo": df.format(toDate), + "doctorId": this.profile['DoctorID'], + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -769,8 +802,8 @@ class _RescheduleLeaveScreen extends State { "weekDayId": 1, "shiftId": 1, "isOpen": true, - "timeFrom": null, - "timeTo": null, + "timeFrom": "", + "timeTo": "", "timeFromstr": "", "timeTostr": "" } @@ -778,21 +811,41 @@ class _RescheduleLeaveScreen extends State { } }; - model.addReschedule(request).then((response) { - print(response); + await model.addReschedule(request).then((value) { + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } }); } updateRecheduleLeave(model) { final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + + if (offTime == '1') { + fromDate = dateFormat.format(fromDate) + 'T' + fromTime + '00'; + toDate = dateFormat.format(fromDate) + 'T' + toTime + '00'; + } else { + fromDate = df.format(fromDate); + toDate = df.format(toDate); + } + Map request = { "Requisition": { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], - "doctorId": this.profile['ClinicID'], - "dateTimeFrom": df.format(fromDate), - "dateTimeTo": df.format(toDate), + "doctorId": this.profile['DoctorID'], + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -803,8 +856,8 @@ class _RescheduleLeaveScreen extends State { "weekDayId": 1, "shiftId": 1, "isOpen": true, - "timeFrom": null, - "timeTo": null, + "timeFrom": fromTime, + "timeTo": toTime, "timeFromstr": "", "timeTostr": "" } @@ -813,7 +866,17 @@ class _RescheduleLeaveScreen extends State { }; model.updateReschedule(request).then((response) { - print(response); + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } }); } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 2aea6f43..fcc641ff 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -203,7 +203,7 @@ class _SickLeaveScreenState extends State { value: getClinicName( model) ?? "", - iconSize: 40, + iconSize: 0, elevation: 16, selectedItemBuilder: (BuildContext @@ -221,6 +221,8 @@ class _SickLeaveScreenState extends State { fontSize: SizeConfig .textMultiplier * 2.1, + color: + Colors.grey, ), ], ); @@ -310,18 +312,19 @@ class _SickLeaveScreenState extends State { // TranslationBase.of(context).remarks, // fontSize: 10, // ), - AppTextFormField( - borderColor: Colors.white, - hintText: widget.extendedData != null - ? widget.extendedData.remarks - : TranslationBase.of(context).remarks, - onChanged: (value) { - addSickLeave.remarks = value; - }, - validator: (value) { - // return TextValidator().validateName(value); - }, - inputFormatter: ONLY_LETTERS) + TextField( + maxLines: 3, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(20.0), + border: InputBorder.none, + hintText: widget.extendedData != null + ? widget.extendedData.remarks + : TranslationBase.of(context) + .remarks), + onChanged: (value) { + addSickLeave.remarks = value; + }, + ) ], ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 5dee728a..b167b48e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -289,6 +289,10 @@ class TranslationBase { String get toDate => localizedValues['toDate'][locale.languageCode]; + String get fromTime => localizedValues['fromTime'][locale.languageCode]; + + String get toTime => localizedValues['toTime'][locale.languageCode]; + String get searchPatientImageCaptionTitle => localizedValues['searchPatientImageCaptionTitle'][locale.languageCode]; @@ -532,9 +536,23 @@ class TranslationBase { localizedValues['selectAllergy'][locale.languageCode]; String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; - String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; - String get referralEmptyMsg => localizedValues['referralEmptyMsg'][locale.languageCode]; - String get referralSuccessMsg => localizedValues['referralSuccessMsg'][locale.languageCode]; + String get leaveCreated => + localizedValues['leaveCreated'][locale.languageCode]; + String get vitalSignEmptyMsg => + localizedValues['vitalSignEmptyMsg'][locale.languageCode]; + String get referralEmptyMsg => + localizedValues['referralEmptyMsg'][locale.languageCode]; + String get referralSuccessMsg => + localizedValues['referralSuccessMsg'][locale.languageCode]; + String get diagnoseType => localizedValues['diagnoseType'][locale.languageCode]; + String get condition => localizedValues['condition'][locale.languageCode]; + String get id => localizedValues['id'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; + String get codeNo => localizedValues['codeNo'][locale.languageCode]; + String get covered => localizedValues['covered'][locale.languageCode]; + String get approvalRequired => localizedValues['approvalRequired'][locale.languageCode]; + String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode]; + String get chiefComplaintEmptyMsg => localizedValues['chiefComplaintEmptyMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index f50c7669..7f49c868 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -94,7 +94,7 @@ class PatientProfileWidget extends StatelessWidget { color: Color(0xffCCCCCC), ), Container( - height: 10 * SizeConfig.textMultiplier, + height: 11 * SizeConfig.textMultiplier, child: Row( children: [ Expanded( @@ -232,14 +232,16 @@ class PatientProfileWidget extends StatelessWidget { SizeConfig.textMultiplier, ), ), - AppText( - patient.admissionDate != null - ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" - : "", - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: - 1.6 * SizeConfig.textMultiplier, + Expanded( + child: AppText( + patient.admissionDate != null + ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" + : "", + color: Colors.black, + fontWeight: FontWeight.normal, + fontSize: + 1.6 * SizeConfig.textMultiplier, + ), ), ], ), @@ -374,13 +376,15 @@ class PatientProfileWidget extends StatelessWidget { SizedBox( width: 4, ), - AppText( - "${patient.nursingStationName}\n${patient.roomId}", - fontWeight: - FontWeight.normal, - fontSize: 1.4 * - SizeConfig - .textMultiplier, + Expanded( + child: AppText( + "${patient.nursingStationName}\n${patient.roomId}", + fontWeight: + FontWeight.normal, + fontSize: 1.4 * + SizeConfig + .textMultiplier, + ), ), ], ), diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index 56f3435e..b7e9e837 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -34,7 +34,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -84,7 +84,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 1 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -187,7 +187,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -257,7 +257,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -307,7 +307,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -357,7 +357,7 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.52, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(2) : null, + onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -411,7 +411,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 43f7bcdd..1d143310 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -28,6 +28,7 @@ class UpdateAllergiesWidget extends StatefulWidget { } class _UpdateAllergiesWidgetState extends State { + TextEditingController remarkController = TextEditingController(); @override @@ -52,7 +53,9 @@ class _UpdateAllergiesWidgetState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context).emptyMessage; + return TranslationBase + .of(context) + .emptyMessage; else return null; }), @@ -61,22 +64,31 @@ class _UpdateAllergiesWidgetState extends State { height: 20, ), Container( - margin: EdgeInsets.only(left: 15, right: 15, top: 15), + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( children: widget.myAllergiesList.map((selectedAllergy) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start,children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween,crossAxisAlignment: CrossAxisAlignment.start, + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ Container( child: Expanded( - child: Texts(projectViewModel.isArabic ? selectedAllergy - .selectedAllergy.nameAr : selectedAllergy - .selectedAllergy.nameEn.toUpperCase(), + child: Texts( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergy.nameAr + : selectedAllergy.selectedAllergy.nameEn + .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: Colors.black), ), @@ -88,17 +100,21 @@ class _UpdateAllergiesWidgetState extends State { .selectedAllergySeverity.nameEn .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: AppGlobal.appPrimaryColor), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeAllergy(selectedAllergy), - ) - ], + if(selectedAllergy.isChecked) + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeAllergy(selectedAllergy), + ) + ], ), SizedBox( height: 10, @@ -112,13 +128,22 @@ class _UpdateAllergiesWidgetState extends State { } removeAllergy(MySelectedAllergy mySelectedAllergy) { - Iterable allergy = - widget.myAllergiesList.where((element) => mySelectedAllergy == element); + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergySeverity.id == + element.selectedAllergySeverity.id && + mySelectedAllergy.selectedAllergy.id == element.selectedAllergy.id + ).toList(); - if (allergy.length > 0) + if (allergy.length > 0) { setState(() { - widget.myAllergiesList.remove(allergy.first); + allergy[0].isChecked = false; }); + } + + + print(allergy); } openAllergiesList(BuildContext context) { @@ -130,14 +155,29 @@ class _UpdateAllergiesWidgetState extends State { return AddAllergies( addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { setState(() { - if (!widget.myAllergiesList.contains(mySelectedAllergy)) { + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergy.id == + element.selectedAllergy.id + ).toList(); + if (allergy.isEmpty) { widget.myAllergiesList.add(mySelectedAllergy); Navigator.of(context).pop(); } else { - helpers.showErrorToast(TranslationBase - .of(context) - .itemExist); + allergy.first.selectedAllergy = + mySelectedAllergy.selectedAllergy; + allergy.first.selectedAllergySeverity = + mySelectedAllergy.selectedAllergySeverity; + allergy.first.remark = mySelectedAllergy.remark; + allergy.first.isChecked = mySelectedAllergy.isChecked; + Navigator.of(context).pop(); + + // helpers.showErrorToast(TranslationBase + // .of(context) + // .itemExist); } + }); },); }); @@ -162,9 +202,9 @@ class _AddAllergiesState extends State { TextEditingController remarkController = TextEditingController(); GlobalKey key = new GlobalKey>(); - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { + + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown,{IconData icon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -204,166 +244,167 @@ class _AddAllergiesState extends State { await model.getMasterLookup(MasterKeysService.AllergySeverity); } }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 16, + ), + AppText( + TranslationBase .of(context) .addAllergies, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null - ? () { - setState(() { - _selectedAllergy = null; - }); - } - : null, - child: _selectedAllergy == null - ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration( - TranslationBase + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + }); + } + : null, + child: _selectedAllergy==null? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectAllergy, - _selectedAllergy != null - ? _selectedAllergy.nameEn - : null, - true, - icon: EvaIcons.search), - itemSubmitted: (item) => - setState(() => _selectedAllergy = item), - key: key, - suggestions: model.allergiesList, - itemBuilder: (context, suggestion) => - new Padding( - child: Texts( - projectViewModel.isArabic - ? suggestion.nameAr - : suggestion.nameEn), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.nameAr - .toLowerCase() - .startsWith(input.toLowerCase()) || - suggestion.nameEn - .toLowerCase() - .startsWith(input.toLowerCase()), - ) - : TextField( - decoration: textFieldSelectorDecoration( - TranslationBase + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, true, icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() => _selectedAllergy = item), + key: key, + suggestions: model.allergiesList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + projectViewModel.isArabic ? suggestion + .nameAr : suggestion.nameEn), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.nameAr.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.nameEn.toLowerCase() + .startsWith(input.toLowerCase()), + ):TextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectAllergy, - _selectedAllergy != null - ? projectViewModel.isArabic?_selectedAllergy.nameAr: _selectedAllergy.nameEn - : null, - true, - icon: EvaIcons.search), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergySeverityList != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.allergySeverityList, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedAllergySeverity = - selectedValue; - - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase + _selectedAllergy != null + ? projectViewModel.isArabic?_selectedAllergy.nameAr: _selectedAllergy.nameEn + : null, true, icon: EvaIcons.search), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.allergySeverityList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedAllergySeverity = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectSeverity, - _selectedAllergySeverity != null - ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn - : null, - true), - enabled: false, + _selectedAllergySeverity != null + ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn + : null, + true), + enabled: false, + ), + ), ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 10, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - MySelectedAllergy mySelectedAllergy = - new MySelectedAllergy( - remark: remarkController.text, - selectedAllergy: _selectedAllergy, - selectedAllergySeverity: - _selectedAllergySeverity); - widget.addAllergiesFun(mySelectedAllergy); - }, - ), - ]), - ), - ), - )), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 10, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( + remark: remarkController.text, + selectedAllergy: _selectedAllergy, + isChecked: true, + selectedAllergySeverity: _selectedAllergySeverity,); + widget.addAllergiesFun(mySelectedAllergy); + }, + ), + ] + + ), + ), + ), + )), ), ); } } + + + + + diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 98d1b7d0..ddab4734 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -131,6 +131,10 @@ class _UpdateSubjectivePageState extends State { return BaseView( onModelReady: (model) async { + widget.myAllergiesList.clear(); + widget.myHistoryList.clear(); + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -165,6 +169,7 @@ class _UpdateSubjectivePageState extends State { ); MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, + isChecked: element.isChecked, selectedAllergySeverity: selectedAllergySeverity); if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index e3aef3f4..37a5d72f 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -505,6 +505,8 @@ class _AddExaminationDailogState extends State { baseViewModel: model, child: MasterKeyCheckboxSearchWidget( model: model, + hintSearchText: 'Search Examination', + buttonName: 'Add Examination', masterList: model.physicalExaminationList, removeHistory: (history){ setState(() { diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 9f6dfdf1..f2e663bf 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -16,11 +16,12 @@ class Texts extends StatefulWidget { final bool readMore; final String style; final bool allowExpand; + final TextDecoration textDecoration; Texts(this.text, {Key key, this.variant, this.color, this.bold, this.regular, this.medium, this.allowExpand = true, this.italic:false, this.textAlign, this.maxLength=60, - this.maxLines, this.readMore=false, this.style + this.maxLines, this.readMore=false, this.style, this.textDecoration }) : super(key: key); @override @@ -192,6 +193,7 @@ class _TextsState extends State { fontSize: _getFontSize(), letterSpacing: widget.variant=="overline" ? 1.5 : null, fontWeight: _getFontWeight(), + decoration: widget.textDecoration//TextDecoration.lineThrough ) ), if (widget.readMore && text.length > widget.maxLength && hidden) @@ -228,7 +230,8 @@ class _TextsState extends State { style: _getFontStyle().copyWith( color: HexColor('#FF0000'), fontWeight: FontWeight.w800, - fontFamily: "WorkSans" + fontFamily: "WorkSans", + ) ), ), diff --git a/pubspec.lock b/pubspec.lock index 5650f5f9..7f1d8c1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -503,7 +503,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: @@ -760,7 +760,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: @@ -895,5 +895,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0"