From d0d68741598f2355873d3930d29713dd3ac24b90 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 14 Jul 2021 11:02:51 +0300 Subject: [PATCH] create mapper for the selected items --- lib/config/localized_values.dart | 1 + lib/models/SOAP/my_selected_allergy.dart | 54 -- lib/models/SOAP/my_selected_assement.dart | 65 -- lib/models/SOAP/my_selected_examination.dart | 61 -- lib/models/SOAP/my_selected_history.dart | 33 - .../selected_items/my_selected_allergy.dart | 23 + .../selected_items/my_selected_assement.dart | 24 + .../my_selected_examination.dart | 27 + .../selected_items/my_selected_history.dart | 11 + .../assessment/add_assessment_details.dart | 2 +- .../assessment/update_assessment_page.dart | 755 +++++++++--------- .../objective/add_examination_page.dart | 2 +- .../objective/add_examination_widget.dart | 2 +- .../objective/examination_item_card.dart | 2 +- .../examinations_list_search_widget.dart | 2 +- .../objective/update_objective_page.dart | 8 +- .../profile/soap_update/soap_utils.dart | 88 ++ .../subjective/allergies/add_allergies.dart | 2 +- .../subjective/allergies/allergies_item.dart | 14 +- ..._key_checkbox_search_allergies_widget.dart | 2 +- .../allergies/update_allergies_widget.dart | 2 +- .../history/add_history_dialog.dart | 9 +- .../history/update_history_widget.dart | 2 +- .../medication/update_medication_widget.dart | 2 +- .../subjective/update_subjective_page.dart | 203 +++-- .../soap_update/update_soap_index.dart | 7 +- lib/util/translations_delegate_base.dart | 1 + 27 files changed, 713 insertions(+), 691 deletions(-) delete mode 100644 lib/models/SOAP/my_selected_allergy.dart delete mode 100644 lib/models/SOAP/my_selected_assement.dart delete mode 100644 lib/models/SOAP/my_selected_examination.dart delete mode 100644 lib/models/SOAP/my_selected_history.dart create mode 100644 lib/models/SOAP/selected_items/my_selected_allergy.dart create mode 100644 lib/models/SOAP/selected_items/my_selected_assement.dart create mode 100644 lib/models/SOAP/selected_items/my_selected_examination.dart create mode 100644 lib/models/SOAP/selected_items/my_selected_history.dart create mode 100644 lib/screens/patients/profile/soap_update/soap_utils.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0a094b9b..ebc43a87 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -704,4 +704,5 @@ const Map> localizedValues = { "edit": {"en": "Edit", "ar": "تعديل"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, "finish": {"en": "Finish", "ar": "انهاء"}, + "severityValidationError": {"en": "Please add allergy severity", "ar": "الرجاء إضافة شدة الحساسية"}, }; diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart deleted file mode 100644 index 90031230..00000000 --- a/lib/models/SOAP/my_selected_allergy.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedAllergy { - MasterKeyModel selectedAllergySeverity; - MasterKeyModel selectedAllergy; - String remark; - bool isChecked; - bool isExpanded; - bool isLocal; - int createdBy; - bool hasValidationError; - - MySelectedAllergy( - {this.selectedAllergySeverity, - this.selectedAllergy, - this.remark, - this.isChecked, - this.isExpanded = true, - this.isLocal = true, - this.createdBy, - this.hasValidationError = false}); - - MySelectedAllergy.fromJson(Map json) { - selectedAllergySeverity = json['selectedAllergySeverity'] != null - ? new MasterKeyModel.fromJson(json['selectedAllergySeverity']) - : null; - selectedAllergy = json['selectedAllergy'] != null - ? new MasterKeyModel.fromJson(json['selectedAllergy']) - : null; - remark = json['remark']; - isChecked = json['isChecked']; - isExpanded = json['isExpanded']; - isLocal = json['isLocal']; - createdBy = json['createdBy']; - hasValidationError = json['hasValidationError']; - } - - Map toJson() { - final Map data = new Map(); - if (this.selectedAllergySeverity != null) { - data['selectedAllergySeverity'] = this.selectedAllergySeverity.toJson(); - } - if (this.selectedAllergy != null) { - data['selectedAllergy'] = this.selectedAllergy.toJson(); - } - data['remark'] = this.remark; - data['isChecked'] = this.isChecked; - data['isExpanded'] = this.isExpanded; - data['createdBy'] = this.createdBy; - data['isLocal'] = this.isLocal; - data['hasValidationError'] = this.hasValidationError; - return data; - } -} diff --git a/lib/models/SOAP/my_selected_assement.dart b/lib/models/SOAP/my_selected_assement.dart deleted file mode 100644 index 4d4afc2d..00000000 --- a/lib/models/SOAP/my_selected_assement.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedAssessment { - MasterKeyModel selectedICD; - MasterKeyModel selectedDiagnosisCondition; - MasterKeyModel selectedDiagnosisType; - String remark; - int appointmentId; - int createdBy; - String createdOn; - int doctorID; - String doctorName; - String icdCode10ID; - - MySelectedAssessment( - {this.selectedICD, - this.selectedDiagnosisCondition, - this.selectedDiagnosisType, - this.remark, this.appointmentId, this.createdBy, - this.createdOn, - this.doctorID, - this.doctorName, - this.icdCode10ID}); - - MySelectedAssessment.fromJson(Map json) { - selectedICD = json['selectedICD'] != null - ? new MasterKeyModel.fromJson(json['selectedICD']) - : null; - selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null - ? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition']) - : null; - selectedDiagnosisType = json['selectedDiagnosisType'] != null - ? new MasterKeyModel.fromJson(json['selectedDiagnosisType']) - : null; - remark = json['remark']; - appointmentId = json['appointmentId']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - doctorID = json['doctorID']; - doctorName = json['doctorName']; - icdCode10ID = json['icdCode10ID']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedICD != null) { - data['selectedICD'] = this.selectedICD.toJson(); - } - if (this.selectedDiagnosisCondition != null) { - data['selectedICD'] = this.selectedDiagnosisCondition.toJson(); - } - if (this.selectedDiagnosisType != null) { - data['selectedICD'] = this.selectedDiagnosisType.toJson(); - } - data['remark'] = this.remark; - data['appointmentId'] = this.appointmentId; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['doctorID'] = this.doctorID; - data['doctorName'] = this.doctorName; - data['icdCode10ID'] = this.icdCode10ID; - return data; - } -} diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart deleted file mode 100644 index 6a3ecf99..00000000 --- a/lib/models/SOAP/my_selected_examination.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedExamination { - MasterKeyModel selectedExamination; - String remark; - bool isNormal; - bool isAbnormal; - bool notExamined; - bool isNew; - bool isLocal; - int createdBy; - String createdOn; - String editedOn; - - MySelectedExamination({ - this.selectedExamination, - this.remark, - this.isNormal = false, - this.isAbnormal = false, - this.notExamined = true, - this.isNew = true, - this.isLocal = true, - this.createdBy, - this.createdOn, - this.editedOn, - }); - - MySelectedExamination.fromJson(Map json) { - selectedExamination = json['selectedExamination'] != null - ? new MasterKeyModel.fromJson(json['selectedExamination']) - : null; - remark = json['remark']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - notExamined = json['notExamined']; - isNew = json['isNew']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - editedOn = json['editedOn']; - isLocal = json['isLocal']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedExamination != null) { - data['selectedExamination'] = this.selectedExamination.toJson(); - } - data['remark'] = this.remark; - data['isNormal'] = this.isNormal; - data['isAbnormal'] = this.isAbnormal; - data['notExamined'] = this.notExamined; - data['isNew'] = this.isNew; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['editedOn'] = this.editedOn; - data['isLocal'] = this.isLocal; - - return data; - } -} diff --git a/lib/models/SOAP/my_selected_history.dart b/lib/models/SOAP/my_selected_history.dart deleted file mode 100644 index 91f66910..00000000 --- a/lib/models/SOAP/my_selected_history.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedHistory { - MasterKeyModel selectedHistory; - String remark; - bool isChecked; - bool isLocal; - - MySelectedHistory( - { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); - - MySelectedHistory.fromJson(Map json) { - - selectedHistory = json['selectedHistory'] != null - ? new MasterKeyModel.fromJson(json['selectedHistory']) - : null; - remark = json['remark']; - remark = json['isChecked']; - isLocal = json['isLocal']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedHistory != null) { - data['selectedHistory'] = this.selectedHistory.toJson(); - } - data['remark'] = this.remark; - data['isChecked'] = this.remark; - data['isLocal'] = this.isLocal; - return data; - } -} diff --git a/lib/models/SOAP/selected_items/my_selected_allergy.dart b/lib/models/SOAP/selected_items/my_selected_allergy.dart new file mode 100644 index 00000000..512a4f64 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_allergy.dart @@ -0,0 +1,23 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAllergy { + MasterKeyModel selectedAllergySeverity; + MasterKeyModel selectedAllergy; + String remark; + bool isChecked; + bool isExpanded; + bool isLocal; + int createdBy; + bool hasValidationError; + + MySelectedAllergy( + {this.selectedAllergySeverity, + this.selectedAllergy, + this.remark, + this.isChecked, + this.isExpanded = true, + this.isLocal = true, + this.createdBy, + this.hasValidationError = false}); + +} diff --git a/lib/models/SOAP/selected_items/my_selected_assement.dart b/lib/models/SOAP/selected_items/my_selected_assement.dart new file mode 100644 index 00000000..01572e6d --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_assement.dart @@ -0,0 +1,24 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAssessment { + MasterKeyModel selectedICD; + MasterKeyModel selectedDiagnosisCondition; + MasterKeyModel selectedDiagnosisType; + String remark; + int appointmentId; + int createdBy; + String createdOn; + int doctorID; + String doctorName; + String icdCode10ID; + + MySelectedAssessment( + {this.selectedICD, + this.selectedDiagnosisCondition, + this.selectedDiagnosisType, + this.remark, this.appointmentId, this.createdBy, + this.createdOn, + this.doctorID, + this.doctorName, + this.icdCode10ID}); +} diff --git a/lib/models/SOAP/selected_items/my_selected_examination.dart b/lib/models/SOAP/selected_items/my_selected_examination.dart new file mode 100644 index 00000000..75f67ae2 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_examination.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + bool notExamined; + bool isNew; + bool isLocal; + int createdBy; + String createdOn; + String editedOn; + + MySelectedExamination({ + this.selectedExamination, + this.remark, + this.isNormal = false, + this.isAbnormal = false, + this.notExamined = true, + this.isNew = true, + this.isLocal = true, + this.createdBy, + this.createdOn, + this.editedOn, + }); +} diff --git a/lib/models/SOAP/selected_items/my_selected_history.dart b/lib/models/SOAP/selected_items/my_selected_history.dart new file mode 100644 index 00000000..3769c418 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_history.dart @@ -0,0 +1,11 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedHistory { + MasterKeyModel selectedHistory; + String remark; + bool isChecked; + bool isLocal; + + MySelectedHistory( + {this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); +} diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index e14eb6f2..cc8be61f 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -6,8 +6,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.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'; diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index f8da93f5..95d3cda5 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -5,9 +5,10 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.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/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -28,12 +29,14 @@ class UpdateAssessmentPage extends StatefulWidget { final Function changePageViewIndex; final PatiantInformtion patientInfo; final Function changeLoadingState; - final int currentIndex; + final int currentIndex; + UpdateAssessmentPage( {Key key, this.changePageViewIndex, this.patientInfo, - this.changeLoadingState, this.currentIndex}); + this.changeLoadingState, + this.currentIndex}); @override _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); @@ -42,6 +45,7 @@ class UpdateAssessmentPage extends StatefulWidget { class _UpdateAssessmentPageState extends State { bool isAssessmentExpand = false; List mySelectedAssessmentList = List(); + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -54,7 +58,8 @@ class _UpdateAssessmentPageState extends State { episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientAssessment(getAssessmentReqModel); if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { @@ -83,11 +88,11 @@ class _UpdateAssessmentPageState extends State { diagnosisType != null && diagnosisCondition != null) { MySelectedAssessment temMySelectedAssessment = - MySelectedAssessment( - appointmentId: element.appointmentNo, + SoapUtils.generateMySelectedAssessment( + appointmentNo: element.appointmentNo, remark: element.remarks, - selectedDiagnosisType: diagnosisType, - selectedDiagnosisCondition: diagnosisCondition, + diagnosisType: diagnosisType, + diagnosisCondition: diagnosisCondition, selectedICD: selectedICD, doctorID: element.doctorID, doctorName: element.doctorName, @@ -103,207 +108,173 @@ class _UpdateAssessmentPageState extends State { widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - - color: Theme - .of(context) - .scaffoldBackgroundColor, - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex:widget.changePageViewIndex), - - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).assessment - , - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - - SOAPOpenItems(label: "${TranslationBase.of(context).addAssessment}",onTap: () { - openAssessmentDialog(context, - isUpdate: false, model: model); - },), - - SizedBox( - height: 20, - ), - Column( - children: mySelectedAssessmentList - .map((assessment) { - return Container( - margin: EdgeInsets.only( - left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600), - children: [ - new TextSpan( - text: "ICD : ".toUpperCase(), - ), - new TextSpan( - text: assessment - .selectedICD.code - .trim() - .toUpperCase() ?? - "", - ), - ], - ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.50, - child: RichText( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).assessment, + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); + }, + child: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + SOAPOpenItems( + label: + "${TranslationBase.of(context).addAssessment}", + onTap: () { + openAssessmentDialog(context, + isUpdate: false, model: model); + }, + ), + SizedBox( + height: 20, + ), + Column( + children: + mySelectedAssessmentList.map((assessment) { + return Container( + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + RichText( text: new TextSpan( style: new TextStyle( - fontSize: 16, + fontSize: 12, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600), children: [ + new TextSpan( + text: + "ICD : ".toUpperCase(), + ), new TextSpan( text: assessment - .selectedICD.description - .toString(), + .selectedICD.code + .trim() + .toUpperCase() ?? + "", ), ], ), ), - ), - RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600), - children: [ - new TextSpan( - text: TranslationBase.of( - context) - .appointmentNo, + Container( + width: MediaQuery.of(context) + .size + .width * + 0.50, + child: RichText( + text: new TextSpan( style: new TextStyle( - color: Color(0xFF575757), - ), - ), - new TextSpan( - text: assessment - .appointmentId.toString() - - ?? - "", - style: new TextStyle( - fontSize: 14, - color: Color(0xFF2B353E), - ), + fontSize: 16, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: assessment + .selectedICD + .description + .toString(), + ), + ], ), - ], + ), ), - ), - RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600), - children: [ - new TextSpan( - text: TranslationBase.of( - context) - .condition + - " : ", - style: new TextStyle( - color: Color(0xFF575757), + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .appointmentNo, + style: new TextStyle( + color: Color(0xFF575757), + ), ), - ), - new TextSpan( - text: projectViewModel - .isArabic - ? assessment - .selectedDiagnosisCondition - .nameAr - : assessment - .selectedDiagnosisCondition - .nameEn, - style: new TextStyle( - fontSize: 14, - color: Color(0xFF2B353E), + new TextSpan( + text: assessment + .appointmentId + .toString() ?? + "", + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), ), - ), - ], + ], + ), ), - ), - RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600), - children: [ - new TextSpan( - text: TranslationBase.of( - context) - .dType + - ' : ', - style: new TextStyle( - color: Color(0xFF575757), + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .condition + + " : ", + style: new TextStyle( + color: Color(0xFF575757), + ), ), - ), - new TextSpan( - text: projectViewModel - .isArabic - ? assessment - .selectedDiagnosisType - .nameAr - : assessment - .selectedDiagnosisType - .nameEn, - style: new TextStyle( - fontSize: 14, - color: Color(0xFF2B353E), + new TextSpan( + text: projectViewModel + .isArabic + ? assessment + .selectedDiagnosisCondition + .nameAr + : assessment + .selectedDiagnosisCondition + .nameEn, + style: new TextStyle( + fontSize: 14, + color: Color(0xFF2B353E), + ), ), - ), - ], + ], + ), ), - ), - if (assessment.doctorName != null) RichText( text: new TextSpan( style: new TextStyle( @@ -316,16 +287,21 @@ class _UpdateAssessmentPageState extends State { new TextSpan( text: TranslationBase.of( context) - .doc + + .dType + ' : ', style: new TextStyle( color: Color(0xFF575757), ), ), new TextSpan( - text: - assessment.doctorName ?? - '', + text: projectViewModel + .isArabic + ? assessment + .selectedDiagnosisType + .nameAr + : assessment + .selectedDiagnosisType + .nameEn, style: new TextStyle( fontSize: 14, color: Color(0xFF2B353E), @@ -334,204 +310,236 @@ class _UpdateAssessmentPageState extends State { ], ), ), - SizedBox( - height: 6, - ), - - Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - AppText( - (assessment.remark != null && - assessment.remark != - '') - ? TranslationBase.of( - context) - .remarks + - " : " - : '', - - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: - FontWeight.w600 - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.38, - child: AppText( - assessment.remark ?? "", - fontSize: 11, - color: Color(0xFF2B353E), - fontWeight: FontWeight.w700, + if (assessment.doctorName != null) + RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + children: [ + new TextSpan( + text: TranslationBase.of( + context) + .doc + + ' : ', + style: new TextStyle( + color: + Color(0xFF575757), + ), + ), + new TextSpan( + text: assessment + .doctorName ?? + '', + style: new TextStyle( + fontSize: 14, + color: + Color(0xFF2B353E), + ), + ), + ], ), ), - ], - ), - ], - ), - Column( - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Row( - children: [ - Column( - children: [ - AppText( - assessment.createdOn != null - ? AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.parse( - assessment - .createdOn)) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now()), - fontWeight: FontWeight - .w600, - fontSize: 14, - ), AppText( - assessment.createdOn != null - ? AppDateUtils.getHour( - DateTime.parse( - assessment - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), - fontWeight: FontWeight - .w600, - fontSize: 14, + SizedBox( + height: 6, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + AppText( + (assessment.remark != + null && + assessment.remark != + '') + ? TranslationBase.of( + context) + .remarks + + " : " + : '', + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: + FontWeight.w600), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.38, + child: AppText( + assessment.remark ?? "", + fontSize: 11, + color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, ), - ], + ), + ], + ), + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Row( + children: [ + Column( + children: [ + AppText( + assessment.createdOn != + null + ? AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.parse( + assessment + .createdOn)) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime + .now()), + fontWeight: + FontWeight.w600, + fontSize: 14, + ), + AppText( + assessment.createdOn != + null + ? AppDateUtils.getHour( + DateTime.parse( + assessment + .createdOn)) + : AppDateUtils + .getHour(DateTime + .now()), + fontWeight: + FontWeight.w600, + fontSize: 14, + ), + ], + ), + ], + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.05, + ), + InkWell( + onTap: () { + openAssessmentDialog(context, + isUpdate: true, + assessment: assessment, + model: model); + }, + child: Icon( + DoctorApp.edit, + size: 18, ), - ], - ), - SizedBox( - height: MediaQuery.of(context) - .size - .height * - 0.05, - ), - InkWell( - onTap: () { - openAssessmentDialog(context, - isUpdate: true, - assessment: assessment, - model: model); - }, - child: Icon( - DoctorApp.edit, size: 18,), - ) - ], - ), - ], - ), - ); - }).toList(), - ) - ], - ) - ]), - isExpanded: isAssessmentExpand, - ), - SizedBox( - height: 130, - ), - ], + ) + ], + ), + ], + ), + ); + }).toList(), + ) + ], + ) + ]), + isExpanded: isAssessmentExpand, + ), + SizedBox( + height: 130, + ), + ], + ), ), ), ), ), - ), - bottomSheet:Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), - Container(child: - FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(1); - }, - ) - , - ), - SizedBox(width: 5,), - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - if (mySelectedAssessmentList.isEmpty) { - Helpers.showErrorToast( - TranslationBase - .of(context) - .assessmentErrorMsg); - } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(3); - - } - }, - ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: 80, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + widget.changePageViewIndex(1); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + if (mySelectedAssessmentList.isEmpty) { + Helpers.showErrorToast( + TranslationBase.of(context) + .assessmentErrorMsg); + } else { + widget.changeLoadingState(true); + widget.changePageViewIndex(3); + } + }, + ), + ), + ], ), - ], + ), ), ), - ),), - SizedBox( - height: 5, - ), - ], - ),) - - ), + SizedBox( + height: 5, + ), + ], + ), + )), ); } openAssessmentDialog(BuildContext context, {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { if (assessment == null) { - assessment = MySelectedAssessment( - remark: '', appointmentId: widget.patientInfo.appointmentNo); + assessment = SoapUtils.generateMySelectedAssessment( + remark: '', appointmentNo: widget.patientInfo.appointmentNo); } showModalBottomSheet( backgroundColor: Colors.white, @@ -546,11 +554,10 @@ class _UpdateAssessmentPageState extends State { addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async { setState(() { - if(!isUpdate) - mySelectedAssessmentList.add(mySelectedAssessment); + if (!isUpdate) + mySelectedAssessmentList.add(mySelectedAssessment); }); }); }); } } - diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 87af6ec2..37f67ffc 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index f0dc25cf..ce2bced1 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 84a4c740..58dc7180 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index c67102ee..ed7554e1 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index dbd3b080..ca2464b1 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -4,11 +4,12 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.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/patients/profile/soap_update/soap_utils.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/shared/app_scaffold_widget.dart'; @@ -80,8 +81,9 @@ class _UpdateObjectivePageState extends State { masterKeys: MasterKeysService.PhysicalExamination, id: element.examId, ); - MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, + MySelectedExamination tempEam = + SoapUtils.generateMySelectedExamination( + examination: examMaster, remark: element.remarks, isNormal: element.isNormal, createdBy: element.createdBy, diff --git a/lib/screens/patients/profile/soap_update/soap_utils.dart b/lib/screens/patients/profile/soap_update/soap_utils.dart new file mode 100644 index 00000000..34bf4236 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/soap_utils.dart @@ -0,0 +1,88 @@ +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; + +class SoapUtils { + static MySelectedHistory generateMySelectedHistory( + {history, isChecked, remark, isLocal}) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: isChecked, + remark: remark, + isLocal: isLocal); + return mySelectedHistory; + } + + static MySelectedAllergy generateMySelectedAllergy( + {allergy, + allergySeverity, + isChecked, + remark, + isLocal, + int createdBy, + bool isExpanded}) { + MySelectedAllergy mySelectedAllergy = MySelectedAllergy( + selectedAllergy: allergy, + selectedAllergySeverity: allergySeverity, + isChecked: isChecked, + remark: remark, + isLocal: isLocal, + createdBy: createdBy, + isExpanded: isExpanded); + return mySelectedAllergy; + } + + static MySelectedExamination generateMySelectedExamination( + {examination, + allergySeverity, + isChecked, + remark, + isLocal, + isNormal, + createdBy, + createdOn, + editedOn, + notExamined, + isNew, + isAbnormal}) { + MySelectedExamination mySelectedExamination = MySelectedExamination( + selectedExamination: examination, + remark: remark, + isNormal: isNormal, + createdBy: createdBy, + createdOn: createdOn, + editedOn: editedOn, + notExamined: notExamined, + isNew: isNew, + isLocal: isLocal, + isAbnormal: isAbnormal, + ); + return mySelectedExamination; + } + + static MySelectedAssessment generateMySelectedAssessment( + {appointmentNo, + remark, + diagnosisType, + diagnosisCondition, + selectedICD, + doctorID, + doctorName, + createdBy, + createdOn, + icdCode10ID}) { + MySelectedAssessment mySelectedAssessment = MySelectedAssessment( + appointmentId: appointmentNo, + remark: remark, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: doctorID, + doctorName: doctorName, + createdBy: createdBy, + createdOn: createdOn, + icdCode10ID: icdCode10ID); + return mySelectedAssessment; + } +} diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 4cf20318..9f002d65 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart index 55e36342..08753bec 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; @@ -12,6 +12,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../soap_utils.dart'; + class AddAllergiesItem extends StatefulWidget { final SOAPViewModel model; final Function(MasterKeyModel) removeAllergy; @@ -139,14 +141,14 @@ class _AddAllergiesItemState extends State { } : null, isTextFieldHasSuffix: true, - hintText: TranslationBase.of(context).selectSeverity, + hintText: TranslationBase.of(context).selectSeverity + "*", enabled: false, maxLines: 2, minLines: 2, validationError: mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError - ? TranslationBase.of(context).emptyMessage + ? TranslationBase.of(context).severityValidationError : null, controller: severityController, ), @@ -184,9 +186,9 @@ class _AddAllergiesItemState extends State { widget.removeAllergy(widget.item); } else { MySelectedAllergy mySelectedAllergy = - new MySelectedAllergy( - selectedAllergy: widget.item, - selectedAllergySeverity: _selectedAllergySeverity, + SoapUtils.generateMySelectedAllergy( + allergy: widget.item, + allergySeverity: _selectedAllergySeverity, remark: null, isChecked: true, isExpanded: true); diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index 8644c9a9..8da1799b 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index 4be953a7..32c54f52 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.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/shared/app_texts_widget.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index bd2f8502..566eeda4 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -2,8 +2,9 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -215,10 +216,10 @@ class _AddHistoryDialogState extends State { if (myhistory.isEmpty) { setState(() { - MySelectedHistory mySelectedHistory = MySelectedHistory( - remark: history.remarks ?? "", - selectedHistory: history, + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(remark: history.remarks ?? "", + history: history, isChecked: true); + widget.myHistoryList.add(mySelectedHistory); }); } else { diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index 3b431a69..cede4e15 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart index 7372e7ee..c6427511 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 7a48a786..5942a7cf 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -6,14 +6,15 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/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/patients/profile/soap_update/soap_utils.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/shared/app_scaffold_widget.dart'; @@ -55,8 +56,8 @@ class _UpdateSubjectivePageState extends State { String medicationControllerError = ''; String illnessControllerError = ''; final formKey = GlobalKey(); - List myAllergiesList=List(); - List myHistoryList=List(); + List myAllergiesList = List(); + List myHistoryList = List(); getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); @@ -84,51 +85,67 @@ class _UpdateSubjectivePageState extends State { } model.patientHistoryList.forEach((element) { - if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -145,16 +162,23 @@ class _UpdateSubjectivePageState extends State { editedBy: ''); await model.getPatientAllergy(generalGetReqForSOAP); if (model.patientAllergiesList.isNotEmpty) { - if (model.allergiesList.isEmpty) await model.getMasterLookup(MasterKeysService.Allergies); - if (model.allergySeverityList.isEmpty) await model.getMasterLookup(MasterKeysService.AllergySeverity); + if (model.allergiesList.isEmpty) + await model.getMasterLookup(MasterKeysService.Allergies); + if (model.allergySeverityList.isEmpty) + await model.getMasterLookup(MasterKeysService.AllergySeverity); model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( - masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); MasterKeyModel selectedAllergySeverity; if (element.severity == 0) { selectedAllergySeverity = MasterKeyModel( - id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + id: 0, + typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), + nameAr: '', + nameEn: ''); } else { selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, @@ -162,14 +186,17 @@ class _UpdateSubjectivePageState extends State { ); } - MySelectedAllergy mySelectedAllergy = MySelectedAllergy( - selectedAllergy: selectedAllergy, - isChecked: element.isChecked, - createdBy: element.createdBy, - remark: element.remarks, - isLocal : false, - selectedAllergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); + MySelectedAllergy mySelectedAllergy = + SoapUtils.generateMySelectedAllergy( + allergy: selectedAllergy, + isChecked: element.isChecked, + createdBy: element.createdBy, + remark: element.remarks, + isLocal: false, + allergySeverity: selectedAllergySeverity); + + if (selectedAllergy != null && selectedAllergySeverity != null) + myAllergiesList.add(mySelectedAllergy); }); } } @@ -181,20 +208,25 @@ class _UpdateSubjectivePageState extends State { myAllergiesList.clear(); myHistoryList.clear(); - GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( - patientMRN: widget.patientInfo.patientMRN, - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - episodeId: widget.patientInfo.episodeNo, - episodeID: widget.patientInfo.episodeNo, - doctorID: ''); + GetChiefComplaintReqModel getChiefComplaintReqModel = + GetChiefComplaintReqModel( + patientMRN: widget.patientInfo.patientMRN, + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + episodeId: widget.patientInfo.episodeNo, + episodeID: widget.patientInfo.episodeNo, + doctorID: ''); await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); + complaintsController.text = Helpers.parseHtmlString( + model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text = !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty - ? model.patientChiefComplaintList[0].currentMedication + '\n \n' - : model.patientChiefComplaintList[0].currentMedication; + medicationController.text = + !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication + + '\n \n' + : model.patientChiefComplaintList[0].currentMedication; } await getHistory(model); @@ -214,7 +246,9 @@ class _UpdateSubjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).chiefComplaints, onTap: () { @@ -245,7 +279,9 @@ class _UpdateSubjectivePageState extends State { }); }, child: Column( - children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], + children: [ + UpdateHistoryWidget(myHistoryList: myHistoryList) + ], ), isExpanded: isHistoryExpand, ), @@ -306,7 +342,9 @@ class _UpdateSubjectivePageState extends State { // loading: model.state == ViewState.BusyLocal, onPressed: () async { addSubjectiveInfo( - model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); + model: model, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList); }, ), ), @@ -323,9 +361,10 @@ class _UpdateSubjectivePageState extends State { } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - if(FocusScope.of(context).hasFocus) - FocusScope.of(context).unfocus(); + {SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { + if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); formKey.currentState.validate(); @@ -360,7 +399,8 @@ class _UpdateSubjectivePageState extends State { if (complaintsController.text.isEmpty) { complaintsControllerError = TranslationBase.of(context).emptyMessage; } else if (complaintsController.text.length < 25) { - complaintsControllerError = TranslationBase.of(context).chiefComplaintLength; + complaintsControllerError = + TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { @@ -373,33 +413,38 @@ class _UpdateSubjectivePageState extends State { }); widget.changeLoadingState(false); - Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); + Helpers.showErrorToast( + TranslationBase.of(context).chiefComplaintErrorMsg); } } - postAllergy({List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); }); if (model.patientAllergiesList.isEmpty) { await model.postAllergy(postAllergyRequestModel); @@ -423,10 +468,13 @@ class _UpdateSubjectivePageState extends State { } } - postHistories({List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(doctorID: ''); myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -452,17 +500,18 @@ class _UpdateSubjectivePageState extends State { postChiefComplaint({SOAPViewModel model}) async { formKey.currentState.save(); if (formKey.currentState.validate()) { - PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - chiefComplaint: complaintsController.text, - currentMedication: medicationController.text, - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - doctorID: '', - numberOfWeeks: 0); + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + new PostChiefComplaintRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + chiefComplaint: complaintsController.text, + currentMedication: medicationController.text, + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + doctorID: '', + numberOfWeeks: 0); if (model.patientChiefComplaintList.isEmpty) { postChiefComplaintRequestModel.editedBy = ''; await model.postChiefComplaint(postChiefComplaintRequestModel); diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index e9d6d16d..d2fefb31 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,9 +1,8 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.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/patients/profile/soap_update/subjective/update_subjective_page.dart'; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e30a006a..d36512ae 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1366,6 +1366,7 @@ class TranslationBase { String get addPrescription => localizedValues['addPrescription'][locale.languageCode]; String get edit => localizedValues['edit'][locale.languageCode]; String get summeryReply => localizedValues['summeryReply'][locale.languageCode]; + String get severityValidationError => localizedValues['severityValidationError'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {