import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/referral/DischargeReferralPatient.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; class DischargedPatientService extends BaseService { List myDischargedPatients = []; List myDischargeReferralPatients = []; Future getDischargedPatient() async { hasError = false; Map body = Map(); await getDoctorProfile(isGetProfile: true); body['DoctorID'] = doctorProfile!.doctorID; body['FirstName'] = "0"; body['MiddleName'] = "0"; body['LastName'] = "0"; body['PatientMobileNumber'] = "0"; body['PatientIdentificationID'] = "0"; body['PatientID'] = 0; body['From'] = "0"; body['To'] = "0"; body['stamp'] = DateTime.now().toIso8601String(); body['IsLoginForDoctorApp'] = true; body['IPAdress'] = "11.11.11.11"; body['PatientOutSA'] = false; body['PatientTypeID'] = 1; hasError = false; myDischargedPatients.clear(); await baseAppClient.post(GET_DISCHARGE_PATIENT, onSuccess: (dynamic response, int statusCode) { if (response['List_MyDischargePatient'] != null) { response['List_MyDischargePatient'].forEach((v) { myDischargedPatients.add(PatiantInformtion.fromJson(v)); }); } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future gtMyDischargeReferralPatient() async { hasError = false; Map body = Map(); await getDoctorProfile(isGetProfile: true); body['DoctorID'] = doctorProfile!.doctorID; body['FirstName'] = "0"; body['MiddleName'] = "0"; body['LastName'] = "0"; body['PatientMobileNumber'] = "0"; body['PatientIdentificationID'] = "0"; body['PatientID'] = 0; body['From'] = "0"; body['To'] = "0"; body['stamp'] = DateTime.now().toIso8601String(); body['IsLoginForDoctorApp'] = true; body['IPAdress'] = "11.11.11.11"; body['PatientOutSA'] = false; body['PatientTypeID'] = 1; hasError = false; myDischargeReferralPatients.clear(); await baseAppClient.post(GET_MY_DISCHARGE_PATIENT, onSuccess: (dynamic response, int statusCode) { if (response['List_MyDischargeReferralPatient'] != null) { response['List_MyDischargeReferralPatient'].forEach((v) { myDischargeReferralPatients.add(DischargeReferralPatient.fromJson(v)); }); } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } }