diff --git a/lib/config/config.dart b/lib/config/config.dart index d6f98ec6..a818633c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -342,6 +342,9 @@ const GET_LIST_OF_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisDeta const EDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/EditDiagnosis'; +const RESOLVE_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisResolve'; +const GET_CLINIC = 'Services/DoctorApplication.svc/REST/GetDoctorClinicsForVidaPlus'; + var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 283cfb13..240edfef 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1208,11 +1208,13 @@ const Map> localizedValues = { "kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"}, "noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"}, "event": {"en": "Event: ", "ar":"حدث: "}, + "editDiagnosis": {"en": "Edit Diagnosis ", "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":"اسم الحقل: "}, + "noChangeRecorded": {"en": "No Change Recorded Unable To Perform Edit", "ar":"لم يتم تسجيل أي تغيير، غير قادر على إجراء التحرير"}, "oldValue": {"en": "Old Value: ", "ar":"القيمة القديمة: "}, "favoriteDiagnosis": {"en": "Favorite Diagnosis", "ar":"التشخيص المفضل"}, "addToFavorite": {"en": "Add To Favorite", "ar":"إضافة إلى المفضلة"}, diff --git a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart index 0cc2401e..c4fc3b71 100644 --- a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart @@ -107,6 +107,61 @@ class PatientPreviousDiagnosis { }); } } + + Map toJson() { + return { + 'active': active, + 'admissionId': admissionId, + 'admissionRequestId': admissionRequestId, + 'appointmentId': appointmentId, + 'approvedBy': approvedBy, + 'approvedOn': approvedOn, + 'assessmentId': assessmentId, + 'chiefComplainId': chiefComplainId, + 'clinicGroupId': clinicGroupId, + 'clinicId': clinicId, + 'condition': condition, + 'createdBy': createdBy, + 'createdOn': createdOn, + 'deletedBy': deletedBy, + 'deletedByDoctorName': deletedByDoctorName, + 'deletedOn': deletedOn, + 'deletedRemarks': deletedRemarks, + 'diagnosisType': diagnosisType, + 'doctorId': doctorId, + 'episodeId': episodeId, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'icdCodeDetailsDto': icdCodeDetailsDto, + 'icdSubVersion': icdSubVersion, + 'icdType': icdType, + 'icdVersion': icdVersion, + 'location': location, + 'loginUserId': loginUserId, + 'modifiedBy': modifiedBy, + 'modifiedOn': modifiedOn, + 'module': module, + 'parentLocation': parentLocation, + 'patientId': patientId, + 'patientProblemChangeHistories': patientProblemChangeHistories, + 'patientProblemId': patientProblemId, + 'patientProblemRevisionId': patientProblemRevisionId, + 'pomrId': pomrId, + 'previousProblem': previousProblem, + 'problemId': problemId, + 'problemName': problemName, + 'remarks': remarks, + 'resolved': resolved, + 'selectedCategoryCode': selectedCategoryCode, + 'selectedChapterCode': selectedChapterCode, + 'selectedDisease': selectedDisease, + 'selectedIcdCode': selectedIcdCode, + 'selectedSectionCode': selectedSectionCode, + 'status': status, + 'visitWiseSelected': visitWiseSelected, + 'visitWisePatientDiagnoses': visitWisePatientDiagnoses?.map((v) => v.toJson()).toList(), + }; + } } class VisitWisePatientDiagnosis { @@ -130,7 +185,7 @@ class VisitWisePatientDiagnosis { int? hospitalId; String? icdSubVersion; String? icdType; - dynamic icdVersion; // Adjust type if necessary + dynamic icdVersion; bool? isPreviousProblem; String? location; String? loginUserId; @@ -187,4 +242,46 @@ class VisitWisePatientDiagnosis { selectedDoctorId = json['selectedDoctorId']; selectedIcdCode = json['selectedIcdCode']; } -} \ No newline at end of file + + Map toJson() { + return { + 'active': active, + 'admissionId': admissionId, + 'appointmentId': appointmentId, + 'approvedBy': approvedBy, + 'approvedOn': approvedOn, + 'assessmentId': assessmentId, + 'clinicId': clinicId, + 'condition': condition, + 'createdBy': createdBy, + 'createdOn': createdOn, + 'deletedBy': deletedBy, + 'deletedOn': deletedOn, + 'deletedRemarks': deletedRemarks, + 'diagnosisType': diagnosisType, + 'doctorId': doctorId, + 'episodeId': episodeId, + 'hospitalGroupId': hospitalGroupId, + 'hospitalId': hospitalId, + 'icdSubVersion': icdSubVersion, + 'icdType': icdType, + 'icdVersion': icdVersion, + 'isPreviousProblem': isPreviousProblem, + 'location': location, + 'loginUserId': loginUserId, + 'modifiedBy': modifiedBy, + 'modifiedOn': modifiedOn, + 'patientDiagnosisId': patientDiagnosisId, + 'patientId': patientId, + 'patientProblemRevisionId': patientProblemRevisionId, + 'pomrId': pomrId, + 'problemName': problemName, + 'remarks': remarks, + 'resolved': resolved, + 'selected': selected, + 'selectedDisease': selectedDisease, + 'selectedDoctorId': selectedDoctorId, + 'selectedIcdCode': selectedIcdCode, + }; + } +} diff --git a/lib/core/model/SOAP/progress_note/Clinic.dart b/lib/core/model/SOAP/progress_note/Clinic.dart new file mode 100644 index 00000000..70f56492 --- /dev/null +++ b/lib/core/model/SOAP/progress_note/Clinic.dart @@ -0,0 +1,35 @@ +class Clinic { + int? clinicGroupID; + String? clinicGroupName; + int? clinicID; + String? clinicNameArabic; + String? clinicNameEnglish; + + Clinic({ + this.clinicGroupID, + this.clinicGroupName, + this.clinicID, + this.clinicNameArabic, + this.clinicNameEnglish, + }); + + factory Clinic.fromJson(Map json) { + return Clinic( + clinicGroupID: json['clinicGroupID'], + clinicGroupName: json['clinicGroupName'], + clinicID: json['clinicID'], + clinicNameArabic: json['clinicNameArabic'], + clinicNameEnglish: json['clinicNameEnglish'], + ); + } + + Map toJson() { + return { + 'clinicGroupID': clinicGroupID, + 'clinicGroupName': clinicGroupName, + 'clinicID': clinicID, + 'clinicNameArabic': clinicNameArabic, + 'clinicNameEnglish': clinicNameEnglish, + }; + } +} \ No newline at end of file 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 d91be174..361eff19 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -31,6 +31,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/history/post_histories_reques import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/Clinic.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; @@ -63,6 +64,7 @@ class SOAPService extends LookupService { List searchDiagnosisList = []; List patientPhysicalExaminationList = []; List generalSpeciality = []; + List clinicsList = []; Map> specialityDetails = {}; Map diagnosisTypeList = {}; Map conditionTypeList = {}; @@ -938,8 +940,8 @@ class SOAPService extends LookupService { }, body: request); } - Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName, - String subFavoriteCode, dynamic? userId) async { + Future addToFavoriteDiagnosis(PatiantInformtion paitientInfo, + String doctorName, String subFavoriteCode, dynamic? userId) async { Map request = { "ProjectID": paitientInfo.projectId, "listDiagnosisFavourite": [ @@ -960,13 +962,13 @@ class SOAPService extends LookupService { onSuccess: (dynamic response, int statusCode) { var result = response['ListDiagnosisAddFavourite']['resultData']; isFavoriteAdded = true; - if ((result as List).isEmpty) { + if ((result is List) && (result as List).isEmpty) { DrAppToastMsg.showErrorToast( response['ListDiagnosisAddFavourite']['message']); } else { - DrAppToastMsg.showSuccesToast(response['ListDiagnosisAddFavourite']['message']); + DrAppToastMsg.showSuccesToast( + response['ListDiagnosisAddFavourite']['message']); } - }, onFailure: (String error, int statusCode) { favoriteDiagnosisDetailsList.clear(); hasError = true; @@ -1062,9 +1064,13 @@ class SOAPService extends LookupService { } } - Future createDiagnosis(PatiantInformtion patient, SearchDiagnosis? searchDiagnosis, - String? diagnosisType, String conditionType, String remarks, bool isNew) async{ - + 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, @@ -1094,35 +1100,88 @@ class SOAPService extends LookupService { "doctorId": patient.doctorId, "doctorCode": user?['List_MemberInformation'][0]['MemberID'], "ProjectID": patient.projectId, - "codeRange":searchDiagnosis.codeRange + "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) { + DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); + success = true; + }, onFailure: (String error, int statusCode) { success = false; - hasError = true; - super.error = error; - }, body: request); + 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; + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { + var request = diagnosis.toJson(); var success = false; - await baseAppClient.post(CREATE_DIAGNOSIS, + await baseAppClient.post(EDIT_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { - DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']); - success = true; - }, onFailure: (String error, int statusCode) { + if (response['ListVisitWisePatientDiagnosis']['resultData'] != null && + (response['ListVisitWisePatientDiagnosis']['resultData'] as List) + .isNotEmpty) { + success = true; + return; + } success = false; - hasError = true; - super.error = error; - }, body: request); + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + + Future resolveDiagnosis(PatientPreviousDiagnosis diagnosis) async { + var request = { + "patientProblemRevisionId": diagnosis.patientProblemRevisionId, + "patientProblemId": diagnosis.patientProblemId, + "patientId": diagnosis.patientId, + "doctorId": diagnosis.doctorId, + "pomrId": diagnosis.pomrId, + "appointmentId": diagnosis.appointmentId, + "problemId": diagnosis.problemId, + "diagnosisType": diagnosis.diagnosisType, + }; + var success = false; + await baseAppClient.post(RESOLVE_DIAGNOSIS, + onSuccess: (dynamic response, int statusCode) { + if (response['ListDiagnosisResolve'] != null && + response['ListDiagnosisResolve']['resultData'] != null && + (response['ListVisitWisePatientDiagnosis']['resultData'] as List) + .isNotEmpty) { + success = true; + return; + } + success = false; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + + Future getClinic() async { + Map request = {}; + var success = false; + await baseAppClient.post(GET_CLINIC, + onSuccess: (dynamic response, int statusCode) { + response['ListDoctorClinics'].forEach((v) => + v['categories'].forEach( + (cat) => clinicsList.add(Clinic.fromJson(cat)))); + success = false; + }, 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 ff0733a4..c621e4c2 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -9,7 +9,6 @@ import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_re import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/FavoriteDiseaseDetails.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.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/SOAP/chief_complaint/get_chief_complaint_req_model.dart'; @@ -26,13 +25,12 @@ import 'package:doctor_app_flutter/core/model/SOAP/in_patient/get_episode_for_in import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/Category.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/CreatePhysicalExamination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart'; import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_examination_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/Clinic.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; @@ -156,6 +154,8 @@ class SOAPViewModel extends BaseViewModel { List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; + List get clinics => + _SOAPService.clinicsList; Map> get specialityDetails => _SOAPService.specialityDetails; @@ -1285,6 +1285,29 @@ class SOAPViewModel extends BaseViewModel { return result; } + + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.editDiagnosis(diagnosis); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + return result; + } + + Future resolveDiagnosis(PatientPreviousDiagnosis diagnosis) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.resolveDiagnosis(diagnosis); + 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( @@ -1308,4 +1331,14 @@ class SOAPViewModel extends BaseViewModel { speciality = searchList; notifyListeners(); } + + getClinics() async { + setState(ViewState.BusyLocal); + await _SOAPService.getClinic(); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } 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 5a493e21..e88f2612 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 @@ -6,6 +6,7 @@ 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/edit_diagnosis.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'; @@ -97,7 +98,7 @@ class _CurrentDiagnosisState extends State { remarks: widget.currentDiagnosisItems[index].remarks ?? '', - onSoapDetailActionClicked: (action) { + onSoapDetailActionClicked: (action) async{ switch (action) { case SoapDetailItemActions.AUDIT: model.getAuditOfDiagnosis( @@ -108,9 +109,22 @@ class _CurrentDiagnosisState extends State { ''); break; case SoapDetailItemActions.EDIT: - // TODO: Handle this case. + bool result = await Navigator.push( + context, + FadePage( + page: EditDiagnosis( + patientInfo: widget.patientInfo, diagnosis: widget.currentDiagnosisItems[index], + ))); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + break; case SoapDetailItemActions.RESOLVE: - // TODO: Handle this case. + bool result = await model.resolveDiagnosis(widget.currentDiagnosisItems[index]); + if (result) { + model.getCurrentDiagnosisList(widget.patientInfo); + } + break; case SoapDetailItemActions.REMOVE: showConfirmationDialog(context, 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 index fca866bc..fcb2cc05 100644 --- 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 @@ -19,31 +19,41 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar 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:get_it/get_it.dart'; import 'package:hexcolor/hexcolor.dart'; -List patientState = ["", "Stable", "Not Stable", "Not Defined"]; - -class EnterDiagnosis extends StatefulWidget { +class EditDiagnosis extends StatefulWidget { final PatiantInformtion patientInfo; final PatientPreviousDiagnosis diagnosis; - const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis}); + const EditDiagnosis( + {super.key, required this.patientInfo, required this.diagnosis}); @override - State createState() => _EnterDiagnosisState(); + State createState() => _EditDiagnosisState(); } -class _EnterDiagnosisState extends State { +class _EditDiagnosisState extends State { final TextEditingController filteredSearchController = - TextEditingController(); + TextEditingController(); bool showAllDiagnosis = true; String status = ''; String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; SearchDiagnosis? selectedDiagnosis; + @override + void initState() { + super.initState(); + filteredSearchController.text = widget.diagnosis.selectedDisease ?? ''; + filteredSearchController.text = widget.diagnosis.remarks ?? ''; + status = widget.diagnosis.condition ?? ''; + selectedDiagnosisItemValue = widget.diagnosis?.diagnosisType ?? ''; + } + void _onTextChanged(String text) { if (_tTimer != null) { _tTimer!.cancel(); @@ -59,15 +69,31 @@ class _EnterDiagnosisState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) { - this.model = model; - }, - builder: (_, model, w) => AppScaffold( - isLoading: model.state == ViewState.BusyLocal , + return BaseView(onModelReady: (model) { + this.model = model; + WidgetsBinding.instance.addPostFrameCallback((_) { + model.getConditionAndType(widget.patientInfo); + }); + }, builder: (_, model, w) { + if (selectedDiagnosisItem == null && model.diagnosisTypeList.isNotEmpty) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + setState(() { + selectedDiagnosisItem = model.diagnosisTypeList.keys.firstWhere( + (k) => + model.diagnosisTypeList[k] == selectedDiagnosisItemValue, + orElse: () => ''); + if (selectedDiagnosisItem?.isEmpty == true) + selectedDiagnosisItem = null; + }); + } + }); + } + return AppScaffold( + isLoading: model.state == ViewState.BusyLocal, isShowAppBar: true, appBar: PatientSearchHeader( - title: TranslationBase.of(context).addDiagnosis), + title: TranslationBase.of(context).editDiagnosis), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), @@ -75,7 +101,7 @@ class _EnterDiagnosisState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).addDiagnosis, + TranslationBase.of(context).editDiagnosis, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), fontSize: 16, @@ -90,7 +116,7 @@ class _EnterDiagnosisState extends State { controller: filteredSearchController, onClick: () { setState( - () { + () { selectedDiagnosis = null; filteredSearchController.text = ''; model.selectedIcd = ''; @@ -124,12 +150,12 @@ class _EnterDiagnosisState extends State { child: AppText(model.icdVersionList[index]), onTap: () { setState( - () { + () { selectedDiagnosis = model.findTheDiagnosisItem( model.icdVersionList[index]); filteredSearchController.text = - model.icdVersionList[index]; + model.icdVersionList[index]; model.searchDiagnosisList.clear(); model.icdVersionList.clear(); }, @@ -145,34 +171,34 @@ class _EnterDiagnosisState extends State { 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'), - ], - ), + // 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( @@ -190,43 +216,44 @@ class _EnterDiagnosisState extends State { 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, + 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] + .toLowerCase() + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), ), - ), - ), - AppText( - model.conditionTypeList[index], - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier! * 1.6, + AppText( + model.conditionTypeList[index], + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], ), - ], - ), - )), + )), ), SizedBox( height: 8, @@ -258,38 +285,38 @@ class _EnterDiagnosisState extends State { 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, + 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(), ), - value: item, - ); - }).toList(), - ), - ), + ), ], ), ), @@ -310,35 +337,35 @@ class _EnterDiagnosisState extends State { 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), - ), - ], - ), - ) + // 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), + // ), + // ], + // ), + // ) ], ), ), @@ -377,37 +404,65 @@ class _EnterDiagnosisState extends State { ), 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; - } + title: TranslationBase.of(context).save, + fontWeight: FontWeight.w600, + color: Color(0xFF359846), + onPressed: () async { + selectedDiagnosisItem ??= + model.diagnosisTypeList.keys.first; + if (selectedDiagnosis == null && + filteredSearchController.text.isEmpty) { + 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; - } + 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); - } - }, - ), + if (filteredSearchController.text == + widget.diagnosis.selectedDisease && + status == widget.diagnosis.condition && + widget.diagnosis.diagnosisType == + selectedDiagnosisItem && + widget.diagnosis.remarks == + filteredSearchController.text) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .noChangeRecorded); + return; + } + widget.diagnosis.selectedDisease = + filteredSearchController.text; + widget.diagnosis.selectedCategoryCode = + selectedDiagnosis?.selectedCategoryCode ?? ''; + widget.diagnosis.selectedIcdCode = + selectedDiagnosis?.selectedIcdCode ?? ''; + widget.diagnosis.selectedChapterCode = + selectedDiagnosis?.selectedChapterCode ?? ''; + widget.diagnosis.selectedSectionCode = + selectedDiagnosis?.selectedSectionCode ?? ''; + widget.diagnosis.condition = status; + widget.diagnosis.diagnosisType = + selectedDiagnosisItem; + + bool result = + await model.editDiagnosis(widget.diagnosis); + if (result) { + Navigator.pop(context, result); + } + }), ), ], ), @@ -416,7 +471,7 @@ class _EnterDiagnosisState extends State { ), ), ), - ), - ); + ); + }); } } 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 0ecac958..be205dfa 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 @@ -35,6 +35,7 @@ class _EnterDiagnosisState extends State { bool showAllDiagnosis = true; String status = ''; String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; @@ -265,6 +266,7 @@ class _EnterDiagnosisState extends State { if (newValue != null) setState(() { selectedDiagnosisItem = newValue; + selectedDiagnosisItemValue = model.diagnosisTypeList[newValue]; }); }, items: @@ -375,6 +377,8 @@ class _EnterDiagnosisState extends State { color: Color(0xFF359846), onPressed: () async { selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + selectedDiagnosisItemValue = model.diagnosisTypeList[selectedDiagnosisItem]; + if(selectedDiagnosis == null ){ DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis); return; @@ -392,7 +396,7 @@ class _EnterDiagnosisState extends State { bool result = await model.createDiagnosis( widget.patientInfo, selectedDiagnosis, - selectedDiagnosisItem, + selectedDiagnosisItemValue, status, remarksController.text, false); diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart index b60845bb..48b6032e 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/enum/view_state.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'; @@ -11,7 +12,13 @@ class AddProgressNote extends StatelessWidget{ @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model){ + WidgetsBinding.instance.addPostFrameCallback((_) async { + model.getClinics(); + }); + }, builder: (_, model, w) => AppScaffold( + isLoading: model.state == ViewState.BusyLocal, isShowAppBar: true, appBar: PatientSearchHeader( title: TranslationBase.of(context).progressNote diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart index d8e699f5..7158bac1 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart @@ -1,5 +1,8 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +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/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/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -7,8 +10,10 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-cust import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; -List patientState = ["","Stable", "Not Stable", "Not Defined"]; +import '../../../../../../core/model/SOAP/progress_note/Clinic.dart'; +import '../../../../../base/base_view.dart'; class AddProgressNoteDetails extends StatefulWidget { @override @@ -16,37 +21,15 @@ class AddProgressNoteDetails extends StatefulWidget { } class _AddProgressNoteDetailsState extends State { - String selectedItem = "Stable"; + Clinic? selectedItem ; int status = 1; final TextEditingController noteController = TextEditingController(); - @override Widget build(BuildContext context) { - return 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).addProgressNote, - fontSize: 16, - fontWeight: FontWeight.w600, - textAlign: TextAlign.start, - color: Colors.black, - ), - SizedBox( - height: 16, - ), - Material( + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + builder: (_, model, w) => Material( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), side: BorderSide( @@ -61,236 +44,269 @@ class _AddProgressNoteDetailsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).patientCondition, - textAlign: TextAlign.start, + TranslationBase.of(context).addProgressNote, + fontSize: 16, fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), + textAlign: TextAlign.start, + color: Colors.black, ), SizedBox( - height: 4, + height: 16, ), - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem, - iconSize: 25, - elevation: 16, - - onChanged: (newValue) async { - setState(() { - selectedItem = newValue ?? ""; - }); - }, - items: patientState.map((item) { - return DropdownMenuItem( - child: AppText( - item, - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, + 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).patientCondition, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), ), - value: item, - ); - }).toList(), - ), - ), - ], - ), - ), - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).progressNoteType, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 11, - ), - SizedBox( - height: 8, - ), - Row( - children: [ - Flexible( - child: InkWell( - onTap: () { - setState(() { - status = 1; - }); - }, - 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, - ), + SizedBox( + height: 4, + ), + model.clinics.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null ? model.clinics.first : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedItem = newValue; + }); + }, + items: model.clinics.map((item) { + return DropdownMenuItem( + child: AppText( + projectViewModel.isArabic + ? item.clinicNameArabic ?? '' + : item.clinicNameEnglish ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], ), ), - AppText( - TranslationBase.of(context).doctorProgressNote, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - fontSize: 12, - ), - ], - ), - )), - Flexible( - child: InkWell( - onTap: () { - setState(() { - status = 2; - }); - }, - child: Row( + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).progressNoteType, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + SizedBox( + height: 8, + ), + 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), + Flexible( + child: InkWell( + onTap: () { + setState(() { + status = 1; + }); + }, + 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).doctorProgressNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], ), - child: Container( - decoration: BoxDecoration( - color: status == 2 - ? HexColor("#D02127") - : Colors.white, - shape: BoxShape.circle, + )), + Flexible( + 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).nurseNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], ), ), ), - AppText( - TranslationBase.of(context).nurseNote, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - fontSize: 12, - ), ], ), - ), - ), - ], - ), - SizedBox( - height: 24, - ), - 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).speciality, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 11, - color: Color(0xFF2E303A), - ), SizedBox( - height: 4, + height: 24, ), - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - icon: Icon(Icons.keyboard_arrow_down), - isExpanded: true, - value: selectedItem, - iconSize: 25, - elevation: 16, - - onChanged: (newValue) async { - setState(() { - selectedItem = newValue ?? ""; - }); - }, - items: patientState.map((item) { - return DropdownMenuItem( - child: AppText( - "item", - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.normal, - textAlign: TextAlign.left, + 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).speciality, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, ), - value: item, - ); - }).toList(), + model.clinics.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem == null ? model.clinics.first : selectedItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedItem = newValue; + }); + }, + items: model.clinics.map((item) { + return DropdownMenuItem( + child: AppText( + projectViewModel.isArabic + ? item.clinicNameArabic ?? '' + : item.clinicNameEnglish ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), ), ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).addYourNote, + controller: noteController, + inputType: TextInputType.multiline, + maxLines: 25, + minLines: 4, + hasBorder: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 16, + ), + Row( + children: [ + SvgPicture.asset( + 'assets/images/svgs/save_as_draft.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).saveAsDraft, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ) ], ), ), - ), - SizedBox( - height: 16, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).addYourNote, - controller: noteController, - inputType: TextInputType.multiline, - maxLines: 25, - minLines: 4, - hasBorder: true, - onClick: () {}, - onChanged: (value) {}, - onFieldSubmitted: () {}, - ), - SizedBox( - height: 16, - ), - Row( - children: [ - SvgPicture.asset('assets/images/svgs/save_as_draft.svg'), - SizedBox( - width: 4, - ), - AppText( - TranslationBase.of(context).saveAsDraft, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - fontSize: 10, - color: Color(0xFF449BF1), - ), - ], - ) - ], - ), - ), - ); + )); } } 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 e9304c61..4daed7e3 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 =2; + int _currentIndex = 3; List myAllergiesList = []; List myHistoryList = []; @@ -97,19 +97,19 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ - UpdateAssessmentPage( + UpdatePlanPageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, + sOAPViewModel: model, + changeStateFun: changeStateFun, ), - UpdatePlanPageVidaPlus( + UpdateAssessmentPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState, - sOAPViewModel: model, - changeStateFun: changeStateFun, ), UpdateObjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 658ebb0e..9d952a1e 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1947,6 +1947,8 @@ class TranslationBase { String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!; String get selectedDiagnosis => localizedValues['selectedDiagnosis']![locale.languageCode]!; String get selectConditionFirst => localizedValues['selectConditionFirst']![locale.languageCode]!; + String get editDiagnosis => localizedValues['editDiagnosis']![locale.languageCode]!; + String get noChangeRecorded => localizedValues['noChangeRecorded']![locale.languageCode]!; }