Get Clinic List API Implemented, Architecture for HTTP requests implemented
parent
a0173c5b4d
commit
9eb9f01dbd
@ -1,9 +1,35 @@
|
||||
import 'dart:io';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/models/Request.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||
|
||||
const MAX_SMALL_SCREEN = 660;
|
||||
|
||||
const BASE_URL = '';
|
||||
const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment
|
||||
//const BASE_URL = 'https://uat.hmgwebservices.com/'; // UAT Environment
|
||||
|
||||
|
||||
//URL to get clinic list
|
||||
const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized";
|
||||
|
||||
|
||||
class AppGlobal {
|
||||
static var context;
|
||||
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||
|
||||
Request getPublicRequest() {
|
||||
Request request = new Request();
|
||||
request.VersionID = 5.3; //3.6;
|
||||
request.Channel = 3;
|
||||
// request.LanguageID = await sharedPref.getString(APP_LANGUAGE);
|
||||
request.IPAdress = "10.20.10.20";
|
||||
request.generalid = 'Cs2020@2016\$2958';
|
||||
request.PatientOutSA = 0;
|
||||
request.SessionID = null;
|
||||
request.isDentalAllowedBackend = false;
|
||||
request.DeviceTypeID = Platform.isIOS ? 1 : 2;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
class ListClinicCentralized {
|
||||
int clinicID;
|
||||
String clinicDescription;
|
||||
Null clinicDescriptionN;
|
||||
int age;
|
||||
int gender;
|
||||
bool isLiveCareClinicAndOnline;
|
||||
int liveCareClinicID;
|
||||
int liveCareServiceID;
|
||||
|
||||
ListClinicCentralized(
|
||||
{this.clinicID,
|
||||
this.clinicDescription,
|
||||
this.clinicDescriptionN,
|
||||
this.age,
|
||||
this.gender,
|
||||
this.isLiveCareClinicAndOnline,
|
||||
this.liveCareClinicID,
|
||||
this.liveCareServiceID});
|
||||
|
||||
ListClinicCentralized.fromJson(Map<String, dynamic> json) {
|
||||
clinicID = json['ClinicID'];
|
||||
clinicDescription = json['ClinicDescription'];
|
||||
clinicDescriptionN = json['ClinicDescriptionN'];
|
||||
age = json['Age'];
|
||||
gender = json['Gender'];
|
||||
isLiveCareClinicAndOnline = json['IsLiveCareClinicAndOnline'];
|
||||
liveCareClinicID = json['LiveCareClinicID'];
|
||||
liveCareServiceID = json['LiveCareServiceID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['ClinicDescription'] = this.clinicDescription;
|
||||
data['ClinicDescriptionN'] = this.clinicDescriptionN;
|
||||
data['Age'] = this.age;
|
||||
data['Gender'] = this.gender;
|
||||
data['IsLiveCareClinicAndOnline'] = this.isLiveCareClinicAndOnline;
|
||||
data['LiveCareClinicID'] = this.liveCareClinicID;
|
||||
data['LiveCareServiceID'] = this.liveCareServiceID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ListGetBookScheduleConfigsList {
|
||||
int iD;
|
||||
String description;
|
||||
Null descriptionN;
|
||||
bool value;
|
||||
bool isActive;
|
||||
|
||||
ListGetBookScheduleConfigsList(
|
||||
{this.iD,
|
||||
this.description,
|
||||
this.descriptionN,
|
||||
this.value,
|
||||
this.isActive});
|
||||
|
||||
ListGetBookScheduleConfigsList.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
description = json['Description'];
|
||||
descriptionN = json['DescriptionN'];
|
||||
value = json['Value'];
|
||||
isActive = json['IsActive'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ID'] = this.iD;
|
||||
data['Description'] = this.description;
|
||||
data['DescriptionN'] = this.descriptionN;
|
||||
data['Value'] = this.value;
|
||||
data['IsActive'] = this.isActive;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
class Request {
|
||||
var ClinicID;
|
||||
var PatientOutSA;
|
||||
var PatientID;
|
||||
var ProjectID;
|
||||
var LanguageID;
|
||||
var DeviceTypeID;
|
||||
var AppointmentNo;
|
||||
var IPAdress;
|
||||
var VersionID;
|
||||
var Channel;
|
||||
var PatientTypeID;
|
||||
var PatientType;
|
||||
var isDentalAllowedBackend;
|
||||
var IsIrisPrescription;
|
||||
var TokenID;
|
||||
var SessionID;
|
||||
var PatientIdentificationID;
|
||||
var PatientMobileNumber;
|
||||
var BookedBy;
|
||||
var Latitude;
|
||||
var Longitude;
|
||||
var OutSA;
|
||||
var Note;
|
||||
var IsActiveAppointment;
|
||||
var RequestType;
|
||||
var InvoiceNo;
|
||||
var EncounterType;
|
||||
var generalid;
|
||||
var ServiceID;
|
||||
var StrAppointmentDate;
|
||||
var SKU;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
import 'package:diplomaticquarterapp/client/base_app_client.dart';
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/models/Request.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||
|
||||
class ClinicListService {
|
||||
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||
AppGlobal appGlobal = new AppGlobal();
|
||||
|
||||
Future<Map> getClinicsList() async {
|
||||
Map<String, dynamic> request;
|
||||
var languageID = await sharedPref.getString(APP_LANGUAGE);
|
||||
Request req = appGlobal.getPublicRequest();
|
||||
request = {
|
||||
"LanguageID": languageID == 'ar' ? 1 : 2,
|
||||
"IPAdress": "10.20.10.20",
|
||||
"VersionID": req.VersionID,
|
||||
"Channel": req.Channel,
|
||||
"generalid": 'Cs2020@2016\$2958',
|
||||
"PatientOutSA": 0,
|
||||
"TokenID": "",
|
||||
"DeviceTypeID": req.DeviceTypeID,
|
||||
"SessionID": null
|
||||
};
|
||||
|
||||
dynamic localRes;
|
||||
|
||||
await BaseAppClient.post(GET_CLINICS_LIST_URL,
|
||||
onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
throw error;
|
||||
}, body: request);
|
||||
return Future.value(localRes);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue