|
|
|
|
@ -11,40 +11,17 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescripti
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions_orders.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/prescriptions/request_send_prescription_email.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
class PrescriptionsService extends BaseService {
|
|
|
|
|
List<Prescriptions> prescriptionsList = List();
|
|
|
|
|
RequestPrescriptions _requestPrescriptions = RequestPrescriptions(
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
channel: 3,
|
|
|
|
|
languageID: 2,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: 'KIbLoqkytuKJEWECHQ',
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
deviceTypeID: 2,
|
|
|
|
|
patientID: 1231755,
|
|
|
|
|
tokenID: '@dm!n',
|
|
|
|
|
patientTypeID: 1,
|
|
|
|
|
patientType: 1);
|
|
|
|
|
|
|
|
|
|
List<PrescriptionsOrder> prescriptionsOrderList = List();
|
|
|
|
|
RequestPrescriptionsOrders _requestPrescriptionsOrders =
|
|
|
|
|
RequestPrescriptionsOrders(
|
|
|
|
|
patientID: 1231755,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
channel: 3,
|
|
|
|
|
languageID: 1,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
sessionID: 'KIbLoqkytuKJEWECHQ',
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
deviceTypeID: 2);
|
|
|
|
|
|
|
|
|
|
Future getPrescriptions() async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
|
await baseAppClient.post(PRESCRIPTIONS,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionsList.clear();
|
|
|
|
|
@ -54,10 +31,12 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: _requestPrescriptions.toJson());
|
|
|
|
|
}, body: body);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionsOrders() async {
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionsOrderList.clear();
|
|
|
|
|
@ -69,33 +48,16 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: _requestPrescriptionsOrders.toJson());
|
|
|
|
|
}, body: body);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReport _requestPrescriptionReport =
|
|
|
|
|
RequestPrescriptionReport(
|
|
|
|
|
appointmentNo: 0,
|
|
|
|
|
channel: 3,
|
|
|
|
|
clinicID: 4,
|
|
|
|
|
deviceTypeID: 2,
|
|
|
|
|
dischargeNo: 2018003246,
|
|
|
|
|
episodeID: 0,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
languageID: 1,
|
|
|
|
|
patientID: 1231755,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
patientType: 1,
|
|
|
|
|
patientTypeID: 1,
|
|
|
|
|
projectID: 12,
|
|
|
|
|
sessionID: 'wgKuHpsPsEuLnlJhAYCQ',
|
|
|
|
|
tokenID: '@dm!n',
|
|
|
|
|
setupID: "91877",
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
isDentalAllowedBackend: false);
|
|
|
|
|
appointmentNo: 0, isDentalAllowedBackend: false);
|
|
|
|
|
List<PrescriptionReport> prescriptionReportList = List();
|
|
|
|
|
|
|
|
|
|
Future getPrescriptionReport({int dischargeNo,int projectId,int clinicID,String setupID}) async {
|
|
|
|
|
Future getPrescriptionReport(
|
|
|
|
|
{int dischargeNo, int projectId, int clinicID, String setupID}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
_requestPrescriptionReport.dischargeNo = dischargeNo;
|
|
|
|
|
_requestPrescriptionReport.projectID = projectId;
|
|
|
|
|
@ -116,24 +78,7 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
|
|
|
|
|
RequestSendPrescriptionEmail _requestSendPrescriptionEmail =
|
|
|
|
|
RequestSendPrescriptionEmail(
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
languageID: 2,
|
|
|
|
|
channel: 3,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: 'twIUmHfOHqFdDfVcyw',
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
deviceTypeID: 2,
|
|
|
|
|
tokenID: '@dm!n',
|
|
|
|
|
patientTypeID: 1,
|
|
|
|
|
patientType: 1,
|
|
|
|
|
to: 'aljammalzmohammad@outlook.com',
|
|
|
|
|
dateofBirth: '/Date(536743800000+0300)/',
|
|
|
|
|
patientIditificationNum: '2344670985',
|
|
|
|
|
patientMobileNumber: '537503378',
|
|
|
|
|
patientName: 'TAMER FANASHEH',
|
|
|
|
|
setupID: '91877');
|
|
|
|
|
isDentalAllowedBackend: false,);
|
|
|
|
|
|
|
|
|
|
Future sendPrescriptionEmail(String appointmentDate, int patientID,
|
|
|
|
|
String clinicName, String doctorName, int projectID) async {
|
|
|
|
|
@ -143,31 +88,25 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
_requestSendPrescriptionEmail.clinicName = clinicName;
|
|
|
|
|
_requestSendPrescriptionEmail.doctorName = doctorName;
|
|
|
|
|
_requestSendPrescriptionEmail.projectID = projectID;
|
|
|
|
|
_requestSendPrescriptionEmail.to = user.emailAddress;
|
|
|
|
|
_requestSendPrescriptionEmail.dateofBirth = user.dateofBirth;
|
|
|
|
|
_requestSendPrescriptionEmail.patientIditificationNum = user.patientIdentificationNo;
|
|
|
|
|
_requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber;
|
|
|
|
|
_requestSendPrescriptionEmail.patientName = user.firstName +" "+ user.lastName;
|
|
|
|
|
_requestSendPrescriptionEmail.setupID = user.setupID;
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL,
|
|
|
|
|
onSuccess: (response,statusCode){
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: _requestSendPrescriptionEmail.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestGetListPharmacyForPrescriptions
|
|
|
|
|
requestGetListPharmacyForPrescriptions =
|
|
|
|
|
RequestGetListPharmacyForPrescriptions(
|
|
|
|
|
RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions(
|
|
|
|
|
latitude: 0,
|
|
|
|
|
longitude: 0,
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
channel: 3,
|
|
|
|
|
languageID: 2,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: 'HGNerTUSXhpaHXBg',
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
deviceTypeID: 2,
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
|
|
|
|
|
|
|
|
|
|
@ -187,44 +126,85 @@ class PrescriptionsService extends BaseService {
|
|
|
|
|
}, body: requestGetListPharmacyForPrescriptions.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh =
|
|
|
|
|
RequestPrescriptionReportEnh(isDentalAllowedBackend: false,);
|
|
|
|
|
|
|
|
|
|
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
|
|
|
|
|
versionID: 5.5,
|
|
|
|
|
channel: 3,
|
|
|
|
|
languageID: 2,
|
|
|
|
|
iPAdress: '10.20.10.20',
|
|
|
|
|
generalid: 'Cs2020@2016\$2958',
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: 'bQQdesEKpyYKTFMVNeg',
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
deviceTypeID: 2,
|
|
|
|
|
patientID: 1231755,
|
|
|
|
|
tokenID: '@dm!n',
|
|
|
|
|
patientTypeID: 1,
|
|
|
|
|
patientType: 1,
|
|
|
|
|
setupID: '91877',
|
|
|
|
|
appointmentNo: 5926390,
|
|
|
|
|
episodeID: 140251928,
|
|
|
|
|
clinicID: 25,
|
|
|
|
|
projectID: 12
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async {
|
|
|
|
|
|
|
|
|
|
///This logic copy from the old app from class [order-history.component.ts] in line 45
|
|
|
|
|
bool isInPatient = false;
|
|
|
|
|
prescriptionsList.forEach((element) {
|
|
|
|
|
if (prescriptionsOrder.appointmentNo == "0") {
|
|
|
|
|
if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) {
|
|
|
|
|
|
|
|
|
|
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
|
|
|
|
|
_requestPrescriptionReportEnh.clinicID = element.clinicID;
|
|
|
|
|
_requestPrescriptionReportEnh.projectID = element.projectID;
|
|
|
|
|
_requestPrescriptionReportEnh.episodeID = element.episodeID;
|
|
|
|
|
_requestPrescriptionReportEnh.setupID = element.setupID;
|
|
|
|
|
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
|
|
|
|
|
isInPatient = element.isInOutPatient;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
|
|
|
|
|
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
|
|
|
|
|
_requestPrescriptionReportEnh.clinicID = element.clinicID;
|
|
|
|
|
_requestPrescriptionReportEnh.projectID = element.projectID;
|
|
|
|
|
_requestPrescriptionReportEnh.episodeID = element.episodeID;
|
|
|
|
|
_requestPrescriptionReportEnh.setupID = element.setupID;
|
|
|
|
|
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
|
|
|
|
|
isInPatient = element.isInOutPatient;///call inpGetPrescriptionReport
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
|
|
|
|
|
Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder})async{
|
|
|
|
|
hasError = false;
|
|
|
|
|
// _requestPrescriptionReportEnh.appointmentNo = int.parse(prescriptionsOrder.appointmentNo);
|
|
|
|
|
// _requestPrescriptionReportEnh.patientID = prescriptionsOrder.projectID;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH,
|
|
|
|
|
await baseAppClient.post(isInPatient? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
prescriptionReportEnhList.clear();
|
|
|
|
|
|
|
|
|
|
if(isInPatient){
|
|
|
|
|
response['ListPRM'].forEach((prescriptions) {
|
|
|
|
|
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
|
|
|
|
|
|
|
|
|
|
PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
|
|
|
|
|
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
|
|
|
|
|
prescriptionReportEnhList.add(reportEnh);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: _requestPrescriptionReportEnh.toJson());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future updatePressOrder({@required int presOrderID}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
body['PresOrderID'] = presOrderID;
|
|
|
|
|
body['EditedBy'] = user.patientID;
|
|
|
|
|
body['RejectionReason'] = '';
|
|
|
|
|
body['PresOrderStatus'] = 4;
|
|
|
|
|
body['isDentalAllowedBackend'] = false;
|
|
|
|
|
await baseAppClient.post(UPDATE_PRESS_ORDER,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: _requestPrescriptionReportEnh.toJson());
|
|
|
|
|
}, body: body);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|