import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/prescription_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; class UcafService extends LookupService { List patientChiefComplaintList = []; VitalSignData patientVitalSigns; List patientAssessmentList = []; List orderProcedureList = []; PrescriptionModel prescriptionList; Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; body['DoctorID'] = ""; await baseAppClient.post (GET_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); patientChiefComplaintList.clear(); response['List_ChiefComplaint']['entityList'].forEach((v) { patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future getPatientVitalSign(PatiantInformtion patient) async { patientVitalSigns = null; hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; // body['EpisodeID'] = patient.episodeNo; await baseAppClient.post( GET_PATIENT_VITAL_SIGN_DATA, onSuccess: (dynamic response, int statusCode) { if(response['VitalSignsList'] != null){ if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); } } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error.toString(); }, body: body, ); } Future getPatientAssessment(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; await baseAppClient.post (GET_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { print("Success"); patientAssessmentList.clear(); response['AssessmentList']['entityList'].forEach((v) { patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future getPrescription(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; hasError = false; prescriptionList = null; await baseAppClient.post(GET_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { prescriptionList = PrescriptionModel.fromJson(response['PrescriptionList']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future getOrderProcedures(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; await baseAppClient.post (GET_ORDER_PROCEDURE, onSuccess: (dynamic response, int statusCode) { print("Success"); orderProcedureList.clear(); response['OrderedProcedureList']['entityList'].forEach((v) { orderProcedureList.add(OrderProcedure.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } Future postUCAF(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; await baseAppClient.post (POST_UCAF, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } }