From ee8d481504563d0b532d27472d0ef2a9f9ee2ab0 Mon Sep 17 00:00:00 2001 From: ibrahim albitar Date: Mon, 22 Jun 2020 15:30:02 +0300 Subject: [PATCH 1/2] live care web service --- lib/config/config.dart | 2 + .../statstics_for_certain_doctor_request.dart | 36 ++++++++++ lib/providers/doctors_provider.dart | 68 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 lib/models/doctor/statstics_for_certain_doctor_request.dart create mode 100644 lib/providers/doctors_provider.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index d3f1e95d..4c9fab2c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -27,6 +27,8 @@ const GET_PATIENT_LAB_OREDERS = const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; +const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/models/doctor/statstics_for_certain_doctor_request.dart b/lib/models/doctor/statstics_for_certain_doctor_request.dart new file mode 100644 index 00000000..08fa03f3 --- /dev/null +++ b/lib/models/doctor/statstics_for_certain_doctor_request.dart @@ -0,0 +1,36 @@ +class StatsticsForCertainDoctorRequest { + bool outSA; + int doctorID; + String tokenID; + int channel; + int projectID; + String generalid; + + StatsticsForCertainDoctorRequest( + {this.outSA, + this.doctorID, + this.tokenID, + this.channel, + this.projectID, + this.generalid}); + + StatsticsForCertainDoctorRequest.fromJson(Map json) { + outSA = json['OutSA']; + doctorID = json['DoctorID']; + tokenID = json['TokenID']; + channel = json['Channel']; + projectID = json['ProjectID']; + generalid = json['generalid']; + } + + Map toJson() { + final Map data = new Map(); + data['OutSA'] = this.outSA; + data['DoctorID'] = this.doctorID; + data['TokenID'] = this.tokenID; + data['Channel'] = this.channel; + data['ProjectID'] = this.projectID; + data['generalid'] = this.generalid; + return data; + } +} diff --git a/lib/providers/doctors_provider.dart b/lib/providers/doctors_provider.dart new file mode 100644 index 00000000..6ef4b7db --- /dev/null +++ b/lib/providers/doctors_provider.dart @@ -0,0 +1,68 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/doctor/statstics_for_certain_doctor_request.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; + +Helpers helpers = Helpers(); +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + +StatsticsForCertainDoctorRequest _statsticsForCertainDoctorRequest = StatsticsForCertainDoctorRequest(); + + +var certainDoctorsStasticsList = []; + +/*@author: ibrahem albitar + *@Date:22/6/2020 + *@desc: Doctor Provider + */ + +class DoctorsProvider with ChangeNotifier { + + bool isLoading = false; + bool isError = false; + String error = ''; + + resetDefaultValues() { + isLoading = true; + isError = false; + error = ''; + notifyListeners(); + } + + + /*@author: ibrahem albitar + *@Date:22/6/2020 + *@desc: StatsticsForCertainDoctor + */ + getStatsticsForCertainDoctor(String generalId) async { + resetDefaultValues(); + try { + _statsticsForCertainDoctorRequest.generalid = generalId; + await BaseAppClient.post(LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL, + onSuccess: (dynamic response, int statusCode) { + certainDoctorsStasticsList = response['List_LiveCareCertainDoctorsStastics']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, body: _statsticsForCertainDoctorRequest.toJson()); + notifyListeners(); + } catch (err) { + handelCatchErrorCase(err); + } + } + + handelCatchErrorCase(err) { + isLoading = false; + isError = true; + error = helpers.generateContactAdminMsg(err); + notifyListeners(); + throw err; + } + +} \ No newline at end of file From c07f84ff78202848fa4c83d54004b29032e5ca46 Mon Sep 17 00:00:00 2001 From: ibrahim albitar Date: Tue, 23 Jun 2020 16:10:05 +0300 Subject: [PATCH 2/2] fixing and enhancments --- lib/screens/medicine/medicine_search_screen.dart | 4 ++++ .../patients/profile/insurance_approvals_screen.dart | 5 ++++- lib/screens/patients/profile/patient_orders_screen.dart | 5 ++++- lib/screens/patients/profile/progress_note_screen.dart | 5 ++++- lib/widgets/shared/app_text_form_field.dart | 6 +++++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 99bb44ca..5c8726d7 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -60,6 +60,10 @@ class _MedicineSearchState extends State { hintText: TranslationBase.of(context).searchMedicineNameHere, controller: myController, onSaved: (value) {}, + onFieldSubmitted: (value){ + searchMedicine(context); + }, + textInputAction: TextInputAction.search, inputFormatter: ONLY_LETTERS), ), Container( diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index 99db9a4f..a171a0e9 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -61,7 +61,9 @@ class _InsuranceApprovalsState extends State { patientTypeID: patient.patientType, languageID: 2); patientsProv - .getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()); + .getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()).then((c){ + approvalsList = patientsProv.insuranceApporvalsList; + }); } @override @@ -97,6 +99,7 @@ class _InsuranceApprovalsState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration( context, TranslationBase.of(context) diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index 78b3b294..8effd1f9 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -59,7 +59,9 @@ class _PatientsOrdersState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - patientsProv.getPatientProgressNote(progressNoteRequest.toJson()); + patientsProv.getPatientProgressNote(progressNoteRequest.toJson()).then((c){ + notesList = patientsProv.patientProgressNoteList; + }); } @override @@ -94,6 +96,7 @@ class _PatientsOrdersState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration(context, TranslationBase.of(context).searchOrders), ), diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index a2aea154..90640c59 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -59,7 +59,9 @@ class _ProgressNoteState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - patientsProv.getPatientProgressNote(progressNoteRequest.toJson()); + patientsProv.getPatientProgressNote(progressNoteRequest.toJson()).then((c){ + notesList = patientsProv.patientProgressNoteList; + }); } @override @@ -94,6 +96,7 @@ class _ProgressNoteState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration(context, TranslationBase.of(context).searchNote), ), diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index 06dfb9e7..b0b9a8ec 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -19,7 +19,9 @@ class AppTextFormField extends FormField { bool autovalidate = true, TextInputType textInputType, String hintText, - FocusNode focusNode + FocusNode focusNode, + TextInputAction textInputAction, + ValueChanged onFieldSubmitted, }) : super( onSaved: onSaved, validator: validator, @@ -34,6 +36,8 @@ class AppTextFormField extends FormField { onChanged: onChanged?? (value){ state.didChange(value); }, + textInputAction: textInputAction, + onFieldSubmitted: onFieldSubmitted, decoration: InputDecoration( hintText: hintText, hintStyle: TextStyle(fontSize: SizeConfig.textMultiplier * 2),