|
|
|
|
@ -22,7 +22,8 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
List<PrescriptionsOrder> prescriptionsOrderList = List();
|
|
|
|
|
List<PrescriotionInPatient> prescriptionInPatientList = List();
|
|
|
|
|
|
|
|
|
|
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel();
|
|
|
|
|
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel =
|
|
|
|
|
InPatientPrescriptionRequestModel();
|
|
|
|
|
GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel =
|
|
|
|
|
GetMedicationForInPatientRequestModel();
|
|
|
|
|
|
|
|
|
|
@ -34,10 +35,12 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
hasError = false;
|
|
|
|
|
prescriptionInPatientList.clear();
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionsList.clear();
|
|
|
|
|
response['List_PrescriptionReportForInPatient'].forEach((prescriptions) {
|
|
|
|
|
prescriptionInPatientList.add(PrescriotionInPatient.fromJson(prescriptions));
|
|
|
|
|
prescriptionInPatientList
|
|
|
|
|
.add(PrescriotionInPatient.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -49,7 +52,8 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
hasError = false;
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
|
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionsList.clear();
|
|
|
|
|
response['PatientPrescriptionList'].forEach((prescriptions) {
|
|
|
|
|
prescriptionsList.add(Prescriptions.fromJson(prescriptions));
|
|
|
|
|
@ -61,10 +65,13 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReport _requestPrescriptionReport =
|
|
|
|
|
RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
|
|
|
|
|
RequestPrescriptionReport(
|
|
|
|
|
appointmentNo: 0, isDentalAllowedBackend: false);
|
|
|
|
|
List<PrescriptionReport> prescriptionReportList = List();
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
|
|
|
|
|
Future getPrescriptionReport(
|
|
|
|
|
{Prescriptions prescriptions,
|
|
|
|
|
@required PatiantInformtion patient}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
|
|
|
|
|
_requestPrescriptionReport.projectID = prescriptions.projectID;
|
|
|
|
|
@ -74,18 +81,23 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.postPatient(
|
|
|
|
|
prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
|
|
|
|
|
prescriptions.isInOutPatient
|
|
|
|
|
? GET_PRESCRIPTION_REPORT_ENH
|
|
|
|
|
: GET_PRESCRIPTION_REPORT_NEW,
|
|
|
|
|
patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionReportList.clear();
|
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
|
if (prescriptions.isInOutPatient) {
|
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
|
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
prescriptionReportList
|
|
|
|
|
.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
|
prescriptionReportEnhList
|
|
|
|
|
.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
|
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
|
prescriptionReportList
|
|
|
|
|
.add(PrescriptionReport.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
@ -94,7 +106,8 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}, body: _requestPrescriptionReport.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions =
|
|
|
|
|
RequestGetListPharmacyForPrescriptions
|
|
|
|
|
requestGetListPharmacyForPrescriptions =
|
|
|
|
|
RequestGetListPharmacyForPrescriptions(
|
|
|
|
|
latitude: 0,
|
|
|
|
|
longitude: 0,
|
|
|
|
|
@ -102,13 +115,16 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
);
|
|
|
|
|
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
|
|
|
|
|
|
|
|
|
|
Future getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
|
|
|
|
|
Future getListPharmacyForPrescriptions(
|
|
|
|
|
{int itemId, @required PatiantInformtion patient}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
requestGetListPharmacyForPrescriptions.itemID = itemId;
|
|
|
|
|
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
pharmacyPrescriptionsList.clear();
|
|
|
|
|
response['PharmList'].forEach((prescriptions) {
|
|
|
|
|
pharmacyPrescriptionsList.add(PharmacyPrescriptions.fromJson(prescriptions));
|
|
|
|
|
pharmacyPrescriptionsList
|
|
|
|
|
.add(PharmacyPrescriptions.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -116,13 +132,16 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}, body: requestGetListPharmacyForPrescriptions.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
|
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh =
|
|
|
|
|
RequestPrescriptionReportEnh(
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
|
|
|
|
|
Future getPrescriptionReportEnh(
|
|
|
|
|
{PrescriptionsOrder prescriptionsOrder,
|
|
|
|
|
@required PatiantInformtion patient}) async {
|
|
|
|
|
///This logic copy from the old app from class [order-history.component.ts] in line 45
|
|
|
|
|
bool isInPatient = false;
|
|
|
|
|
prescriptionsList.forEach((element) {
|
|
|
|
|
@ -137,7 +156,8 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
isInPatient = element.isInOutPatient;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
|
|
|
|
|
if (int.parse(prescriptionsOrder.appointmentNo) ==
|
|
|
|
|
element.appointmentNo) {
|
|
|
|
|
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
|
|
|
|
|
_requestPrescriptionReportEnh.clinicID = element.clinicID;
|
|
|
|
|
_requestPrescriptionReportEnh.projectID = element.projectID;
|
|
|
|
|
@ -153,17 +173,20 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
|
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.postPatient(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
|
|
|
|
|
await baseAppClient.postPatient(
|
|
|
|
|
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
|
|
|
|
|
patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
|
|
|
|
|
|
if (isInPatient) {
|
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
prescriptionReportEnhList
|
|
|
|
|
.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
|
PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
|
|
|
|
|
PrescriptionReportEnh reportEnh =
|
|
|
|
|
PrescriptionReportEnh.fromJson(prescriptions);
|
|
|
|
|
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
|
|
|
|
|
prescriptionReportEnhList.add(reportEnh);
|
|
|
|
|
});
|
|
|
|
|
@ -177,10 +200,13 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
Future getPrescriptionsOrders() async {
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionsOrderList.clear();
|
|
|
|
|
response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
|
|
|
|
|
prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
|
|
|
|
|
response['PatientER_GetPatientAllPresOrdersList']
|
|
|
|
|
.forEach((prescriptionsOrder) {
|
|
|
|
|
prescriptionsOrderList
|
|
|
|
|
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -190,17 +216,19 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
|
|
|
|
|
Future getMedicationForInPatient(PatiantInformtion patient) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
_getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel(
|
|
|
|
|
_getMedicationForInPatientRequestModel =
|
|
|
|
|
GetMedicationForInPatientRequestModel(
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
admissionNo: int.parse(patient.admissionNo),
|
|
|
|
|
tokenID: "@dm!n",
|
|
|
|
|
projectID: patient.projectId,
|
|
|
|
|
);
|
|
|
|
|
await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT,
|
|
|
|
|
patient: patient, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
medicationForInPatient.clear();
|
|
|
|
|
response['List_GetMedicationForInpatient'].forEach((prescriptions) {
|
|
|
|
|
medicationForInPatient.add(GetMedicationForInPatientModel.fromJson(prescriptions));
|
|
|
|
|
medicationForInPatient
|
|
|
|
|
.add(GetMedicationForInPatientModel.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
|