import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:flutter/cupertino.dart'; import 'base/base_service.dart'; class RadiologyService extends BaseService { List finalRadiologyList = List(); String url = ''; Future getRadImageURL({int invoiceNo, int lineItem, int projectId,@required PatiantInformtion patient}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = invoiceNo; body['LineItemNo'] = lineItem; body['ProjectID'] = projectId; await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, onSuccess: (dynamic response, int statusCode) { url = response['Data']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future getPatientRadOrders(PatiantInformtion patient , {isInPatient = false}) async { String url = GET_PATIENT_ORDERS; final Map body = new Map(); if(isInPatient) { url = GET_IN_PATIENT_ORDERS; body['ProjectID'] = patient.projectId; } hasError = false; await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { finalRadiologyList.clear(); String label = "ListRAD"; if(isInPatient) { label ="List_GetRadOreders"; } response[label].forEach((radiology) { finalRadiologyList.add(FinalRadiology.fromJson(radiology)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body:body); } }