From 6559dd123f1de8c46d9d587f89b1f5799b995f78 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 27 Nov 2024 16:51:32 +0300 Subject: [PATCH] WD: create dignosis and favorite diagnosis and listing of diagnosis --- lib/config/config.dart | 4 + lib/config/localized_values.dart | 2 + .../SOAP/assessment/search_diagnosis.dart | 1 + .../soap/SOAP_service.dart | 135 +++- lib/core/viewModel/SOAP_view_model.dart | 70 +- .../assessment/add_diagnosis.dart | 51 -- .../assessment/update_assessment_page.dart | 3 +- .../widget/audit_list_bottom_sheet.dart | 2 +- .../assessment/widget/current_diagnosis.dart | 184 +++-- .../assessment/widget/edit_diagnosis.dart | 422 ++++++++++ .../assessment/widget/enter_diagnosis.dart | 687 ++++++++--------- .../assessment/widget/favotite_diagnosis.dart | 723 ++++++++++-------- .../plan/update_plan_page_vida_plus.dart | 8 +- .../update_soap_index_vida_plus.dart | 15 +- .../translations_delegate_base_utils.dart | 2 + 15 files changed, 1430 insertions(+), 879 deletions(-) create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 8ef1f0e1..d6f98ec6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -338,6 +338,10 @@ const POST_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/PostPhysi const GET_PROGRESS_NOTE_NEW = 'Services/DoctorApplication.svc/REST/GetProgressNote'; +const GET_LIST_OF_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisDetailsSearch'; + +const EDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/EditDiagnosis'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b9a0b7b0..283cfb13 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1208,6 +1208,8 @@ const Map> localizedValues = { "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, "event": {"en": "Event: ", "ar":"حدث: "}, + "selectedDiagnosis": {"en": "Kindly Select Diagnosis", "ar":"يرجى اختيار التشخيص: "}, + "selectConditionFirst": {"en": "Kindly Select Diagnosis Condition", "ar":"يرجى اختيار حالة التشخيص: "}, "deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "}, "newValue": {"en": "New Value: ", "ar":"قيمة جديدة: "}, "fieldName": {"en": "Field Name: ", "ar":"اسم الحقل: "}, diff --git a/lib/core/model/SOAP/assessment/search_diagnosis.dart b/lib/core/model/SOAP/assessment/search_diagnosis.dart index 3a02db9c..0a7ab2e7 100644 --- a/lib/core/model/SOAP/assessment/search_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/search_diagnosis.dart @@ -26,6 +26,7 @@ class SearchDiagnosis { String? selectedSectionCode; String? selectedChapterCode; String? selectedNandaCode; + bool isFavorite = false; // Default constructor SearchDiagnosis(); diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index e427f015..d91be174 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -57,6 +57,7 @@ class SOAPService extends LookupService { List patientChiefComplaintListVidaPlus = []; List searchChiefComplaintListVidaPlus = []; List patientPreviousDiagnosisList = []; + List patientDiagnosisList = []; List favoriteDiagnosisDetailsList = []; List auditDiagnosislist = []; List searchDiagnosisList = []; @@ -66,7 +67,6 @@ class SOAPService extends LookupService { Map diagnosisTypeList = {}; Map conditionTypeList = {}; List icdVersionList = []; - bool addedToFavorite = false; bool showAuditBottomSheet = false; int? episodeID; @@ -775,6 +775,37 @@ class SOAPService extends LookupService { }, body: request); } + getDiagnosis(PatiantInformtion patient) async { + Map request = { + "hospitalGroupId": 105, + "hospitalId": 313, + "patientId": 70023498, + "patientPomrId": 9907, + "startRow": 0, + "endRow": 10, + "isSelected": true, + "ProjectID": 313 + // "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), + // "hospitalId": patient.projectId, + // "patientId": patient.patientId, + // "patientPomrId": patient.pomrId, + // "startRow": 0, + // "endRow": 1000000, + // "ProjectID": patient.projectId + }; + hasError = false; + await baseAppClient.post(GET_LIST_OF_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + patientDiagnosisList.clear(); + response['ListDiagnosisDetailsSearch']['resultData'].forEach((v) => + patientDiagnosisList.add(PatientPreviousDiagnosis.fromJson(v))); + }, onFailure: (String error, int statusCode) { + patientDiagnosisList.clear(); + hasError = true; + super.error = error; + }, body: request); + } + removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId, String? problemId, String? deletedRemarks) async { Map request = { @@ -835,15 +866,15 @@ class SOAPService extends LookupService { Map? user = await sharedPref.getObj(LOGGED_IN_USER); Map request = - // { - // "patientId": 70024978, - // "pomrId": 10819, - // "hospitalId": 313, - // "hospitalGroupId": 105, - // "ProjectID": 313 - // }; - - { + // { + // "patientId": 70024978, + // "pomrId": 10819, + // "hospitalId": 313, + // "hospitalGroupId": 105, + // "ProjectID": 313 + // }; + + { "patientId": patientInfo.patientId, "pomrId": patientInfo.pomrId, "hospitalId": patientInfo.projectId, @@ -907,8 +938,8 @@ class SOAPService extends LookupService { }, body: request); } - addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, - String subFavoriteCode, String? userId) async { + Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, + String subFavoriteCode, dynamic? userId) async { Map request = { "ProjectID": paitientInfo.projectId, "listDiagnosisFavourite": [ @@ -923,24 +954,27 @@ class SOAPService extends LookupService { ] }; hasError = false; - addedToFavorite = false; + var isFavoriteAdded = false; favoriteDiagnosisDetailsList.clear(); await baseAppClient.post(ADD_TO_FAVORITE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { var result = response['ListDiagnosisAddFavourite']['resultData']; + isFavoriteAdded = true; if ((result as List).isEmpty) { - addedToFavorite = false; DrAppToastMsg.showErrorToast( response['ListDiagnosisAddFavourite']['message']); } else { - addedToFavorite = true; - DrAppToastMsg.showSuccesToast("Added To Favorite"); + DrAppToastMsg.showSuccesToast(response['ListDiagnosisAddFavourite']['message']); } + }, onFailure: (String error, int statusCode) { favoriteDiagnosisDetailsList.clear(); hasError = true; + isFavoriteAdded = false; super.error = error; }, body: request); + + return isFavoriteAdded; } convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, @@ -960,7 +994,7 @@ class SOAPService extends LookupService { "ProjectID": paitientInfo.projectId }; hasError = false; - addedToFavorite = false; + var addedToFavorite = false; await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { var result = response['ContinuePreviousEpisode']['resultData']; @@ -1028,41 +1062,68 @@ class SOAPService extends LookupService { } } - createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis, - int diagnosisType, String conditionType, String remarks, bool isNew) { - /*{ -"codeRange": "A79", -"selectedDisease": "Trench fever", -"categoryId": 3962, -"diseasesCode": "A79.0", -"diseasesId": 17664, -"selectedIcdCode": "A79.0", -"selectedCategoryCode": "A79.0", -"selectedSectionCode": "A79", -"selectedChapterCode": "XX", -"selectedNandaCode": "A79.0", -"codeType": "ICD", -"problemId": 1634, -"icdId": 1, -"problemName": "default", -}*/ + Future createDiagnosis(PatiantInformtion patient, SearchDiagnosis? searchDiagnosis, + String? diagnosisType, String conditionType, String remarks, bool isNew) async{ + Map? user = await sharedPref.getObj(LOGGED_IN_USER); var request = { "pomrId": patient.pomrId, "appointmentId": patient.appointmentNo, "clinicGroupId": patient.clinicGroupId, "clinicId": patient.clinicId, "patientId": patient.patientId, - "hospitalId": searchDiagnosis.hospitalId, + "hospitalId": searchDiagnosis!.hospitalId, "hospitalGroupId": searchDiagnosis.hospitalGroupId, "diagnosisType": diagnosisType, "condition": conditionType, "remarks": remarks, "icdType": searchDiagnosis.icdType, - "icdVersion": searchDiagnosis.icdVersion, + // "icdVersion": searchDiagnosis.icdVersion, "icdSubVersion": searchDiagnosis.icdSubVersion, "isNew": isNew, "specificationId": searchDiagnosis.specificationId, + "selectedDisease": searchDiagnosis.diseasesName, + "diseasesCode": searchDiagnosis.diseasesCode, + "diseasesId": searchDiagnosis.diseasesId, + "selectedIcdCode": searchDiagnosis.selectedIcdCode, + "selectedCategoryCode": searchDiagnosis.selectedCategoryCode, + "selectedSectionCode": searchDiagnosis.selectedSectionCode, + "selectedChapterCode": searchDiagnosis.selectedChapterCode, + "selectedNandaCode": searchDiagnosis.selectedNandaCode, + "isResolved": false, + "doctorId": patient.doctorId, + "doctorCode": user?['List_MemberInformation'][0]['MemberID'], + "ProjectID": patient.projectId, + "codeRange":searchDiagnosis.codeRange }; + var success = false; + await baseAppClient.post(CREATE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async{ + + Map? user = await sharedPref.getObj(LOGGED_IN_USER); + var request = diag; + var success = false; + await baseAppClient.post(CREATE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 870272fc..ff0733a4 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -129,6 +129,9 @@ class SOAPViewModel extends BaseViewModel { List get patientPreviousDiagnosis => _SOAPService.patientPreviousDiagnosisList; + List get diagnosisList => + _SOAPService.patientDiagnosisList; + List get favoriteDiagnosisDetails => _SOAPService.favoriteDiagnosisDetailsList; @@ -159,7 +162,6 @@ class SOAPViewModel extends BaseViewModel { int? get episodeID => _SOAPService.episodeID; - bool get isFavorite => _SOAPService.addedToFavorite; bool get showAudit => _SOAPService.showAuditBottomSheet; @@ -1096,6 +1098,16 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + getCurrentDiagnosisList(PatiantInformtion patientInfo) async { + setState(ViewState.BusyLocal); + await _SOAPService.getDiagnosis(patientInfo); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + getAuditOfDiagnosis( PatiantInformtion patient, String patientProblemRevisionID, @@ -1145,21 +1157,29 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void addToFavoriteDiagnosis(PatiantInformtion patientInfo, + Future addToFavoriteDiagnosis(PatiantInformtion patientInfo, {SearchDiagnosis? diagnosis}) async { setState(ViewState.BusyLocal); Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map? user = await sharedPref.getObj(LOGGED_IN_USER); - await _SOAPService.addToFavoriteDiagnosis( + var userID = user?['List_MemberInformation'][0]['MemberID']; + bool result = await _SOAPService.addToFavoriteDiagnosis( patientInfo, profile?['DoctorName'] ?? '', diagnosis?.diseasesBCode ?? '', - user?['List_MemberInformation'][0]['MemberID'] ?? ''); + userID); + + // if (diagnosis != null) { + diagnosis?.isFavorite = result; + // searchDiagnosisList[index] = diagnosis; + // } + if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + return diagnosis; } void convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, @@ -1183,21 +1203,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - - List getListOfSelectedCategory(){ + List getListOfSelectedCategory() { List mappedItems = []; for (List category in specialityDetails.values) { var selectedCategory = - category.where((value) => value.isSelected == true); + category.where((value) => value.isSelected == true); mappedItems.addAll(selectedCategory); } return mappedItems; } - Future postPhysicalExamination(PatiantInformtion patientInfo, List listOfSelectedCategory) async { + Future postPhysicalExamination(PatiantInformtion patientInfo, + List listOfSelectedCategory) async { setState(ViewState.BusyLocal); - bool result = - await _SOAPService.postPhysicalExamination(patientInfo, listOfSelectedCategory); + bool result = await _SOAPService.postPhysicalExamination( + patientInfo, listOfSelectedCategory); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1231,9 +1251,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void toggleFavorite(bool status) { - _SOAPService.addedToFavorite = status; - } void toggleShowBottomSheetValue(bool status) { _SOAPService.showAuditBottomSheet = status; @@ -1249,6 +1266,25 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future createDiagnosis( + PatiantInformtion patientInformation, + SearchDiagnosis? searchDiagnosis, + String? diagnosisType, + String conditionType, + String remarks, + bool isNew) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.createDiagnosis(patientInformation, + searchDiagnosis, diagnosisType, conditionType, remarks, isNew); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + return result; + } + void changeCurrentCategorySelectedState( GeneralSpeciality selectedExamination, bool status) { final item = speciality.firstWhere( @@ -1264,9 +1300,11 @@ class SOAPViewModel extends BaseViewModel { if (query.isEmpty) { speciality = mainSpecialityList ?? []; } - var searchList = - mainSpecialityList?.where((value) => value.name?.toLowerCase().contains(query.toLowerCase()) == true).toList() ?? - []; + var searchList = mainSpecialityList + ?.where((value) => + value.name?.toLowerCase().contains(query.toLowerCase()) == true) + .toList() ?? + []; speciality = searchList; notifyListeners(); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart index c271a5ae..d7399d58 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart @@ -38,7 +38,6 @@ class _AddDiagnosisState extends State return BaseView( onModelReady: (model) { WidgetsBinding.instance.addPostFrameCallback((_) { - model.toggleFavorite(false); model.getConditionAndType(widget.patientInfo); model.favoriteDiagnosis(widget.patientInfo); setState(() { @@ -98,56 +97,6 @@ class _AddDiagnosisState extends State ), ], ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - children: [ - Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300]!, - // height: SizeConfig.heightMultiplier! * - // (SizeConfig.isHeightVeryShort ? 8 : 6), - // padding: 10, - fontColor: Colors.black, - fontWeight: FontWeight.w600, - onPressed: () { - Navigator.pop(context); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).save, - fontWeight: FontWeight.w600, - color: Color(0xFF359846), - onPressed: () async {}, - ), - ), - ], - ), - ) - ], - ), - ), - ), )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart index 09c07d54..e22cc6ff 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/update_assessment_page.dart @@ -70,6 +70,7 @@ class _UpdateAssessmentPageState extends State WidgetsBinding.instance.addPostFrameCallback((_) async { widget.changeLoadingState(true); model.getPreviousPatientDetails(widget.patientInfo); + model.getCurrentDiagnosisList(widget.patientInfo); widget.changeLoadingState(false); //todo handle get diagnosis list }); @@ -144,7 +145,7 @@ class _UpdateAssessmentPageState extends State CurrentDiagnosis( patientInfo: widget.patientInfo, model: model, - currentDiagnosisItems: [''], + currentDiagnosisItems: model.diagnosisList, ), PreviousDiagnosis( diagnosisItems: model.patientPreviousDiagnosis, diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart index befb56e5..f976063b 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart @@ -12,7 +12,7 @@ class AuditListBottomSheet extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.56:MediaQuery.sizeOf(context).height*.28, + height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.41:MediaQuery.sizeOf(context).height*.28, child: Material( color: Color(0xFFF7F7F7), shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart index 71a69dbb..5a493e21 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/current_diagnosis.dart @@ -1,7 +1,11 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; @@ -15,7 +19,7 @@ import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart'; class CurrentDiagnosis extends StatefulWidget { final PatiantInformtion patientInfo; - final List currentDiagnosisItems; + final List currentDiagnosisItems; final SOAPViewModel model; const CurrentDiagnosis( @@ -33,71 +37,102 @@ class _CurrentDiagnosisState extends State { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - height: 10, - ), - AddSoapItem( - title: TranslationBase.of(context).addNewDiagnosis, - onAddSoapItemClicked: () { - Navigator.push( - context, - FadePage( - page: AddDiagnosis( - patientInfo: widget.patientInfo, - ))); - }), - SizedBox( - height: 16, - ), - Divider(), - SizedBox( - height: 16, - ), - if (widget.currentDiagnosisItems.isEmpty) ...{ - Center( - child: EmptyDiagnosis(), - ), - } else ...{ - Flexible( - child: ListView.separated( - itemBuilder: (_, index) { - return SoapDetailItem( - title: 'lorem ipsum', - status: 'active', - condition: 'acute', - remarks: 'initial', - onSoapDetailActionClicked: (action) { - switch (action) { - case SoapDetailItemActions.EDIT: - // TODO: Handle this case. - case SoapDetailItemActions.RESOLVE: - // TODO: Handle this case. - - case SoapDetailItemActions.REMOVE: - showConfirmationDialog(context, - "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", - () { - widget.model - .removeDiagnosis(widget.patientInfo); - }); - case SoapDetailItemActions.CHANGE_STATUS: - // TODO: Handle this case. - default: - } - }, - ); - }, - separatorBuilder: (_, index) => Divider(), - itemCount: widget.currentDiagnosisItems.length)) + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) { + if (model.showAudit) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showAuditBottomSheet(context, model.auditDiagnosislist, + model.toggleShowBottomSheetValue); + model.toggleShowBottomSheetValue(false); + }); } - ], - ), - ); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + height: 10, + ), + AddSoapItem( + title: TranslationBase.of(context).addNewDiagnosis, + onAddSoapItemClicked: () async { + bool result = await Navigator.push( + context, + FadePage( + page: AddDiagnosis( + patientInfo: widget.patientInfo, + ))); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + }), + SizedBox( + height: 16, + ), + Divider(), + SizedBox( + height: 16, + ), + if (widget.currentDiagnosisItems.isEmpty) ...{ + Center( + child: EmptyDiagnosis(), + ), + } else ...{ + Flexible( + child: ListView.separated( + itemBuilder: (_, index) { + return SoapDetailItem( + title: widget.currentDiagnosisItems[index] + .selectedDisease ?? + '', + status: + widget.currentDiagnosisItems[index].status ?? + '', + condition: widget + .currentDiagnosisItems[index].condition ?? + '', + remarks: + widget.currentDiagnosisItems[index].remarks ?? + '', + onSoapDetailActionClicked: (action) { + switch (action) { + case SoapDetailItemActions.AUDIT: + model.getAuditOfDiagnosis( + widget.patientInfo, + widget.currentDiagnosisItems[index] + .patientProblemRevisionId + ?.toString() ?? + ''); + break; + case SoapDetailItemActions.EDIT: + // TODO: Handle this case. + case SoapDetailItemActions.RESOLVE: + // TODO: Handle this case. + + case SoapDetailItemActions.REMOVE: + showConfirmationDialog(context, + "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", + () { + widget.model + .removeDiagnosis(widget.patientInfo); + }); + case SoapDetailItemActions.CHANGE_STATUS: + // TODO: Handle this case. + default: + } + }, + ); + }, + separatorBuilder: (_, index) => Divider(), + itemCount: widget.currentDiagnosisItems.length)) + } + ], + ), + ); + }); } showConfirmationDialog( @@ -179,4 +214,23 @@ class _CurrentDiagnosisState extends State { deleteController.clear(); }); } + + void showAuditBottomSheet( + BuildContext context, + List diagnosis, + void Function(bool status) toggleShowBottomSheetValue, + ) { + showModalBottomSheet( + isDismissible: true, + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20))), + builder: (_) { + return AuditListBottomSheet( + auditList: diagnosis, + ); + }, + ).then((value) => toggleShowBottomSheetValue(false)); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart new file mode 100644 index 00000000..fca866bc --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/edit_diagnosis.dart @@ -0,0 +1,422 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; + +List patientState = ["", "Stable", "Not Stable", "Not Defined"]; + +class EnterDiagnosis extends StatefulWidget { + final PatiantInformtion patientInfo; + final PatientPreviousDiagnosis diagnosis; + + const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis}); + + @override + State createState() => _EnterDiagnosisState(); +} + +class _EnterDiagnosisState extends State { + final TextEditingController filteredSearchController = + TextEditingController(); + bool showAllDiagnosis = true; + String status = ''; + String? selectedDiagnosisItem; + TextEditingController remarksController = TextEditingController(); + Timer? _tTimer; + SOAPViewModel? model; + SearchDiagnosis? selectedDiagnosis; + + void _onTextChanged(String text) { + if (_tTimer != null) { + _tTimer!.cancel(); + } + _tTimer = Timer(Duration(milliseconds: 500), () { + _onStopped(text); + }); + } + + void _onStopped(String searchText) async { + await model?.searchDiagnosis(widget.patientInfo, searchText); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + this.model = model; + }, + builder: (_, model, w) => AppScaffold( + isLoading: model.state == ViewState.BusyLocal , + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).addDiagnosis), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, + ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).diagnosis, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onClick: () { + setState( + () { + selectedDiagnosis = null; + filteredSearchController.text = ''; + model.selectedIcd = ''; + }, + ); + }, + onChanged: (value) { + if (value != null) _onTextChanged(value); + }, + onFieldSubmitted: () {}, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, + ), + onPressed: () {}, + ), + ), + Positioned( + child: Material( + elevation: 4.0, // Optional: for shadow effect + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: 0, maxHeight: 300), + child: ListView.builder( + shrinkWrap: true, + itemCount: model.icdVersionList.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + child: AppText(model.icdVersionList[index]), + onTap: () { + setState( + () { + selectedDiagnosis = + model.findTheDiagnosisItem( + model.icdVersionList[index]); + filteredSearchController.text = + model.icdVersionList[index]; + model.searchDiagnosisList.clear(); + model.icdVersionList.clear(); + }, + ); + }, + ), + ); + }, + ), + ), + ), + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { + setState(() { + showAllDiagnosis = value; + }); + }, + ), + SizedBox( + width: 8, + ), + AppText( + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, + ), + ], + ), + SvgPicture.asset('assets/images/svgs/information.svg'), + ], + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedDiagnosisItem == null + ? model.diagnosisTypeList.keys.first + : selectedDiagnosisItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedDiagnosisItem = newValue; + }); + }, + items: + model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + SizedBox( + height: 16, + ), + InkWell( + onTap: () async { + if (selectedDiagnosis != null) { + SearchDiagnosis? diagnosis = + await model.addToFavoriteDiagnosis(widget.patientInfo, + diagnosis: selectedDiagnosis); + setState(() { + selectedDiagnosis = diagnosis; + }); + } + }, + child: Row( + children: [ + SvgPicture.asset(selectedDiagnosis?.isFavorite == true + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).addToFavorite, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + if(selectedDiagnosis == null ){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); + return; + } + if(status.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst); + return; + } + + if(remarksController.text.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); + return; + } + + bool result = await model.createDiagnosis( + widget.patientInfo, + selectedDiagnosis, + selectedDiagnosisItem, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart index 45b6ddbe..0ecac958 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/enter_diagnosis.dart @@ -8,8 +8,11 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -31,7 +34,7 @@ class _EnterDiagnosisState extends State { TextEditingController(); bool showAllDiagnosis = true; String status = ''; - String? selectedItem; + String? selectedDiagnosisItem; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; @@ -56,392 +59,354 @@ class _EnterDiagnosisState extends State { onModelReady: (model) { this.model = model; }, - builder: (_, model, w) => SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addDiagnosis, - fontWeight: FontWeight.w600, - color: Color(0xFF2E303A), - fontSize: 16, - ), - SizedBox( - height: 16, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).diagnosis, - isTextFieldHasSuffix: true, - hasBorder: true, - controller: filteredSearchController, - onClick: () { - setState( - () { - selectedDiagnosis = null; - filteredSearchController.text = ''; - model.selectedIcd = ''; - }, - ); - }, - onChanged: (value) { - if (value != null) _onTextChanged(value); - }, - onFieldSubmitted: () {}, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Color(0xff2B353E), - size: 30, - ), - onPressed: () {}, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, ), - ), - Positioned( - child: Material( - elevation: 4.0, // Optional: for shadow effect - child: ConstrainedBox( - constraints: BoxConstraints(minHeight: 0, maxHeight: 300), - child: ListView.builder( - shrinkWrap: true, - itemCount: model.icdVersionList.length, - itemBuilder: (context, index) { - return ListTile( - title: InkWell( - child: AppText(model.icdVersionList[index]), - onTap: () { - setState( - () { - selectedDiagnosis = - model.findTheDiagnosisItem( - model.icdVersionList[index]); - filteredSearchController.text = - model.icdVersionList[index]; - model.searchDiagnosisList.clear(); - model.icdVersionList.clear(); - }, - ); - }, - ), - ); + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).diagnosis, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onClick: () { + setState( + () { + selectedDiagnosis = null; + filteredSearchController.text = ''; + model.selectedIcd = ''; }, + ); + }, + onChanged: (value) { + if (value != null) _onTextChanged(value); + }, + onFieldSubmitted: () {}, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, ), + onPressed: () {}, ), ), - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Switch( - value: showAllDiagnosis, - activeColor: Colors.red, - onChanged: (bool value) { - setState(() { - showAllDiagnosis = value; - }); + Positioned( + child: Material( + elevation: 4.0, // Optional: for shadow effect + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: 0, maxHeight: 300), + child: ListView.builder( + shrinkWrap: true, + itemCount: model.icdVersionList.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + child: AppText(model.icdVersionList[index]), + onTap: () { + setState( + () { + selectedDiagnosis = + model.findTheDiagnosisItem( + model.icdVersionList[index]); + filteredSearchController.text = + model.icdVersionList[index]; + model.searchDiagnosisList.clear(); + model.icdVersionList.clear(); + }, + ); + }, + ), + ); }, ), - SizedBox( - width: 8, - ), - AppText( - TranslationBase.of(context).showAllDiagnosis, - fontWeight: FontWeight.w500, - color: Color(0xFF2E303A), - fontSize: 11, - ), - ], + ), ), - SvgPicture.asset('assets/images/svgs/information.svg'), - ], - ), - Container( - margin: EdgeInsets.only(bottom: 12), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, ), - ), - // Row( - // children: [ - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = ""; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: - // Border.all(color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 1 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).acute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // )), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "2"; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: Border.all( - // color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 2 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).subAcute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "3"; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: Border.all( - // color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 3 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).chronic, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // ], - // ), - SizedBox( - width: MediaQuery.sizeOf(context).width, - height: 24, - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - itemCount: model.conditionTypeList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Switch( + value: showAllDiagnosis, + activeColor: Colors.red, + onChanged: (bool value) { setState(() { - status = model.conditionTypeList[index]; + showAllDiagnosis = value; }); }, - child: Row( - children: [ - Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: - Border.all(color: Colors.grey, width: 1), - ), - child: Container( + ), + SizedBox( + width: 8, + ), + AppText( + TranslationBase.of(context).showAllDiagnosis, + fontWeight: FontWeight.w500, + color: Color(0xFF2E303A), + fontSize: 11, + ), + ], + ), + SvgPicture.asset('assets/images/svgs/information.svg'), + ], + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, decoration: BoxDecoration( - color: - status == model.conditionTypeList[index] - ? HexColor("#D02127") - : Colors.white, + color: Colors.white, shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), ), ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedDiagnosisItem == null + ? model.diagnosisTypeList.keys.first + : selectedDiagnosisItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedDiagnosisItem = newValue; + }); + }, + items: + model.diagnosisTypeList.keys.map((item) { + return DropdownMenuItem( + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, - ), - ], - ), - )), - ), - SizedBox( - height: 8, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + SizedBox( + height: 16, + ), + InkWell( + onTap: () async { + if (selectedDiagnosis != null) { + SearchDiagnosis? diagnosis = + await model.addToFavoriteDiagnosis(widget.patientInfo, + diagnosis: selectedDiagnosis); + setState(() { + selectedDiagnosis = diagnosis; + }); + } + }, + child: Row( children: [ + SvgPicture.asset(selectedDiagnosis?.isFavorite == true + ? 'assets/images/svgs/favoriteadded.svg' + : 'assets/images/svgs/favorite.svg'), + SizedBox( + width: 4, + ), AppText( - TranslationBase.of(context).diagnoseType, + TranslationBase.of(context).addToFavorite, textAlign: TextAlign.start, fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ), + ) + ], + ), + ), + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), ), SizedBox( - height: 4, + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + if(selectedDiagnosis == null ){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); + return; + } + if(status.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst); + return; + } + + if(remarksController.text.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty); + return; + } + + bool result = await model.createDiagnosis( + widget.patientInfo, + selectedDiagnosis, + selectedDiagnosisItem, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, + ), ), - model.diagnosisTypeList.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem == null - ? model.diagnosisTypeList.keys.first - : selectedItem, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedItem = newValue; - }); - }, - items: model.diagnosisTypeList.keys.map((item) { - return DropdownMenuItem( - child: AppText( - item ?? '', - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, - ), - value: item, - ); - }).toList(), - ), - ), ], ), - ), - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) {}, - onClick: () {}, - onFieldSubmitted: () {}, - ), - ), - SizedBox( - height: 16, - ), - InkWell( - onTap: () { - if (selectedDiagnosis != null) - model.addToFavoriteDiagnosis(widget.patientInfo, - diagnosis: selectedDiagnosis); - }, - child: Row( - children: [ - SvgPicture.asset(model.isFavorite - ? 'assets/images/svgs/favoriteadded.svg' - : 'assets/images/svgs/favorite.svg'), - SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).addToFavorite, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), - ), - ], - ), - ) - ], + ) + ], + ), ), ), ), diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart index 219f45cb..71e82650 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/favotite_diagnosis.dart @@ -9,7 +9,9 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -60,357 +62,406 @@ class _FavoriteDiagnosisState extends State { model.favoriteDiagnosis(widget.patientInfo); }); }, - builder: (_, model, w) => SingleChildScrollView( - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).addDiagnosis, - fontWeight: FontWeight.w600, - color: Color(0xFF2E303A), - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).diagnosis, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), - SizedBox( - height: 4, - ), - model.favoriteDiagnosisDetails.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - itemHeight: null, - value: selectedFavorite == null - ? model.favoriteDiagnosisDetails.first - .diseases - : selectedFavorite, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedFavorite = newValue; - }); - }, - items: model.favoriteDiagnosisDetails - .map((item) { - return DropdownMenuItem( - child: AppText( - item.diseases ?? '', - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, - ), - value: item.diseases, - ); - }).toList(), - ), - ), - ], - ), + builder: (_, model, w) => AppScaffold( + body: SingleChildScrollView( + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addDiagnosis, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: 16, ), - ), - - SizedBox( - height: 8, - ), - Container( - margin: EdgeInsets.only(bottom: 12), - child: AppText( - TranslationBase.of(context).condition, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, + SizedBox( + height: 16, ), - ), - // Row( - // children: [ - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = ""; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: - // Border.all(color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 1 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).acute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // )), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "2"; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: Border.all( - // color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 2 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).subAcute, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // status = "3"; - // }); - // }, - // child: Row( - // children: [ - // Container( - // padding: EdgeInsets.all(2.0), - // margin: EdgeInsets.symmetric(horizontal: 6), - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: Colors.white, - // shape: BoxShape.circle, - // border: Border.all( - // color: Colors.grey, width: 1), - // ), - // child: Container( - // decoration: BoxDecoration( - // color: status == 3 - // ? HexColor("#D02127") - // : Colors.white, - // shape: BoxShape.circle, - // ), - // ), - // ), - // AppText( - // TranslationBase.of(context).chronic, - // fontWeight: FontWeight.normal, - // fontFamily: 'Poppins', - // fontSize: SizeConfig.textMultiplier! * 1.6, - // ), - // ], - // ), - // ), - // ), - // ], - // ), - SizedBox( - width: MediaQuery.sizeOf(context).width, - height: 24, - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - itemCount: model.conditionTypeList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { - setState(() { - status = model.conditionTypeList[index]; - }); - }, - child: Row( - children: [ - Container( - padding: EdgeInsets.all(2.0), - margin: - EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: Border.all( - color: Colors.grey, width: 1), - ), - child: Container( - decoration: BoxDecoration( - color: status == - model.conditionTypeList[index] - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, - ), - ), - ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier! * 1.6, - ), - ], - ), - )), - ), - SizedBox( - height: 8, - ), - Material( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, - color: Color(0xFFEFEFEF), - )), - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).diagnoseType, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), - SizedBox( - height: 4, - ), - model.diagnosisTypeList.isEmpty - ? EmptyDropDown() - : DropdownButtonHideUnderline( - child: DropdownButton( - itemHeight: null, - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem == null - ? model.diagnosisTypeList.keys.first - : selectedItem, - iconSize: 25, - elevation: 16, - onChanged: (newValue) async { - if (newValue != null) - setState(() { - selectedItem = newValue; - }); - }, - items: model.diagnosisTypeList.keys - .map((item) { - return DropdownMenuItem( - child: Padding( - padding: const EdgeInsets.all(8.0), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnosis, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.favoriteDiagnosisDetails.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + itemHeight: null, + value: selectedFavorite == null + ? model.favoriteDiagnosisDetails.first + .diseases + : selectedFavorite, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedFavorite = newValue; + }); + }, + items: model.favoriteDiagnosisDetails + .map((item) { + return DropdownMenuItem( child: AppText( - item ?? '', + item.diseases ?? '', fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, fontWeight: FontWeight.normal, textAlign: TextAlign.left, ), - ), - value: item, - ); - }).toList(), + value: item.diseases, + ); + }).toList(), + ), ), + ], + ), + ), + ), + + SizedBox( + height: 8, + ), + Container( + margin: EdgeInsets.only(bottom: 12), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + ), + // Row( + // children: [ + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = ""; + // }); + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: + // Border.all(color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 1 + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).acute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "2"; + // }); + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all( + // color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 2 + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).subAcute, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // ), + // ), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = "3"; + // }); + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all( + // color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 3 + // ? HexColor("#D02127") + // : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).chronic, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // ), + // ), + // ], + // ), + SizedBox( + width: MediaQuery.sizeOf(context).width, + height: 24, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: model.conditionTypeList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + status = model.conditionTypeList[index]; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: + EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == + model.conditionTypeList[index] + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier! * 1.6, + ), + ], ), - ], + )), + ), + SizedBox( + height: 8, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnoseType, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + model.diagnosisTypeList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + itemHeight: null, + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null + ? model.diagnosisTypeList.keys.first + : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + if (newValue != null) + setState(() { + selectedItem = newValue; + }); + }, + items: model.diagnosisTypeList.keys + .map((item) { + return DropdownMenuItem( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + item ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), ), ), - ), - Container( - margin: EdgeInsets.only(top: 8), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) {}, - onClick: () {}, - onFieldSubmitted: () {}, + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, + ), ), - ), - SizedBox( - height: 16, - ), - ], + SizedBox( + height: 16, + ), + ], + ), ), ), - )); + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async {}, + ), + ), + ], + ), + ) + ], + ), + ), + ), + )); } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart index b33caa3d..ff8e2bd0 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -101,13 +101,13 @@ class _UpdatePlanPageVidaPlusState extends State return BaseView( onModelReady: (model) async { widget.sOAPViewModel.setPlanCallBack(this); - widget.changeLoadingState(true); WidgetsBinding.instance.addPostFrameCallback((_) async { - if (model.progressNote.isEmpty) { + widget.changeLoadingState(true); + model.getProgressNote(widget.patientInfo); - } + widget.changeLoadingState(false); + }); - widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index 23283dd3..e9304c61 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget { class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex =3; + int _currentIndex =2; List myAllergiesList = []; List myHistoryList = []; @@ -97,6 +97,12 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ + UpdateAssessmentPage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState, + ), UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, @@ -110,12 +116,7 @@ class _UpdateSoapIndexVidaPlusState extends State currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState, - ), + UpdateSubjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 4302f215..658ebb0e 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1945,6 +1945,8 @@ class TranslationBase { String get kindlySelectCategory => localizedValues['kindlySelectCategory']![locale.languageCode]!; String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!; + String get selectedDiagnosis => localizedValues['selectedDiagnosis']![locale.languageCode]!; + String get selectConditionFirst => localizedValues['selectConditionFirst']![locale.languageCode]!; }