|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.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 {
|
|
|
|
|
Future<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;
|
|
|
|
|
MedicationList? result;
|
|
|
|
|
await baseAppClient.post(GET_MEDICINE_WITH_INTERVAL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
result = MedicationList.fromJson(response['List_MedicineWithIntervention']);
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = super.error??'' + "\n" + error;
|
|
|
|
|
|
|
|
|
|
}, body: request);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
/// it will be called only for the doctor that are associated to vida plus
|
|
|
|
|
/// project
|
|
|
|
|
///
|
|
|
|
|
Future<bool> getInfectiousDiseaseConsultantStatus() async {
|
|
|
|
|
String vidaToken = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
|
|
|
|
|
|
|
|
|
|
if(vidaToken.isEmpty){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
hasError = false;
|
|
|
|
|
var success = false;
|
|
|
|
|
await baseAppClient.post(IS_INFECTIOUS_DISEASE,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
success = response['IsInfectiousDiseases'];
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = super.error! + "\n" + error;
|
|
|
|
|
|
|
|
|
|
}, body: {});
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<InterventionHistoryList?> getInfectiousDiseaseHistory({
|
|
|
|
|
String admissionNumber = '',
|
|
|
|
|
String prescriptionNumber = '',
|
|
|
|
|
String orderNumber = '',
|
|
|
|
|
String itemID = '',
|
|
|
|
|
}) async {
|
|
|
|
|
var request = {
|
|
|
|
|
"AdmissionNo": admissionNumber,
|
|
|
|
|
"PrescriptionNo": prescriptionNumber,
|
|
|
|
|
"OrderNo": orderNumber,
|
|
|
|
|
"ItemID": itemID,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
hasError = false;
|
|
|
|
|
InterventionHistoryList? result;
|
|
|
|
|
await baseAppClient.post(INFECTIOUS_HISTORY,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
result = InterventionHistoryList.fromJson(
|
|
|
|
|
response['List_MedicineInterventionHistory']);
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = super.error! + "\n" + error;
|
|
|
|
|
|
|
|
|
|
}, body: request);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<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;
|
|
|
|
|
var result = false;
|
|
|
|
|
await baseAppClient.post(INFECTIOUS_HISTORY,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
result = response['IsAccepted'];
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = super.error! + "\n" + error;
|
|
|
|
|
}, body: request);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|