From 9c018d3c55fa5e006f911f63274e1c5ecee06347 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 17 Dec 2020 12:45:37 +0200 Subject: [PATCH 01/20] 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; From 94093e775eaeb3fb1e7d124975afd92e2d131b38 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 17 Dec 2020 15:16:08 +0200 Subject: [PATCH 02/20] add vital-sign files --- lib/core/service/base/base_service.dart | 2 + .../service/patient-vital-signs-service.dart | 45 +++++++++++++++++++ .../patient-vital-sign-viewModel.dart | 27 +++++++++++ lib/locator.dart | 4 ++ 4 files changed, 78 insertions(+) create mode 100644 lib/core/service/patient-vital-signs-service.dart create mode 100644 lib/core/viewModel/patient-vital-sign-viewModel.dart diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index c4cb240d..885398f5 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); //TODO add the user login model when we need it } diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart new file mode 100644 index 00000000..72619fa4 --- /dev/null +++ b/lib/core/service/patient-vital-signs-service.dart @@ -0,0 +1,45 @@ +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/patient/vital_sign/vital_sign_res_model.dart'; + +class VitalSignsService extends BaseService{ + + List patientVitalSignList = []; + List patientVitalSignOrderdSubList = []; + + Future getPatientVitalSign(patient) async { + hasError = false; + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN, + onSuccess: (dynamic response, int statusCode) { + patientVitalSignList = []; + response['List_DoctorPatientVitalSign'].forEach((v) { + patientVitalSignList.add(new VitalSignResModel.fromJson(v)); + }); + + if (patientVitalSignList.length > 0) { + List patientVitalSignOrderdSubListTemp = []; + patientVitalSignOrderdSubListTemp = patientVitalSignList; + patientVitalSignOrderdSubListTemp + .sort((VitalSignResModel a, VitalSignResModel b) { + return b.vitalSignDate.microsecondsSinceEpoch - + a.vitalSignDate.microsecondsSinceEpoch; + }); + patientVitalSignOrderdSubList.clear(); + int length = patientVitalSignOrderdSubListTemp.length >= 20 + ? 20 + : patientVitalSignOrderdSubListTemp.length; + for (int x = 0; x < length; x++) { + patientVitalSignOrderdSubList + .add(patientVitalSignOrderdSubListTemp[x]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: patient, + ); + } +} \ No newline at end of file diff --git a/lib/core/viewModel/patient-vital-sign-viewModel.dart b/lib/core/viewModel/patient-vital-sign-viewModel.dart new file mode 100644 index 00000000..255ab5bd --- /dev/null +++ b/lib/core/viewModel/patient-vital-sign-viewModel.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient-vital-signs-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; + +import '../../locator.dart'; + +class VitalSignsViewModel extends BaseViewModel{ + VitalSignsService _vitalSignService = locator(); + + List get patientVitalSignList => + _vitalSignService.patientVitalSignList; + + List get patientVitalSignOrderdSubList => + _vitalSignService.patientVitalSignOrderdSubList; + + Future getPatientVitalSign(patient) async { + setState(ViewState.Busy); + await _vitalSignService.getPatientVitalSign(patient); + if (_vitalSignService.hasError) { + error = _vitalSignService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..9ca9d8db 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -4,11 +4,13 @@ import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; +import 'core/service/patient-vital-signs-service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; +import 'core/viewModel/patient-vital-sign-viewModel.dart'; import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; @@ -24,6 +26,7 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => VitalSignsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -32,4 +35,5 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => VitalSignsViewModel()); } From 44779e6ee7dc88f1c5eb83d1470846a72cd0e65b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 17 Dec 2020 19:17:20 +0200 Subject: [PATCH 03/20] patient screen --- lib/client/base_app_client.dart | 21 +++++----- lib/screens/patients/patients_screen.dart | 49 +++++++++++++---------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ee4e9882..876226ce 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -50,7 +50,7 @@ class BaseAppClient { body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; - body['VidaAuthTokenID'] = ""; + body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiMDBmMDI3NjQtZDczMi00NDA0LThkYmUtZWViZDkwY2EzM2JiIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1NzYyMDYiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODIyMjUwNiwiZXhwIjoxNjA5MDg2NTA2LCJpYXQiOjE2MDgyMjI1MDZ9.X_66vZw08tiH4DmhKUPXzIiIMrnadE2IHe0wOA0GM6g"; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') @@ -80,16 +80,19 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - if (!parsed['IsAuthenticated']) { - await helpers.logout(); + // TODO: return it back when backend fixed + // if (!parsed['IsAuthenticated']) { + // await helpers.logout(); + // + // helpers.showErrorToast('Your session expired Please login agian'); + // } else - helpers.showErrorToast('Your session expired Please login agian'); - } else if (parsed['MessageStatus'] == 1) { + // if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); - } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - } + // } else { + // onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + // statusCode); + // } } } else { onFailure('Please Check The Internet Connection', -1); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 7b27d746..8b02ab3d 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -285,25 +285,33 @@ class _PatientsScreenState extends State { .then((res) { setState(() { _isLoading = false; - if (res['MessageStatus'] == 1) { - if (val2 == 7) { - print("Assad"); + // if (res['MessageStatus'] == 1) { + if (val2 == 7) { + print("Assad"); + if (res[SERVICES_PATIANT2[val2]] == null) { + _isError = true; + _isLoading = false; + this.error = error.toString(); + } else { + lItems = res[SERVICES_PATIANT2[val2]]["entityList"]; } - lItems = res[SERVICES_PATIANT2[val2]]; - parsed = lItems; - responseModelList = new ModelResponse.fromJson(parsed).list; - responseModelList2 = responseModelList; - _isError = false; } else { - _isError = true; - error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + lItems = res[SERVICES_PATIANT2[val2]]; } + parsed = lItems; + responseModelList = new ModelResponse.fromJson(parsed).list; + responseModelList2 = responseModelList; + _isError = false; + // } else { + // _isError = true; + // error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + // } }); }).catchError((error) { setState(() { _isError = true; _isLoading = false; - this.error = error; + this.error = error.toString(); }); }); }, @@ -315,16 +323,15 @@ class _PatientsScreenState extends State { : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .youDontHaveAnyPatient) - : Container( - child: ListView( - scrollDirection: Axis.vertical, - children: [ - Container( - child: lItems == null + ? DrAppEmbeddedError( + error: + TranslationBase.of(context).youDontHaveAnyPatient) + : Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: lItems == null ? Column( crossAxisAlignment: CrossAxisAlignment.start, From a71da8e4ef3acb556a3149a0829cf541f3fdd66f Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 28 Dec 2020 13:38:13 +0200 Subject: [PATCH 04/20] working on vital signs --- .../service/patient-vital-signs-service.dart | 6 ++---- .../patient-vital-sign-viewModel.dart | 20 +++++++++++-------- .../vital_sign/patient-vital-sign-data.dart | 8 +++----- lib/routes.dart | 3 +++ .../referral/refer-patient-screen.dart | 10 ++-------- lib/screens/patients/vital-signs-screen.dart | 12 +++++++++++ lib/screens/patients/vital-signs.dart | 9 --------- lib/util/helpers.dart | 4 ++-- .../profile/profile_medical_info_widget.dart | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 lib/screens/patients/vital-signs-screen.dart delete mode 100644 lib/screens/patients/vital-signs.dart diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 2c7188a4..578aea88 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -45,12 +45,10 @@ class VitalSignsService extends BaseService{ ); } // Vit*/ - Future getPatientVitalSign(patient) async { + Future getPatientVitalSign(/*PatientArrivalEntity patientArrivalEntity*/) async { hasError = false; Map body = Map(); - body['PatientMRN'] = 1; - body['AppointmentNo'] = 1; - body['EpisodeID'] = 1; + body['PatientMRN'] = 50377782; await baseAppClient.post( GET_PATIENT_VITAL_SIGN_DATA, diff --git a/lib/core/viewModel/patient-vital-sign-viewModel.dart b/lib/core/viewModel/patient-vital-sign-viewModel.dart index 255ab5bd..30f979f3 100644 --- a/lib/core/viewModel/patient-vital-sign-viewModel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewModel.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient-vital-signs-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; import '../../locator.dart'; @@ -8,20 +9,23 @@ import '../../locator.dart'; class VitalSignsViewModel extends BaseViewModel{ VitalSignsService _vitalSignService = locator(); - List get patientVitalSignList => - _vitalSignService.patientVitalSignList; + VitalSignData get patientVitalSigns => + _vitalSignService.patientVitalSigns; - List get patientVitalSignOrderdSubList => - _vitalSignService.patientVitalSignOrderdSubList; - - Future getPatientVitalSign(patient) async { + Future getPatientVitalSign() async { setState(ViewState.Busy); - await _vitalSignService.getPatientVitalSign(patient); + await _vitalSignService.getPatientVitalSign(); if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); - } else + } else { + if(patientVitalSigns == null) { + _vitalSignService.patientVitalSigns = VitalSignData( + appointmentNo: 2016053265, bloodPressureCuffLocation: 0, bloodPressureCuffSize: 0, bloodPressureHigher: 38, + ); + } setState(ViewState.Idle); + } } } \ No newline at end of file diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart index b5c46aa6..5d20e017 100644 --- a/lib/models/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -1,5 +1,4 @@ class VitalSignData { - int appointmentNo; int bloodPressureCuffLocation; int bloodPressureCuffSize; @@ -33,7 +32,7 @@ class VitalSignData { int weightKg; VitalSignData( - this.appointmentNo, + {this.appointmentNo, this.bloodPressureCuffLocation, this.bloodPressureCuffSize, this.bloodPressureHigher, @@ -63,7 +62,7 @@ class VitalSignData { this.temperatureCelcius, this.temperatureCelciusMethod, this.waistSizeInch, - this.weightKg); + this.weightKg}); VitalSignData.fromJson(Map json) { appointmentNo = json['appointmentNo']; @@ -134,5 +133,4 @@ class VitalSignData { data['weightKg'] = this.weightKg; return data; } - -} \ No newline at end of file +} diff --git a/lib/routes.dart b/lib/routes.dart index 5d8b730a..257db6fc 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -40,6 +40,7 @@ import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'screens/patients/profile/referral/refer-patient-screen.dart'; +import 'screens/patients/vital-signs-screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -74,6 +75,7 @@ const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; +const String PATIENT_VITAL_SIGN = 'patients/vital-sign-data'; const String CREATE_EPISODE = 'patients/create-episode'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; @@ -113,6 +115,7 @@ var routes = { PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), + PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), CREATE_EPISODE:(_)=>AddSOAPIndex(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index b6287cd9..2ab7cc18 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.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/patients/profile/patient-page-header-widget.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/app_texts_widget.dart'; @@ -64,14 +65,7 @@ class _PatientMakeReferralScreenState extends State { children: [ Column( children: [ - Container( - height: 75, - child: AppText( - "This is where upper view for avatar.. etc placed", - fontWeight: FontWeight.normal, - fontSize: 16, - ), - ), + PatientPageHeaderWidget(patient), const Divider( color: Color(0xffCCCCCC), height: 1, diff --git a/lib/screens/patients/vital-signs-screen.dart b/lib/screens/patients/vital-signs-screen.dart new file mode 100644 index 00000000..6aeb5b3e --- /dev/null +++ b/lib/screens/patients/vital-signs-screen.dart @@ -0,0 +1,12 @@ +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:flutter/material.dart'; + +class PatientVitalSignScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return Container(); + } +} diff --git a/lib/screens/patients/vital-signs.dart b/lib/screens/patients/vital-signs.dart deleted file mode 100644 index b6df3236..00000000 --- a/lib/screens/patients/vital-signs.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:flutter/material.dart'; - -class PatientVitalSignScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - - return Container(); - } -} diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 0c3f1b5f..5c2d6615 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -348,7 +348,7 @@ class Helpers { String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); sharedPref.setString(APP_Language, lang); - // Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); - Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index d9c0f796..9d97a1ad 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -39,7 +39,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { patient: patient, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, + route: PATIENT_VITAL_SIGN, icon: 'heartbeat.png'), PatientProfileButton( key: key, From c7bfe24207b809cf57c25a85d19e265a6fc7df20 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 29 Dec 2020 14:32:06 +0200 Subject: [PATCH 05/20] post procedure --- lib/client/base_app_client.dart | 17 +-- lib/config/config.dart | 2 + .../model/procedure/categories_procedure.dart | 18 +++ lib/core/service/prescription_service.dart | 19 ++- lib/core/service/procedure_service.dart | 32 +++- lib/core/viewModel/procedure_View_model.dart | 28 ++++ .../prescription/prescription_screen.dart | 5 +- lib/screens/procedures/procedure_screen.dart | 144 +++++++++++------- 8 files changed, 192 insertions(+), 73 deletions(-) create mode 100644 lib/core/model/procedure/categories_procedure.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ed14ecac..46dd9290 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -83,13 +83,12 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - // if (!parsed['IsAuthenticated']) { - // // TODO: return it back when IsAuthenticated work fine in all service - // // await helpers.logout(); - // - // helpers.showErrorToast('Your session expired Please login agian'); - // } else - if (parsed['MessageStatus'] == 1) { + if (!parsed['IsAuthenticated']) { + // TODO: return it back when IsAuthenticated work fine in all service + // await helpers.logout(); + // + // helpers.showErrorToast('Your session expired Please login agian'); + } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { String error = @@ -102,8 +101,8 @@ class BaseAppClient { if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { error = error + parsed["ValidationErrors"]["ValidationErrors"][i] ["Messages"][0] + diff --git a/lib/config/config.dart b/lib/config/config.dart index abf451b8..fa184b33 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -122,6 +122,8 @@ const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const GET_CATEGORISE_PROCEDURE = + 'Services/DoctorApplication.svc/REST/GetCategories'; var selectedPatientType = 1; diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart new file mode 100644 index 00000000..e7a7fd40 --- /dev/null +++ b/lib/core/model/procedure/categories_procedure.dart @@ -0,0 +1,18 @@ +class CategoriseProcedureModel { + String categoryID; + String categoryName; + + CategoriseProcedureModel({this.categoryID, this.categoryName}); + + CategoriseProcedureModel.fromJson(Map json) { + categoryID = json['CategoryID']; + categoryName = json['CategoryName']; + } + + Map toJson() { + final Map data = new Map(); + data['CategoryID'] = this.categoryID; + data['CategoryName'] = this.categoryName; + return data; + } +} diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 46b93481..d51fcc3e 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -33,13 +33,16 @@ class PrescriptionService extends BaseService { Future postPrescription() async { hasError = false; //_prescriptionList.clear(); - await baseAppClient.post(POST_PRESCRIPTION_LIST, - onSuccess: (dynamic response, int statusCode) { - _prescriptionList - .add(PrescriptionModel.fromJson(response['PrescriptionList'])); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _postPrescriptionReqModel.toJson()); + await baseAppClient.post( + GET_CATEGORISE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + _prescriptionList + .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); } } diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 4c795baf..fdc18003 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -1,12 +1,22 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:flutter/foundation.dart'; class ProcedureService extends BaseService { List _procedureList = List(); List get procedureList => _procedureList; + List _categoriesList = List(); + List get categoriesList => _categoriesList; + List procedureslist = List(); + + Procedures t1 = Procedures( + category: '02', + procedure: '02011002', + ); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( clinicId: 0, @@ -34,15 +44,31 @@ class ProcedureService extends BaseService { }, body: _getProcedureReqModel.toJson()); } - Future postProcedure() async { + Future getCategories() async { + hasError = false; + _categoriesList.clear(); + await baseAppClient.post( + GET_CATEGORISE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + _categoriesList + .add(CategoriseProcedureModel.fromJson(response['listCategories'])); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { hasError = false; _procedureList.clear(); await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { - _procedureList.add(GetProcedureModel.fromJson(response['ProcedureList'])); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _postProcedureReqModel.toJson()); + }, body: postProcedureReqModel.toJson()); } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index f65c0b2e..13e18ed3 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; @@ -8,6 +10,8 @@ class ProcedureViewModel extends BaseViewModel { bool hasError = false; ProcedureService _procedureService = locator(); List get procedureList => _procedureService.procedureList; + List get categoriesList => + _procedureService.categoriesList; Future getProcedure() async { hasError = false; @@ -20,4 +24,28 @@ class ProcedureViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getCategories() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getCategories(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.postProcedure(postProcedureReqModel); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 4ccebf39..e29bcefc 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -76,7 +76,7 @@ class _NewPrescriptionScreenState extends State { fontWeight: FontWeight.bold, ), SizedBox( - width: 20, + width: 5.0, ), AppText( patient.patientId.toString(), @@ -111,7 +111,7 @@ class _NewPrescriptionScreenState extends State { InkWell( onTap: () { addPrescriptionForm(context); - //model.postPrescription(); + model.postPrescription(); }, child: CircleAvatar( radius: 65, @@ -195,6 +195,7 @@ class _NewPrescriptionScreenState extends State { ), onTap: () { addPrescriptionForm(context); + model.postPrescription(); }, ), SizedBox( diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 3af63004..59cf5bdf 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -1,10 +1,14 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; 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/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_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/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/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -24,6 +28,7 @@ class ProcedureScreen extends StatefulWidget { class _ProcedureScreenState extends State { int testNum = 1; PatiantInformtion patient; + TextEditingController procedureController = TextEditingController(); @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; @@ -72,7 +77,7 @@ class _ProcedureScreenState extends State { fontWeight: FontWeight.bold, ), SizedBox( - width: 20, + width: 5.0, ), AppText( patient.patientId.toString(), @@ -376,62 +381,99 @@ class _ProcedureScreenState extends State { } } +postProcedure({ProcedureViewModel model}) async { + model = new ProcedureViewModel(); + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + List controls = List(); + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = 2016054575; + + postProcedureReqModel.episodeID = 200012166; + postProcedureReqModel.patientMRN = 3120725; + postProcedureReqModel.vidaAuthTokenID = + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI'; + + controls.add( + Controls(code: 'Remarks', controlValue: 'Testing'), + ); + controlsProcedure.add( + Procedures(category: "02", procedure: "02011002", controls: controls)); + postProcedureReqModel.procedures = controlsProcedure; + + await model.postProcedure(postProcedureReqModel); + DrAppToastMsg.showSuccesToast('Procedure had been added'); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } +} + void addSelectedProcedure(context) { + TextEditingController procedureController = TextEditingController(); showModalBottomSheet( context: context, builder: (BuildContext bc) { - return SingleChildScrollView( - child: Container( - height: 490, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Select Procedure'.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 9.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: 'Add Delected Procedures'.toUpperCase(), - borderColor: Colors.white, - textInputType: TextInputType.text, - inputFormatter: ONLY_LETTERS, + return BaseView( + //onModelReady: (model) => model.getCategories(), + builder: + (BuildContext context, ProcedureViewModel model, Widget child) => + SingleChildScrollView( + child: Container( + height: 490, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + // Text(model.categoriesList[0].categoryName), + SizedBox( + height: 9.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Add Delected Procedures'.toUpperCase(), + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + controller: procedureController, + ), ), - ), - SizedBox( - height: 280.0, - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addMedication, - // onPressed: () { - // Navigator.pop(context); - // prescriptionWarning(context); - // }, - ), - ], + SizedBox( + height: 280.0, + ), + Container( + margin: + EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: + TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + postProcedure(); + }, + ), + ], + ), ), - ), - ], - ) - ], + ], + ) + ], + ), ), ), ), From 0c18d96ba2d40d5f6e05ad1e3d7d6e4316e2006e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 29 Dec 2020 14:37:48 +0200 Subject: [PATCH 06/20] post procedure --- lib/client/base_app_client.dart | 14 ++++++-------- lib/config/config.dart | 8 +++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 015cf0f5..3006662e 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -78,7 +78,7 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 ) { + if (statusCode < 200 || statusCode >= 400) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); @@ -89,7 +89,7 @@ class BaseAppClient { // helpers.showErrorToast('Your session expired Please login agian'); // } else if (parsed['MessageStatus'] == 1) { - if(!parsed['IsAuthenticated']) + if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); else onSuccess(parsed, statusCode); @@ -106,21 +106,19 @@ class BaseAppClient { } } - String getError(parsed){ + String getError(parsed) { //TODO change this fun String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { error = error + - parsed["ValidationErrors"]["ValidationErrors"][i] - ["Messages"][0] + + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; } } diff --git a/lib/config/config.dart b/lib/config/config.dart index 7f4fea03..d3728ddf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -120,11 +120,13 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; -const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; -const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = + 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = + '/Services/DoctorApplication.svc/REST/PostProgressNote'; + const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetCategories'; From 8a6ea1c0c562a20799e060c69a76f95faf60c73d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 29 Dec 2020 15:01:51 +0200 Subject: [PATCH 07/20] Fix SOAP --- .../profile/SOAP/assessment_page.dart | 42 +++++---- .../patients/profile/SOAP/steps_widget.dart | 89 +++++++++++-------- .../shared/dialogs/master_key_dailog.dart | 5 +- 3 files changed, 80 insertions(+), 56 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 3bd9f0f1..5eb3694b 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -236,7 +236,7 @@ class _AssessmentPageState extends State { height: 6, ), AppText( - "Some short remark about the allergy", + widget.mySelectedAssessment.remark, fontSize: 10, color: Colors.grey, ), @@ -268,7 +268,9 @@ class _AssessmentPageState extends State { Column( children: [ InkWell( - onTap: () {}, + onTap: () { + openAssessmentDialog(context); + }, child: Icon(EvaIcons .edit2Outline), ) @@ -334,14 +336,15 @@ class AddAssessmentDetails extends StatefulWidget { } class _AddAssessmentDetailsState extends State { - MasterKeyModel _selectedDiagnosisCondition; - MasterKeyModel _selectedDiagnosisType; + // MasterKeyModel _selectedDiagnosisCondition; + // MasterKeyModel _selectedDiagnosisType; TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController( text: "234567"); @override Widget build(BuildContext context) { + remarkController.text = widget.mySelectedAssessment.remark??""; final screenSize = MediaQuery .of(context) .size; @@ -433,14 +436,14 @@ class _AddAssessmentDetailsState extends State { ? () { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisCondition, + selectedValue: widget.mySelectedAssessment + .selectedDiagnosisCondition, okText: TranslationBase .of(context) .ok, okFunction: ( MasterKeyModel selectedValue) { setState(() { - _selectedDiagnosisCondition = - selectedValue; widget.mySelectedAssessment .selectedDiagnosisCondition = selectedValue; @@ -459,8 +462,10 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Condition", - _selectedDiagnosisCondition != null - ? _selectedDiagnosisCondition + widget.mySelectedAssessment + .selectedDiagnosisCondition != null + ? widget.mySelectedAssessment + .selectedDiagnosisCondition .nameEn : null, true), @@ -485,7 +490,8 @@ class _AddAssessmentDetailsState extends State { okFunction: ( MasterKeyModel selectedValue) { setState(() { - _selectedDiagnosisCondition = + widget.mySelectedAssessment + .selectedDiagnosisCondition = selectedValue; }); }, @@ -502,8 +508,10 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Condition", - _selectedDiagnosisCondition != null - ? _selectedDiagnosisCondition + widget.mySelectedAssessment + .selectedDiagnosisCondition != null + ? widget.mySelectedAssessment + .selectedDiagnosisCondition .nameEn : null, true), @@ -527,11 +535,11 @@ class _AddAssessmentDetailsState extends State { okFunction: ( MasterKeyModel selectedValue) { setState(() { - _selectedDiagnosisType = - selectedValue; + // _selectedDiagnosisType = + // selectedValue; widget.mySelectedAssessment .selectedDiagnosisType = - _selectedDiagnosisType; + selectedValue; }); }, ); @@ -547,8 +555,10 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Type", - _selectedDiagnosisType != null - ? _selectedDiagnosisType.nameEn + widget.mySelectedAssessment + .selectedDiagnosisType != null + ? widget.mySelectedAssessment + .selectedDiagnosisType.nameEn : null, true), enabled: false, diff --git a/lib/widgets/patients/profile/SOAP/steps_widget.dart b/lib/widgets/patients/profile/SOAP/steps_widget.dart index 863da3a9..b0b091c1 100644 --- a/lib/widgets/patients/profile/SOAP/steps_widget.dart +++ b/lib/widgets/patients/profile/SOAP/steps_widget.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -70,10 +71,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 0 ? 5 : 10, ), - Texts('SUBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "SUBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -82,7 +84,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.28, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -119,10 +121,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 1 ? 5 : 10, ), - Texts('OBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "OBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -131,7 +134,10 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.52, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(3) : null, + onTap: () { + if(index >= 3) + changeCurrentTab(2); + }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -168,10 +174,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 2 ? 5 : 10, ), - Texts('ASSESSMENT', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "ASSESSMENT", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -212,15 +219,17 @@ class StepsWidget extends StatelessWidget { ? Colors.white : Colors.grey, ), - ), + ) ), SizedBox( height: index == 3 ? 5 : 10, ), - Texts('PLAN', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "PLAN", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: 14, + ), ], ), ), @@ -274,18 +283,19 @@ class StepsWidget extends StatelessWidget { color: index == 0 ? Colors.black : index > 0 - ? Colors.white - : Colors.grey, + ? Colors.white + : Colors.grey, ), ), ), SizedBox( height: index == 0 ? 5 : 10, ), - Texts('SUBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "SUBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 16, + ), ], ), ), @@ -331,10 +341,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 1 ? 5 : 10, ), - Texts('OBJECTIVE', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "OBJECTIVE", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), @@ -343,7 +354,7 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.52, child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(3) : null, + onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -383,10 +394,11 @@ class StepsWidget extends StatelessWidget { Padding( padding: const EdgeInsets.only(right: 2), - child: Texts('ASSESSMENT', - variant: "bodyText", - bold: true, - color: Colors.black), + child: AppText( + "ASSESSMENT", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ), ], ), @@ -433,10 +445,11 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 3 ? 5 : 10, ), - Texts('PLAN', - variant: "bodyText", - bold: true, - color: Colors.black), + AppText( + "PLAN", + fontWeight: FontWeight.bold, + fontSize: 14, + ), ], ), ), diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index a276c4af..42d766e7 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -2,16 +2,17 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +// ignore: must_be_immutable class MasterKeyDailog extends StatefulWidget { final List list; final okText; final Function(MasterKeyModel) okFunction; - MasterKeyModel selectedValue; + MasterKeyModel selectedValue; MasterKeyDailog( {@required this.list, @required this.okText, - @required this.okFunction}); + @required this.okFunction, this.selectedValue}); @override _MasterKeyDailogState createState() => _MasterKeyDailogState(); From a47e9b69f5b4e685e413f7064a8c59b2513e8ea5 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 29 Dec 2020 20:27:55 +0200 Subject: [PATCH 08/20] add CDI service --- lib/client/base_app_client.dart | 4 +- lib/core/enum/master_lookup_key.dart | 6 +- lib/core/service/base/lookup-service.dart | 8 ++ lib/core/viewModel/SOAP_view_model.dart | 1 + .../profile/SOAP/assessment_page.dart | 80 +++++++++---------- .../patients/profile/SOAP/steps_widget.dart | 28 ++++--- 6 files changed, 74 insertions(+), 53 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ed14ecac..fcdf86dd 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -111,7 +111,9 @@ class BaseAppClient { } } } - + if(error == null) { + error = helpers.generateContactAdminMsg(); + } onFailure(error, statusCode); } } diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index a4010858..8f5d76f8 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -9,7 +9,8 @@ enum MasterKeysService { AllergySeverity, physiotherapyGoals, DiagnosisCondition, - DiagnosisType + DiagnosisType, + ICD10 } extension SelectedMasterKeysService on MasterKeysService { @@ -48,6 +49,9 @@ extension SelectedMasterKeysService on MasterKeysService { case MasterKeysService.DiagnosisType: return 35; break; + case MasterKeysService.ICD10: + return 2500; + break; } } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 61f0c31e..d677201b 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -33,6 +33,7 @@ class LookupService extends BaseService { // List listOfPhysiotherapyGoals = []; List listOfDiagnosisType = []; List listOfDiagnosisCondition = []; + List listOfICD10 = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -120,6 +121,13 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; + case MasterKeysService.ICD10: + listOfICD10.clear(); + entryList.forEach((v) { + listOfICD10 + .add(MasterKeyModel.fromJson(v)); + }); + break; } } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e8cde824..e36e132c 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -34,6 +34,7 @@ class SOAPViewModel extends BaseViewModel { List get physicalExaminationList => _SOAPService.physicalExaminationList; List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; + List get listOfICD10 => _SOAPService.listOfICD10; diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 5eb3694b..9eff9ed1 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -382,6 +382,10 @@ class _AddAssessmentDetailsState extends State { if (model.listOfDiagnosisType.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisType); } + // todo return it back when service is fixed. + // if (model.listOfICD10.length == 0) { + // await model.getMasterLookup(MasterKeysService.ICD10); + // } }, builder: (_, model, w) => AppScaffold( @@ -431,47 +435,43 @@ class _AddAssessmentDetailsState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.listOfDiagnosisCondition != - null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - selectedValue: widget.mySelectedAssessment - .selectedDiagnosisCondition, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Condition", + onTap: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + selectedValue: widget + .mySelectedAssessment + .selectedICD, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { widget.mySelectedAssessment - .selectedDiagnosisCondition != null - ? widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn - : null, - true), - enabled: false, - ), - ), + .selectedICD = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Name / ICD", + widget.mySelectedAssessment.selectedICD != + null + ? widget.mySelectedAssessment + .selectedICD.nameEn + : null, + true), + enabled: false, + ), + ), ), SizedBox( height: 10, diff --git a/lib/widgets/patients/profile/SOAP/steps_widget.dart b/lib/widgets/patients/profile/SOAP/steps_widget.dart index b0b091c1..d5cb7ddc 100644 --- a/lib/widgets/patients/profile/SOAP/steps_widget.dart +++ b/lib/widgets/patients/profile/SOAP/steps_widget.dart @@ -224,12 +224,15 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 3 ? 5 : 10, ), - AppText( - "PLAN", - fontWeight: FontWeight.bold, - textAlign: TextAlign.center, - fontSize: 14, - ), + Container( + margin: EdgeInsets.only(left: index == 3? 15:0), + child: AppText( + "PLAN", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: 14, + ), + ), ], ), ), @@ -445,11 +448,14 @@ class StepsWidget extends StatelessWidget { SizedBox( height: index == 3 ? 5 : 10, ), - AppText( - "PLAN", - fontWeight: FontWeight.bold, - fontSize: 14, - ), + Container( + margin: EdgeInsets.only(right:index == 3? 15:0), + child: AppText( + "PLAN", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ), ], ), ), From efee00c79eeeed48607089f96ab82bdf0bf22f48 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 29 Dec 2020 21:09:36 +0200 Subject: [PATCH 09/20] finish add assessment --- lib/config/config.dart | 5 +- lib/core/service/SOAP_service.dart | 13 ++++ lib/core/viewModel/SOAP_view_model.dart | 11 +++ .../SOAP/post_assessment_request_model.dart | 69 +++++++++++++++++ .../profile/SOAP/assessment_page.dart | 75 +++++++++++++------ 5 files changed, 150 insertions(+), 23 deletions(-) create mode 100644 lib/models/SOAP/post_assessment_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index d3728ddf..74ee9d89 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -125,7 +125,10 @@ const POST_CHIEF_COMPLAINT = const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; const POST_PROGRESS_NOTE = - '/Services/DoctorApplication.svc/REST/PostProgressNote'; + 'Services/DoctorApplication.svc/REST/PostProgressNote'; + +const POST_ASSESSMENT = + 'Services/DoctorApplication.svc/REST/PostAssessment'; const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetCategories'; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index e5d2023c..3219ef6a 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.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'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; 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'; @@ -86,4 +87,16 @@ class SOAPService extends LookupService { super.error = error; }, body: postProgressNoteRequestModel.toJson()); } + + Future postAssessment( + PostAssessmentRequestModel postAssessmentRequestModel) async { + hasError = false; + await baseAppClient.post(POST_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAssessmentRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e36e132c..422f554a 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/Allergy_model.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'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; 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'; @@ -108,5 +109,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postAssessment(postAssessmentRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/models/SOAP/post_assessment_request_model.dart b/lib/models/SOAP/post_assessment_request_model.dart new file mode 100644 index 00000000..c8a1ebfd --- /dev/null +++ b/lib/models/SOAP/post_assessment_request_model.dart @@ -0,0 +1,69 @@ +class PostAssessmentRequestModel { + int patientMRN; + int appointmentNo; + int episodeId; + List icdCodeDetails; + + PostAssessmentRequestModel( + {this.patientMRN, + this.appointmentNo, + this.episodeId, + this.icdCodeDetails}); + + PostAssessmentRequestModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + if (json['icdCodeDetails'] != null) { + icdCodeDetails = new List(); + json['icdCodeDetails'].forEach((v) { + icdCodeDetails.add(new IcdCodeDetails.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + if (this.icdCodeDetails != null) { + data['icdCodeDetails'] = + this.icdCodeDetails.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class IcdCodeDetails { + String icdcode10Id; + int conditionId; + int diagnosisTypeId; + bool complexDiagnosis; + String remarks; + + IcdCodeDetails( + {this.icdcode10Id, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); + + IcdCodeDetails.fromJson(Map json) { + icdcode10Id = json['icdcode10Id']; + conditionId = json['conditionId']; + diagnosisTypeId = json['diagnosisTypeId']; + complexDiagnosis = json['complexDiagnosis']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['icdcode10Id'] = this.icdcode10Id; + data['conditionId'] = this.conditionId; + data['diagnosisTypeId'] = this.diagnosisTypeId; + data['complexDiagnosis'] = this.complexDiagnosis; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 9eff9ed1..edb2f608 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,8 +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/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_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/shared/Text.dart'; @@ -285,24 +288,48 @@ class _AssessmentPageState extends State { isExpand: isAssessmentExpand, ), DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase - .of(context) - .next, - onPressed: () { - widget.changePageViewIndex(3); - }, - ), - SizedBox( - height: 30, - ), - ], + height: 30, ), - ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitAssessment(model); + }, + ), + SizedBox( + height: 30, + ), + ], ), - ))); + ), + ), + ))); + } + + submitAssessment(SOAPViewModel model) async { + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + icdCodeDetails: [new IcdCodeDetails( + remarks: widget.mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: widget.mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: widget.mySelectedAssessment.selectedDiagnosisType.id , + icdcode10Id: "1" + )] + ); + + await model.postAssessment(postAssessmentRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(3); + } + } openAssessmentDialog(BuildContext context) { @@ -441,13 +468,16 @@ class _AddAssessmentDetailsState extends State { list: model.listOfDiagnosisType, selectedValue: widget .mySelectedAssessment - .selectedICD, - okText: TranslationBase.of(context).ok, + .selectedDiagnosisType, + okText: TranslationBase + .of(context) + .ok, okFunction: (MasterKeyModel selectedValue) { setState(() { widget.mySelectedAssessment - .selectedICD = selectedValue; + .selectedDiagnosisType = + selectedValue; }); }, ); @@ -463,10 +493,11 @@ class _AddAssessmentDetailsState extends State { child: TextField( decoration: textFieldSelectorDecoration( "Name / ICD", - widget.mySelectedAssessment.selectedICD != - null + widget.mySelectedAssessment + .selectedDiagnosisType != + null ? widget.mySelectedAssessment - .selectedICD.nameEn + .selectedDiagnosisType.nameEn : null, true), enabled: false, From 14955201a91267b7fca536db0902fd31ea6955cf Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 11:10:45 +0200 Subject: [PATCH 10/20] fix things --- .../profile/SOAP/assessment_page.dart | 42 ++++++++++------- .../patients/profile/SOAP/objective_page.dart | 5 +- .../SOAP/subjective/subjective_page.dart | 47 +++++++++++++++---- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index edb2f608..0e7a6b41 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -308,28 +308,34 @@ class _AssessmentPageState extends State { } submitAssessment(SOAPViewModel model) async { - PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - icdCodeDetails: [new IcdCodeDetails( - remarks: widget.mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: widget.mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: widget.mySelectedAssessment.selectedDiagnosisType.id , - icdcode10Id: "1" - )] - ); + if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && + widget.mySelectedAssessment.selectedDiagnosisType != null) { + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + icdCodeDetails: [ + new IcdCodeDetails( + remarks: widget.mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + widget.mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + widget.mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: "1") + ]); - await model.postAssessment(postAssessmentRequestModel); + await model.postAssessment(postAssessmentRequestModel); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(3); + } } else { - widget.changePageViewIndex(3); + helpers.showErrorToast('Please add required field correctly'); } - } openAssessmentDialog(BuildContext context) { diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index add9ca16..6b8a4661 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -352,11 +352,12 @@ class _ObjectivePageState extends State { if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); } else { + widget.changePageViewIndex(2); } + } else { + helpers.showErrorToast('Please add required field correctly'); } - // TODO move it back to else stat when it work. - widget.changePageViewIndex(2); } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index 9100cb76..c45ca457 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -277,13 +277,45 @@ class _SubjectivePageState extends State { {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - await postChiefComplaint(model: model); - if (myHistoryList.length != 0) - await postHistories(model: model, myHistoryList: myHistoryList); - if (myAllergiesList.length != 0) - await postAllergy(myAllergiesList: myAllergiesList, model: model); + formKey.currentState.save(); + 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 { + 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); } postAllergy( @@ -362,9 +394,6 @@ class _SubjectivePageState extends State { await model.postChiefComplaint(postChiefComplaintRequestModel); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } } } From 78e2c662c84994a517d5b5a9cc1a46287442a7fc Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 30 Dec 2020 11:33:19 +0200 Subject: [PATCH 11/20] finish vital sign feature, and adding makeReferralResponse --- lib/config/config.dart | 3 +++ .../patient-doctor-referral-service.dart | 25 +++++++++++++++++++ .../viewModel/patient-referral-viewmodel.dart | 10 ++++++++ .../referral/my-referral-detail-screen.dart | 8 ++++-- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e5ed9690..4a4a2d1c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -68,6 +68,9 @@ const GET_PENDING_REFERRAL_PATIENT = const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; +const RESPONSE_PENDING_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/CreateReferral'; + const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index ad108c3b..a15ed05a 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -162,6 +162,31 @@ class PatientReferralService extends LookupService { ); } + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + hasError = false; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + Map body = Map(); + body['IsAccepted'] = isAccepted; + body['AppointmentNo'] = pendingReferral.sourceAppointmentNo; + body['PatientMRN'] = pendingReferral.patientID; + body['PatientName'] = pendingReferral.patientName; + body['ReferralResponse'] = pendingReferral.remarksFromSource; + body['SetupID'] = pendingReferral.sourceSetupID; + body['DoctorName'] = doctorProfile.doctorName; + + await baseAppClient.post( + RESPONSE_PENDING_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + Future makeReferral( PatientArrivalEntity patientArrivalEntity, String isoStringDate, diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 6fa72f6f..9662a910 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -107,6 +107,16 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + setState(ViewState.Busy); + await _referralPatientService.responseReferral(pendingReferral, isAccepted); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getPatientArrivalList(String date) async { setState(ViewState.Busy); await _referralPatientService.getPatientArrivalList(date); diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 5f38f190..4c9d41e0 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -119,7 +119,9 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: null, + handler: (){ + model.responseReferral(pendingReferral, true); + }, ), ), SizedBox( @@ -133,7 +135,9 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: null, + handler: (){ + model.responseReferral(pendingReferral, false); + }, ), ), ], From 4e8de52efe7e5e30aaf72a832a560365c0035d7a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 11:48:59 +0200 Subject: [PATCH 12/20] add commented code --- .../profile/SOAP/assessment_page.dart | 57 ++++++++------- .../patients/profile/SOAP/objective_page.dart | 73 ++++++++++--------- .../SOAP/subjective/subjective_page.dart | 73 ++++++++++--------- 3 files changed, 105 insertions(+), 98 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 0e7a6b41..8fa73630 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -308,34 +308,35 @@ class _AssessmentPageState extends State { } submitAssessment(SOAPViewModel model) async { - if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && - widget.mySelectedAssessment.selectedDiagnosisType != null) { - PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - icdCodeDetails: [ - new IcdCodeDetails( - remarks: widget.mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: - widget.mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: - widget.mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: "1") - ]); - - await model.postAssessment(postAssessmentRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changePageViewIndex(3); - } - } else { - helpers.showErrorToast('Please add required field correctly'); - } + // if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && + // widget.mySelectedAssessment.selectedDiagnosisType != null) { + // PostAssessmentRequestModel postAssessmentRequestModel = + // new PostAssessmentRequestModel( + // patientMRN: 3120690, + // episodeId: 200012117, + // appointmentNo: 2016054573, + // icdCodeDetails: [ + // new IcdCodeDetails( + // remarks: widget.mySelectedAssessment.remark, + // complexDiagnosis: true, + // conditionId: + // widget.mySelectedAssessment.selectedDiagnosisCondition.id, + // diagnosisTypeId: + // widget.mySelectedAssessment.selectedDiagnosisType.id, + // icdcode10Id: "1") + // ]); + // + // await model.postAssessment(postAssessmentRequestModel); + // + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(3); + // } + // } else { + // helpers.showErrorToast('Please add required field correctly'); + // } + widget.changePageViewIndex(3); } openAssessmentDialog(BuildContext context) { diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 6b8a4661..8d12e1c9 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -320,43 +320,46 @@ class _ObjectivePageState extends State { } submitObjectivePage(SOAPViewModel model) async { - if(widget.mySelectedExamination.isNotEmpty){ - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + // if(widget.mySelectedExamination.isNotEmpty){ + // PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + // widget.mySelectedExamination.forEach((exam) { + // if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + // null) + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + // + // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + // ListHisProgNotePhysicalExaminationVM( + // patientMRN: 3120690, + // episodeId: 200012117, + // appointmentNo: 2016054573, + // remarks: exam.remark ?? '', + // createdBy: 1485, + // createdOn: DateTime.now().toIso8601String(), + // editedBy: 1485, + // editedOn: DateTime.now().toIso8601String(), + // examId: exam.selectedExamination.id, + // examType: exam.selectedExamination.typeId, + // isAbnormal: exam.isAbnormal, + // isNormal: exam.isNormal, + // masterDescription: exam.selectedExamination, + // notExamined: false + // + // )); + // }); + // + // await model.postPhysicalExam(postPhysicalExamRequestModel); + // + // if (model.state == ViewState.ErrorLocal) { + // helpers.showErrorToast(model.error); + // } else { + // widget.changePageViewIndex(2); + // } + // } else { + // helpers.showErrorToast('Please add required field correctly'); + // } - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - ListHisProgNotePhysicalExaminationVM( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - remarks: exam.remark ?? '', - createdBy: 1485, - createdOn: DateTime.now().toIso8601String(), - editedBy: 1485, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false + widget.changePageViewIndex(2); - )); - }); - - await model.postPhysicalExam(postPhysicalExamRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changePageViewIndex(2); - } - } else { - helpers.showErrorToast('Please add required field correctly'); - } } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index c45ca457..80246166 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -279,42 +279,45 @@ class _SubjectivePageState extends State { List myHistoryList}) async { formKey.currentState.save(); 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 { - 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); + + // 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 { + // 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'); + // } } From 2f273dcde8cdb9f38a335dd2796ea58c0ac807a3 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 12:58:13 +0200 Subject: [PATCH 13/20] add ICD10 --- lib/models/SOAP/master_key_model.dart | 16 ++++----- lib/routes.dart | 3 ++ .../patients/profile/SOAP/add_SOAP_index.dart | 3 ++ .../profile/SOAP/assessment_page.dart | 20 +++++------ .../SOAP/subjective/subjective_page.dart | 10 ------ .../profile/profile_medical_info_widget.dart | 8 +++++ .../shared/dialogs/master_key_dailog.dart | 35 ++++++++++++------- 7 files changed, 54 insertions(+), 41 deletions(-) diff --git a/lib/models/SOAP/master_key_model.dart b/lib/models/SOAP/master_key_model.dart index 79615f82..a1c32039 100644 --- a/lib/models/SOAP/master_key_model.dart +++ b/lib/models/SOAP/master_key_model.dart @@ -1,18 +1,18 @@ class MasterKeyModel { String alias; String aliasN; - int code; - Null description; - Null detail1; - Null detail2; - Null detail3; - Null detail4; - Null detail5; + dynamic code; + dynamic description; + dynamic detail1; + dynamic detail2; + dynamic detail3; + dynamic detail4; + dynamic detail5; int groupID; int id; String nameAr; String nameEn; - Null remarks; + dynamic remarks; int typeId; String valueList; diff --git a/lib/routes.dart b/lib/routes.dart index 3fbec294..8412f055 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -79,6 +79,7 @@ const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String CREATE_EPISODE = 'patients/create-episode'; +const String UPDATE_EPISODE = 'patients/create-episode'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -89,6 +90,7 @@ const String ORDER_PROCEDURE = 'procedure/procedure'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; const String ADD_SICKLEAVE = 'add-sickleave'; +//todo: change the routing way. var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -122,6 +124,7 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), CREATE_EPISODE: (_) => AddSOAPIndex(), + UPDATE_EPISODE: (_) => AddSOAPIndex(isUpdate: true,), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index a6f792c8..e06e8033 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -22,6 +22,9 @@ import '../patient_profile_widget.dart'; import 'steps_widget.dart'; class AddSOAPIndex extends StatefulWidget { + final bool isUpdate; + + const AddSOAPIndex({Key key, this.isUpdate}) : super(key: key); @override _AddSOAPIndexState createState() => _AddSOAPIndexState(); } diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 8fa73630..22778913 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -416,10 +416,9 @@ class _AddAssessmentDetailsState extends State { if (model.listOfDiagnosisType.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisType); } - // todo return it back when service is fixed. - // if (model.listOfICD10.length == 0) { - // await model.getMasterLookup(MasterKeysService.ICD10); - // } + if (model.listOfICD10.length == 0) { + await model.getMasterLookup(MasterKeysService.ICD10); + } }, builder: (_, model, w) => AppScaffold( @@ -469,13 +468,14 @@ class _AddAssessmentDetailsState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.listOfDiagnosisType != null + onTap: model.listOfICD10 != null ? () { MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, + isICD: true, + list: model.listOfICD10, selectedValue: widget .mySelectedAssessment - .selectedDiagnosisType, + .selectedICD, okText: TranslationBase .of(context) .ok, @@ -483,7 +483,7 @@ class _AddAssessmentDetailsState extends State { (MasterKeyModel selectedValue) { setState(() { widget.mySelectedAssessment - .selectedDiagnosisType = + .selectedICD = selectedValue; }); }, @@ -501,10 +501,10 @@ class _AddAssessmentDetailsState extends State { decoration: textFieldSelectorDecoration( "Name / ICD", widget.mySelectedAssessment - .selectedDiagnosisType != + .selectedICD != null ? widget.mySelectedAssessment - .selectedDiagnosisType.nameEn + .selectedICD.nameEn : null, true), enabled: false, diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index 80246166..d4ed9c86 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -168,11 +168,6 @@ class _SubjectivePageState extends State { variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : false, color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) ], ), InkWell( @@ -214,11 +209,6 @@ class _SubjectivePageState extends State { variant: isAllergiesExpand ? "bodyText" : '', bold: isAllergiesExpand ? true : false, color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) ], ), InkWell( diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 9b70ae3a..446db0ac 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -18,6 +18,7 @@ import 'PatientProfileButton.dart'; *@desc: Profile Medical Info Widget */ class ProfileMedicalInfoWidget extends StatelessWidget { + ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); PatiantInformtion patient; @override @@ -35,6 +36,13 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: "Episode", route: CREATE_EPISODE, icon: 'heartbeat.png'), + PatientProfileButton( + key: key, + patient: patient, + nameLine1: "Update", + nameLine2: "Episode", + route: CREATE_EPISODE, + icon: 'heartbeat.png'), PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index 42d766e7..a3be364b 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -7,12 +7,15 @@ class MasterKeyDailog extends StatefulWidget { final List list; final okText; final Function(MasterKeyModel) okFunction; - MasterKeyModel selectedValue; + MasterKeyModel selectedValue; + final bool isICD; MasterKeyDailog( {@required this.list, @required this.okText, - @required this.okFunction, this.selectedValue}); + @required this.okFunction, + this.selectedValue, + this.isICD = false}); @override _MasterKeyDailogState createState() => _MasterKeyDailogState(); @@ -63,17 +66,23 @@ class _MasterKeyDailogState extends State { children: [ ...widget.list .map((item) => RadioListTile( - title: Text(item.nameEn.toString()), - groupValue: widget.selectedValue.id.toString(), - value: item.id.toString(), - activeColor: Colors.blue.shade700, - selected: item.id.toString() == widget.selectedValue.id.toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) + title: Text( + '${item.nameEn}' + (widget.isICD ? '/${item.code}' : '')), + groupValue: widget.isICD + ? widget.selectedValue.code.toString() + : widget.selectedValue.id.toString(), + value: widget.isICD ? widget.selectedValue.code.toString() : item + .id.toString(), + activeColor: Colors.blue.shade700, + selected: widget.isICD ? item.code.toString() == + widget.selectedValue.code.toString() : item.id.toString() == + widget.selectedValue.id.toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) .toList() ], ), From fc82665f1b84d0e1dcfce5527cc2adf10d8508b1 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 15:37:21 +0200 Subject: [PATCH 14/20] add ICD10 --- lib/widgets/patients/profile/SOAP/assessment_page.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 22778913..6d5aa7d3 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -416,9 +416,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( @@ -468,11 +468,11 @@ class _AddAssessmentDetailsState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.listOfICD10 != null + onTap: model.listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( isICD: true, - list: model.listOfICD10, + list: model.listOfDiagnosisType, selectedValue: widget .mySelectedAssessment .selectedICD, From 04ed76069c46a73517beb95330c7dcdcc8d73de4 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 30 Dec 2020 15:39:05 +0200 Subject: [PATCH 15/20] hack login --- lib/client/base_app_client.dart | 36 ++--- lib/core/viewModel/project_view_model.dart | 22 +-- lib/root_page.dart | 2 +- lib/screens/dashboard_screen.dart | 125 +++++++++--------- .../profile/profile-welcome-widget.dart | 7 +- 5 files changed, 99 insertions(+), 93 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index eacf3e8d..f9f683b8 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -36,20 +36,21 @@ class BaseAppClient { }) async { String url = BASE_URL + endPoint; try { - 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 ?? ''; + //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 ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -63,9 +64,10 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; + //await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaRefreshTokenID'] ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; + //await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 267f823a..1448fb47 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -101,7 +101,7 @@ class ProjectViewModel with ChangeNotifier { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: {}); + }, body: Map()); return Future.value(localRes); } catch (error) { @@ -111,18 +111,18 @@ class ProjectViewModel with ChangeNotifier { } void getProfile() async { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: doctorProfile.clinicID, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); + // ProfileReqModel docInfo = new ProfileReqModel( + // doctorID: doctorProfile.doctorID, + // clinicID: doctorProfile.clinicID, + // license: true, + // projectID: doctorProfile.projectID, + // tokenID: '', + // languageID: 2); Provider.of(AppGlobal.CONTEX, listen: false) - .getDocProfiles(docInfo.toJson()) + .getDocProfiles(ProfileReqModel().toJson()) .then((res) async { sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); }).catchError((err) { diff --git a/lib/root_page.dart b/lib/root_page.dart index fe35a246..0f44dc4d 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 Loginsreen(); + return LandingPage(); break; case APP_STATUS.AUTHENTICATED: return LandingPage(); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b6bbc6cf..c55b5afa 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -115,68 +115,69 @@ class _DashboardScreenState extends State { SizedBox( height: 4, ), - 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, - )), - ), - ], - ), - ]), - ), + //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, + // )), + // ), + // ], + // ), + // ]), + // ), ], ), ]), diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index fae705f4..90141080 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -43,7 +43,8 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - 'Dr. ${authProvider.doctorProfile.doctorName}', + //TODO change it edit By Jammal + 'Dr. ',//${authProvider.doctorProfile.doctorName}', fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, color: Colors.white, @@ -71,7 +72,9 @@ final double height; height: 50, width: 60, child: Image.network( - authProvider.doctorProfile.doctorImageURL, + //TODO change it edit By Jammal + 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg' + // authProvider.doctorProfile.doctorImageURL, // fit: BoxFit.fill, ), ), From 9d8514c83ba2861862653f3123578079ad53aaea Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 30 Dec 2020 15:49:05 +0200 Subject: [PATCH 16/20] post prescription --- lib/config/config.dart | 2 +- .../model/post_prescrition_req_model.dart | 38 +++--- .../model/procedure/categories_procedure.dart | 86 +++++++++++- lib/core/service/prescription_service.dart | 9 +- lib/core/service/procedure_service.dart | 35 ++--- .../viewModel/prescription_view_model.dart | 5 +- .../prescription/add_prescription_form.dart | 67 +++++++++- .../prescription/prescription_screen.dart | 4 +- lib/screens/procedures/procedure_screen.dart | 125 ++++++++++-------- 9 files changed, 259 insertions(+), 112 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d3728ddf..b8509f66 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -128,7 +128,7 @@ const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const GET_CATEGORISE_PROCEDURE = - 'Services/DoctorApplication.svc/REST/GetCategories'; + 'Services/DoctorApplication.svc/REST/GetProcedure'; var selectedPatientType = 1; diff --git a/lib/core/model/post_prescrition_req_model.dart b/lib/core/model/post_prescrition_req_model.dart index 892854aa..6fc71199 100644 --- a/lib/core/model/post_prescrition_req_model.dart +++ b/lib/core/model/post_prescrition_req_model.dart @@ -7,12 +7,11 @@ class PostPrescriptionReqModel { List prescriptionRequestModel; PostPrescriptionReqModel( - {this.vidaAuthTokenID = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiYTYxZjAyZjItNzUwZS00MTZkLWEzOTQtZTRjZmViZGVjMDE5IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUzNTIiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODUzMDAyNywiZXhwIjoxNjA5Mzk0MDI3LCJpYXQiOjE2MDg1MzAwMjd9.M1NTREPgz5vQH_GTZ_KGb0xQW5HEDs47AtNR3jbqnms", - this.clinicID = 1, - this.episodeID = 200012117, - this.appointmentNo = 2016054573, - this.patientMRN = 3120690, + {this.vidaAuthTokenID, + this.clinicID, + this.episodeID, + this.appointmentNo, + this.patientMRN, this.prescriptionRequestModel}); PostPrescriptionReqModel.fromJson(Map json) { @@ -58,19 +57,20 @@ class PrescriptionRequestModel { String remarks; String icdcode10Id; - PrescriptionRequestModel( - {this.itemId = 4, - this.doseStartDate = "2020-12-20T13:07:41.769Z", - this.duration = 2, - this.dose = 1, - this.doseUnitId = 1, - this.route = 1, - this.frequency = 1, - this.doseTime = 1, - this.covered = true, - this.approvalRequired = true, - this.remarks = "test1", - this.icdcode10Id = "test3"}); + PrescriptionRequestModel({ + this.itemId, + this.doseStartDate, + this.duration, + this.dose, + this.doseUnitId, + this.route, + this.frequency, + this.doseTime, + this.covered, + this.approvalRequired, + this.remarks, + this.icdcode10Id, + }); PrescriptionRequestModel.fromJson(Map json) { itemId = json['itemId']; diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart index e7a7fd40..074d8a1b 100644 --- a/lib/core/model/procedure/categories_procedure.dart +++ b/lib/core/model/procedure/categories_procedure.dart @@ -1,18 +1,90 @@ class CategoriseProcedureModel { - String categoryID; - String categoryName; + List entityList; + int rowcount; + dynamic statusMessage; - CategoriseProcedureModel({this.categoryID, this.categoryName}); + CategoriseProcedureModel( + {this.entityList, this.rowcount, this.statusMessage}); CategoriseProcedureModel.fromJson(Map json) { - categoryID = json['CategoryID']; - categoryName = json['CategoryName']; + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + bool allowedClinic; + String category; + String categoryID; + String genderValidation; + String group; + String orderedValidation; + dynamic price; + String procedureId; + String procedureName; + String specialPermission; + String subGroup; + String template; + + EntityList( + {this.allowedClinic, + this.category, + this.categoryID, + this.genderValidation, + this.group, + this.orderedValidation, + this.price, + this.procedureId, + this.procedureName, + this.specialPermission, + this.subGroup, + this.template}); + + EntityList.fromJson(Map json) { + allowedClinic = json['allowedClinic']; + category = json['category']; + categoryID = json['categoryID']; + genderValidation = json['genderValidation']; + group = json['group']; + orderedValidation = json['orderedValidation']; + price = json['price']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + specialPermission = json['specialPermission']; + subGroup = json['subGroup']; + template = json['template']; } Map toJson() { final Map data = new Map(); - data['CategoryID'] = this.categoryID; - data['CategoryName'] = this.categoryName; + data['allowedClinic'] = this.allowedClinic; + data['category'] = this.category; + data['categoryID'] = this.categoryID; + data['genderValidation'] = this.genderValidation; + data['group'] = this.group; + data['orderedValidation'] = this.orderedValidation; + data['price'] = this.price; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['specialPermission'] = this.specialPermission; + data['subGroup'] = this.subGroup; + data['template'] = this.template; return data; } } diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index d51fcc3e..65e74dda 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -30,19 +30,20 @@ class PrescriptionService extends BaseService { }, body: _prescriptionReqModel.toJson()); } - Future postPrescription() async { + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; //_prescriptionList.clear(); await baseAppClient.post( - GET_CATEGORISE_PROCEDURE, + POST_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { - _prescriptionList - .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, + body: postProcedureReqModel.toJson(), ); } } diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index fdc18003..7ffd9310 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -13,11 +13,6 @@ class ProcedureService extends BaseService { List get categoriesList => _categoriesList; List procedureslist = List(); - Procedures t1 = Procedures( - category: '02', - procedure: '02011002', - ); - GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( clinicId: 0, pageSize: 10, @@ -29,8 +24,17 @@ class ProcedureService extends BaseService { search: ["lab"], ); + GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel( + clinicId: 0, + pageSize: 100, + pageIndex: 1, + patientMRN: 0, + //categoryId: null, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", - PostProcedureReqModel _postProcedureReqModel = PostProcedureReqModel(); + search: ["lab"], + ); Future getProcedure() async { hasError = false; @@ -47,17 +51,14 @@ class ProcedureService extends BaseService { Future getCategories() async { hasError = false; _categoriesList.clear(); - await baseAppClient.post( - GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['listCategories'])); - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - ); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + _categoriesList + .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getProcedureCategoriseReqModel.toJson()); } Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 4ab4b3f7..6c3fe7b2 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -24,11 +24,12 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postPrescription() async { + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _prescriptionService.postPrescription(); + await _prescriptionService.postPrescription(postProcedureReqModel); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 40704009..5782a166 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -1,7 +1,12 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; 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/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; @@ -10,6 +15,8 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; void addPrescriptionForm(context) { + TextEditingController durationController = TextEditingController(); + TextEditingController doseController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; showModalBottomSheet( @@ -122,6 +129,7 @@ void addPrescriptionForm(context) { borderColor: Colors.white, textInputType: TextInputType.number, inputFormatter: ONLY_NUMBERS, + controller: doseController, ), ), SizedBox(height: spaceBetweenTextFileds), @@ -160,11 +168,18 @@ void addPrescriptionForm(context) { border: Border.all( width: 1.0, color: HexColor("#CCCCCC"))), child: AppTextFormField( - labelText: TranslationBase.of(context).duration, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), + labelText: TranslationBase.of(context).duration, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + controller: durationController, + validator: (value) { + if (value == null || value == "") + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), ), SizedBox(height: spaceBetweenTextFileds), Container( @@ -192,8 +207,11 @@ void addPrescriptionForm(context) { title: TranslationBase.of(context).addMedication, onPressed: () { + //prescriptionWarning(context); + postProcedure( + duration: durationController.text, + dose: doseController.text); Navigator.pop(context); - prescriptionWarning(context); }, ), ], @@ -210,3 +228,40 @@ void addPrescriptionForm(context) { ); }); } + +postProcedure({String duration, String dose}) async { + PrescriptionViewModel model = new PrescriptionViewModel(); + PostPrescriptionReqModel postProcedureReqModel = + new PostPrescriptionReqModel(); + List sss = List(); + + postProcedureReqModel.appointmentNo = 2016055175; + postProcedureReqModel.clinicID = 1; + postProcedureReqModel.episodeID = 200012335; + postProcedureReqModel.patientMRN = 1234; + postProcedureReqModel.vidaAuthTokenID = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY"; + sss.add(PrescriptionRequestModel( + covered: true, + dose: int.parse(dose), + itemId: 8, + doseUnitId: 1, + route: 1, + frequency: 1, + remarks: "test2", + approvalRequired: true, + icdcode10Id: "test2", + doseTime: 1, + duration: int.parse(duration), + doseStartDate: "2020-12-20T13:07:41.769Z")); + postProcedureReqModel.prescriptionRequestModel = sss; + //postProcedureReqModel.procedures = controlsProcedure; + + await model.postPrescription(postProcedureReqModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast('Medication has been added'); + } +} diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index e29bcefc..742cfad8 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -111,7 +111,7 @@ class _NewPrescriptionScreenState extends State { InkWell( onTap: () { addPrescriptionForm(context); - model.postPrescription(); + //model.postPrescription(); }, child: CircleAvatar( radius: 65, @@ -195,7 +195,7 @@ class _NewPrescriptionScreenState extends State { ), onTap: () { addPrescriptionForm(context); - model.postPrescription(); + //model.postPrescription(); }, ), SizedBox( diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 59cf5bdf..5b6b10f3 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -414,65 +414,82 @@ void addSelectedProcedure(context) { context: context, builder: (BuildContext bc) { return BaseView( - //onModelReady: (model) => model.getCategories(), + onModelReady: (model) => model.getCategories(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => - SingleChildScrollView( - child: Container( - height: 490, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Select Procedure'.toUpperCase(), - fontWeight: FontWeight.w900, - ), - // Text(model.categoriesList[0].categoryName), - SizedBox( - height: 9.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + height: 490, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + if (model.categoriesList.length != 0) Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: 'Add Delected Procedures'.toUpperCase(), - borderColor: Colors.white, - textInputType: TextInputType.text, - inputFormatter: ONLY_LETTERS, - controller: procedureController, - ), + height: 120.0, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.categoriesList[0].rowcount, + itemBuilder: (BuildContext ctxt, int index) { + return Container( + child: AppText(model.categoriesList[0] + .entityList[index].procedureName), + ); + }), ), - SizedBox( - height: 280.0, - ), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: - TranslationBase.of(context).addMedication, - onPressed: () { - Navigator.pop(context); - postProcedure(); - }, - ), - ], + SizedBox( + height: 0.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: + 'Add Delected Procedures'.toUpperCase(), + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + controller: procedureController, + ), ), - ), - ], - ) - ], + SizedBox( + height: 80.0, + ), + Container( + margin: + EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: + TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + postProcedure(); + }, + ), + ], + ), + ), + ], + ) + ], + ), ), ), ), From df4eb940426fb9b90881a9606a689e8f61772dbd Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 15:52:03 +0200 Subject: [PATCH 17/20] work with patient model --- lib/models/patient/patiant_info_model.dart | 203 ++++++++++++--------- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 2b2fd876..f1a53d8b 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,98 +1,112 @@ -import 'dart:convert'; - -//PatiantInformtion patiantInformtionFromJson(String str) => PatiantInformtion.fromJson(json.decode(str)); - -////String patiantInformtionToJson(PatiantInformtion data) => json.encode(data.toJson()); -//****************************** */ - -/* - *@author: Amjad Amireh - *@Date:27/4/2020 - *@param: - *@return:Patian information Model - - *@desc: - */ +// TODO : it have to be changed. class PatiantInformtion { final List list; - int projectId; - int clinicId; - int doctorId; - int patientId; - String doctorName; - String doctorNameN; - String firstName; - String middleName; - String lastName; - String firstNameN; - String middleNameN; - String lastNameN; - int gender; - String dateofBirth; - String nationalityId; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomId; - String bedId; - String nursingStationId; - String description; - String clinicDescription; - String clinicDescriptionN; - String nationalityName; - String nationalityNameN; - String age; - String genderDescription; - String nursingStationName; - String appointmentDate; - String startTime; - - PatiantInformtion({ - this.list, - this.projectId, - this.clinicId, - this.doctorId, - this.patientId, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.nationalityId, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.roomId, - this.bedId, - this.nursingStationId, - this.description, - this.clinicDescription, - this.clinicDescriptionN, - this.nationalityName, - this.nationalityNameN, - this.age, - this.genderDescription, - this.nursingStationName, - this.appointmentDate, - this.startTime, + int genderInt; + String age; + String appointmentDate; + int appointmentNo; + String appointmentType; + String arrivedOn; + int clinicGroupId; + String companyName; + Null dischargeStatus; + Null doctorDetails; + int doctorId; + String endTime; + int episodeNo; + int fallRiskScore; + bool isSigned; + int medicationOrders; + String mobileNumber; + String nationality; + int projectId; + int clinicId; + int patientId; + String doctorName; + String doctorNameN; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int gender; + String dateofBirth; + String nationalityId; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomId; + String bedId; + String nursingStationId; + String description; + String clinicDescription; + String clinicDescriptionN; + String nationalityName; + String nationalityNameN; + String genderDescription; + String nursingStationName; + String startTime; - }); + PatiantInformtion({ + this.list, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + this.appointmentDate, + this.startTime, + this.appointmentNo, + this.appointmentType, + this.arrivedOn, + this.clinicGroupId, + this.companyName, + this.dischargeStatus, + this.doctorDetails, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.genderInt, + this.isSigned, + this.medicationOrders, + this.nationality, + }); - factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( + factory PatiantInformtion.fromJson(Map json) => + PatiantInformtion( projectId: json["ProjectID"], clinicId: json["ClinicID"], doctorId: json["DoctorID"], @@ -127,6 +141,19 @@ class PatiantInformtion { nursingStationName: json["NursingStationName"], appointmentDate: json["AppointmentDate"]?? '', startTime: json["StartTime"], + appointmentNo :json['appointmentNo'], + appointmentType :json['appointmentType'], + arrivedOn :json['arrivedOn'], + clinicGroupId :json['clinicGroupId'], + companyName :json['companyName'], + dischargeStatus :json['dischargeStatus'], + doctorDetails :json['doctorDetails'], + endTime :json['endTime'], + episodeNo :json['episodeNo'], + fallRiskScore :json['fallRiskScore'], + isSigned :json['isSigned'], + medicationOrders :json['medicationOrders'], + nationality :json['nationality'], ); From 806682b9214863546bc3d011043f868176b8da28 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 30 Dec 2020 16:03:54 +0200 Subject: [PATCH 18/20] hack login --- .../patients/patient_search_screen.dart | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 9de384b6..b8dfe225 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -71,28 +71,28 @@ class _PatientSearchScreenState extends State { //==================== //_selectedType=='3'? //===================== - - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); + // + // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = + // new DoctorProfileModel.fromJson(profile); if (_formKey.currentState.validate()) { _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()); + // 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, From 61209663f3660dd85021d365a85358aaf5388e8e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 18:26:51 +0200 Subject: [PATCH 19/20] Finish arrived --- lib/core/viewModel/patient_view_model.dart | 2 +- lib/models/patient/patiant_info_model.dart | 60 +++++++++++----------- lib/screens/patients/patients_screen.dart | 9 +++- 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index a1221266..9672da83 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -49,7 +49,7 @@ class PatientViewModel extends BaseViewModel { List get referralFrequencyList => _patientService.referalFrequancyList; - Future getPatientList(PatientModel patient, patientType, + Future getPatientList( patient, patientType, {bool isBusyLocal = false}) async { if (isBusyLocal) { setState(ViewState.BusyLocal); diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index f1a53d8b..d1f10ce0 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -107,36 +107,36 @@ class PatiantInformtion { factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( - projectId: json["ProjectID"], - clinicId: json["ClinicID"], - doctorId: json["DoctorID"], - patientId: json["PatientID"], - doctorName: json["DoctorName"], - doctorNameN: json["DoctorNameN"], - firstName: json["FirstName"], - middleName: json["MiddleName"], - lastName: json["LastName"], - firstNameN: json["FirstNameN"], - middleNameN: json["MiddleNameN"], - lastNameN: json["LastNameN"], - gender: json["Gender"], - dateofBirth: json["DateofBirth"], - nationalityId: json["NationalityID"], - mobileNumber: json["MobileNumber"], - emailAddress: json["EmailAddress"], - patientIdentificationNo: json["PatientIdentificationNo"], - patientType: json["PatientType"], - admissionNo: json["AdmissionNo"], - admissionDate: json["AdmissionDate"], - roomId: json["RoomID"], - bedId: json["BedID"], - nursingStationId: json["NursingStationID"], - description: json["Description"], - clinicDescription: json["ClinicDescription"], - clinicDescriptionN: json["ClinicDescriptionN"], - nationalityName: json["NationalityName"], - nationalityNameN: json["NationalityNameN"], - age: json["Age"], + projectId: json["ProjectID"] ?? json["projectID"], + clinicId: json["ClinicID"]?? json["clinicID"], + doctorId: json["DoctorID"]?? json["doctorID"], + patientId: json["PatientID"]?? json["patientID"], + doctorName: json["DoctorName"]?? json["doctorName"], + doctorNameN: json["DoctorNameN"]?? json["doctorNameN"], + firstName: json["FirstName"]?? json["firstName"], + middleName: json["MiddleName"]?? json["middleName"], + lastName: json["LastName"]?? json["lastName"], + firstNameN: json["FirstNameN"]?? json["firstNameN"], + middleNameN: json["MiddleNameN"]?? json["middleNameN"], + lastNameN: json["LastNameN"]?? json["lastNameN"], + gender: json["Gender"]?? json["gender"], + dateofBirth: json["DateofBirth"]?? json["dob"], + nationalityId: json["NationalityID"]?? json["nationalityID"], + mobileNumber: json["MobileNumber"]?? json["mobileNumber"], + emailAddress: json["EmailAddress"]?? json["emailAddress"], + patientIdentificationNo: json["PatientIdentificationNo"]?? json["patientIdentificationNo"], + patientType: json["PatientType"]?? json["patientType"], + admissionNo: json["AdmissionNo"]?? json["admissionNo"], + admissionDate: json["AdmissionDate"]?? json["admissionDate"], + roomId: json["RoomID"]?? json["roomID"], + bedId: json["BedID"]?? json["bedID"], + nursingStationId: json["NursingStationID"]?? json["nursingStationID"], + description: json["Description"]?? json["description"], + clinicDescription: json["ClinicDescription"]?? json["clinicDescription"], + clinicDescriptionN: json["ClinicDescriptionN"]?? json["clinicDescriptionN"], + nationalityName: json["NationalityName"]?? json["nationalityName"], + nationalityNameN: json["NationalityNameN"]?? json["nationalityNameN"], + age: json["Age"]?? json["age"], genderDescription: json["GenderDescription"], nursingStationName: json["NursingStationName"], appointmentDate: json["AppointmentDate"]?? '', diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 85c0947c..cb0c7248 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -282,7 +282,14 @@ class _PatientsScreenState extends State { _isLoading = false; this.error = error.toString(); } else { - lItems = res[SERVICES_PATIANT2[val2]]["entityList"]; + + var localList=[]; + res["patientArrivalList"]["entityList"].forEach((v) { + Map mergedPatient= {...v,...v["patientDetails"]}; + localList.add(mergedPatient); + }); + print(localList.toString()); + lItems = localList;//res[SERVICES_PATIANT2[val2]]["entityList"]; } } else { lItems = res[SERVICES_PATIANT2[val2]]; From 05e77625332396e7bd20c8e464c6a8bbc979ce0a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 30 Dec 2020 23:13:35 +0200 Subject: [PATCH 20/20] fix obj page --- lib/client/base_app_client.dart | 3 +- lib/config/config.dart | 10 +- lib/core/service/SOAP_service.dart | 6 +- lib/models/patient/patiant_info_model.dart | 4 +- .../patients/patient_search_screen.dart | 17 ++- lib/util/translations_delegate_base.dart | 2 +- .../patients/profile/SOAP/add_SOAP_index.dart | 31 +++-- .../profile/SOAP/assessment_page.dart | 61 +++++----- .../patients/profile/SOAP/objective_page.dart | 76 ++++++------ .../patients/profile/SOAP/plan_page.dart | 10 +- .../SOAP/subjective/subjective_page.dart | 108 ++++++++++-------- .../profile/patient_profile_widget.dart | 2 +- 12 files changed, 179 insertions(+), 151 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index fe2723df..c68f9522 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -64,7 +64,8 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; + body['VidaAuthTokenID'] = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; //await sharedPref.getString(VIDA_AUTH_TOKEN_ID); body['VidaRefreshTokenID'] ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU"; //await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); diff --git a/lib/config/config.dart b/lib/config/config.dart index 08417a05..1a13d7e9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -123,12 +123,12 @@ const GET_PATIENT_ARRIVAL_LIST = const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; -const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; -const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = - 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const PATCH_ALLERGY = 'Services/DoctorApplication.svc/REST/PatchAllergies'; +const PATCH_HISTORY = 'Services/DoctorApplication.svc/REST/PatchHistory'; +const PATCH_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/PatchChiefcomplaint'; const POST_PHYSICAL_EXAM = - 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; + 'Services/DoctorApplication.svc/REST/PatchPhysicalExam'; const POST_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/PostProgressNote'; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 3219ef6a..45777511 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -31,7 +31,7 @@ class SOAPService extends LookupService { Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { hasError = false; - await baseAppClient.post(POST_ALLERGY, + await baseAppClient.post(PATCH_ALLERGY, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { @@ -43,7 +43,7 @@ class SOAPService extends LookupService { Future postHistories( PostHistoriesRequestModel postHistoriesRequestModel) async { hasError = false; - await baseAppClient.post(POST_HISTORY, + await baseAppClient.post(PATCH_HISTORY, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { @@ -55,7 +55,7 @@ class SOAPService extends LookupService { Future postChiefComplaint( PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { hasError = false; - await baseAppClient.post(POST_CHIEF_COMPLAINT, + await baseAppClient.post(PATCH_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index d1f10ce0..e5b89cfa 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -39,6 +39,7 @@ class PatiantInformtion { String emailAddress; String patientIdentificationNo; int patientType; + int patientMRN; String admissionNo; String admissionDate; String roomId; @@ -102,7 +103,7 @@ class PatiantInformtion { this.genderInt, this.isSigned, this.medicationOrders, - this.nationality, + this.nationality,this.patientMRN }); factory PatiantInformtion.fromJson(Map json) => @@ -154,6 +155,7 @@ class PatiantInformtion { isSigned :json['isSigned'], medicationOrders :json['medicationOrders'], nationality :json['nationality'], + patientMRN :json['patientMRN'], ); diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index aa8d7a96..ba32fbe1 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.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/patient_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/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -83,11 +83,16 @@ class _PatientSearchScreenState extends State { _patientSearchFormValues.DoctorID = doctorProfile.doctorID; _patientSearchFormValues.ClinicID = doctorProfile.clinicID; - - Navigator.of(context).pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": _selectedType - }); + if ((_patientSearchFormValues.From == "0" || + _patientSearchFormValues.To == "0") && + _selectedType == "7") { + helpers.showErrorToast("Please Choose The Dates"); + } else { + Navigator.of(context).pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": _selectedType + }); + } } else { setState(() { _autoValidate = true; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 19818a0c..093423f1 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -285,7 +285,7 @@ class TranslationBase { String get transfertoadmin => localizedValues['transfertoadmin'][locale.languageCode]; - String get fromDate => localizedValues['toDate'][locale.languageCode]; + String get fromDate => localizedValues['fromDate'][locale.languageCode]; String get toDate => localizedValues['toDate'][locale.languageCode]; diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 09d86fd8..5a698af9 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -1,5 +1,4 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/my_selected_assement.dart'; @@ -12,14 +11,10 @@ import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page. import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.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/shared/Text.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/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../patient_profile_widget.dart'; import 'steps_widget.dart'; class AddSOAPIndex extends StatefulWidget { @@ -96,10 +91,28 @@ class _AddSOAPIndexState extends State }, scrollDirection: Axis.horizontal, children: [ - SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), - AssessmentPage(changePageViewIndex: changePageViewIndex,mySelectedAssessment:mySelectedAssessment), - PlanPage(changePageViewIndex: changePageViewIndex,) + SubjectivePage( + changePageViewIndex: changePageViewIndex, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList, + patientInfo: patient, + ), + ObjectivePage( + changePageViewIndex: changePageViewIndex, + mySelectedExamination: + mySelectedExamination, + patientInfo: patient, + ), + AssessmentPage( + changePageViewIndex: changePageViewIndex, + mySelectedAssessment: + mySelectedAssessment, + patientInfo: patient, + ), + PlanPage( + changePageViewIndex: changePageViewIndex, + patientInfo: patient, + ) ], ), ), diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 6d5aa7d3..76c6cdec 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_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/shared/Text.dart'; @@ -23,9 +24,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; final MySelectedAssessment mySelectedAssessment; + final PatiantInformtion patientInfo; AssessmentPage( - {Key key, this.changePageViewIndex, this.mySelectedAssessment}); + {Key key, this.changePageViewIndex, this.mySelectedAssessment, this.patientInfo}); @override _AssessmentPageState createState() => _AssessmentPageState(); @@ -308,35 +310,34 @@ class _AssessmentPageState extends State { } submitAssessment(SOAPViewModel model) async { - // if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && - // widget.mySelectedAssessment.selectedDiagnosisType != null) { - // PostAssessmentRequestModel postAssessmentRequestModel = - // new PostAssessmentRequestModel( - // patientMRN: 3120690, - // episodeId: 200012117, - // appointmentNo: 2016054573, - // icdCodeDetails: [ - // new IcdCodeDetails( - // remarks: widget.mySelectedAssessment.remark, - // complexDiagnosis: true, - // conditionId: - // widget.mySelectedAssessment.selectedDiagnosisCondition.id, - // diagnosisTypeId: - // widget.mySelectedAssessment.selectedDiagnosisType.id, - // icdcode10Id: "1") - // ]); - // - // await model.postAssessment(postAssessmentRequestModel); - // - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(3); - // } - // } else { - // helpers.showErrorToast('Please add required field correctly'); - // } - widget.changePageViewIndex(3); + if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && + widget.mySelectedAssessment.selectedDiagnosisType != null) { + PostAssessmentRequestModel postAssessmentRequestModel = + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ + new IcdCodeDetails( + remarks: widget.mySelectedAssessment.remark, + complexDiagnosis: true, + conditionId: + widget.mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: + widget.mySelectedAssessment.selectedDiagnosisType.id, + icdcode10Id: "1") + ]); + + await model.postAssessment(postAssessmentRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(3); + } + } else { + helpers.showErrorToast('Please add required field correctly'); + } } openAssessmentDialog(BuildContext context) { diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 8d12e1c9..6441ac6c 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.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'; +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/shared/Text.dart'; @@ -23,9 +24,9 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; final List mySelectedExamination; - + final PatiantInformtion patientInfo; ObjectivePage( - {Key key, this.changePageViewIndex, this.mySelectedExamination}); + {Key key, this.changePageViewIndex, this.mySelectedExamination, this.patientInfo}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -320,48 +321,43 @@ class _ObjectivePageState extends State { } submitObjectivePage(SOAPViewModel model) async { - // if(widget.mySelectedExamination.isNotEmpty){ - // PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - // widget.mySelectedExamination.forEach((exam) { - // if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - // null) - // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - // - // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - // ListHisProgNotePhysicalExaminationVM( - // patientMRN: 3120690, - // episodeId: 200012117, - // appointmentNo: 2016054573, - // remarks: exam.remark ?? '', - // createdBy: 1485, - // createdOn: DateTime.now().toIso8601String(), - // editedBy: 1485, - // editedOn: DateTime.now().toIso8601String(), - // examId: exam.selectedExamination.id, - // examType: exam.selectedExamination.typeId, - // isAbnormal: exam.isAbnormal, - // isNormal: exam.isNormal, - // masterDescription: exam.selectedExamination, - // notExamined: false - // - // )); - // }); - // - // await model.postPhysicalExam(postPhysicalExamRequestModel); - // - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(2); - // } - // } else { - // helpers.showErrorToast('Please add required field correctly'); - // } + if(widget.mySelectedExamination.isNotEmpty){ + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - widget.changePageViewIndex(2); + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: 1485, + createdOn: DateTime.now().toIso8601String(), + editedBy: 1485, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + masterDescription: exam.selectedExamination, + notExamined: false + )); + }); + await model.postPhysicalExam(postPhysicalExamRequestModel); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(2); + } + } else { + helpers.showErrorToast('Please add required field correctly'); + } } removeExamination(MasterKeyModel masterKey) { diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 3e5ca10a..3bf7aa5e 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -3,6 +3,7 @@ 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/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'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -18,8 +19,9 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class PlanPage extends StatefulWidget { final Function changePageViewIndex; + final PatiantInformtion patientInfo; - PlanPage({Key key, this.changePageViewIndex}); + PlanPage({Key key, this.changePageViewIndex, this.patientInfo}); @override _PlanPageState createState() => _PlanPageState(); @@ -269,9 +271,9 @@ class _PlanPageState extends State { submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, planNote: progressNoteController.text); diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index d4ed9c86..18849aa5 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -7,11 +7,11 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; 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/subjective/add_medication_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -24,9 +24,15 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class SubjectivePage extends StatefulWidget { final Function changePageViewIndex; final List myAllergiesList; - final List myHistoryList ; + final List myHistoryList; + final PatiantInformtion patientInfo; - SubjectivePage({Key key, this.changePageViewIndex, this.myAllergiesList, this.myHistoryList}); + SubjectivePage( + {Key key, + this.changePageViewIndex, + this.myAllergiesList, + this.myHistoryList, + this.patientInfo}); @override _SubjectivePageState createState() => _SubjectivePageState(); @@ -270,44 +276,46 @@ class _SubjectivePageState extends State { formKey.currentState.save(); formKey.currentState.validate(); - widget.changePageViewIndex(1); - // 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 { - // 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'); + } } @@ -324,9 +332,9 @@ class _SubjectivePageState extends State { .add(ListHisProgNotePatientAllergyDiseaseVM( allergyDiseaseId: allergy.selectedAllergy.id, allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, severity: allergy.selectedAllergySeverity.id, remarks: allergy.remark, createdBy: 1485, @@ -353,9 +361,9 @@ class _SubjectivePageState extends State { postHistoriesRequestModel.listMedicalHistoryVM = []; //TODO: make static value dynamic postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, remarks: "", historyId: history.id, historyType: history.typeId, @@ -375,11 +383,11 @@ class _SubjectivePageState extends State { PostChiefComplaintRequestModel postChiefComplaintRequestModel = //TODO: make static value dynamic new PostChiefComplaintRequestModel( - patientMRN: 3120690, - episodeID: 200012117, - appointmentNo: 2016054573, + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, chiefComplaint: complaintsController.text, - currentMedication: "currentMedication", + currentMedication: " currentMedication ", hopi: illnessController.text, isLactation: false, ispregnant: false, diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index ac6c7f0f..792eb49e 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -168,7 +168,7 @@ class PatientProfileWidget extends StatelessWidget { height: 4, ), AppText( - patient.genderDescription, + patient.gender.toString() == '1' ? 'Male' : 'Female', fontWeight: FontWeight.normal, fontSize: 1.8 * SizeConfig.textMultiplier, ),