diff --git a/lib/config/config.dart b/lib/config/config.dart index 93dfa881..372fab75 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,12 +6,41 @@ const ONLY_DATE = "[0-9/]"; const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; +const GET_PROJECTS = 'Lists.svc/REST/GetProjectForDoctorAPP'; +const GET_PATIENT_VITAL_SIGN = 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_LAB_OREDERS = + 'DoctorApplication.svc/REST/GetPatientLabOreders'; +const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; +const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; //*********change value to decode json from Dropdown ************ - var SERVICES_PATIANT = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; -var SERVICES_PATIANT2 = ["List_MyOutPatient", "List_MyInPatient","List_MyDischargePatient" ,"List_MyReferredPatient","List_MyDischargeReferralPatient","List_MyTomorrowPatient","List_MyReferralPatient"]; -var SERVICES_PATIANT_HEADER = ["OutPatient", "InPatient", "Discharge","Referred","Referral Discharge","Tomorrow","Referral"]; +var SERVICES_PATIANT = [ + "GetMyOutPatient", + "GetMyInPatient", + "GtMyDischargePatient", + "GtMyReferredPatient", + "GtMyDischargeReferralPatient", + "GtMyTomorrowPatient", + "GtMyReferralPatient" +]; +var SERVICES_PATIANT2 = [ + "List_MyOutPatient", + "List_MyInPatient", + "List_MyDischargePatient", + "List_MyReferredPatient", + "List_MyDischargeReferralPatient", + "List_MyTomorrowPatient", + "List_MyReferralPatient" +]; +var SERVICES_PATIANT_HEADER = [ + "OutPatient", + "InPatient", + "Discharge", + "Referred", + "Referral Discharge", + "Tomorrow", + "Referral" +]; //****************** - // Colors ////// by : ibrahim -const PRIMARY_COLOR = 0xff58434F; \ No newline at end of file +const PRIMARY_COLOR = 0xff58434F; diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index 005a53ac..abf758a2 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -1,23 +1,11 @@ import 'dart:convert'; +import 'package:doctor_app_flutter/client/app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; - -import '../interceptor/http_interceptor.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; - -const GET_PROJECTS = BASE_URL + 'Lists.svc/REST/GetProjectForDoctorAPP'; class HospitalProvider with ChangeNotifier { - - - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); - Future getProjectsList() async { const url = GET_PROJECTS; var info = { @@ -31,7 +19,7 @@ class HospitalProvider with ChangeNotifier { "IsLoginForDoctorApp": true }; try { - final response = await client.post(url, body: json.encode(info)); + final response = await AppClient.post(url, body: json.encode(info)); return Future.value(json.decode(response.body)); } catch (error) { throw error; diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 9e6ef767..c68e94d0 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -1,29 +1,20 @@ import 'dart:convert'; -import 'package:doctor_app_flutter/models/patient/lab_orders_res_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/prescription_req_model.dart'; -import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; -import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; -import 'package:doctor_app_flutter/widgets/auth/login_form.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; +import '../client/app_client.dart'; import '../config/config.dart'; import '../interceptor/http_interceptor.dart'; +import '../models/patient/lab_orders_res_model.dart'; +import '../models/patient/patiant_info_model.dart'; import '../models/patient/patient_model.dart'; +import '../models/patient/prescription_res_model.dart'; +import '../models/patient/radiology_res_model.dart'; import '../models/patient/vital_sign_res_model.dart'; - import '../util/helpers.dart'; -const GET_PATIENT_VITAL_SIGN = - BASE_URL + 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; -const GET_PATIENT_LAB_OREDERS = - BASE_URL + 'DoctorApplication.svc/REST/GetPatientLabOreders'; -const GET_PRESCRIPTION = BASE_URL + 'Patients.svc/REST/GetPrescriptionApptList'; -const GET_RADIOLOGY = - BASE_URL + 'DoctorApplication.svc/REST/GetPatientRadResult'; Helpers helpers = Helpers(); class PatientsProvider with ChangeNotifier { @@ -43,12 +34,12 @@ class PatientsProvider with ChangeNotifier { Future getPatientList(PatientModel patient, patientType) async { /* const url = BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ - + int val = int.parse(patientType); - //**********Modify url by amjad amireh for patiant type********* - - - final url =BASE_URL+"DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val]; + //**********Modify url by amjad amireh for patiant type********* + + final url = + BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; // print("a===========$url=======a"); try { @@ -103,7 +94,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_PATIENT_VITAL_SIGN, + final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -136,15 +127,6 @@ class PatientsProvider with ChangeNotifier { } } - PatiantInformtion getSelectedPatient() { - return _selectedPatient; - } - - setSelectedPatient(PatiantInformtion patient) { - // return _selectedPatient; - _selectedPatient = patient; - } - /*@author: Elham Rababah *@Date:27/4/2020 *@param: patient @@ -158,7 +140,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_PATIENT_LAB_OREDERS, + final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -204,7 +186,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { final response = - await client.post(GET_PRESCRIPTION, body: json.encode(patient)); + await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -263,7 +245,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { final response = - await client.post(GET_RADIOLOGY, body: json.encode(patient)); + await AppClient.post(GET_RADIOLOGY, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; diff --git a/lib/widgets/patients/profile/profile_header_widget.dart b/lib/widgets/patients/profile/profile_header_widget.dart index a745cf88..4aa9f92b 100644 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ b/lib/widgets/patients/profile/profile_header_widget.dart @@ -1,9 +1,6 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/providers/patients_provider.dart'; - import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; import '../../../config/size_config.dart'; import '../../shared/profile_image_widget.dart';