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

Loading…
Cancel
Save