fix small bug

merge-requests/48/head
Elham Rababah 6 years ago
parent ce8fa791e9
commit a9ca9be801

@ -18,19 +18,21 @@ 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';
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';
class PatientsProvider with ChangeNotifier {
bool isLoading = true;
bool isLoading = false;
bool isError = false;
String error = '';
List<VitalSignResModel> patientVitalSignList = [];
List <LabOrdersResModel>patientLabResultOrdersList = [];
List <PrescriptionResModel>patientPrescriptionsList = [];
List <RadiologyResModel >patientRadiologyList = [];
List<LabOrdersResModel> patientLabResultOrdersList = [];
List<PrescriptionResModel> patientPrescriptionsList = [];
List<RadiologyResModel> patientRadiologyList = [];
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
@ -87,6 +89,9 @@ class PatientsProvider with ChangeNotifier {
*@desc: getPatientVitalSign
*/
getPatientVitalSign(patient) async {
isLoading = true;
notifyListeners();
try {
if (await Helpers.checkConnection()) {
final response = await client.post(GET_PATIENT_VITAL_SIGN,
@ -138,6 +143,9 @@ class PatientsProvider with ChangeNotifier {
*@desc: getLabResult Orders
*/
getLabResultOrders(patient) async {
isLoading = true;
notifyListeners();
try {
if (await Helpers.checkConnection()) {
final response = await client.post(GET_PATIENT_LAB_OREDERS,
@ -179,11 +187,14 @@ class PatientsProvider with ChangeNotifier {
*@return:
*@desc: getPatientPrescriptions
*/
getPatientPrescriptions(patient) async {
getPatientPrescriptions(patient) async {
isLoading = true;
notifyListeners();
try {
if (await Helpers.checkConnection()) {
final response = await client.post(GET_PRESCRIPTION,
body: json.encode(patient));
final response =
await client.post(GET_PRESCRIPTION, body: json.encode(patient));
final int statusCode = response.statusCode;
isLoading = false;
@ -197,7 +208,8 @@ getPatientPrescriptions(patient) async {
patientPrescriptionsList = [];
print("res['PatientPrescriptionList']");
res['PatientPrescriptionList'].forEach((v) {
patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v));
patientPrescriptionsList
.add(new PrescriptionResModel.fromJson(v));
});
} else {
isError = true;
@ -221,11 +233,13 @@ getPatientPrescriptions(patient) async {
*@return:
*@desc: getPatientRadiology
*/
getPatientRadiology(patient) async {
getPatientRadiology(patient) async {
isLoading = true;
notifyListeners();
try {
if (await Helpers.checkConnection()) {
final response = await client.post(GET_RADIOLOGY,
body: json.encode(patient));
final response =
await client.post(GET_RADIOLOGY, body: json.encode(patient));
final int statusCode = response.statusCode;
isLoading = false;
@ -239,7 +253,7 @@ getPatientRadiology(patient) async {
patientRadiologyList = [];
print("res['List_GetRadOreders']");
res['List_GetRadOreders'].forEach((v) {
patientRadiologyList.add(new RadiologyResModel .fromJson(v));
patientRadiologyList.add(new RadiologyResModel.fromJson(v));
});
} else {
isError = true;
@ -256,6 +270,4 @@ getPatientRadiology(patient) async {
throw error;
}
}
}

Loading…
Cancel
Save