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.
RSGDoctorApp/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_servi...

111 lines
3.4 KiB
Dart

import 'dart:async';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
class PharmacyInterventionService extends BaseService {
FutureOr<MedicationList?> getMedicationList(
{String nursingStationId = '',
String admissionId = '',
String patientID = '',
String fromDate = '',
String toDate = ''}) async {
var request = {
"nursingStationID": nursingStationId,
"admissionNo": admissionId,
"patientID": patientID,
"fromDate": fromDate,
"toDate": toDate,
};
hasError = false;
await baseAppClient.post(GET_MEDICINE_WITH_INTERVAL,
onSuccess: (dynamic response, int statusCode) {
return MedicationList.fromJson(response['List_MedicineWithIntervention']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = super.error! + "\n" + error;
return null;
}, body: request);
return null;
}
FutureOr<bool> getInfectiousDiseaseConsultantStatus() async {
hasError = false;
await baseAppClient.post(IS_INFECTIOUS_DISEASE,
onSuccess: (dynamic response, int statusCode) {
return response['IsInfectiousDiseases'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = super.error! + "\n" + error;
return false;
}, body: {});
return false;
}
FutureOr<InterventionHistoryList?> getInfectiousDiseaseHistory({
String admissionNumber = '',
String prescriptionNumber = '',
String orderNumber = '',
String itemID = '',
}) async {
var request = {
"AdmissionNo": admissionNumber,
"PrescriptionNo": prescriptionNumber,
"OrderNo": orderNumber,
"ItemID": itemID,
};
hasError = false;
await baseAppClient.post(INFECTIOUS_HISTORY,
onSuccess: (dynamic response, int statusCode) {
return InterventionHistoryList.fromJson(
response['List_MedicineInterventionHistory']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = super.error! + "\n" + error;
return null;
}, body: request);
return null;
}
FutureOr<bool> updateInterventionStatus({
String admissionNo = '',
String prescriptionNo = '',
String orderNo = '',
String itemID = '',
String interventionID = '',
String isAccepted = '',
String remarks = '',
String authorizeID = '',
String lineItemNo = '',
String status = '',
}) async {
var request = {
"AdmissionNo": admissionNo,
"PrescriptionNo": prescriptionNo,
"OrderNo": orderNo,
"ItemID": itemID,
"InterventionID": interventionID,
"IsAccepted": isAccepted,
"Remarks": remarks,
"AuthorizeID": authorizeID,
"LineItemNo": lineItemNo,
"Status": status,
};
hasError = false;
await baseAppClient.post(INFECTIOUS_HISTORY,
onSuccess: (dynamic response, int statusCode) {
return response['IsAccepted'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = super.error! + "\n" + error;
return false;
}, body: request);
return false;
}
}