|
|
@ -23,8 +23,7 @@ class PrescriptionsService extends BaseService {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
await baseAppClient.post(PRESCRIPTIONS,
|
|
|
|
await baseAppClient.post(PRESCRIPTIONS, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
prescriptionsList.clear();
|
|
|
|
prescriptionsList.clear();
|
|
|
|
response['PatientPrescriptionList'].forEach((prescriptions) {
|
|
|
|
response['PatientPrescriptionList'].forEach((prescriptions) {
|
|
|
|
prescriptionsList.add(Prescriptions.fromJson(prescriptions));
|
|
|
|
prescriptionsList.add(Prescriptions.fromJson(prescriptions));
|
|
|
@ -38,13 +37,10 @@ class PrescriptionsService extends BaseService {
|
|
|
|
Future getPrescriptionsOrders() async {
|
|
|
|
Future getPrescriptionsOrders() async {
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS,
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
prescriptionsOrderList.clear();
|
|
|
|
prescriptionsOrderList.clear();
|
|
|
|
response['PatientER_GetPatientAllPresOrdersList']
|
|
|
|
response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
|
|
|
|
.forEach((prescriptionsOrder) {
|
|
|
|
prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
|
|
|
|
prescriptionsOrderList
|
|
|
|
|
|
|
|
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
@ -53,8 +49,7 @@ class PrescriptionsService extends BaseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReport _requestPrescriptionReport =
|
|
|
|
RequestPrescriptionReport _requestPrescriptionReport =
|
|
|
|
RequestPrescriptionReport(
|
|
|
|
RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
|
|
|
|
appointmentNo: 0, isDentalAllowedBackend: false);
|
|
|
|
|
|
|
|
List<PrescriptionReport> prescriptionReportList = List();
|
|
|
|
List<PrescriptionReport> prescriptionReportList = List();
|
|
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionReport({Prescriptions prescriptions}) async {
|
|
|
|
Future getPrescriptionReport({Prescriptions prescriptions}) async {
|
|
|
@ -70,25 +65,19 @@ class PrescriptionsService extends BaseService {
|
|
|
|
_requestPrescriptionReport.episodeID = prescriptions.episodeID;
|
|
|
|
_requestPrescriptionReport.episodeID = prescriptions.episodeID;
|
|
|
|
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
|
|
|
|
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
|
|
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
|
|
|
|
prescriptions.isInOutPatient
|
|
|
|
|
|
|
|
? GET_PRESCRIPTION_REPORT_ENH
|
|
|
|
|
|
|
|
: GET_PRESCRIPTION_REPORT,
|
|
|
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
prescriptionReportList.clear();
|
|
|
|
prescriptionReportList.clear();
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
if (prescriptions.isInOutPatient) {
|
|
|
|
if (prescriptions.isInOutPatient) {
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
prescriptionReportList
|
|
|
|
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
prescriptionReportEnhList
|
|
|
|
|
|
|
|
.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
prescriptionReportListINP.clear();
|
|
|
|
prescriptionReportListINP.clear();
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
prescriptionReportListINP
|
|
|
|
prescriptionReportListINP.add(PrescriptionReportINP.fromJson(prescriptions));
|
|
|
|
.add(PrescriptionReportINP.fromJson(prescriptions));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
@ -97,13 +86,12 @@ class PrescriptionsService extends BaseService {
|
|
|
|
}, body: _requestPrescriptionReport.toJson());
|
|
|
|
}, body: _requestPrescriptionReport.toJson());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RequestSendPrescriptionEmail _requestSendPrescriptionEmail =
|
|
|
|
RequestSendPrescriptionEmail _requestSendPrescriptionEmail = RequestSendPrescriptionEmail(
|
|
|
|
RequestSendPrescriptionEmail(
|
|
|
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
Future sendPrescriptionEmail(String appointmentDate, int patientID,
|
|
|
|
Future sendPrescriptionEmail(
|
|
|
|
String clinicName, String doctorName, int doctorID, int projectID) async {
|
|
|
|
String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async {
|
|
|
|
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
|
|
|
|
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
|
|
|
|
_requestSendPrescriptionEmail.appointmentDate = appointmentDate;
|
|
|
|
_requestSendPrescriptionEmail.appointmentDate = appointmentDate;
|
|
|
|
_requestSendPrescriptionEmail.patientID = patientID;
|
|
|
|
_requestSendPrescriptionEmail.patientID = patientID;
|
|
|
@ -112,25 +100,21 @@ class PrescriptionsService extends BaseService {
|
|
|
|
_requestSendPrescriptionEmail.projectID = projectID;
|
|
|
|
_requestSendPrescriptionEmail.projectID = projectID;
|
|
|
|
_requestSendPrescriptionEmail.to = user.emailAddress;
|
|
|
|
_requestSendPrescriptionEmail.to = user.emailAddress;
|
|
|
|
_requestSendPrescriptionEmail.dateofBirth = user.dateofBirth;
|
|
|
|
_requestSendPrescriptionEmail.dateofBirth = user.dateofBirth;
|
|
|
|
_requestSendPrescriptionEmail.patientIditificationNum =
|
|
|
|
_requestSendPrescriptionEmail.patientIditificationNum = user.patientIdentificationNo;
|
|
|
|
user.patientIdentificationNo;
|
|
|
|
|
|
|
|
_requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber;
|
|
|
|
_requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber;
|
|
|
|
_requestSendPrescriptionEmail.doctorID = doctorID;
|
|
|
|
_requestSendPrescriptionEmail.doctorID = doctorID;
|
|
|
|
_requestSendPrescriptionEmail.patientName =
|
|
|
|
_requestSendPrescriptionEmail.patientName = user.firstName + " " + user.lastName;
|
|
|
|
user.firstName + " " + user.lastName;
|
|
|
|
|
|
|
|
_requestSendPrescriptionEmail.setupID = user.setupID;
|
|
|
|
_requestSendPrescriptionEmail.setupID = user.setupID;
|
|
|
|
_requestSendPrescriptionEmail.to = user.emailAddress;
|
|
|
|
_requestSendPrescriptionEmail.to = user.emailAddress;
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
await baseAppClient
|
|
|
|
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {},
|
|
|
|
.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {},
|
|
|
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|
}, body: _requestSendPrescriptionEmail.toJson());
|
|
|
|
}, body: _requestSendPrescriptionEmail.toJson());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RequestGetListPharmacyForPrescriptions
|
|
|
|
RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions =
|
|
|
|
requestGetListPharmacyForPrescriptions =
|
|
|
|
|
|
|
|
RequestGetListPharmacyForPrescriptions(
|
|
|
|
RequestGetListPharmacyForPrescriptions(
|
|
|
|
latitude: 0,
|
|
|
|
latitude: 0,
|
|
|
|
longitude: 0,
|
|
|
|
longitude: 0,
|
|
|
@ -141,12 +125,11 @@ class PrescriptionsService extends BaseService {
|
|
|
|
Future getListPharmacyForPrescriptions({int itemId}) async {
|
|
|
|
Future getListPharmacyForPrescriptions({int itemId}) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
requestGetListPharmacyForPrescriptions.itemID = itemId;
|
|
|
|
requestGetListPharmacyForPrescriptions.itemID = itemId;
|
|
|
|
await baseAppClient.post(GET_PHARMACY_LIST,
|
|
|
|
pharmacyPrescriptionsList.clear();
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
await baseAppClient.post(GET_PHARMACY_LIST, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
pharmacyPrescriptionsList.clear();
|
|
|
|
pharmacyPrescriptionsList.clear();
|
|
|
|
response['PharmList'].forEach((prescriptions) {
|
|
|
|
response['PharmList'].forEach((prescriptions) {
|
|
|
|
pharmacyPrescriptionsList
|
|
|
|
pharmacyPrescriptionsList.add(PharmacyPrescriptions.fromJson(prescriptions));
|
|
|
|
.add(PharmacyPrescriptions.fromJson(prescriptions));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
@ -154,15 +137,13 @@ class PrescriptionsService extends BaseService {
|
|
|
|
}, body: requestGetListPharmacyForPrescriptions.toJson());
|
|
|
|
}, body: requestGetListPharmacyForPrescriptions.toJson());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh =
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
|
|
|
|
RequestPrescriptionReportEnh(
|
|
|
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionReportEnh(
|
|
|
|
Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async {
|
|
|
|
{PrescriptionsOrder prescriptionsOrder}) async {
|
|
|
|
|
|
|
|
///This logic copy from the old app from class [order-history.component.ts] in line 45
|
|
|
|
///This logic copy from the old app from class [order-history.component.ts] in line 45
|
|
|
|
bool isInPatient = false;
|
|
|
|
bool isInPatient = false;
|
|
|
|
prescriptionsList.forEach((element) {
|
|
|
|
prescriptionsList.forEach((element) {
|
|
|
@ -177,8 +158,7 @@ class PrescriptionsService extends BaseService {
|
|
|
|
isInPatient = element.isInOutPatient;
|
|
|
|
isInPatient = element.isInOutPatient;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (int.parse(prescriptionsOrder.appointmentNo) ==
|
|
|
|
if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
|
|
|
|
element.appointmentNo) {
|
|
|
|
|
|
|
|
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
|
|
|
|
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
|
|
|
|
_requestPrescriptionReportEnh.clinicID = element.clinicID;
|
|
|
|
_requestPrescriptionReportEnh.clinicID = element.clinicID;
|
|
|
|
_requestPrescriptionReportEnh.projectID = element.projectID;
|
|
|
|
_requestPrescriptionReportEnh.projectID = element.projectID;
|
|
|
@ -194,20 +174,17 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
|
|
|
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
|
|
|
|
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
|
|
|
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
|
|
|
|
|
|
|
|
if (isInPatient) {
|
|
|
|
if (isInPatient) {
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
prescriptionReportEnhList
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
PrescriptionReportEnh reportEnh =
|
|
|
|
PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
|
|
|
|
PrescriptionReportEnh.fromJson(prescriptions);
|
|
|
|
|
|
|
|
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
|
|
|
|
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
|
|
|
|
prescriptionReportEnhList.add(reportEnh);
|
|
|
|
prescriptionReportEnhList.add(reportEnh);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -226,8 +203,7 @@ class PrescriptionsService extends BaseService {
|
|
|
|
body['RejectionReason'] = '';
|
|
|
|
body['RejectionReason'] = '';
|
|
|
|
body['PresOrderStatus'] = 4;
|
|
|
|
body['PresOrderStatus'] = 4;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
await baseAppClient.post(UPDATE_PRESS_ORDER,
|
|
|
|
await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {},
|
|
|
|
onSuccess: (dynamic response, int statusCode) {},
|
|
|
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
hasError = true;
|
|
|
|
hasError = true;
|
|
|
|
super.error = error;
|
|
|
|
super.error = error;
|
|
|
|