|
|
|
@ -12,16 +12,30 @@ import 'base/base_service.dart';
|
|
|
|
class LabsService extends BaseService {
|
|
|
|
class LabsService extends BaseService {
|
|
|
|
List<PatientLabOrders> patientLabOrdersList = List();
|
|
|
|
List<PatientLabOrders> patientLabOrdersList = List();
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientLabOrdersList(PatiantInformtion patient) async {
|
|
|
|
Future getPatientLabOrdersList(
|
|
|
|
|
|
|
|
PatiantInformtion patient, bool isArrived) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
|
|
|
String url = "";
|
|
|
|
|
|
|
|
if (isArrived) {
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
await baseAppClient.postPatient(GET_Patient_LAB_ORDERS, patient: patient,
|
|
|
|
url = GET_Patient_LAB_ORDERS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
url = GET_PATIENT_LAB_OREDERS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await baseAppClient.postPatient(url, patient: patient,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientLabOrdersList.clear();
|
|
|
|
patientLabOrdersList.clear();
|
|
|
|
|
|
|
|
if (isArrived) {
|
|
|
|
response['ListPLO'].forEach((hospital) {
|
|
|
|
response['ListPLO'].forEach((hospital) {
|
|
|
|
patientLabOrdersList.add(PatientLabOrders.fromJson(hospital));
|
|
|
|
patientLabOrdersList.add(PatientLabOrders.fromJson(hospital));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
response['List_GetLabOreders'].forEach((hospital) {
|
|
|
|
|
|
|
|
patientLabOrdersList.add(PatientLabOrders.fromJson(hospital));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
@ -40,42 +54,65 @@ class LabsService extends BaseService {
|
|
|
|
int clinicID,
|
|
|
|
int clinicID,
|
|
|
|
String invoiceNo,
|
|
|
|
String invoiceNo,
|
|
|
|
String orderNo,
|
|
|
|
String orderNo,
|
|
|
|
PatiantInformtion patient}) async {
|
|
|
|
PatiantInformtion patient,
|
|
|
|
|
|
|
|
bool isInpatient = false}) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
_requestPatientLabSpecialResult.projectID = projectID;
|
|
|
|
_requestPatientLabSpecialResult.projectID = projectID;
|
|
|
|
_requestPatientLabSpecialResult.clinicID = clinicID;
|
|
|
|
_requestPatientLabSpecialResult.clinicID = clinicID;
|
|
|
|
_requestPatientLabSpecialResult.invoiceNo = invoiceNo;
|
|
|
|
_requestPatientLabSpecialResult.invoiceNo = invoiceNo;
|
|
|
|
_requestPatientLabSpecialResult.orderNo = orderNo;
|
|
|
|
_requestPatientLabSpecialResult.orderNo = orderNo;
|
|
|
|
|
|
|
|
body = _requestPatientLabSpecialResult.toJson();
|
|
|
|
|
|
|
|
|
|
|
|
await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT,
|
|
|
|
await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, patient: patient,
|
|
|
|
patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientLabSpecialResult.clear();
|
|
|
|
patientLabSpecialResult.clear();
|
|
|
|
|
|
|
|
|
|
|
|
response['ListPLSR'].forEach((hospital) {
|
|
|
|
response['ListPLSR'].forEach((hospital) {
|
|
|
|
patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital));
|
|
|
|
patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
}, body: _requestPatientLabSpecialResult.toJson());
|
|
|
|
}, body: body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientLabResult(
|
|
|
|
Future getPatientLabResult(
|
|
|
|
{PatientLabOrders patientLabOrder, PatiantInformtion patient}) async {
|
|
|
|
{PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url = "";
|
|
|
|
|
|
|
|
if (isInpatient) {
|
|
|
|
|
|
|
|
url = GET_PATIENT_LAB_RESULTS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
url = GET_Patient_LAB_RESULT;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
body['InvoiceNo'] = patientLabOrder.invoiceNo;
|
|
|
|
body['InvoiceNo'] = patientLabOrder.invoiceNo;
|
|
|
|
body['OrderNo'] = patientLabOrder.orderNo;
|
|
|
|
body['OrderNo'] = patientLabOrder.orderNo;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['SetupID'] = patientLabOrder.setupID;
|
|
|
|
body['SetupID'] = patientLabOrder.setupID;
|
|
|
|
body['ProjectID'] = patientLabOrder.projectID;
|
|
|
|
body['ProjectID'] = patientLabOrder.projectID;
|
|
|
|
body['ClinicID'] = patientLabOrder.clinicID;
|
|
|
|
body['ClinicID'] = patientLabOrder.clinicID ?? 0;
|
|
|
|
await baseAppClient.postPatient(GET_Patient_LAB_RESULT, patient: patient,
|
|
|
|
|
|
|
|
|
|
|
|
await baseAppClient.postPatient(url, patient: patient,
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
patientLabSpecialResult.clear();
|
|
|
|
patientLabSpecialResult.clear();
|
|
|
|
labResultList.clear();
|
|
|
|
labResultList.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isInpatient){
|
|
|
|
|
|
|
|
response['List_GetLabNormal'].forEach((hospital) {
|
|
|
|
|
|
|
|
labResultList.add(LabResult.fromJson(hospital));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}else {
|
|
|
|
response['ListPLR'].forEach((lab) {
|
|
|
|
response['ListPLR'].forEach((lab) {
|
|
|
|
labResultList.add(LabResult.fromJson(lab));
|
|
|
|
labResultList.add(LabResult.fromJson(lab));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
|