You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.8 KiB
Dart
99 lines
2.8 KiB
Dart
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
|
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
|
|
|
import '../base_view_model.dart';
|
|
|
|
|
|
class RRTService extends BaseService{
|
|
|
|
}
|
|
class _RRTServiceOrders{
|
|
List<PrescriptionsOrder> pendingOrders = [];
|
|
List<PrescriptionsOrder> completedOrders = [];
|
|
}
|
|
|
|
class RRTViewModel extends BaseViewModel{
|
|
var _service = RRTService();
|
|
_RRTServiceOrders rrtOrders = _RRTServiceOrders();
|
|
|
|
Future getRequiredData() async{
|
|
getServicePrice();
|
|
getAllOrders();
|
|
}
|
|
|
|
Future createOrder(){
|
|
var body = {"Latitude":24.828170776367188,"Longitude":46.63229029757938,"IdentificationNo":"2344670985","NationalityID":"JOR","CreatedBy":1231755,"OrderServiceID":5,"Notes":""};
|
|
_service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode){
|
|
print(response);
|
|
}, onFailure: (error, statusCode){
|
|
|
|
});
|
|
return null;
|
|
}
|
|
|
|
// Service ID: 4 == RRT
|
|
Future<_RRTServiceOrders> getAllOrders() async{
|
|
await _service.baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, body: {}, onSuccess: (response, statusCode){
|
|
var data = response["PatientER_GetPatientAllPresOrdersList"];
|
|
if(data != null && data is List){
|
|
data.forEach((json){
|
|
if(json["ServiceID"] == 4){
|
|
if(json["Status"] == 1){ // Pending
|
|
rrtOrders.pendingOrders.clear();
|
|
rrtOrders.pendingOrders.add(PrescriptionsOrder.fromJson(json));
|
|
}else if (json["Status"] == 3){ // Completed
|
|
rrtOrders.completedOrders.clear();
|
|
rrtOrders.completedOrders.add(PrescriptionsOrder.fromJson(json));
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}, onFailure: (error, statusCode){
|
|
print(error);
|
|
});
|
|
return rrtOrders;
|
|
}
|
|
|
|
|
|
Future getOrderDetails(){
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
Future getAllQuestions(){
|
|
_service.baseAppClient.post(GET_ALL_RRT_QUESTIONS, body: {}, onSuccess: (response, statusCode){
|
|
print(response);
|
|
}, onFailure: (error, statusCode){
|
|
print(error);
|
|
});
|
|
return null;
|
|
}
|
|
|
|
|
|
Future getServicePrice(){
|
|
var body = {"IdentificationNo":user.patientIdentificationNo};
|
|
_service.baseAppClient.post(GET_RRT_SERVICE_PRICE, body: body, onSuccess: (response, statusCode){
|
|
print(response);
|
|
}, onFailure: (error, statusCode){
|
|
print(error);
|
|
});
|
|
return null;
|
|
}
|
|
|
|
Future cancelOrder(){
|
|
var body = {"PresOrderID":"2318","PresOrderStatus":4,"EditedBy":3,"RejectionReason":""};
|
|
_service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode){
|
|
print(response);
|
|
}, onFailure: (error, statusCode){
|
|
print(error);
|
|
});
|
|
return null;
|
|
}
|
|
|
|
|
|
Future getCancelReasons(){
|
|
}
|
|
} |