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