get projects setup id code updated.

update_flutter_3.16.0
Sultan Khan 9 months ago
parent 0268b796fe
commit f40adfb087

@ -29,7 +29,9 @@ class BaseAppClient {
required Function(String error, int statusCode) onFailure, required Function(String error, int statusCode) onFailure,
bool isAllowAny = false, bool isAllowAny = false,
bool isLiveCare = false, bool isLiveCare = false,
bool isFallLanguage = false}) async { bool isFallLanguage = false,
bool isCustomRequest = false
}) async {
String url; String url;
if (isLiveCare) if (isLiveCare)
url = BASE_URL_LIVE_CARE + endPoint; url = BASE_URL_LIVE_CARE + endPoint;
@ -40,84 +42,85 @@ class BaseAppClient {
try { try {
Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE); Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE);
String? token = await sharedPref.getString(TOKEN); String? token = await sharedPref.getString(TOKEN);
if(!isCustomRequest) {
if (profile != null) {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
if (body == null || body['DoctorID'] == null) {
body!['DoctorID'] = doctorProfile.doctorID.toString();
}
if (body['DoctorID'] == "") body['DoctorID'] = doctorProfile.doctorID; // changed from null; because create update episode not working
if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString();
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile.projectID.toString();
}
if (profile != null) { if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID.toString();
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); } else {
if (body == null || body['DoctorID'] == null) { String? doctorID = await sharedPref.getString(DOCTOR_ID);
body!['DoctorID'] = doctorProfile.doctorID.toString(); if (body!['DoctorID'] == '') {
} body['DoctorID'] = null;
if (body['DoctorID'] == "") body['DoctorID'] = doctorProfile.doctorID; // changed from null; because create update episode not working } else if (doctorID != null) body['DoctorID'] = int.parse(doctorID);
if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString();
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile.projectID.toString();
} }
if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID.toString(); body['SetupID'] = body.containsKey('SetupID')
} else { ? body['SetupID'] != null
String? doctorID = await sharedPref.getString(DOCTOR_ID); ? body['SetupID']
if (body!['DoctorID'] == '') { : await sharedPref.getString(DOCTOR_SETUP_ID)
body['DoctorID'] = null; : await sharedPref.getString(DOCTOR_SETUP_ID);
} else if (doctorID != null) body['DoctorID'] = int.parse(doctorID);
}
body['SetupID'] = body.containsKey('SetupID') if (body['EditedBy'] == '') {
? body['SetupID'] != null body.remove("EditedBy");
? body['SetupID'] }
: await sharedPref.getString(DOCTOR_SETUP_ID) if (body['TokenID'] == null) {
: await sharedPref.getString(DOCTOR_SETUP_ID); body['TokenID'] = token ?? '';
}
if (body['EditedBy'] == '') { if (!isFallLanguage) {
body.remove("EditedBy"); String? lang = await sharedPref.getString(APP_Language);
} if (lang != null && lang == 'ar')
if (body['TokenID'] == null) { body['LanguageID'] = '1';
body['TokenID'] = token ?? ''; else
} body['LanguageID'] = '2';
}
body['stamp'] = DateTime.now().toIso8601String();
body['IPAdress'] = IP_ADDRESS.toString();
if (body['VersionID'] == null) {
body['VersionID'] = VERSION_ID.toString();
}
if (body['Channel'] == null) {
body['Channel'] = CHANNEL.toString();
}
body['SessionID'] = SESSION_ID.toString();
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString();
body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA;
if (body['VidaAuthTokenID'] == null) {
body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
}
if (body['VidaRefreshTokenID'] == null) {
body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
}
if (!isFallLanguage) { int? projectID = await sharedPref.getInt(PROJECT_ID);
String? lang = await sharedPref.getString(APP_Language); if (projectID == 2 || projectID == 3)
if (lang != null && lang == 'ar') body['PatientOutSA'] = true;
body['LanguageID'] = '1'; else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3)
body['PatientOutSA'] = 'true';
else else
body['LanguageID'] = '2'; body['PatientOutSA'] = 'false';
}
body['stamp'] = DateTime.now().toIso8601String(); // if (!body.containsKey('ProjectID')) {
body['IPAdress'] = IP_ADDRESS.toString(); // if (projectID != null) {
if (body['VersionID'] == null) { // body['ProjectID'] = projectID;
body['VersionID'] = VERSION_ID.toString(); // } else {
} // body['ProjectID'] = 0;
if (body['Channel'] == null) { // }
body['Channel'] = CHANNEL.toString(); // }
}
body['SessionID'] = SESSION_ID.toString(); body['DeviceTypeID'] = Platform.isAndroid ? '1' : '2';
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString(); if (body['SetupID'] != null) {
body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA; body['SetupID'] = body['SetupID'].trim();
if (body['VidaAuthTokenID'] == null) { }
body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
}
if (body['VidaRefreshTokenID'] == null) {
body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
} }
int? projectID = await sharedPref.getInt(PROJECT_ID);
if (projectID == 2 || projectID == 3)
body['PatientOutSA'] = true;
else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3)
body['PatientOutSA'] = 'true';
else
body['PatientOutSA'] = 'false';
// if (!body.containsKey('ProjectID')) {
// if (projectID != null) {
// body['ProjectID'] = projectID;
// } else {
// body['ProjectID'] = 0;
// }
// }
body['DeviceTypeID'] = Platform.isAndroid ? '1' : '2';
if( body['SetupID'] != null) {
body['SetupID'] = body['SetupID'].trim();
}
// body['ClinicID'] = 501; // body['ClinicID'] = 501;
// body['ProjectID'] = 12; // body['ProjectID'] = 12;
@ -134,7 +137,7 @@ class BaseAppClient {
final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (body['DoctorID'] != null) { if (body!['DoctorID'] != null) {
postRequestAndResponse( postRequestAndResponse(
doctorId: body['DoctorID'], doctorId: body['DoctorID'],
completeUrl: url, completeUrl: url,

@ -29,7 +29,8 @@ class HospitalsService extends BaseService {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, },
body: {"LanguageID":await sharedPref.getString(APP_Language),"MemberID":getHospitalsRequestModel.memberID,"DoctorID":getHospitalsRequestModel.doctorID} //getHospitalsRequestModel.toJson(), body: {"LanguageID":2,"MemberID":getHospitalsRequestModel.memberID,"DoctorID":getHospitalsRequestModel.doctorID}, //getHospitalsRequestModel.toJson(),
isCustomRequest: true
); );
} }
} }

Loading…
Cancel
Save