diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index c68f9522..ff9d957d 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -36,21 +36,20 @@ class BaseAppClient { }) async { String url = BASE_URL + endPoint; try { - //TODO change it edit By Jammal - // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - // String token = await sharedPref.getString(TOKEN); - // if (profile != null) { - // DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - // if (body['DoctorID'] == null) - body['DoctorID'] = 4709;//doctorProfile?.doctorID; - body['EditedBy'] = 4709;//doctorProfile?.doctorID; - //if (body['ProjectID'] == null) { - body['ProjectID'] = 15;//doctorProfile?.projectID; - // } - // if (body['ClinicID'] == null) - body['ClinicID'] = 1;//doctorProfile?.clinicID; - // } - body['TokenID'] = "@dm!n";//token ?? ''; + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + String token = await sharedPref.getString(TOKEN); + if (profile != null) { + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + if (body['DoctorID'] == null) + body['DoctorID'] = doctorProfile?.doctorID; + body['EditedBy'] = doctorProfile?.doctorID; + if (body['ProjectID'] == null) { + body['ProjectID'] = doctorProfile?.projectID; + } + if (body['ClinicID'] == null) + body['ClinicID'] = doctorProfile?.clinicID; + } + body['TokenID'] = token ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -64,11 +63,9 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; - //await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - body['VidaRefreshTokenID'] ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; - //await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index f4b8ef1c..09530d50 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,6 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -14,7 +22,11 @@ import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_a import 'base/lookup-service.dart'; class SOAPService extends LookupService { - List chiefComplaintList = []; + List patientChiefComplaintList = []; + List patientAllergiesList = []; + List patientHistoryList = []; + List patientPhysicalExamList = []; + List patientProgressNoteList = []; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( @@ -181,68 +193,83 @@ class SOAPService extends LookupService { - Future getPatientAllergy(PostAllergyRequestModel getPatientAllergyRequestModel) async { + Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP) async { hasError = false; await baseAppClient.post (GET_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); + patientAllergiesList.clear(); + response['List_Allergies']['entityList'].forEach((v) { + patientAllergiesList.add(GetAllergiesResModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientAllergyRequestModel.toJson()); + }, body: generalGetReqForSOAP.toJson()); } Future getPatientHistories( - PostHistoriesRequestModel getPatientHistoriesRequestModel) async { + GetHistoryReqModel getHistoryReqModel) async { hasError = false; await baseAppClient.post (GET_HISTORY, onSuccess: (dynamic response, int statusCode) { print("Success"); + patientHistoryList.clear(); + response['List_History']['entityList'].forEach((v) { + patientHistoryList.add(GetHistoryResModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientHistoriesRequestModel.toJson()); + }, body: getHistoryReqModel.toJson()); } Future getPatientChiefComplaint( - GeneralGetReqForSOAP getPatientChiefComplaintRequestModel) async { + GetChiefComplaintReqModel getChiefComplaintReqModel) async { hasError = false; await baseAppClient.post (GET_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); - chiefComplaintList.clear(); + patientChiefComplaintList.clear(); response['List_ChiefComplaint']['entityList'].forEach((v) { - chiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientChiefComplaintRequestModel.toJson()); + }, body: getChiefComplaintReqModel.toJson()); } Future getPatientPhysicalExam( - PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async { + GetPhysicalExamReqModel getPhysicalExamReqModel) async { hasError = false; await baseAppClient.post (GET_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - print("Success"); + patientPhysicalExamList.clear(); + response['PhysicalExamList']['entityList'].forEach((v) { + patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientPhysicalExamRequestModel.toJson()); + }, body: getPhysicalExamReqModel.toJson()); } Future getPatientProgressNote( - PostProgressNoteRequestModel getPatientProgressNoteRequestModel) async { + GetGetProgressNoteReqModel getGetProgressNoteReqModel) async { hasError = false; await baseAppClient.post (GET_PROGRESS_NOTE, onSuccess: (dynamic response, int statusCode) { print("Success"); + patientProgressNoteList.clear(); + response['ProgressNoteList']['entityList'].forEach((v) { + patientProgressNoteList.add(GetGetProgressNoteResModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getPatientProgressNoteRequestModel.toJson()); + }, body: getGetProgressNoteReqModel.toJson()); } Future getPatientAssessment( diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 62959b05..3bc6e61e 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:flutter/cupertino.dart'; import 'base_service.dart'; @@ -146,4 +147,5 @@ class LookupService extends BaseService { break; } } + } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 43107275..8d03a04e 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -1,8 +1,16 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; -import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -12,6 +20,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; +import 'package:flutter/material.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -32,14 +41,36 @@ class SOAPViewModel extends BaseViewModel { List get historySportList => _SOAPService.historySportList; List get historySocialList => _SOAPService.historySocialList; - List get historySurgicalList => _SOAPService.historySurgicalList; - List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; - List get physicalExaminationList => _SOAPService.physicalExaminationList; - List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; - List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; - List get listOfICD10 => _SOAPService.listOfICD10; + List get historySurgicalList => + _SOAPService.historySurgicalList; + List get mergeHistorySurgicalWithHistorySportList => + [...historySurgicalList, ...historySportList]; + + List get physicalExaminationList => + _SOAPService.physicalExaminationList; + + List get listOfDiagnosisType => + _SOAPService.listOfDiagnosisType; + + List get listOfDiagnosisCondition => + _SOAPService.listOfDiagnosisCondition; + + List get listOfICD10 => _SOAPService.listOfICD10; + + List get patientChiefComplaintList => + _SOAPService.patientChiefComplaintList; + + List get patientAllergiesList => + _SOAPService.patientAllergiesList; + List get patientHistoryList => + _SOAPService.patientHistoryList; + List get patientPhysicalExamList => + _SOAPService.patientPhysicalExamList; + + List get patientProgressNoteList => + _SOAPService.patientProgressNoteList; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); @@ -183,11 +214,9 @@ class SOAPViewModel extends BaseViewModel { } - - - Future getPatientAllergy(PostAllergyRequestModel getPatientAllergyRequestModel) async { + Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP) async { setState(ViewState.Busy); - await _SOAPService.getPatientAllergy(getPatientAllergyRequestModel); + await _SOAPService.getPatientAllergy(generalGetReqForSOAP); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.Busy); @@ -195,9 +224,9 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientHistories(PostHistoriesRequestModel getPatientHistoriesRequestModel) async { + Future getPatientHistories(GetHistoryReqModel getHistoryReqModel) async { setState(ViewState.Busy); - await _SOAPService.getPatientHistories(getPatientHistoriesRequestModel); + await _SOAPService.getPatientHistories(getHistoryReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.Busy); @@ -205,9 +234,10 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientChiefComplaint(GeneralGetReqForSOAP getPatientChiefComplaintRequestModel) async { + Future getPatientChiefComplaint( + GetChiefComplaintReqModel getChiefComplaintReqModel) async { setState(ViewState.Busy); - await _SOAPService.getPatientChiefComplaint(getPatientChiefComplaintRequestModel); + await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.Busy); @@ -215,27 +245,28 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientPhysicalExam(PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async { + Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async { setState(ViewState.Busy); - await _SOAPService.getPatientPhysicalExam(getPatientPhysicalExamRequestModel); + await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } - Future getPatientProgressNote(PostProgressNoteRequestModel getPatientProgressNoteRequestModel) async { + Future getPatientProgressNote(GetGetProgressNoteReqModel getGetProgressNoteReqModel) async { setState(ViewState.Busy); - await _SOAPService.getPatientProgressNote(getPatientProgressNoteRequestModel); + await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } - Future getPatientAssessment(PostAssessmentRequestModel getPatientAssessmentRequestModel) async { + Future getPatientAssessment( + PostAssessmentRequestModel getPatientAssessmentRequestModel) async { setState(ViewState.Busy); await _SOAPService.getPatientAssessment(getPatientAssessmentRequestModel); if (_SOAPService.hasError) { @@ -245,4 +276,133 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + + // ignore: missing_return + MasterKeyModel getOneMasterKey( + {@required MasterKeysService masterKeys, int id, int typeId}) { + switch (masterKeys) { + case MasterKeysService.Allergies: + List result = allergiesList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + + case MasterKeysService.HistoryFamily: + List result = historyFamilyList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistoryMedical: + List result = historyMedicalList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySocial: + List result = historySocialList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySports: + List result = historySocialList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.HistorySurgical: + List result = historySurgicalList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.PhysicalExamination: + List result = physicalExaminationList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.AllergySeverity: + List result = allergySeverityList.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + // case MasterKeysService.physiotherapyGoals: + // listOfPhysiotherapyGoals.clear(); + // entryList.forEach((v) { + // listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v)); + // }); + // break; + + case MasterKeysService.DiagnosisType: + List result = listOfDiagnosisType.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.DiagnosisCondition: + List result = listOfDiagnosisCondition.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + case MasterKeysService.ICD10: + listOfICD10.clear(); + List result = listOfICD10.where((element) { + print(element.id == id); + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + break; + break; + } + } + + } diff --git a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart new file mode 100644 index 00000000..68ab6c40 --- /dev/null +++ b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart @@ -0,0 +1,25 @@ +class GetChiefComplaintReqModel { + int patientMRN; + int appointmentNo; + int episodeId; + int episodeID; + + GetChiefComplaintReqModel( + {this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID}); + + GetChiefComplaintReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + episodeID = json['EpisodeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['EpisodeID'] = this.episodeID; + return data; + } +} diff --git a/lib/models/SOAP/GetAllergiesResModel.dart b/lib/models/SOAP/GetAllergiesResModel.dart new file mode 100644 index 00000000..a403bd2e --- /dev/null +++ b/lib/models/SOAP/GetAllergiesResModel.dart @@ -0,0 +1,60 @@ +class GetAllergiesResModel { + int allergyDiseaseId; + String allergyDiseaseName; + int allergyDiseaseType; + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + int episodeID; + bool isChecked; + bool isUpdatedByNurse; + int severity; + String severityName; + + GetAllergiesResModel( + {this.allergyDiseaseId, + this.allergyDiseaseName, + this.allergyDiseaseType, + this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.episodeID, + this.isChecked, + this.isUpdatedByNurse, + this.severity, + this.severityName}); + + GetAllergiesResModel.fromJson(Map json) { + allergyDiseaseId = json['allergyDiseaseId']; + allergyDiseaseName = json['allergyDiseaseName']; + allergyDiseaseType = json['allergyDiseaseType']; + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + episodeID = json['episodeID']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + severity = json['severity']; + severityName = json['severityName']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['allergyDiseaseName'] = this.allergyDiseaseName; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['episodeID'] = this.episodeID; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['severity'] = this.severity; + data['severityName'] = this.severityName; + return data; + } +} diff --git a/lib/models/SOAP/GetGetProgressNoteReqModel.dart b/lib/models/SOAP/GetGetProgressNoteReqModel.dart new file mode 100644 index 00000000..936c6f65 --- /dev/null +++ b/lib/models/SOAP/GetGetProgressNoteReqModel.dart @@ -0,0 +1,40 @@ +class GetGetProgressNoteReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + int clinicID; + int doctorID; + + GetGetProgressNoteReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to, + this.clinicID, + this.doctorID}); + + GetGetProgressNoteReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + return data; + } +} diff --git a/lib/models/SOAP/GetGetProgressNoteResModel.dart b/lib/models/SOAP/GetGetProgressNoteResModel.dart new file mode 100644 index 00000000..bbc184f1 --- /dev/null +++ b/lib/models/SOAP/GetGetProgressNoteResModel.dart @@ -0,0 +1,25 @@ +class GetGetProgressNoteResModel { + int appointmentNo; + int episodeId; + int patientMRN; + String planNote; + + GetGetProgressNoteResModel( + {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); + + GetGetProgressNoteResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + episodeId = json['episodeId']; + patientMRN = json['patientMRN']; + planNote = json['planNote']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['episodeId'] = this.episodeId; + data['patientMRN'] = this.patientMRN; + data['planNote'] = this.planNote; + return data; + } +} diff --git a/lib/models/SOAP/GetHistoryReqModel.dart b/lib/models/SOAP/GetHistoryReqModel.dart new file mode 100644 index 00000000..9b852e9b --- /dev/null +++ b/lib/models/SOAP/GetHistoryReqModel.dart @@ -0,0 +1,18 @@ +class GetHistoryReqModel { + int patientMRN; + int historyType; + + GetHistoryReqModel({this.patientMRN, this.historyType}); + + GetHistoryReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + historyType = json['HistoryType']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['HistoryType'] = this.historyType; + return data; + } +} diff --git a/lib/models/SOAP/GetHistoryResModel.dart b/lib/models/SOAP/GetHistoryResModel.dart new file mode 100644 index 00000000..c4b4f129 --- /dev/null +++ b/lib/models/SOAP/GetHistoryResModel.dart @@ -0,0 +1,40 @@ +class GetHistoryResModel { + int appointmentNo; + int episodeId; + int historyId; + int historyType; + bool isChecked; + int patientMRN; + String remarks; + + GetHistoryResModel( + {this.appointmentNo, + this.episodeId, + this.historyId, + this.historyType, + this.isChecked, + this.patientMRN, + this.remarks}); + + GetHistoryResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + episodeId = json['episodeId']; + historyId = json['historyId']; + historyType = json['historyType']; + isChecked = json['isChecked']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['episodeId'] = this.episodeId; + data['historyId'] = this.historyId; + data['historyType'] = this.historyType; + data['isChecked'] = this.isChecked; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamListResModel.dart b/lib/models/SOAP/GetPhysicalExamListResModel.dart new file mode 100644 index 00000000..f9b2f44f --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamListResModel.dart @@ -0,0 +1,64 @@ +class GetPhysicalExamResModel { + int appointmentNo; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + int episodeId; + int examId; + int examType; + bool isAbnormal; + bool isNormal; + bool notExamined; + int patientMRN; + String remarks; + + GetPhysicalExamResModel( + {this.appointmentNo, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.episodeId, + this.examId, + this.examType, + this.isAbnormal, + this.isNormal, + this.notExamined, + this.patientMRN, + this.remarks}); + + GetPhysicalExamResModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + episodeId = json['episodeId']; + examId = json['examId']; + examType = json['examType']; + isAbnormal = json['isAbnormal']; + isNormal = json['isNormal']; + notExamined = json['notExamined']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['episodeId'] = this.episodeId; + data['examId'] = this.examId; + data['examType'] = this.examType; + data['isAbnormal'] = this.isAbnormal; + data['isNormal'] = this.isNormal; + data['notExamined'] = this.notExamined; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamReqModel.dart b/lib/models/SOAP/GetPhysicalExamReqModel.dart new file mode 100644 index 00000000..ce045c22 --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamReqModel.dart @@ -0,0 +1,32 @@ +class GetPhysicalExamReqModel { + int patientMRN; + int appointmentNo; + String episodeID; + String from; + String to; + + GetPhysicalExamReqModel( + {this.patientMRN, + this.appointmentNo, + this.episodeID, + this.from, + this.to}); + + GetPhysicalExamReqModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + return data; + } +} diff --git a/lib/root_page.dart b/lib/root_page.dart index 0f44dc4d..fe35a246 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -22,7 +22,7 @@ class RootPage extends StatelessWidget { ); break; case APP_STATUS.UNAUTHENTICATED: - return LandingPage(); + return Loginsreen(); break; case APP_STATUS.AUTHENTICATED: return LandingPage(); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index c55b5afa..b6bbc6cf 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -115,69 +115,68 @@ class _DashboardScreenState extends State { SizedBox( height: 4, ), - //TODO change it edit By Jammal - // InkWell( - // onTap: () async { - // showCupertinoPicker( - // decKey: '', - // context: context, - // actionList: projectsProvider - // .doctorClinicsList); - // }, - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Container( - // child: AppText( - // authProvider.selectedClinicName != - // null - // ? authProvider - // .selectedClinicName - // : authProvider.doctorProfile - // .clinicDescription, - // fontSize: - // SizeConfig.textMultiplier * - // 1.7, - // color: Colors.white, - // textAlign: TextAlign.center, - // ), - // alignment: projectsProvider.isArabic - // ? Alignment.topRight - // : Alignment.topLeft, - // ), - // Row( - // mainAxisAlignment: - // MainAxisAlignment.start, - // mainAxisSize: MainAxisSize.max, - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // InkWell( - // child: Container( - // margin: EdgeInsets.only( - // left: 5, - // top: projectsProvider - // .isArabic - // ? 0 - // : 5, - // right: 10, - // bottom: projectsProvider - // .isArabic - // ? 15 - // : 7), - // child: Icon( - // DoctorApp.sync_icon, - // color: Colors.white, - // size: SizeConfig - // .textMultiplier * - // 1.8, - // )), - // ), - // ], - // ), - // ]), - // ), + InkWell( + onTap: () async { + showCupertinoPicker( + decKey: '', + context: context, + actionList: projectsProvider + .doctorClinicsList); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + child: AppText( + authProvider.selectedClinicName != + null + ? authProvider + .selectedClinicName + : authProvider.doctorProfile + .clinicDescription, + fontSize: + SizeConfig.textMultiplier * + 1.7, + color: Colors.white, + textAlign: TextAlign.center, + ), + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + InkWell( + child: Container( + margin: EdgeInsets.only( + left: 5, + top: projectsProvider + .isArabic + ? 0 + : 5, + right: 10, + bottom: projectsProvider + .isArabic + ? 15 + : 7), + child: Icon( + DoctorApp.sync_icon, + color: Colors.white, + size: SizeConfig + .textMultiplier * + 1.8, + )), + ), + ], + ), + ]), + ), ], ), ]), diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 0a4ce08e..43748f3d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -242,7 +242,8 @@ class _AddAllergiesState extends State { ), SizedBox( height: 10, - ), Container( + ), + Container( height: screenSize.height * 0.070, child: InkWell( onTap: model.allergySeverityList != null diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 90141080..fae705f4 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -43,8 +43,7 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - //TODO change it edit By Jammal - 'Dr. ',//${authProvider.doctorProfile.doctorName}', + 'Dr. ${authProvider.doctorProfile.doctorName}', fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, color: Colors.white, @@ -72,9 +71,7 @@ final double height; height: 50, width: 60, child: Image.network( - //TODO change it edit By Jammal - 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg' - // authProvider.doctorProfile.doctorImageURL, + authProvider.doctorProfile.doctorImageURL, // fit: BoxFit.fill, ), ), diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index d7bbd0af..fa6b8acb 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -1,6 +1,8 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -14,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; class UpdateAllergiesWidget extends StatefulWidget { final List myAllergiesList; @@ -144,10 +147,11 @@ class _AddAllergiesState extends State { MasterKeyModel _selectedAllergySeverity; MasterKeyModel _selectedAllergy; TextEditingController remarkController = TextEditingController(); + GlobalKey key = new GlobalKey>(); InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { + String selectedText, bool isDropDown,{IconData icon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -162,7 +166,7 @@ class _AddAllergiesState extends State { borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, hintStyle: TextStyle( fontSize: 14, color: Colors.grey.shade600, @@ -172,6 +176,7 @@ class _AddAllergiesState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); final screenSize = MediaQuery .of(context) .size; @@ -214,40 +219,32 @@ class _AddAllergiesState extends State { child: InkWell( onTap: model.allergiesList != null ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.allergiesList, - okText: TranslationBase - .of(context) - .ok, - okFunction: (MasterKeyModel selectedValue) { - setState(() { - _selectedAllergy = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); + setState(() { + _selectedAllergy = null; + }); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Allergy", - _selectedAllergy != null - ? _selectedAllergy.nameEn - : null, - true), + child: _selectedAllergy==null? AutoCompleteTextField( + decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), + itemSubmitted: (item) => setState(() => _selectedAllergy = item), + key: key, + suggestions: model.allergiesList, + itemBuilder: (context, suggestion) => new Padding( + child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()), + ):TextField( + decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), enabled: false, ), ), ), SizedBox( height: 10, - ), Container( + ), + Container( height: screenSize.height * 0.070, child: InkWell( onTap: model.allergySeverityList != null diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart index d8f2b888..5e033127 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; @@ -280,273 +281,59 @@ class _AddHistoryDialogState extends State { }, scrollDirection: Axis.horizontal, children: [ - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.historyFamilyList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - (bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - widget.addSelectedHistories(); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyFamilyList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.mergeHistorySurgicalWithHistorySportList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - widget.addSelectedHistories(); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.mergeHistorySurgicalWithHistorySportList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.historyMedicalList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - setState(() { - widget.addSelectedHistories(); - }); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyMedicalList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), ], ), diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 24be10e1..1339c2f2 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -1,7 +1,11 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; @@ -10,8 +14,6 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_history_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_history_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -47,11 +49,114 @@ class _UpdateSubjectivePageState extends State { TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); final formKey = GlobalKey(); + getHistory(SOAPViewModel model) async{ + GetHistoryReqModel getHistoryMedicalReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + historyType: + MasterKeysService.HistoryMedical.getMasterKeyService()); + GetHistoryReqModel getHistorySportsReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + historyType: + MasterKeysService.HistorySports.getMasterKeyService()); + GetHistoryReqModel getHistorySurgicalReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + historyType: + MasterKeysService.HistorySurgical.getMasterKeyService()); + GetHistoryReqModel getHistoryFamilyReqModel = GetHistoryReqModel( + patientMRN: widget.patientInfo.patientMRN, + historyType: + MasterKeysService.HistoryFamily.getMasterKeyService()); + await model.getPatientHistories(getHistoryMedicalReqModel); + await model.getPatientHistories(getHistorySportsReqModel); + await model.getPatientHistories(getHistorySurgicalReqModel); + await model.getPatientHistories(getHistoryFamilyReqModel); + if(model.patientHistoryList.isNotEmpty) { + if (model.historyFamilyList.isEmpty) { + await model.getMasterLookup(MasterKeysService.HistoryFamily); + } + if (model.historyMedicalList.isEmpty) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); + } + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + await model.getMasterLookup(MasterKeysService.HistorySports); + } + + model.patientHistoryList.forEach((element) { + if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { + widget.myHistoryList.add( model.getOneMasterKey( + masterKeys: MasterKeysService.HistoryFamily, + id: element.historyId, + )); + }if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { + widget.myHistoryList.add( model.getOneMasterKey( + masterKeys: MasterKeysService.HistoryMedical, + id: element.historyId, + )); + }if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { + widget.myHistoryList.add( model.getOneMasterKey( + masterKeys: MasterKeysService.HistorySports, + id: element.historyId, + )); + } + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { + widget.myHistoryList.add(model.getOneMasterKey( + masterKeys: MasterKeysService.HistorySurgical, + id: element.historyId, + )); + } + }); + } + } @override Widget build(BuildContext context) { return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + onModelReady: (model) async { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo); + GetChiefComplaintReqModel getChiefComplaintReqModel = + GetChiefComplaintReqModel( + patientMRN: widget.patientInfo.patientMRN, + appointmentNo: widget.patientInfo.appointmentNo, + episodeId: widget.patientInfo.episodeNo, + episodeID: widget.patientInfo.episodeNo); + await model.getPatientChiefComplaint(getChiefComplaintReqModel); + if (model.patientChiefComplaintList.isNotEmpty) { + complaintsController.text = + model.patientChiefComplaintList[0].chiefComplaint; + illnessController.text = model.patientChiefComplaintList[0].hopi; + } + await model.getPatientAllergy(generalGetReqForSOAP); + if (model.patientAllergiesList.isNotEmpty) { + if (model.allergiesList.isEmpty) + await model.getMasterLookup(MasterKeysService.Allergies); + if (model.allergySeverityList.isEmpty) + await model.getMasterLookup(MasterKeysService.AllergySeverity); + + model.patientAllergiesList.forEach((element) { + MasterKeyModel selectedAllergy = model.getOneMasterKey( + masterKeys: MasterKeysService.Allergies, + id: element.allergyDiseaseId, + typeId: element.allergyDiseaseType); + MasterKeyModel selectedAllergySeverity = model.getOneMasterKey( + masterKeys: MasterKeysService.AllergySeverity, + id: element.severity, + ); + MySelectedAllergy mySelectedAllergy = MySelectedAllergy( + selectedAllergy: selectedAllergy, + selectedAllergySeverity: selectedAllergySeverity); + + widget.myAllergiesList.add(mySelectedAllergy); + }); + } + + await getHistory(model); + + }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, baseViewModel: model, @@ -279,45 +384,45 @@ class _UpdateSubjectivePageState extends State { formKey.currentState.validate(); - // if(complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length>25) { - // await postChiefComplaint(model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // if (myHistoryList.length != 0) { - // await postHistories(model: model, myHistoryList: myHistoryList); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // if (myAllergiesList.length != 0) { - // await postAllergy(myAllergiesList: myAllergiesList, model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(1); - // } - // } else { - // widget.changePageViewIndex(1); - // - // } - // - // } - // } else { - // if (myAllergiesList.length != 0) { - // await postAllergy(myAllergiesList: myAllergiesList, model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(1); - // } - // } else { - // widget.changePageViewIndex(1); - // } - // } - // } - // } else { - // helpers.showErrorToast('Please add required field correctly'); - // } + if (complaintsController.text.isNotEmpty && + illnessController.text.isNotEmpty && + complaintsController.text.length > 25) { + await postChiefComplaint(model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + if (myHistoryList.length != 0) { + await postHistories(model: model, myHistoryList: myHistoryList); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + if (myAllergiesList.length != 0) { + await postAllergy(myAllergiesList: myAllergiesList, model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(1); + } + } else { + widget.changePageViewIndex(1); + } + } + } else { + if (myAllergiesList.length != 0) { + await postAllergy(myAllergiesList: myAllergiesList, model: model); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(1); + } + } else { + widget.changePageViewIndex(1); + } + } + } + } else { + helpers.showErrorToast('Please add required field correctly'); + } widget.changePageViewIndex(1); @@ -334,22 +439,28 @@ class _UpdateSubjectivePageState extends State { //TODO: make static value dynamic postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM .add(ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: 1485, - // - createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", - editedBy: 1485, - editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", - isChecked: false, - isUpdatedByNurse: false)); + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.id, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: 4709, + // + createdOn: DateTime.now().toIso8601String(), + //"2020-08-14T20:37:22.780Z", + editedBy: 4709, + editedOn: DateTime.now().toIso8601String(), + //"2020-08-14T20:37:22.780Z", + isChecked: false, + isUpdatedByNurse: false)); }); - await model.patchAllergy(postAllergyRequestModel); + if (model.patientAllergiesList.isEmpty) { + await model.postAllergy(postAllergyRequestModel); + } else { + await model.patchAllergy(postAllergyRequestModel); + } if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); @@ -374,6 +485,14 @@ class _UpdateSubjectivePageState extends State { isChecked: false, )); }); + + + if (model.patientAllergiesList.isEmpty) { + await model.postHistories(postHistoriesRequestModel); + } else { + await model.patchHistories(postHistoriesRequestModel); + } + await model.patchHistories(postHistoriesRequestModel); if (model.state == ViewState.ErrorLocal) { @@ -386,19 +505,22 @@ class _UpdateSubjectivePageState extends State { if(formKey.currentState.validate()){ PostChiefComplaintRequestModel postChiefComplaintRequestModel = //TODO: make static value dynamic - new PostChiefComplaintRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - chiefComplaint: complaintsController.text, - currentMedication: " currentMedication ", - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - numberOfWeeks: 22); - - await model.patchChiefComplaint(postChiefComplaintRequestModel); - + new PostChiefComplaintRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + chiefComplaint: complaintsController.text, + currentMedication: " currentMedication ", + hopi: illnessController.text, + isLactation: false, + ispregnant: true, + numberOfWeeks: 22); + if (model.patientChiefComplaintList.isEmpty) { + // TODO: make it postChiefComplaint after it start to work + await model.postChiefComplaint(postChiefComplaintRequestModel); + } else { + await model.patchChiefComplaint(postChiefComplaintRequestModel); + } } } diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 556949e8..61c7f20b 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -1,3 +1,4 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; @@ -377,6 +378,7 @@ class _AddAssessmentDetailsState extends State { TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController( text: "234567"); + GlobalKey key = new GlobalKey>(); @override Widget build(BuildContext context) { @@ -385,7 +387,7 @@ class _AddAssessmentDetailsState extends State { .of(context) .size; InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { + String selectedText, bool isDropDown,{IconData icon}) { //TODO: make one Input InputDecoration for all return InputDecoration( focusedBorder: OutlineInputBorder( @@ -401,7 +403,7 @@ class _AddAssessmentDetailsState extends State { borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null, hintStyle: TextStyle( fontSize: 14, color: Colors.grey.shade600, @@ -418,9 +420,9 @@ class _AddAssessmentDetailsState extends State { if (model.listOfDiagnosisType.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisType); } - // if (model.listOfICD10.length == 0) { - // await model.getMasterLookup(MasterKeysService.ICD10); - // } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } }, builder: (_, model, w) => AppScaffold( @@ -472,43 +474,28 @@ class _AddAssessmentDetailsState extends State { child: InkWell( onTap: model.listOfDiagnosisType != null ? () { - MasterKeyDailog dialog = MasterKeyDailog( - isICD: true, - list: model.listOfDiagnosisType, - selectedValue: widget - .mySelectedAssessment - .selectedICD, - okText: TranslationBase - .of(context) - .ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedICD = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); + setState(() { + widget.mySelectedAssessment.selectedICD = null; + }); } : null, - child: TextField( + child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration("Name or ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), + itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => new Padding( + child:Texts( suggestion.description +" / "+ suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.description.toLowerCase().startsWith(input.toLowerCase()) + ||suggestion.code.toLowerCase().startsWith(input.toLowerCase()) + , + ): TextField( decoration: textFieldSelectorDecoration( - "Name / ICD", - widget.mySelectedAssessment - .selectedICD != - null - ? widget.mySelectedAssessment - .selectedICD.nameEn - : null, - true), + widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", + widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), enabled: false, ), ), diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index a073c578..55be0be6 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; @@ -16,6 +17,7 @@ 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/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; @@ -53,40 +55,69 @@ class _UpdateObjectivePageState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + onModelReady: (model) async { + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + + await model.getPatientPhysicalExam(getPhysicalExamReqModel); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = MySelectedExamination( + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + isAbnormal: element.isAbnormal); + widget.mySelectedExamination.add(tempEam); + }); + } + }, builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( + isShowAppBar: false, + //TODO: retrun it back + // baseViewModel: model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts('Physical/System Examination', - variant: - isSysExaminationExpand ? "bodyText" : '', - bold: isSysExaminationExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { + Row( + children: [ + Texts('Physical/System Examination', + variant: isSysExaminationExpand + ? "bodyText" + : '', + bold: isSysExaminationExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { setState(() { isSysExaminationExpand = !isSysExaminationExpand; @@ -469,96 +500,31 @@ class _AddExaminationDailogState extends State { ), NetworkBaseView( baseViewModel: model, - child: Container( - height: - MediaQuery - .of(context) - .size - .height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius - .circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model - .physicalExaminationList - .map((examinationInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - examinationInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - examinationInfo - )) { - widget - .removeExamination( - examinationInfo - ); - } - else { - MySelectedExamination mySelectedExamination = new MySelectedExamination( - selectedExamination: examinationInfo - ); - widget - .mySelectedExamination - .add( - mySelectedExamination); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - examinationInfo - .nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED Examinations" - .toUpperCase(), - onPressed: () { + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.physicalExaminationList, + removeHistory: (history){ + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history){ + setState(() { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: history + ); + widget + .mySelectedExamination + .add( + mySelectedExamination); + }); + }, + addSelectedHistories: (){ widget.addSelectedExamination(); }, + isServiceSelected: (master) =>isServiceSelected(master), ), + ), ]), ))), )), diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index a6ce8fad..506ff103 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -53,8 +54,21 @@ class _UpdatePlanPageState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + onModelReady: (model) async { + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: widget.patientInfo.appointmentNo, + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString()); + await model.getPatientProgressNote(getGetProgressNoteReqModel); + + if (model.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = + model.patientProgressNoteList[0].planNote; + } + }, builder: (_, model, w) => AppScaffold( + baseViewModel: model, isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -74,8 +88,7 @@ class _UpdatePlanPageState extends State { Row( children: [ Texts('Progress Note', - variant: - isProgressNoteExpand ? "bodyText" : '', + variant: isProgressNoteExpand ? "bodyText" : '', bold: isProgressNoteExpand ? true : false, color: Colors.black), Icon( @@ -88,8 +101,7 @@ class _UpdatePlanPageState extends State { InkWell( onTap: () { setState(() { - isProgressNoteExpand = - !isProgressNoteExpand; + isProgressNoteExpand = !isProgressNoteExpand; }); }, child: Icon(isProgressNoteExpand @@ -105,7 +117,7 @@ class _UpdatePlanPageState extends State { children: [ Container( margin: - EdgeInsets.only(left: 10, right: 10, top: 15), + EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( hintText: "Add Progress Note", fontSize: 13.5, @@ -120,8 +132,7 @@ class _UpdatePlanPageState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase - .of(context) + return TranslationBase.of(context) .emptyMessage; else return null; @@ -133,10 +144,10 @@ class _UpdatePlanPageState extends State { if (progressNoteController.text.isNotEmpty) Container( margin: - EdgeInsets.only(left: 5, right: 5, top: 15), + EdgeInsets.only(left: 5, right: 5, top: 15), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( @@ -144,9 +155,9 @@ class _UpdatePlanPageState extends State { children: [ Column( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ AppText( "12".toUpperCase(), @@ -163,13 +174,12 @@ class _UpdatePlanPageState extends State { ], ), Column( - crossAxisAlignment: CrossAxisAlignment - .start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ SizedBox( height: 6, @@ -177,25 +187,25 @@ class _UpdatePlanPageState extends State { Padding( padding: const EdgeInsets.all(0.0), child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.6, + width: MediaQuery.of(context) + .size + .width * + 0.6, child: AppText( progressNoteController.text, fontSize: 10, - color: Colors.grey, ), ), ), ], - ), SizedBox( + ), + SizedBox( height: 8, ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( "Created By : ", @@ -211,7 +221,7 @@ class _UpdatePlanPageState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( "Edited By : ", @@ -225,7 +235,6 @@ class _UpdatePlanPageState extends State { ), ], ), - ], ), Column( @@ -246,14 +255,13 @@ class _UpdatePlanPageState extends State { ]), isExpand: isProgressNoteExpand, ), - DividerWithSpacesAround(height: 30,), + DividerWithSpacesAround( + height: 30, + ), AppButton( - title: TranslationBase - .of(context) - .next, + title: TranslationBase.of(context).next, loading: model.state == ViewState.BusyLocal, onPressed: () { - submitPlan(model); // widget.changePageViewIndex(2); }, @@ -265,7 +273,9 @@ class _UpdatePlanPageState extends State { ), ), ), - ),),); + ), + ), + ); } submitPlan(SOAPViewModel model) async { @@ -276,8 +286,13 @@ class _UpdatePlanPageState extends State { appointmentNo: widget.patientInfo.appointmentNo, planNote: progressNoteController.text); + if(model.patientProgressNoteList.isEmpty){ + await model.postProgressNote(postProgressNoteRequestModel); + + }else { + await model.patchProgressNote(postProgressNoteRequestModel); - await model.patchProgressNote(postProgressNoteRequestModel); + } if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 59557145..744f5244 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -6,7 +6,11 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/steps_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart';