|
|
@ -10,7 +10,6 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
import 'dart:io' show Platform;
|
|
|
|
import 'dart:io' show Platform;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
Helpers helpers = new Helpers();
|
|
|
|
Helpers helpers = new Helpers();
|
|
|
|
//ProjectProvider projectsProvider = new ProjectProvider();
|
|
|
|
//ProjectProvider projectsProvider = new ProjectProvider();
|
|
|
@ -86,7 +85,7 @@ class BaseAppClient {
|
|
|
|
|
|
|
|
|
|
|
|
print("URL : $url");
|
|
|
|
print("URL : $url");
|
|
|
|
print("Body : ${json.encode(body)}");
|
|
|
|
print("Body : ${json.encode(body)}");
|
|
|
|
String asd= json.encode(body);
|
|
|
|
|
|
|
|
if (await Helpers.checkConnection()) {
|
|
|
|
if (await Helpers.checkConnection()) {
|
|
|
|
final response = await http.post(url,
|
|
|
|
final response = await http.post(url,
|
|
|
|
body: json.encode(body),
|
|
|
|
body: json.encode(body),
|
|
|
@ -126,10 +125,10 @@ class BaseAppClient {
|
|
|
|
|
|
|
|
|
|
|
|
postPatient(String endPoint,
|
|
|
|
postPatient(String endPoint,
|
|
|
|
{Map<String, dynamic> body,
|
|
|
|
{Map<String, dynamic> body,
|
|
|
|
Function(dynamic response, int statusCode) onSuccess,
|
|
|
|
Function(dynamic response, int statusCode) onSuccess,
|
|
|
|
Function(String error, int statusCode) onFailure,
|
|
|
|
Function(String error, int statusCode) onFailure,
|
|
|
|
@required PatiantInformtion patient,
|
|
|
|
@required PatiantInformtion patient,
|
|
|
|
bool isExternal = false}) async {
|
|
|
|
bool isExternal = false}) async {
|
|
|
|
String url = BASE_URL + endPoint;
|
|
|
|
String url = BASE_URL + endPoint;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -138,65 +137,63 @@ class BaseAppClient {
|
|
|
|
'Accept': 'application/json'
|
|
|
|
'Accept': 'application/json'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
String token = await sharedPref.getString(TOKEN);
|
|
|
|
String token = await sharedPref.getString(TOKEN);
|
|
|
|
var languageID =
|
|
|
|
var languageID =
|
|
|
|
await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
|
|
|
|
await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
|
|
|
|
if (body.containsKey('SetupID')) {
|
|
|
|
if (body.containsKey('SetupID')) {
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
? body['SetupID'] != null
|
|
|
|
? body['SetupID'] != null
|
|
|
|
? body['SetupID']
|
|
|
|
? body['SetupID']
|
|
|
|
: SETUP_ID
|
|
|
|
: SETUP_ID
|
|
|
|
: SETUP_ID;
|
|
|
|
: SETUP_ID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body['VersionID'] = VERSION_ID;
|
|
|
|
|
|
|
|
body['Channel'] = CHANNEL;
|
|
|
|
|
|
|
|
body['LanguageID'] = languageID == 'ar' ? 1 : 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body['IPAdress'] = IP_ADDRESS;
|
|
|
|
body['VersionID'] = VERSION_ID;
|
|
|
|
body['generalid'] = GENERAL_ID;
|
|
|
|
body['Channel'] = CHANNEL;
|
|
|
|
body['PatientOutSA'] = body.containsKey('PatientOutSA')
|
|
|
|
body['LanguageID'] = languageID == 'ar' ? 1 : 2;
|
|
|
|
? body['PatientOutSA'] != null
|
|
|
|
|
|
|
|
? body['PatientOutSA']
|
|
|
|
|
|
|
|
: PATIENT_OUT_SA_PATIENT_REQ
|
|
|
|
|
|
|
|
: PATIENT_OUT_SA_PATIENT_REQ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (body.containsKey('isDentalAllowedBackend')) {
|
|
|
|
body['IPAdress'] = IP_ADDRESS;
|
|
|
|
body['isDentalAllowedBackend'] =
|
|
|
|
body['generalid'] = GENERAL_ID;
|
|
|
|
body.containsKey('isDentalAllowedBackend')
|
|
|
|
body['PatientOutSA'] = body.containsKey('PatientOutSA')
|
|
|
|
? body['isDentalAllowedBackend'] != null
|
|
|
|
? body['PatientOutSA'] != null
|
|
|
|
? body['isDentalAllowedBackend']
|
|
|
|
? body['PatientOutSA']
|
|
|
|
: IS_DENTAL_ALLOWED_BACKEND
|
|
|
|
: PATIENT_OUT_SA_PATIENT_REQ
|
|
|
|
: IS_DENTAL_ALLOWED_BACKEND;
|
|
|
|
: PATIENT_OUT_SA_PATIENT_REQ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body['DeviceTypeID'] = Platform.isAndroid ? 1: 2;
|
|
|
|
if (body.containsKey('isDentalAllowedBackend')) {
|
|
|
|
|
|
|
|
body['isDentalAllowedBackend'] =
|
|
|
|
|
|
|
|
body.containsKey('isDentalAllowedBackend')
|
|
|
|
|
|
|
|
? body['isDentalAllowedBackend'] != null
|
|
|
|
|
|
|
|
? body['isDentalAllowedBackend']
|
|
|
|
|
|
|
|
: IS_DENTAL_ALLOWED_BACKEND
|
|
|
|
|
|
|
|
: IS_DENTAL_ALLOWED_BACKEND;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
|
|
|
|
|
|
|
|
|
|
|
|
body['PatientType'] = body.containsKey('PatientType')
|
|
|
|
body['PatientType'] = body.containsKey('PatientType')
|
|
|
|
? body['PatientType'] != null
|
|
|
|
? body['PatientType'] != null
|
|
|
|
? body['PatientType']
|
|
|
|
? body['PatientType']
|
|
|
|
: patient.patientType!= null
|
|
|
|
: patient.patientType != null
|
|
|
|
? patient.patientType
|
|
|
|
? patient.patientType
|
|
|
|
: PATIENT_TYPE
|
|
|
|
: PATIENT_TYPE
|
|
|
|
: PATIENT_TYPE;
|
|
|
|
: PATIENT_TYPE;
|
|
|
|
|
|
|
|
|
|
|
|
body['PatientTypeID'] = body.containsKey('PatientTypeID')
|
|
|
|
body['PatientTypeID'] = body.containsKey('PatientTypeID')
|
|
|
|
? body['PatientTypeID'] != null
|
|
|
|
? body['PatientTypeID'] != null
|
|
|
|
? body['PatientTypeID']
|
|
|
|
? body['PatientTypeID']
|
|
|
|
: patient.patientType!= null
|
|
|
|
: patient.patientType != null
|
|
|
|
? patient.patientType
|
|
|
|
? patient.patientType
|
|
|
|
: PATIENT_TYPE_ID
|
|
|
|
: PATIENT_TYPE_ID
|
|
|
|
: PATIENT_TYPE_ID;
|
|
|
|
: PATIENT_TYPE_ID;
|
|
|
|
|
|
|
|
|
|
|
|
body['TokenID'] = token;
|
|
|
|
|
|
|
|
body['PatientID'] = body['PatientID'] != null
|
|
|
|
|
|
|
|
? body['PatientID']
|
|
|
|
|
|
|
|
: patient.patientId?? patient.patientMRN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body['PatientOutSA'] = 0;//user['OutSA']; //TODO change it
|
|
|
|
body['TokenID'] = token;
|
|
|
|
body['SessionID'] = SESSION_ID; //getSe
|
|
|
|
body['PatientID'] = body['PatientID'] != null
|
|
|
|
|
|
|
|
? body['PatientID']
|
|
|
|
|
|
|
|
: patient.patientId ?? patient.patientMRN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it
|
|
|
|
|
|
|
|
body['SessionID'] = SESSION_ID; //getSe
|
|
|
|
|
|
|
|
|
|
|
|
print("URL : $url");
|
|
|
|
print("URL : $url");
|
|
|
|
print("Body : ${json.encode(body)}");
|
|
|
|
print("Body : ${json.encode(body)}");
|
|
|
|