From 1edd375fd7002f8cd24e9f37ce918292fac4d5a9 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 14 Jun 2021 16:30:55 +0300 Subject: [PATCH 1/7] first step from special clinic --- lib/config/config.dart | 1 + lib/core/service/home/dasboard_service.dart | 26 +++++++++++++-- lib/core/viewModel/dashboard_view_model.dart | 14 ++++++++ ...cial_clinical_care_List_Respose_Model.dart | 32 +++++++++++++++++++ lib/screens/home/home_screen.dart | 2 ++ 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 588976ba..851eb832 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -219,6 +219,7 @@ const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RE const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin"; +const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList"; var selectedPatientType = 1; diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index b35d24f2..8bb0e586 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -1,10 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; class DashboardService extends BaseService { List _dashboardItemsList = []; List get dashboardItemsList => _dashboardItemsList; + + List _specialClinicalCareList = []; + List get specialClinicalCareList => _specialClinicalCareList; bool hasVirtualClinic = false; String sServiceID; @@ -24,8 +28,6 @@ class DashboardService extends BaseService { super.error = error; }, body: { - // "VidaAuthTokenID": - // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" }, ); } @@ -48,4 +50,24 @@ class DashboardService extends BaseService { }, ); } + Future getSpecialClinicalCareList() async { + hasError = false; + await getDoctorProfile(isGetProfile: true); + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareList.clear(); + response['List_SpecialClinicalCareList'].forEach((v) { + _specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + }, + ); + } + } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index bbbef0b6..fe160c3c 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -22,6 +23,9 @@ class DashboardViewModel extends BaseViewModel { String get sServiceID => _dashboardService.sServiceID; + List get specialClinicalCareList => _dashboardService.specialClinicalCareList; + + Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); @@ -64,6 +68,16 @@ class DashboardViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getSpecialClinicalCareList() async { + setState(ViewState.Busy); + await _dashboardService.getSpecialClinicalCareList(); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future changeClinic( int clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); diff --git a/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart new file mode 100644 index 00000000..ec19abb0 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart @@ -0,0 +1,32 @@ +class GetSpecialClinicalCareListResponseModel { + int projectID; + int clinicID; + String clinicDescription; + String clinicDescriptionN; + bool isActive; + + GetSpecialClinicalCareListResponseModel( + {this.projectID, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.isActive}); + + GetSpecialClinicalCareListResponseModel.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + isActive = json['IsActive']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['IsActive'] = this.isActive; + return data; + } +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 85ea3506..eba91cc2 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -69,6 +69,8 @@ class _HomeScreenState extends State { await model.getDashboard(); await model.getDoctorProfile(isGetProfile: true); await model.checkDoctorHasLiveCare(); + + await model.getSpecialClinicalCareList(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, From 363b55069faf22e4696ebf875f256caf0bca563c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 14 Jun 2021 18:04:20 +0300 Subject: [PATCH 2/7] first step form Special Clinic --- lib/config/config.dart | 1 + .../PatientSearchRequestModel.dart | 32 ++-- lib/core/service/home/dasboard_service.dart | 21 --- .../special_clinic_service.dart | 57 +++++++ .../viewModel/PatientSearchViewModel.dart | 42 +++++- lib/core/viewModel/dashboard_view_model.dart | 23 ++- lib/locator.dart | 2 + ...nical_care_mapping_List_Respose_Model.dart | 37 +++++ lib/screens/home/home_screen.dart | 3 +- .../patients/PatientsInPatientScreen.dart | 142 +++++++++++++++++- 10 files changed, 315 insertions(+), 45 deletions(-) create mode 100644 lib/core/service/special_clinics/special_clinic_service.dart create mode 100644 lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index c8eac881..eb361798 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -226,6 +226,7 @@ const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoc const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin"; const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks_New"; const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList"; +const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList"; var selectedPatientType = 1; diff --git a/lib/core/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index 437c5885..2918a393 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -11,20 +11,24 @@ class PatientSearchRequestModel { int searchType; String mobileNo; String identificationNo; + int nursingStationID; + int clinicID; PatientSearchRequestModel( - {this.doctorID =0, - this.firstName ="0", - this.middleName ="0", - this.lastName ="0", - this.patientMobileNumber ="0", - this.patientIdentificationID ="0", - this.patientID =0, - this.searchType =1, - this.mobileNo="", - this.identificationNo="0", - this.from ="0", - this.to ="0"}); + {this.doctorID = 0, + this.firstName = "0", + this.middleName = "0", + this.lastName = "0", + this.patientMobileNumber = "0", + this.patientIdentificationID = "0", + this.patientID = 0, + this.searchType = 1, + this.mobileNo = "", + this.identificationNo = "0", + this.from = "0", + this.to = "0", + this.clinicID, + this.nursingStationID = 0}); PatientSearchRequestModel.fromJson(Map json) { doctorID = json['DoctorID']; @@ -39,6 +43,8 @@ class PatientSearchRequestModel { searchType = json['SearchType']; mobileNo = json['MobileNo']; identificationNo = json['IdentificationNo']; + nursingStationID = json['NursingStationID']; + clinicID = json['ClinicID']; } Map toJson() { @@ -55,6 +61,8 @@ class PatientSearchRequestModel { data['SearchType'] = this.searchType; data['MobileNo'] = this.mobileNo; data['IdentificationNo'] = this.identificationNo; + data['NursingStationID'] = this.nursingStationID; + data['ClinicID'] = this.clinicID; return data; } } diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index 8bb0e586..ad3ec887 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -7,8 +7,6 @@ class DashboardService extends BaseService { List _dashboardItemsList = []; List get dashboardItemsList => _dashboardItemsList; - List _specialClinicalCareList = []; - List get specialClinicalCareList => _specialClinicalCareList; bool hasVirtualClinic = false; String sServiceID; @@ -50,24 +48,5 @@ class DashboardService extends BaseService { }, ); } - Future getSpecialClinicalCareList() async { - hasError = false; - await getDoctorProfile(isGetProfile: true); - await baseAppClient.post( - GET_SPECIAL_CLINICAL_CARE_LIST, - onSuccess: (dynamic response, int statusCode) { - - _specialClinicalCareList.clear(); - response['List_SpecialClinicalCareList'].forEach((v) { - _specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v)); - });}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: { - }, - ); - } } diff --git a/lib/core/service/special_clinics/special_clinic_service.dart b/lib/core/service/special_clinics/special_clinic_service.dart new file mode 100644 index 00000000..49237331 --- /dev/null +++ b/lib/core/service/special_clinics/special_clinic_service.dart @@ -0,0 +1,57 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; + +class SpecialClinicsService extends BaseService { + + + List _specialClinicalCareList = []; + List get specialClinicalCareList => _specialClinicalCareList; + + List _specialClinicalCareMappingList = []; + List get specialClinicalCareMappingList => _specialClinicalCareMappingList; + Future getSpecialClinicalCareList() async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareList.clear(); + response['List_SpecialClinicalCareList'].forEach((v) { + _specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + }, + ); + } + + + Future getSpecialClinicalCareMappingList(int clinicId) async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareMappingList.clear(); + response['List_SpecialClinicalCareMappingList'].forEach((v) { + _specialClinicalCareMappingList.add(GetSpecialClinicalCareMappingListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "ClinicID": clinicId, + "DoctorID":0, + "EditedBy":0 + }, + ); + } + +} diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index a0cd68d9..6b83461b 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -12,8 +14,10 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); + SpecialClinicsService _specialClinicsService = locator(); List get patientList => _outPatientService.patientList; + List get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList; List filterData = []; @@ -143,15 +147,22 @@ class PatientSearchViewModel extends BaseViewModel { List filteredInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, - {bool isMyInpatient = false}) async { + {bool isMyInpatient = false, bool isLocalBusy = false}) async { await getDoctorProfile(); - setState(ViewState.Busy); - + if(isLocalBusy) { + setState(ViewState.BusyLocal); + } else{ + setState(ViewState.Busy); + } if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; + if(isLocalBusy) { + setState(ViewState.ErrorLocal); + } else{ setState(ViewState.Error); + } } else { // setDefaultInPatientList(); setState(ViewState.Idle); @@ -166,6 +177,9 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Idle); } + + + void clearPatientList() { _inPatientService.inPatientList = []; _inPatientService.myInPatientList = []; @@ -195,4 +209,26 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } } + + + getSpecialClinicalCareMappingList(clinicId, + {bool isLocalBusy = false}) async { + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } + //TODO Elham* change clinic id to dynamic + await _specialClinicsService.getSpecialClinicalCareMappingList(221); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; + if (isLocalBusy) { + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Error); + } + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index fe160c3c..95028f52 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; @@ -15,6 +16,7 @@ import 'base_view_model.dart'; class DashboardViewModel extends BaseViewModel { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); DashboardService _dashboardService = locator(); + SpecialClinicsService _specialClinicsService = locator(); List get dashboardItemsList => _dashboardService.dashboardItemsList; @@ -23,7 +25,7 @@ class DashboardViewModel extends BaseViewModel { String get sServiceID => _dashboardService.sServiceID; - List get specialClinicalCareList => _dashboardService.specialClinicalCareList; + List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; Future setFirebaseNotification(ProjectViewModel projectsProvider, @@ -70,9 +72,9 @@ class DashboardViewModel extends BaseViewModel { Future getSpecialClinicalCareList() async { setState(ViewState.Busy); - await _dashboardService.getSpecialClinicalCareList(); - if (_dashboardService.hasError) { - error = _dashboardService.error; + await _specialClinicsService.getSpecialClinicalCareList(); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; setState(ViewState.Error); } else setState(ViewState.Idle); @@ -99,4 +101,17 @@ class DashboardViewModel extends BaseViewModel { return value.toString(); } + + + bool isSpecialClinic(clinicId){ + bool isSpecial = false; + specialClinicalCareList.forEach((element) { + if(element.clinicID == 1){ + isSpecial = true; + } + }); + + return isSpecial; + + } } diff --git a/lib/locator.dart b/lib/locator.dart index 1c491b54..de493196 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -37,6 +37,7 @@ import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'core/service/patient_medical_file/soap/SOAP_service.dart'; import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; +import 'core/service/special_clinics/special_clinic_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; @@ -91,6 +92,7 @@ void setupLocator() { locator.registerLazySingleton(() => PatientMedicalReportService()); locator.registerLazySingleton(() => LiveCarePatientServices()); locator.registerLazySingleton(() => NavigationService()); + locator.registerLazySingleton(() => SpecialClinicsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); diff --git a/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart new file mode 100644 index 00000000..287f40f1 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart @@ -0,0 +1,37 @@ +class GetSpecialClinicalCareMappingListResponseModel { + int mappingProjectID; + int clinicID; + int nursingStationID; + bool isActive; + int projectID; + String description; + + GetSpecialClinicalCareMappingListResponseModel( + {this.mappingProjectID, + this.clinicID, + this.nursingStationID, + this.isActive, + this.projectID, + this.description}); + + GetSpecialClinicalCareMappingListResponseModel.fromJson( + Map json) { + mappingProjectID = json['MappingProjectID']; + clinicID = json['ClinicID']; + nursingStationID = json['NursingStationID']; + isActive = json['IsActive']; + projectID = json['ProjectID']; + description = json['Description']; + } + + Map toJson() { + final Map data = new Map(); + data['MappingProjectID'] = this.mappingProjectID; + data['ClinicID'] = this.clinicID; + data['NursingStationID'] = this.nursingStationID; + data['IsActive'] = this.isActive; + data['ProjectID'] = this.projectID; + data['Description'] = this.description; + return data; + } +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index f2a8da6a..294541b0 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -69,7 +69,6 @@ class _HomeScreenState extends State { await model.getDashboard(); await model.getDoctorProfile(isGetProfile: true); await model.checkDoctorHasLiveCare(); - await model.getSpecialClinicalCareList(); }, builder: (_, model, w) => AppScaffold( @@ -356,7 +355,7 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen(), + page: PatientInPatientScreen(specialClinic: model.specialClinicalCareList[0],), ), ); }, diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 60446887..1d8e91b9 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -1,17 +1,27 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'DischargedPatientPage.dart'; import 'InPatientPage.dart'; class PatientInPatientScreen extends StatefulWidget { + GetSpecialClinicalCareListResponseModel specialClinic; + + PatientInPatientScreen({Key key, this.specialClinic}); + @override _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); } @@ -21,6 +31,9 @@ class _PatientInPatientScreenState extends State TabController _tabController; int _activeTab = 0; + int selectedMapId; + + @override void initState() { super.initState(); @@ -42,15 +55,23 @@ class _PatientInPatientScreenState extends State @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; + final screenSize = MediaQuery + .of(context) + .size; PatientSearchRequestModel requestModel = PatientSearchRequestModel(); + ProjectViewModel projectsProvider = Provider.of(context); + return BaseView( onModelReady: (model) async { model.clearPatientList(); + if (widget.specialClinic != null) + await model.getSpecialClinicalCareMappingList( + widget.specialClinic.clinicID); model.getInPatientList(requestModel); }, - builder: (_, model, w) => AppScaffold( + builder: (_, model, w) => + AppScaffold( baseViewModel: model, isShowAppBar: false, body: Column( @@ -72,12 +93,127 @@ class _PatientInPatientScreenState extends State ), Expanded( child: AppText( - TranslationBase.of(context).inPatient, + TranslationBase + .of(context) + .inPatient, fontSize: SizeConfig.textMultiplier * 2.8, fontWeight: FontWeight.bold, color: Color(0xFF2B353E), ), ), + if(model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null) + Container( + width: MediaQuery + .of(context) + .size + .width * .3, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null ? model + .specialClinicalCareMappingList[0] + .nursingStationID : selectedMapId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model + .specialClinicalCareMappingList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Container( + padding: + EdgeInsets.all(2), + margin: + EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: + Colors.red[800], + borderRadius: + BorderRadius + .circular( + 20), + ), + constraints: + BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + model + .specialClinicalCareMappingList + .length + .toString(), + color: + Colors.white, + fontSize: + projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign + .center, + ), + )), + ], + ), + AppText(item.description, + fontSize: 12, + color: Colors.black, + fontWeight: + FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + selectedMapId = newValue; + }); + model.clearPatientList(); + GifLoaderDialogUtils.showMyDialog( + context); + + PatientSearchRequestModel requestModel = PatientSearchRequestModel( + nursingStationID: selectedMapId, clinicID: 0); + await model.getInPatientList(requestModel, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog( + context); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } + }, + items: model + .specialClinicalCareMappingList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.description, + textAlign: TextAlign.left, + ), + value: item.nursingStationID, + ); + }).toList(), + )), + ) ]), ), ), From 7b71bd752fd892334fa20a953ce033dd65a7ecce Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 14 Jun 2021 18:08:24 +0300 Subject: [PATCH 3/7] add to do --- lib/screens/patients/PatientsInPatientScreen.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 1d8e91b9..fe908b8d 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -68,6 +68,8 @@ class _PatientInPatientScreenState extends State if (widget.specialClinic != null) await model.getSpecialClinicalCareMappingList( widget.specialClinic.clinicID); + + //TODO Elham* check why he call it without await and handel the special clinic part. model.getInPatientList(requestModel); }, builder: (_, model, w) => From 7f3ae19fd2394002b8d2407c298136b098a00a83 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 15 Jun 2021 09:42:50 +0300 Subject: [PATCH 4/7] remove todo --- lib/screens/patients/PatientsInPatientScreen.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index fe908b8d..1d8e91b9 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -68,8 +68,6 @@ class _PatientInPatientScreenState extends State if (widget.specialClinic != null) await model.getSpecialClinicalCareMappingList( widget.specialClinic.clinicID); - - //TODO Elham* check why he call it without await and handel the special clinic part. model.getInPatientList(requestModel); }, builder: (_, model, w) => From 37e68539769ba73a3c924b564f4338d7d8a765b4 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 15 Jun 2021 12:10:04 +0300 Subject: [PATCH 5/7] add special one first calling --- .../patients/PatientsInPatientScreen.dart | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 1d8e91b9..4971b636 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -65,9 +65,13 @@ class _PatientInPatientScreenState extends State return BaseView( onModelReady: (model) async { model.clearPatientList(); - if (widget.specialClinic != null) - await model.getSpecialClinicalCareMappingList( - widget.specialClinic.clinicID); + if (widget.specialClinic != null) { + await model + .getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + requestModel.nursingStationID = + model.specialClinicalCareMappingList[0].nursingStationID; + requestModel.clinicID = 0; + } model.getInPatientList(requestModel); }, builder: (_, model, w) => @@ -101,19 +105,17 @@ class _PatientInPatientScreenState extends State color: Color(0xFF2B353E), ), ), - if(model.specialClinicalCareMappingList.isNotEmpty && - widget.specialClinic != null) + if (model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null && + _activeTab != 2) Container( - width: MediaQuery - .of(context) - .size - .width * .3, + width: MediaQuery.of(context).size.width * .3, child: DropdownButtonHideUnderline( child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - isExpanded: true, - value: selectedMapId == null ? model + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null ? model .specialClinicalCareMappingList[0] .nursingStationID : selectedMapId, iconSize: 25, From 3cf4ef43488466248c6aed4bbfdafca1229012e7 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 15 Jun 2021 14:57:42 +0300 Subject: [PATCH 6/7] check if special in home page --- lib/core/viewModel/dashboard_view_model.dart | 8 ++++---- lib/screens/home/home_screen.dart | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 95028f52..f35a4a2a 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -103,15 +103,15 @@ class DashboardViewModel extends BaseViewModel { } - bool isSpecialClinic(clinicId){ - bool isSpecial = false; + GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ + GetSpecialClinicalCareListResponseModel special ; specialClinicalCareList.forEach((element) { if(element.clinicID == 1){ - isSpecial = true; + special = element; } }); - return isSpecial; + return special; } } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 294541b0..aaf4d9b9 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -288,7 +288,7 @@ class _HomeScreenState extends State { child: ListView( scrollDirection: Axis.horizontal, children: [ - ...homePatientsCardsWidget(model), + ...homePatientsCardsWidget(model, projectsProvider), ])), SizedBox( height: 20, @@ -306,7 +306,7 @@ class _HomeScreenState extends State { ); } - List homePatientsCardsWidget(DashboardViewModel model) { + List homePatientsCardsWidget(DashboardViewModel model,projectsProvider) { colorIndex = 0; List backgroundColors = List(3); @@ -355,7 +355,8 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen(specialClinic: model.specialClinicalCareList[0],), + page: PatientInPatientScreen(specialClinic: model.getSpecialClinic(clinicId??projectsProvider + .doctorClinicsList[0].clinicID),), ), ); }, From f76bac898bc81ca10544ed7e107c6a9e68efb2a0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 15 Jun 2021 15:20:33 +0300 Subject: [PATCH 7/7] make clinic id dynamic --- lib/core/viewModel/PatientSearchViewModel.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 6b83461b..e0ee8948 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -218,8 +218,7 @@ class PatientSearchViewModel extends BaseViewModel { } else { setState(ViewState.Busy); } - //TODO Elham* change clinic id to dynamic - await _specialClinicsService.getSpecialClinicalCareMappingList(221); + await _specialClinicsService.getSpecialClinicalCareMappingList(clinicId); if (_specialClinicsService.hasError) { error = _specialClinicsService.error; if (isLocalBusy) {