diff --git a/lib/config/config.dart b/lib/config/config.dart index 03581d63..fe7d9b43 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -363,6 +363,10 @@ const REMOVE_CURRENT_MEDICATION = 'Services/DoctorApplication.svc/REST/DeleteHom const ADD_CURRENT_MEDICATION = 'Services/DoctorApplication.svc/REST/AddHomeMedication'; +const CREATE_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/PostProgressNote'; + +const GET_PATIENT_CLINIC = 'Services/DoctorApplication.svc/REST/GetPatientConditionProgress'; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3a0b56bd..fca9679f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1226,5 +1226,9 @@ const Map> localizedValues = { }, "activate": {"en": "Activate", "ar":"فعل"}, "resolved": {"en": "Resolved", "ar":"تم الحل"}, + "diagnosisAlreadyDeleted": {"en": "Diagnosis Already Deleted", "ar":"تم حذف التشخيص بالفعل"}, + "diagnosisAlreadyResolved": {"en": "Diagnosis Already Resolved", "ar":"تم حل التشخيص بالفعل"}, + "selectReaction": {"en": "Select Reaction", "ar":"حدد رد الفعل"}, + "progressNoteCanNotBeEmpty": {"en": "Progress Note Can Not Be Empty", "ar":"ملاحظة التقدم لا يمكن أن تكون فارغة"}, }; diff --git a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart index c4fc3b71..63419958 100644 --- a/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart +++ b/lib/core/model/SOAP/assessment/patient_previous_diagnosis.dart @@ -111,14 +111,14 @@ class PatientPreviousDiagnosis { Map toJson() { return { 'active': active, - 'admissionId': admissionId, - 'admissionRequestId': admissionRequestId, + 'admissionId': admissionId ?? 0, + 'admissionRequestId': admissionRequestId ?? 0, 'appointmentId': appointmentId, 'approvedBy': approvedBy, 'approvedOn': approvedOn, - 'assessmentId': assessmentId, - 'chiefComplainId': chiefComplainId, - 'clinicGroupId': clinicGroupId, + 'assessmentId': assessmentId ?? 0, + 'chiefComplainId': chiefComplainId ?? 0, + 'clinicGroupId': clinicGroupId ?? 0, 'clinicId': clinicId, 'condition': condition, 'createdBy': createdBy, @@ -129,7 +129,7 @@ class PatientPreviousDiagnosis { 'deletedRemarks': deletedRemarks, 'diagnosisType': diagnosisType, 'doctorId': doctorId, - 'episodeId': episodeId, + 'episodeId': episodeId ?? 0, 'hospitalGroupId': hospitalGroupId, 'hospitalId': hospitalId, 'icdCodeDetailsDto': icdCodeDetailsDto, diff --git a/lib/core/model/SOAP/progress_note/Clinic.dart b/lib/core/model/SOAP/progress_note/Clinic.dart index 70f56492..2e452990 100644 --- a/lib/core/model/SOAP/progress_note/Clinic.dart +++ b/lib/core/model/SOAP/progress_note/Clinic.dart @@ -1,11 +1,11 @@ -class Clinic { +class SOAPClinic { int? clinicGroupID; String? clinicGroupName; int? clinicID; String? clinicNameArabic; String? clinicNameEnglish; - Clinic({ + SOAPClinic({ this.clinicGroupID, this.clinicGroupName, this.clinicID, @@ -13,8 +13,8 @@ class Clinic { this.clinicNameEnglish, }); - factory Clinic.fromJson(Map json) { - return Clinic( + factory SOAPClinic.fromJson(Map json) { + return SOAPClinic( clinicGroupID: json['clinicGroupID'], clinicGroupName: json['clinicGroupName'], clinicID: json['clinicID'], diff --git a/lib/core/model/SOAP/progress_note/PatientCondition.dart b/lib/core/model/SOAP/progress_note/PatientCondition.dart new file mode 100644 index 00000000..c082c501 --- /dev/null +++ b/lib/core/model/SOAP/progress_note/PatientCondition.dart @@ -0,0 +1,11 @@ +class PatientCondition{ + String? code; + int? id; + String? name; + + PatientCondition.fromJson(Map json){ + name = json['name'] ?? ''; + id = json['id'] ?? -1; + code = json['code'] ?? ''; + } +} \ 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 826ca410..949fe0ff 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -39,6 +39,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/get_physical_ex 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/PatientCondition.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'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; @@ -80,7 +81,8 @@ class SOAPService extends LookupService { List searchDiagnosisList = []; List patientPhysicalExaminationList = []; List generalSpeciality = []; - List clinicsList = []; + List clinicsList = []; + List patientConditionList = []; Map> specialityDetails = {}; Map diagnosisTypeList = {}; Map conditionTypeList = {}; @@ -447,6 +449,7 @@ class SOAPService extends LookupService { searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v)); }); }, onFailure: (String error, int statusCode) { + searchAllergiesList.clear(); hasError = true; super.error = error; }, body: { @@ -624,13 +627,16 @@ class SOAPService extends LookupService { ..addAll(request) ..addAll(req); hasError = false; + bool success = false; await baseAppClient.post(CREATE_HOPI, onSuccess: (dynamic response, int statusCode) { DrAppToastMsg.showSuccesToast("History Saved Successfully"); + success = true; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: finalRequest); + return success; } getHopi(PatiantInformtion patient) async { @@ -720,7 +726,7 @@ class SOAPService extends LookupService { "diseaseCode": diagnosis, }; hasError = false; - searchDiagnosisList.clear(); + clearSearchResult(); await baseAppClient.post(SEARCH_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { @@ -728,12 +734,17 @@ class SOAPService extends LookupService { .forEach((v) => searchDiagnosisList.add(SearchDiagnosis.fromJson(v))); _processData(); }, onFailure: (String error, int statusCode) { - searchChiefComplaintListVidaPlus.clear(); + clearSearchResult(); hasError = true; super.error = error; }, body: request); } + clearSearchResult(){ + searchDiagnosisList.clear(); + icdVersionList.clear(); + } + void _processData() { Set icdVersions = {}; for (var item in searchDiagnosisList) { @@ -811,21 +822,21 @@ class SOAPService extends LookupService { getPreviousDiagnosis(PatiantInformtion patient) async { Map request = { - // "HospitalGroupID": await sharedPref.getString(DOCTOR_SETUP_ID), //setup - // "hospitalId": patient.projectId, - // "patientId": patient.patientId, - // "patientPomrId": patient.pomrId, - // "startRow": 0, - // "endRow": 1000, - // "ProjectID": patient.projectId - //todo just for the test as the create diagnosis is still not working - "HospitalGroupID": 105, - "hospitalId": 313, - "patientId": 70010976, - "patientPomrId": 8414, + "HospitalGroupID": await sharedPref.getString(DOCTOR_SETUP_ID), //setup + "hospitalId": patient.projectId, + "patientId": patient.patientId, + "patientPomrId": patient.pomrId, "startRow": 0, - "endRow": 2, - "ProjectID": 313 + "endRow": 1000, + "ProjectID": patient.projectId + //todo just for the test as the create diagnosis is still not working + // "HospitalGroupID": 105, + // "hospitalId": 313, + // "patientId": 70010976, + // "patientPomrId": 8414, + // "startRow": 0, + // "endRow": 2, + // "ProjectID": 313 }; hasError = false; patientPreviousDiagnosisList.clear(); @@ -843,21 +854,21 @@ class SOAPService extends LookupService { 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, + // "hospitalGroupId": 105, + // "hospitalId": 313, + // "patientId": 70023498, + // "patientPomrId": 9907, // "startRow": 0, - // "endRow": 1000000, - // "ProjectID": patient.projectId + // "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, @@ -875,31 +886,33 @@ class SOAPService extends LookupService { removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId, String? problemId, String? deletedRemarks) async { Map request = { - // "patientProblemId": patientProblemId, - // "patientId": patientInfo.patientId, - // "problemId": problemId, - // "deletedRemarks": deletedRemarks, - // "ProjectID": patientInfo.projectId, - // "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) + "patientProblemId": patientProblemId, + "patientId": patientInfo.patientId, + "problemId": problemId, + "deletedRemarks": deletedRemarks, + "ProjectID": patientInfo.projectId, + "setupId": await sharedPref.getString(DOCTOR_SETUP_ID) //todo just for the test as the create diagnosis is still not working - "patientProblemId": 13691, - "patientId": 70010986, - "problemId": 41698, - "deletedRemarks": "kethees test", - "ProjectID": 313, - "setupId": 105 + // "patientProblemId": 13691, + // "patientId": 70010986, + // "problemId": 41698, + // "deletedRemarks": "kethees test", + // "ProjectID": 313, + // "setupId": 105 }; hasError = false; + var success = false; patientPreviousDiagnosisList.clear(); await baseAppClient.post(REMOVE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { DrAppToastMsg.showSuccesToast(response['ListDiagnosisRemove']['message']); - //todo get the current diagnosis after the delete if it is successful + success = true; }, onFailure: (String error, int statusCode) { patientPreviousDiagnosisList.clear(); hasError = true; super.error = error; }, body: request); + return success; } favoriteDiagnosis( @@ -1025,7 +1038,6 @@ class SOAPService extends LookupService { }; hasError = false; var isFavoriteAdded = false; - favoriteDiagnosisDetailsList.clear(); await baseAppClient.post(ADD_TO_FAVORITE_DIAGNOSIS, onSuccess: (dynamic response, int statusCode) { var result = response['ListDiagnosisAddFavourite']['resultData']; @@ -1038,7 +1050,6 @@ class SOAPService extends LookupService { response['ListDiagnosisAddFavourite']['message']); } }, onFailure: (String error, int statusCode) { - favoriteDiagnosisDetailsList.clear(); hasError = true; isFavoriteAdded = false; super.error = error; @@ -1047,7 +1058,7 @@ class SOAPService extends LookupService { return isFavoriteAdded; } - convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, + Future convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { Map request = { "patientProblemRevisionId": diagnosis.patientProblemRevisionId, @@ -1064,18 +1075,21 @@ class SOAPService extends LookupService { "ProjectID": paitientInfo.projectId }; hasError = false; - var addedToFavorite = false; + var success = false; await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS, - onSuccess: (dynamic response, int statusCode) { + onSuccess: (dynamic response, int statusCode) async { var result = response['ContinuePreviousEpisode']['resultData']; if ((result as List).isEmpty) { DrAppToastMsg.showErrorToast( response['ContinuePreviousEpisode']['message']); + } else { + success = true; } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: request); + return success; } Future getProgressNoteNew(PatiantInformtion patientInformation) async { @@ -1184,6 +1198,88 @@ class SOAPService extends LookupService { return success; } + Future createDiagnosisFromFavorite( + PatiantInformtion patient, + FavoriteDiseaseDetails? 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, + "hospitalGroupId": searchDiagnosis.hospitalGroupId, + "diagnosisType": diagnosisType, + "condition": conditionType, + "remarks": remarks, + "icdType": searchDiagnosis.icdType, + // "icdVersion": searchDiagnosis.icdVersion, + "icdSubVersion": searchDiagnosis.icdSubVersion, + "isNew": isNew, + "specificationId": searchDiagnosis.specificationId, + "selectedDisease": searchDiagnosis.diseases, + "diseasesCode": searchDiagnosis.diseasesCode, + "diseasesId": searchDiagnosis.diseasesId, + "selectedIcdCode": searchDiagnosis.icdId, + "selectedCategoryCode": searchDiagnosis.categoryCode, + "selectedSectionCode": searchDiagnosis.sectionCode, + "selectedChapterCode": searchDiagnosis.chapterCode, + // "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 createProgressNote(PatiantInformtion patient, String? clinicID, + String conditionType, String note, ) async { + Map request = { + "planNote": note, + "PatientMRN": patient.patientMRN, + "EpisodeID": patient.episodeNo, + "CreatedByName": patient.doctorName, + "CreatedBy": patient.doctorId, + "Speciality": clinicID, + "ProgressNotesTypes": "DOCTOR_NOTE", + "PatientCondition": conditionType, + "ProjectID": patient.projectId + }; + var success = false; + await baseAppClient.post(CREATE_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + if (response['ListCreateProgressNote'] != null) { + DrAppToastMsg.showSuccesToast( + response['ListCreateProgressNote']['message']); + success = true; + } + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { var request = diagnosis.toJson(); var success = false; @@ -1242,8 +1338,25 @@ class SOAPService extends LookupService { 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)))); + response['ListDoctorClinics'] + .forEach((v) => clinicsList.add(SOAPClinic.fromJson(v))); + success = false; + }, onFailure: (String error, int statusCode) { + success = false; + hasError = true; + super.error = error; + }, body: request); + + return success; + } + + Future getPatientCondition() async { + Map request = {}; + var success = false; + await baseAppClient.post(GET_PATIENT_CLINIC, + onSuccess: (dynamic response, int statusCode) { + response['ListPatientConditionProgress']['resultData'].forEach((v) => v['PATIENT_CONDITION'].forEach( + (item) => patientConditionList.add(PatientCondition.fromJson(item)))); success = false; }, onFailure: (String error, int statusCode) { success = false; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index fd5e4262..4b149e7c 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -36,6 +36,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_e 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/PatientCondition.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'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; @@ -148,10 +149,9 @@ class SOAPViewModel extends BaseViewModel { List get getChiefComplaintListVidaPlus => _SOAPService.patientChiefComplaintListVidaPlus; - - List get episodeByChiefComplaintListVidaPlus => - _SOAPService.episodeByChiefComplaintListVidaPlus; - + List + get episodeByChiefComplaintListVidaPlus => + _SOAPService.episodeByChiefComplaintListVidaPlus; List get patientPhysicalExaminationList => _SOAPService.patientPhysicalExaminationList; @@ -159,20 +159,22 @@ class SOAPViewModel extends BaseViewModel { List get auditDiagnosislist => _SOAPService.auditDiagnosislist; + List get patientConditionList => + _SOAPService.patientConditionList; + List? mainSpecialityList = null; List speciality = []; List get progressNote => _SOAPService.patientProgressNoteListVidaPlus; - List get clinics => - _SOAPService.clinicsList; + + List get clinics => _SOAPService.clinicsList; Map> get specialityDetails => _SOAPService.specialityDetails; int? get episodeID => _SOAPService.episodeID; - bool get showAudit => _SOAPService.showAuditBottomSheet; bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder; @@ -195,18 +197,15 @@ class SOAPViewModel extends BaseViewModel { List? get allMedicationList => _prescriptionService.allMedicationList; - List? get getHomeMedicationList => _SOAPService.getHomeMedicationList; - List? get getMedicationListVP => _SOAPService.getSearchCurrentMedication; - - List? get getSearchCurrentMedicationDetails => - _SOAPService.getSearchCurrentMedicationDetails; - + List? + get getSearchCurrentMedicationDetails => + _SOAPService.getSearchCurrentMedicationDetails; late SubjectiveCallBack subjectiveCallBack; @@ -997,7 +996,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - getEditAllergiesVidaPlus(int AllergyID ) async { + getEditAllergiesVidaPlus(int AllergyID) async { setState(ViewState.BusyLocal); await _SOAPService.getEditAllergies(AllergyID); if (_SOAPService.hasError) { @@ -1039,7 +1038,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - updateAllergies( PatientAllergiesVidaPlus request, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); @@ -1051,14 +1049,17 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - saveHopi(Map req, PatiantInformtion patientInfo) async { + Future saveHopi( + Map req, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); - await _SOAPService.saveHopi(req, patientInfo); + bool result = await _SOAPService.saveHopi(req, patientInfo); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + + return result; } getHopi(PatiantInformtion patientInfo) async { @@ -1100,7 +1101,9 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - updateChiefComplaint(PatiantInformtion patientInfo, GetChiefComplaintVidaPlus CC) async { + + updateChiefComplaint( + PatiantInformtion patientInfo, GetChiefComplaintVidaPlus CC) async { setState(ViewState.BusyLocal); await _SOAPService.updateChiefComplaintVidaPlus(patientInfo, CC); if (_SOAPService.hasError) { @@ -1109,6 +1112,7 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + episodeByChiefComplaint(PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.episodeByChiefComplaint(patientInfo); @@ -1118,7 +1122,9 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - createCCByEpisode(PatiantInformtion patientInfo, List chiefComplaint) async { + + createCCByEpisode( + PatiantInformtion patientInfo, List chiefComplaint) async { setState(ViewState.BusyLocal); await _SOAPService.continueEpisodeVidaPlus(patientInfo, chiefComplaint); if (_SOAPService.hasError) { @@ -1127,6 +1133,7 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + getHomeMedication(PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.getHomeMedication(patientInfo); @@ -1137,7 +1144,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - searchCurrentMedication(String searchQuery) async{ + searchCurrentMedication(String searchQuery) async { setState(ViewState.BusyLocal); await _SOAPService.searchCurrentMedication(searchQuery); if (_SOAPService.hasError) { @@ -1147,7 +1154,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - getCurrentMedicationDetails(String id) async{ + getCurrentMedicationDetails(String id) async { setState(ViewState.BusyLocal); await _SOAPService.getCurrentMedicationDetails(id); if (_SOAPService.hasError) { @@ -1157,7 +1164,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - removeCurrentMedication(String id) async{ + removeCurrentMedication(String id) async { setState(ViewState.BusyLocal); await _SOAPService.removeCurrentMedicationVidaPlus(id); if (_SOAPService.hasError) { @@ -1167,7 +1174,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - addCurrentMedication(request, PatiantInformtion patientInfo) async{ + addCurrentMedication(request, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); await _SOAPService.addCurrentMedicationVidaPlus(request, patientInfo); if (_SOAPService.hasError) { @@ -1178,7 +1185,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - searchDiagnosis(PatiantInformtion patientInfo, String searchQuery) async { setState(ViewState.BusyLocal); await _SOAPService.searchDiagnosis(patientInfo, searchQuery); @@ -1189,7 +1195,13 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + clearSearchResult() { + _SOAPService.clearSearchResult(); + notifyListeners(); + } + getConditionAndType(PatiantInformtion patientInfo) async { + clearSearchResult(); setState(ViewState.BusyLocal); await _SOAPService.getDiagnosisType(patientInfo); await _SOAPService.getConditionType(patientInfo); @@ -1250,14 +1262,19 @@ class SOAPViewModel extends BaseViewModel { } void removeDiagnosis( - PatiantInformtion patientInfo, { - String? patientProblemId, - String? problemId, - String? deletedRemarks, - }) async { + PatiantInformtion patientInfo, + PatientPreviousDiagnosis currentDiagnosisItem, + String remarks, + ) async { setState(ViewState.BusyLocal); - await _SOAPService.removeDiagnosis( - patientInfo, patientProblemId, problemId, deletedRemarks); + var result = await _SOAPService.removeDiagnosis( + patientInfo, + currentDiagnosisItem.patientProblemId?.toString(), + currentDiagnosisItem.problemId?.toString(), + remarks); + if (result) { + await getCurrentDiagnosisList(patientInfo); + } if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1286,14 +1303,11 @@ class SOAPViewModel extends BaseViewModel { Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map? user = await sharedPref.getObj(LOGGED_IN_USER); var userID = user?['List_MemberInformation'][0]['MemberID']; - bool result = await _SOAPService.addToFavoriteDiagnosis( - patientInfo, - profile?['DoctorName'] ?? '', - diagnosis?.diseasesBCode ?? '', - userID); + bool result = await _SOAPService.addToFavoriteDiagnosis(patientInfo, + profile?['DoctorName'] ?? '', diagnosis?.diseasesBCode ?? '', userID); // if (diagnosis != null) { - diagnosis?.isFavorite = result; + diagnosis?.isFavorite = result; // searchDiagnosisList[index] = diagnosis; // } @@ -1308,7 +1322,9 @@ class SOAPViewModel extends BaseViewModel { void convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo, PatientPreviousDiagnosis diagnosis) async { setState(ViewState.BusyLocal); - await _SOAPService.convertPreviousDiagnosisCurrent(paitientInfo, diagnosis); + var result = await _SOAPService.convertPreviousDiagnosisCurrent( + paitientInfo, diagnosis); + if (result) await getPreviousPatientDetails(paitientInfo); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1374,7 +1390,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - void toggleShowBottomSheetValue(bool status) { _SOAPService.showAuditBottomSheet = status; } @@ -1408,6 +1423,43 @@ class SOAPViewModel extends BaseViewModel { return result; } + Future createDiagnosisFromFavorite( + PatiantInformtion patientInformation, + FavoriteDiseaseDetails? searchDiagnosis, + String? diagnosisType, + String conditionType, + String remarks, + bool isNew) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.createDiagnosisFromFavorite( + patientInformation, + searchDiagnosis, + diagnosisType, + conditionType, + remarks, + isNew); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + return result; + } + + Future createProgressNote(PatiantInformtion patient, String? clinicID, + String conditionType, String note) async { + setState(ViewState.BusyLocal); + bool result = await _SOAPService.createProgressNote( + patient, clinicID, conditionType, note); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + + return result; + } Future editDiagnosis(PatientPreviousDiagnosis diagnosis) async { setState(ViewState.BusyLocal); @@ -1420,9 +1472,13 @@ class SOAPViewModel extends BaseViewModel { return result; } - Future resolveDiagnosis(PatientPreviousDiagnosis diagnosis) async { + Future resolveDiagnosis( + PatientPreviousDiagnosis diagnosis, PatiantInformtion patientInfo) async { setState(ViewState.BusyLocal); bool result = await _SOAPService.resolveDiagnosis(diagnosis); + if (result) { + await getCurrentDiagnosisList(patientInfo); + } if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -1464,4 +1520,42 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + getPatientConditionList() async { + setState(ViewState.BusyLocal); + await _SOAPService.getPatientCondition(); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + /** + * function that checks if all the mandatory data is obtained from the subjective + * page + * @return [true] if the data is correctly inserted [false] if the data is incomplete + */ + bool isSubjectiveAssesmentCompleted() { + return getChiefComplaintListVidaPlus.isNotEmpty && + getHopiDetails.isNotEmpty && + patientAllergiesVidaPlus.isNotEmpty; + } + + bool isPhysicalExaminationAdded() { + return patientPhysicalExaminationList.isNotEmpty; + } + + bool isDiagnosticsAdded() { + return diagnosisList.isNotEmpty; + } + + bool isProgressAdded() { + return progressNote.isNotEmpty; + } + + void clearAllergy() { + _SOAPService.searchAllergiesList.clear(); + notifyListeners(); + } } 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 e22cc6ff..347deec6 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 @@ -103,7 +103,7 @@ class _UpdateAssessmentPageState extends State }, child: Column(children: [ SizedBox( - height: 20, + height: 10, ), SizedBox( 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 e88f2612..59a171b8 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 @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plu 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'; +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_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -98,7 +99,7 @@ class _CurrentDiagnosisState extends State { remarks: widget.currentDiagnosisItems[index].remarks ?? '', - onSoapDetailActionClicked: (action) async{ + onSoapDetailActionClicked: (action) async { switch (action) { case SoapDetailItemActions.AUDIT: model.getAuditOfDiagnosis( @@ -113,26 +114,48 @@ class _CurrentDiagnosisState extends State { context, FadePage( page: EditDiagnosis( - patientInfo: widget.patientInfo, diagnosis: widget.currentDiagnosisItems[index], - ))); + patientInfo: widget.patientInfo, + diagnosis: widget + .currentDiagnosisItems[index], + ))); if (result) { - model.getCurrentDiagnosisList(widget.patientInfo); + model.getCurrentDiagnosisList( + widget.patientInfo); } break; case SoapDetailItemActions.RESOLVE: - bool result = await model.resolveDiagnosis(widget.currentDiagnosisItems[index]); + if (widget.currentDiagnosisItems[index] + .resolved == + true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .diagnosisAlreadyResolved); + } + bool result = await model.resolveDiagnosis( + widget.currentDiagnosisItems[index], + widget.patientInfo); if (result) { - model.getCurrentDiagnosisList(widget.patientInfo); + model.getCurrentDiagnosisList( + widget.patientInfo); } - break; + break; case SoapDetailItemActions.REMOVE: - showConfirmationDialog(context, - "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", - () { - widget.model - .removeDiagnosis(widget.patientInfo); - }); + if (widget.currentDiagnosisItems[index] + .status == + "Deleted") { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).diagnosisAlreadyDeleted); + return; + } + showConfirmationDialog(context, + "${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}", + (remarks) { + widget.model.removeDiagnosis( + widget.patientInfo, + widget.currentDiagnosisItems[index], + remarks); + }); + case SoapDetailItemActions.CHANGE_STATUS: // TODO: Handle this case. default: @@ -150,7 +173,7 @@ class _CurrentDiagnosisState extends State { } showConfirmationDialog( - BuildContext context, String message, Function okFunction) { + BuildContext context, String message, Function(String) okFunction) { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -209,7 +232,14 @@ class _CurrentDiagnosisState extends State { Expanded( child: AppButton( onPressed: () { - okFunction(); + if (deleteController.text.isEmpty) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .remarksCanNotBeEmpty); + return; + ; + } + okFunction(deleteController.text); Navigator.of(context).pop(); }, title: TranslationBase.of(context).delete, 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 fcb2cc05..63b178b8 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 @@ -49,7 +49,7 @@ class _EditDiagnosisState extends State { void initState() { super.initState(); filteredSearchController.text = widget.diagnosis.selectedDisease ?? ''; - filteredSearchController.text = widget.diagnosis.remarks ?? ''; + remarksController.text = widget.diagnosis.remarks ?? ''; status = widget.diagnosis.condition ?? ''; selectedDiagnosisItemValue = widget.diagnosis?.diagnosisType ?? ''; } @@ -58,12 +58,15 @@ class _EditDiagnosisState extends State { if (_tTimer != null) { _tTimer!.cancel(); } + if(text.isEmpty) return; + _tTimer = Timer(Duration(milliseconds: 500), () { _onStopped(text); }); } void _onStopped(String searchText) async { + FocusScope.of(context).unfocus(); await model?.searchDiagnosis(widget.patientInfo, searchText); } @@ -236,7 +239,7 @@ class _EditDiagnosisState extends State { ), child: Container( decoration: BoxDecoration( - color: status == + color: status.toLowerCase() == model.conditionTypeList[index] .toLowerCase() ? HexColor("#D02127") @@ -433,11 +436,11 @@ class _EditDiagnosisState extends State { if (filteredSearchController.text == widget.diagnosis.selectedDisease && - status == widget.diagnosis.condition && + status.toLowerCase() == widget.diagnosis.condition?.toLowerCase() && widget.diagnosis.diagnosisType == - selectedDiagnosisItem && + selectedDiagnosisItemValue && widget.diagnosis.remarks == - filteredSearchController.text) { + remarksController.text) { DrAppToastMsg.showErrorToast( TranslationBase.of(context) .noChangeRecorded); @@ -445,17 +448,25 @@ class _EditDiagnosisState extends State { } 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; + widget.diagnosis.remarks = + remarksController.text; + + if(selectedDiagnosis != null ) { + 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); 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 be205dfa..c7f93308 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 @@ -45,12 +45,14 @@ class _EnterDiagnosisState extends State { if (_tTimer != null) { _tTimer!.cancel(); } + if(text.isEmpty) return; _tTimer = Timer(Duration(milliseconds: 500), () { _onStopped(text); }); } void _onStopped(String searchText) async { + FocusScope.of(context).unfocus(); await model?.searchDiagnosis(widget.patientInfo, searchText); } 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 71e82650..7a08886b 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 @@ -2,12 +2,14 @@ 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/model/SOAP/assessment/FavoriteDiseaseDetails.dart'; import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.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/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'; @@ -33,8 +35,9 @@ class _FavoriteDiagnosisState extends State { TextEditingController(); bool showAllDiagnosis = true; String status = ''; - String? selectedItem; - String? selectedFavorite; + String? selectedDiagnosisItem; + String? selectedDiagnosisItemValue; + FavoriteDiseaseDetails? selectedFavorite; TextEditingController remarksController = TextEditingController(); Timer? _tTimer; SOAPViewModel? model; @@ -106,7 +109,7 @@ class _FavoriteDiagnosisState extends State { model.favoriteDiagnosisDetails.isEmpty ? EmptyDropDown() : DropdownButtonHideUnderline( - child: DropdownButton( + child: DropdownButton( dropdownColor: Colors.white, iconEnabledColor: Colors.black, icon: Icon(Icons.keyboard_arrow_down), @@ -114,7 +117,6 @@ class _FavoriteDiagnosisState extends State { itemHeight: null, value: selectedFavorite == null ? model.favoriteDiagnosisDetails.first - .diseases : selectedFavorite, iconSize: 25, elevation: 16, @@ -135,7 +137,7 @@ class _FavoriteDiagnosisState extends State { fontWeight: FontWeight.normal, textAlign: TextAlign.left, ), - value: item.diseases, + value: item, ); }).toList(), ), @@ -355,42 +357,39 @@ class _FavoriteDiagnosisState extends State { 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(), + 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; + selectedDiagnosisItemValue = model.diagnosisTypeList[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(), + ), + ), ], ), ), @@ -452,7 +451,32 @@ class _FavoriteDiagnosisState extends State { title: TranslationBase.of(context).save, fontWeight: FontWeight.w600, color: Color(0xFF359846), - onPressed: () async {}, + onPressed: () async { + selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first; + selectedDiagnosisItemValue = model.diagnosisTypeList[selectedDiagnosisItem]; + selectedFavorite ??=model.favoriteDiagnosisDetails.first; + + 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.createDiagnosisFromFavorite( + widget.patientInfo, + selectedFavorite, + selectedDiagnosisItemValue, + status, + remarksController.text, + false); + if (result) { + Navigator.pop(context, result); + } + }, ), ), ], diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart index 20a30c2f..39b0295c 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis.dart @@ -50,6 +50,7 @@ class PreviousDiagnosis extends StatelessWidget { status: diagnosisItems[index].status ?? '', condition: diagnosisItems[index].condition ?? '', remarks: diagnosisItems[index].remarks ?? '', + isPreviousAddedToCurrent:diagnosisItems[index].visitWisePatientDiagnoses == true , onSoapDetailActionClicked: (action) { switch (action) { case SoapDetailItemActions.AUDIT: diff --git a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart index 0b83fc8f..81e1837b 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/assessment/widget/previous_diagnosis_item.dart @@ -13,6 +13,7 @@ class PreviousDiagnosisItem extends StatelessWidget { final String condition; final String status; final String remarks; + final bool isPreviousAddedToCurrent; final OnSoapDetailActionClicked onSoapDetailActionClicked; const PreviousDiagnosisItem( @@ -21,80 +22,82 @@ class PreviousDiagnosisItem extends StatelessWidget { required this.condition, required this.remarks, required this.onSoapDetailActionClicked, - required this.status}); + required this.status, + required this.isPreviousAddedToCurrent}); @override Widget build(BuildContext context) { return Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Stack( // children: [ - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + title, + color: Color(0XFF2B353E), + fontSize: 12, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 4, + ), + Row( children: [ AppText( - title, + "${TranslationBase.of(context).condition}:", color: Color(0XFF2B353E), - fontSize: 12, - fontWeight: FontWeight.bold, + fontSize: 10, + fontWeight: FontWeight.w500, ), - SizedBox(height: 4,), - Row( - children: [ - AppText( - "${TranslationBase.of(context).condition}:", - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - SizedBox( - width: 4, - ), - AppText( - condition, - color: Color(0xffD02127), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - ], + SizedBox( + width: 4, + ), + AppText( + condition, + color: Color(0xffD02127), + fontSize: 10, + fontWeight: FontWeight.w500, ), ], ), - ), - Status(status: status), - - ], + ], + ), ), - Visibility( - visible: remarks.isNotEmpty, - child: Column( - children: [ - SizedBox( - height: 8, - ), - AppText( - remarks, - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w400, - ), - ], - )) + Status(status: status), ], ), - // Align( - // alignment: Alignment.topRight, child: Status(status: status)) - // ], + Visibility( + visible: remarks.isNotEmpty, + child: Column( + children: [ + SizedBox( + height: 8, + ), + AppText( + remarks, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ], + )) + ], + ), + // Align( + // alignment: Alignment.topRight, child: Status(status: status)) + // ], // ), SizedBox( height: 16, @@ -120,15 +123,23 @@ class PreviousDiagnosisItem extends StatelessWidget { width: 187, height: 27, child: Material( - color: HexColor("#D02127"), - shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(5.0)) , + color: isPreviousAddedToCurrent + ? Color(0xffEAEAEA) + : HexColor("#D02127"), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0)), child: InkWell( - onTap: () { - onSoapDetailActionClicked( - SoapDetailItemActions.CHANGE_STATUS); - }, - child:Center(child: AppText( TranslationBase.of(context).makeCurrentDiagnosis, color: Colors.white,)), - ), + onTap: () { + if (!isPreviousAddedToCurrent) // to make it clickable if it has not been added to the current diagnosis + onSoapDetailActionClicked( + SoapDetailItemActions.CHANGE_STATUS); + }, + child: Center( + child: AppText( + TranslationBase.of(context).makeCurrentDiagnosis, + color: Colors.white, + )), + ), ), ) ], 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 ff8e2bd0..1d971c0a 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 @@ -145,7 +145,7 @@ class _UpdatePlanPageVidaPlusState extends State title: TranslationBase.of(context) .addProgressNote, onAddSoapItemClicked: () { - navigateToAddPlan(); + navigateToAddPlan(model); }), SizedBox( height: 16, @@ -385,11 +385,15 @@ class _UpdatePlanPageVidaPlusState extends State //todo handle the next event here } - void navigateToAddPlan() { - Navigator.push( + void navigateToAddPlan(SOAPViewModel model) async{ + bool result = await Navigator.push( context, FadePage( - page: AddProgressNote(), + page: AddProgressNote(information: widget.patientInfo,), )); + + if(result){ + model.getProgressNote(widget.patientInfo); + } } } 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 48b6032e..ab92d4d8 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,20 +1,49 @@ + +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/Clinic.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/PatientCondition.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/core/viewModel/project_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/plan/widget/add_progress_note_details.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:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class AddProgressNote extends StatefulWidget{ + final PatiantInformtion information; + + const AddProgressNote({super.key, required this.information}); + @override + State createState() => _AddProgressNoteState(); +} + +class _AddProgressNoteState extends State { + SOAPClinic? selectedClinicItem; + + PatientCondition? selectedPatientConditionItem; + + int status = 1; + final TextEditingController noteController = TextEditingController(); -class AddProgressNote extends StatelessWidget{ @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( onModelReady: (model){ WidgetsBinding.instance.addPostFrameCallback((_) async { model.getClinics(); + model.getPatientConditionList(); }); }, builder: (_, model, w) => AppScaffold( @@ -26,7 +55,251 @@ class AddProgressNote extends StatelessWidget{ body: Padding( padding: const EdgeInsets.all(20.0), child: SingleChildScrollView( - child: AddProgressNoteDetails(), + child: 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( + 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), + ), + SizedBox( + height: 4, + ), + model.patientConditionList.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: + selectedPatientConditionItem == null + ? model.patientConditionList.first + : selectedPatientConditionItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedPatientConditionItem = + newValue; + }); + }, + items: model.patientConditionList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.name ?? '', + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + 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, + ), + ), + ), + AppText( + TranslationBase.of(context).doctorProgressNote, + 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, + ), + model.clinics.isEmpty + ? EmptyDropDown() + : DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedClinicItem == null + ? model.clinics.first + : selectedClinicItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedClinicItem = 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), + // ), + // ], + // ) + ], + ), + ), + ), ), ), bottomNavigationBar: Material( @@ -56,9 +329,16 @@ class AddProgressNote extends StatelessWidget{ fontColor: Colors.white, fontWeight: FontWeight.w600, onPressed: () async { - Navigator.pop(context); + selectedPatientConditionItem ??= model.patientConditionList.first; + selectedClinicItem ??= model.clinics.first; + if(noteController.text.isEmpty){ + DrAppToastMsg.showErrorToast(TranslationBase.of(context).progressNoteCanNotBeEmpty); + return; + } + bool result = await model.createProgressNote(widget.information, selectedClinicItem?.clinicID?.toString(), selectedPatientConditionItem?.code ?? '',noteController.text ); + Navigator.pop(context, result); }, ), @@ -68,5 +348,4 @@ class AddProgressNote extends StatelessWidget{ ), ); } - } \ No newline at end of file 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 7158bac1..24af94c9 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,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/PatientCondition.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'; @@ -21,7 +22,10 @@ class AddProgressNoteDetails extends StatefulWidget { } class _AddProgressNoteDetailsState extends State { - Clinic? selectedItem ; + SOAPClinic? selectedClinicItem; + + PatientCondition? selectedPatientConditionItem; + int status = 1; final TextEditingController noteController = TextEditingController(); @@ -77,28 +81,31 @@ class _AddProgressNoteDetailsState extends State { SizedBox( height: 4, ), - model.clinics.isEmpty + model.patientConditionList.isEmpty ? EmptyDropDown() : DropdownButtonHideUnderline( - child: DropdownButton( + child: DropdownButton( dropdownColor: Colors.white, iconEnabledColor: Colors.black, icon: Icon(Icons.keyboard_arrow_down), isExpanded: true, - value: selectedItem == null ? model.clinics.first : selectedItem, + value: + selectedPatientConditionItem == null + ? model.patientConditionList.first + : selectedPatientConditionItem, iconSize: 25, elevation: 16, onChanged: (newValue) async { setState(() { - selectedItem = newValue; + selectedPatientConditionItem = + newValue; }); }, - items: model.clinics.map((item) { + items: model.patientConditionList + .map((item) { return DropdownMenuItem( child: AppText( - projectViewModel.isArabic - ? item.clinicNameArabic ?? '' - : item.clinicNameEnglish ?? '', + item.name ?? '', fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, @@ -166,45 +173,6 @@ class _AddProgressNoteDetailsState extends State { ], ), )), - 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, - ), - ], - ), - ), - ), ], ), SizedBox( @@ -237,36 +205,38 @@ class _AddProgressNoteDetailsState extends State { 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, + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedClinicItem == null + ? model.clinics.first + : selectedClinicItem, + iconSize: 25, + elevation: 16, + onChanged: (newValue) async { + setState(() { + selectedClinicItem = 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(), ), - value: item, - ); - }).toList(), - ), - ), + ), ], ), ), @@ -288,22 +258,22 @@ class _AddProgressNoteDetailsState extends State { 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), - ), - ], - ) + // 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/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart index 6b9f7b0b..7fd7bde3 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.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/utils/translations_delegate_base_utils.dart'; @@ -38,12 +39,15 @@ class _AddAllergiesState extends State { @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model){ + WidgetsBinding.instance.addPostFrameCallback((_) { + model.clearAllergy(); + }); + }, builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - + isLoading: model.state == ViewState.BusyLocal, appBar: PatientSearchHeader( - title: TranslationBase.of(context).addAllergies), body: MasterKeyCheckboxSearchAllergiesWidget( model: model, @@ -61,47 +65,4 @@ class _AddAllergiesState extends State { )), ); } -// -// isServiceSelected(MasterKeyModel masterKey) { -// Iterable allergy = -// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); -// if (allergy.length > 0) { -// return true; -// } -// return false; -// } -// -// removeAllergyFromLocalList(MasterKeyModel masterKey) { -// myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id); -// } -// -// MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) { -// Iterable allergy = -// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); -// if (allergy.length > 0) { -// return allergy.first; -// } -// return MySelectedAllergy(); -// } -// -// addAllergyLocally(AllergiesListVidaPlus mySelectedAllergy) { -// if (mySelectedAllergy.selectedAllergy == null) { -// Utils.showErrorToast(TranslationBase.of(context).requiredMsg); -// } else { -// setState(() { -// List allergy = -// // ignore: missing_return -// myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList(); -// -// if (allergy.isEmpty) { -// myAllergiesListLocal.add(mySelectedAllergy); -// } else { -// allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy; -// allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity; -// allergy.first.remark = mySelectedAllergy.remark; -// allergy.first.isChecked = mySelectedAllergy.isChecked; -// } -// }); -// } -// } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index 10370c01..3ee99a12 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -15,132 +15,151 @@ import '../../../../../../core/model/patient/patiant_info_model.dart'; import '../../../../../../widgets/transitions/fade_page.dart'; import '../../objective/widget/EmptyExamination.dart'; - class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { final SOAPViewModel model; final String? buttonName; final String? hintSearchText; final PatientAllergiesVidaPlus? myAllergiesList; final PatiantInformtion patientInfo; - MasterKeyCheckboxSearchAllergiesWidget( - {Key? key, - required this.model, - this.myAllergiesList, - required this.patientInfo, - this.buttonName, - this.hintSearchText, - }) - : super(key: key); + MasterKeyCheckboxSearchAllergiesWidget({ + Key? key, + required this.model, + this.myAllergiesList, + required this.patientInfo, + this.buttonName, + this.hintSearchText, + }) : super(key: key); @override - _MasterKeyCheckboxSearchAllergiesWidgetState createState() => _MasterKeyCheckboxSearchAllergiesWidgetState(); + _MasterKeyCheckboxSearchAllergiesWidgetState createState() => + _MasterKeyCheckboxSearchAllergiesWidgetState(); } -class _MasterKeyCheckboxSearchAllergiesWidgetState extends State { +class _MasterKeyCheckboxSearchAllergiesWidgetState + extends State { // List items = []; -bool loading =false; + bool loading = false; TextEditingController filteredSearchController = TextEditingController(); @override void initState() { - super.initState(); } @override Widget build(BuildContext context) { - return Column( - children: [ - - Expanded( - child: Container( - - margin: EdgeInsets.all(20), - height: Utils.getTextFieldHeight(), - child: Center( - child: Container( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)), - child: Column( - children: [ - AppTextFieldCustom( - - hintText: TranslationBase.of(context).selectAllergy, - isTextFieldHasSuffix: true, - hasBorder: true, - controller: filteredSearchController, - onChanged: (value) { - // filterSearchResults(value); - }, - onFieldSubmitted: () { - - }, - - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Color(0xff2B353E - ), - size: 30, - ), - onPressed: () { - loading =true; - widget.model.searchAllergies(filteredSearchController.text); - - }, - ), - ), - // DividerWithSpacesAround(), - SizedBox( - height: 10, - ), - Expanded( - child: RoundedContainer( - width:MediaQuery.of(context).size.width , - height: MediaQuery.of(context).size.height * 0.60, - child: widget.model.state == ViewState.Idle - ? ListView.builder( - itemCount: widget.model.searchAllergiesVidaPlus.length, - itemBuilder: (context, index) { - loading =false; - return ListTile(title: AppText(widget.model.searchAllergiesVidaPlus[index].allergyName!), trailing: TextButton.icon(icon: SvgPicture.asset("assets/images/svgs/add-square.svg", color: Color(0xffD02127),), style: ButtonStyle(iconColor: WidgetStateProperty.all(Color(0xffD02127)), ), onPressed: (){ - - openReaction(widget.model, widget.model.searchAllergiesVidaPlus[index]); - - }, label: AppText(TranslationBase.of(context).add, fontSize:12, color:Color(0xffD02127) ,), - ), - ); - - }, - ) - : widget.model.state == ViewState.BusyLocal ? Center(child: CircularProgressIndicator()) :Center(child: EmptyWidget(TranslationBase.of(context).noDataAvailable)) - + return Column( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(20), + height: Utils.getTextFieldHeight(), + child: Center( + child: Container( + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(12)), + child: Column( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).selectAllergy, + isTextFieldHasSuffix: true, + hasBorder: true, + controller: filteredSearchController, + onChanged: (value) { + // filterSearchResults(value); + }, + onFieldSubmitted: () { + }, + onEditingComplete: (){ + loading = true; + if(filteredSearchController.text.isNotEmpty) { + widget.model + .searchAllergies(filteredSearchController.text); + } + }, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Color(0xff2B353E), + size: 30, ), + onPressed: () { + loading = true; + widget.model + .searchAllergies(filteredSearchController.text); + }, ), - ], - ), + ), + // DividerWithSpacesAround(), + SizedBox( + height: 10, + ), + Expanded( + child: RoundedContainer( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.60, + child: widget.model.searchAllergiesVidaPlus.isEmpty + ? Center( + child: EmptyWidget( + TranslationBase.of(context) + .noDataAvailable)) + : ListView.builder( + itemCount: widget + .model.searchAllergiesVidaPlus.length, + itemBuilder: (context, index) { + loading = false; + return ListTile( + title: AppText(widget + .model + .searchAllergiesVidaPlus[index] + .allergyName!), + trailing: TextButton.icon( + icon: SvgPicture.asset( + "assets/images/svgs/add-square.svg", + color: Color(0xffD02127), + ), + style: ButtonStyle( + iconColor: + WidgetStateProperty.all< + Color>(Color(0xffD02127)), + ), + onPressed: () { + openReaction( + widget.model, + widget.model + .searchAllergiesVidaPlus[ + index]); + }, + label: AppText( + TranslationBase.of(context).add, + fontSize: 12, + color: Color(0xffD02127), + ), + ), + ); + }, + ) + ), + ), + ], ), ), ), ), - - ], - + ), + ], ); } -openReaction(model, AllergiesListVidaPlus mySelectedAllergy){ - Navigator.of(context).pop(); - Navigator.push( - context, - FadePage( - page:ReactionsSelectionAllergiesWidget( - model:model, - mySelectedAllergy: mySelectedAllergy, - patientInfo: widget.patientInfo - ) - - )); + openReaction(model, AllergiesListVidaPlus mySelectedAllergy) { + Navigator.of(context).pop(); + Navigator.push( + context, + FadePage( + page: ReactionsSelectionAllergiesWidget( + model: model, + mySelectedAllergy: mySelectedAllergy, + patientInfo: widget.patientInfo))); } - } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart index 8ac3c13b..9dac5c7a 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; @@ -56,9 +57,7 @@ class _ReactionsSelectionAllergiesWidgetState builder: (_, model, w) => AppScaffold( isLoading: loading, appBar: PatientSearchHeader( - title: widget.mySelectedAllergy != null - ? widget.mySelectedAllergy!.allergyName - : widget.editSelectedAllergy!.allergyName), + title: TranslationBase.of(context).selectReaction), body: Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -66,7 +65,7 @@ class _ReactionsSelectionAllergiesWidgetState widget.mySelectedAllergy != null ? Expanded( child: RoundedContainer( - margin: EdgeInsets.only(top:10, left: 15, right: 15, bottom: 10), + margin: EdgeInsets.only(top:6, left: 15, right: 15, bottom: 6), child: ListView.builder( itemCount: widget.mySelectedAllergy! .allergyReactionDTOs!.length, @@ -108,11 +107,12 @@ class _ReactionsSelectionAllergiesWidgetState .allergyReactionName!), children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, children: [ Expanded( + child: ListTile( + contentPadding: EdgeInsets.zero , + title: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -147,6 +147,7 @@ class _ReactionsSelectionAllergiesWidgetState ))), Expanded( child: ListTile( + contentPadding: EdgeInsets.zero , title: Row( children: [ Radio( @@ -180,6 +181,8 @@ class _ReactionsSelectionAllergiesWidgetState ))), Expanded( child: ListTile( + contentPadding: EdgeInsets.zero , + title: Row( children: [ Radio( @@ -215,7 +218,7 @@ class _ReactionsSelectionAllergiesWidgetState ) ], ), - Divider(), + // Divider(), ]); }, ))) @@ -263,6 +266,8 @@ class _ReactionsSelectionAllergiesWidgetState children: [ Expanded( child: ListTile( + contentPadding: EdgeInsets.zero , + title: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -305,6 +310,8 @@ class _ReactionsSelectionAllergiesWidgetState ))), Expanded( child: ListTile( + contentPadding: EdgeInsets.zero , + title: Row( children: [ Radio( @@ -346,6 +353,8 @@ class _ReactionsSelectionAllergiesWidgetState ))), Expanded( child: ListTile( + contentPadding: EdgeInsets.zero , + title: Row( children: [ Radio( diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart index 6938ec87..e9f00bdd 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart @@ -253,7 +253,11 @@ class UpdatePresentIllnessState extends State { "hpiTakenOtherText": otherController.text, "hpiTakenFamilyText": familyController.text, }; - await model!.saveHopi(request, widget.patientInfo!); + bool result = await model!.saveHopi(request, widget.patientInfo!); + if(result){ + getHopi(model); + } + GifLoaderDialogUtils.hideDialog(context); } getHopi(SOAPViewModel model) async{ 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 81c87e49..21df4f06 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 @@ -174,10 +174,10 @@ class _UpdateSoapIndexVidaPlusState extends State child: AppButton( title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, + disabled: !model.isSubjectiveAssesmentCompleted(), color: Colors.red[700]!, onPressed: () async { changePageViewIndex(1); - //model.nextOnSubjectPage(model); }, ), ); @@ -217,7 +217,7 @@ class _UpdateSoapIndexVidaPlusState extends State // height: SizeConfig.heightMultiplier! * // (SizeConfig.isHeightVeryShort ? 8 : 6), // padding: 10, - disabled: model.state == ViewState.BusyLocal, + disabled: model.state == ViewState.BusyLocal || !model.isPhysicalExaminationAdded(), onPressed: () async { changePageViewIndex(2); // await model.nextOnObjectivePage(model); @@ -254,7 +254,7 @@ class _UpdateSoapIndexVidaPlusState extends State title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700]!, - disabled: model.state == ViewState.BusyLocal, + disabled: model.state == ViewState.BusyLocal || !model.isDiagnosticsAdded(), onPressed: () async { changePageViewIndex(3); }, @@ -292,7 +292,7 @@ class _UpdateSoapIndexVidaPlusState extends State : TranslationBase.of(context).finish, fontWeight: FontWeight.w600, color: Colors.red[700]!, - disabled: model.progressNoteText.isEmpty, + disabled: !model.isProgressAdded(), onPressed: () async { changePageViewIndex(3); // model.nextOnPlanPage(model); diff --git a/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart b/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart index 034c2976..0e391584 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart @@ -10,6 +10,7 @@ class SoapDetailItem extends StatelessWidget { final String condition; final String status; final String remarks; + final bool showActions; final OnSoapDetailActionClicked onSoapDetailActionClicked; const SoapDetailItem( @@ -18,7 +19,8 @@ class SoapDetailItem extends StatelessWidget { required this.condition, required this.remarks, required this.onSoapDetailActionClicked, - required this.status}); + required this.status, + this.showActions = true}); @override Widget build(BuildContext context) { @@ -112,7 +114,7 @@ class SoapDetailItem extends StatelessWidget { onSoapDetailActionClicked(SoapDetailItemActions.AUDIT), child: SoapDetailItemActionsView( icon: 'assets/images/svgs/audit.svg', - fontColor: Color(0XFF359846), + fontColor: Color(0XFF2B353E), text: TranslationBase.of(context).audit, ), ), diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 9589e220..3fa6f0c4 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1952,6 +1952,11 @@ class TranslationBase { String get activate => localizedValues['activate']![locale.languageCode]!; String get resolved => localizedValues['resolved']![locale.languageCode]!; + String get selectReaction => localizedValues['selectReaction']![locale.languageCode]!; + String get progressNoteCanNotBeEmpty => localizedValues['progressNoteCanNotBeEmpty']![locale.languageCode]!; + String get diagnosisAlreadyResolved => localizedValues['diagnosisAlreadyResolved']![locale.languageCode]!; + String get diagnosisAlreadyDeleted => localizedValues['diagnosisAlreadyDeleted']![locale.languageCode]!; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index 3d386a27..93aef94d 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -27,6 +27,7 @@ class AppTextFieldCustom extends StatefulWidget { final List? inputFormatters; final Function(String? value) onChanged; final Function() onFieldSubmitted; + final VoidCallback? onEditingComplete; final String? validationError; final bool isPrscription; @@ -57,6 +58,7 @@ class AppTextFieldCustom extends StatefulWidget { this.focus = false, this.isSearchTextField = false, required this.onFieldSubmitted, + this.onEditingComplete }); @override @@ -161,6 +163,10 @@ class _AppTextFieldCustomState extends State { } }, child: TextFormField( + textInputAction: TextInputAction.search, + onEditingComplete: (){ + widget.onEditingComplete?.call(); + }, textAlign: projectViewModel.isArabic ? TextAlign.right : TextAlign.left, @@ -192,6 +198,7 @@ class _AppTextFieldCustomState extends State { } setState(() {}); }, + onFieldSubmitted: widget.onFieldSubmitted(), obscureText: widget.isSecure),