From 9c018d3c55fa5e006f911f63274e1c5ecee06347 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 17 Dec 2020 12:45:37 +0200 Subject: [PATCH] first step from patient arrival --- lib/client/base_app_client.dart | 1 + lib/config/config.dart | 12 ++++-- lib/core/service/patient_service.dart | 4 +- lib/core/viewModel/patient_view_model.dart | 2 +- lib/lookups/patient_lookup.dart | 1 + ...et_patient_arrival_list_request_model.dart | 40 +++++++++++++++++++ .../patients/patient_search_screen.dart | 13 +----- lib/screens/patients/patients_screen.dart | 31 ++++++++------ 8 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..ee4e9882 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -50,6 +50,7 @@ class BaseAppClient { body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; + body['VidaAuthTokenID'] = ""; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..17a3ae44 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -88,7 +88,8 @@ var SERVICES_PATIANT = [ "GtMyReferredPatient", "GtMyDischargeReferralPatient", "GtMyTomorrowPatient", - "GtMyReferralPatient" + "GtMyReferralPatient", + "PatientArrivalList" ]; var SERVICES_PATIANT2 = [ "List_MyOutPatient", @@ -97,7 +98,8 @@ var SERVICES_PATIANT2 = [ "List_MyReferredPatient", "List_MyDischargeReferralPatient", "List_MyTomorrowPatient", - "List_MyReferralPatient" + "List_MyReferralPatient", + "patientArrivalList" ]; var SERVICES_PATIANT_HEADER = [ "Search Out-Patient", @@ -106,7 +108,8 @@ var SERVICES_PATIANT_HEADER = [ "Referred", "Referral Discharge", "Tomorrow", - "Referral" + "Referral", + "Arrival Patient" ]; var SERVICES_PATIANT_HEADER_AR = [ "المريض الخارجي", @@ -115,7 +118,8 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول الي", "المريض المحال المعافى", "مريض الغد", - "المريض المحول مني" + "المريض المحول مني", + "المريض الواصل" ]; //****************** diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index b16753f5..a847b95d 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -84,7 +84,7 @@ class PatientService extends BaseService { RequestSchedule _requestSchedule = RequestSchedule(); - Future getPatientList(PatientModel patient, patientType) async { + Future getPatientList( patient, patientType) async { hasError = false; int val = int.parse(patientType); @@ -98,7 +98,7 @@ class PatientService extends BaseService { hasError = true; super.error = error; }, - body: { + body:val ==7?patient: { "ProjectID": patient.ProjectID, "ClinicID": patient.ClinicID, "DoctorID": patient.DoctorID, diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index f39a3d48..46232bbf 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -46,7 +46,7 @@ class PatientViewModel extends BaseViewModel { get doctorsList => _patientService.doctorsList; get referalFrequancyList => _patientService.referalFrequancyList; - Future getPatientList(PatientModel patient, patientType, + Future getPatientList( patient, patientType, {bool isBusyLocal = false}) async { if(isBusyLocal) { setState(ViewState.BusyLocal); diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 189535ce..dfcaa305 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -10,6 +10,7 @@ const PATIENT_TYPE = const [ }, {"text": "Tomorrow Patient", "text_ar": "مريض الغد", "val": "5"}, {"text": "Referral", "text_ar": "المريض المحول مني", "val": "6"}, + {"text": "Arrival", "text_ar": "المريض الواصل", "val": "7"}, ]; const LOCATIONS = const [ diff --git a/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart b/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart new file mode 100644 index 00000000..393790dd --- /dev/null +++ b/lib/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart @@ -0,0 +1,40 @@ +class GetPatientArrivalListRequestModel { + String vidaAuthTokenID; + String from; + String to; + String doctorID; + int pageIndex; + int pageSize; + int clinicID; + + GetPatientArrivalListRequestModel( + {this.vidaAuthTokenID, + this.from, + this.to, + this.doctorID, + this.pageIndex, + this.pageSize, + this.clinicID}); + + GetPatientArrivalListRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + from = json['From']; + to = json['To']; + doctorID = json['DoctorID']; + pageIndex = json['PageIndex']; + pageSize = json['PageSize']; + clinicID = json['ClinicID']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['From'] = this.from; + data['To'] = this.to; + data['DoctorID'] = this.doctorID; + data['PageIndex'] = this.pageIndex; + data['PageSize'] = this.pageSize; + data['ClinicID'] = this.clinicID; + return data; + } +} diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 204d2336..450a32f7 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -65,12 +65,9 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { -//print("============== _selectedType============"+ _selectedType); + try { - //==================== - //_selectedType=='3'? - //===================== Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = @@ -79,20 +76,13 @@ class _PatientSearchScreenState extends State { _formKey.currentState.save(); sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); - print('************_selectedType*************'); - print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); _patientSearchFormValues.TokenID = token; _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 _patientSearchFormValues.DoctorID = doctorProfile.doctorID; _patientSearchFormValues.ClinicID = doctorProfile.clinicID; - //===================== - // _patientSearchFormValues. - //===================== - print("=============doctorProfile.clinicID=" + - doctorProfile.clinicID.toString()); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, @@ -105,7 +95,6 @@ class _PatientSearchScreenState extends State { } } catch (err) { error = err; - // handelCatchErrorCase(err); } } diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 4ca3e587..7b27d746 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -9,11 +9,12 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -48,7 +49,6 @@ class _PatientsScreenState extends State { final String avatarFemale = 'user_female.svg'; final String assetName = 'assets/image.svg'; - // List _locations = ['Today', 'Old Date', 'YESTERDAY']; List _locations = []; //['All', 'Today', 'Tomorrow', 'Next Week']; int _activeLocation = 0; @@ -66,14 +66,6 @@ class _PatientsScreenState extends State { PatientModel patient; -/* - *@author: Amjad Amireh - *@Date:2/5/2020 - *@param: - *@return:PatientsScreen Search textbox filter - - *@desc: - */ searchData(String str) { this.responseModelList = this.responseModelList2; @@ -277,11 +269,26 @@ class _PatientsScreenState extends State { return BaseView( onModelReady: (model) { // TODO : change all the logic here to make it work with the model and remove future - model.getPatientList(patient, patientType).then((res) { + int val2 = int.parse(patientType); + GetPatientArrivalListRequestModel getPatientArrivalListRequestModel; + if (val2 == 7) { + getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel( + from: patient.From, to: patient.To, pageIndex: 0, pageSize: 0); + } + + model + .getPatientList( + val2 == 7 + ? getPatientArrivalListRequestModel.toJson() + : patient, + patientType) + .then((res) { setState(() { _isLoading = false; if (res['MessageStatus'] == 1) { - int val2 = int.parse(patientType); + if (val2 == 7) { + print("Assad"); + } lItems = res[SERVICES_PATIANT2[val2]]; parsed = lItems; responseModelList = new ModelResponse.fromJson(parsed).list;