Pending Orders Service

merge-requests/864/head
hussam al-habibeh 4 years ago
parent d7b1212b54
commit 64b5652c8d

@ -348,6 +348,9 @@ const GET_EPISODE_FOR_INPATIENT =
const GET_OPERATION_REPORT =
"/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails";
const GET_PENDING_ORDERS =
"Services/DoctorApplication.svc/REST/DoctorApp_GetPendingOrdersForInPatient";
var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************

@ -0,0 +1,36 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/pending_orders/pending_order_request_model.dart';
import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart';
class PendingOrderService extends BaseService {
List<PendingOrderModel> get _pendingOrderList => List();
List<PendingOrderModel> get pendingOrderList => _pendingOrderList;
Future getPendingOrders(
{PendingOrderRequestModel pendingOrderRequestModel,
int patientId,
int admissionNo}) async {
pendingOrderRequestModel = PendingOrderRequestModel(
patientID: patientId,
admissionNo: admissionNo,
patientTypeID: 1,
patientType: 1,
);
hasError = false;
await baseAppClient.post(GET_PENDING_ORDERS,
onSuccess: (dynamic response, int statusCode) {
print("Success");
_pendingOrderList.clear();
response['List_PendingOrders'].forEach(
(v) {
_pendingOrderList.add(PendingOrderModel.fromJson(v));
},
);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: pendingOrderRequestModel.toJson());
}
}

@ -0,0 +1,26 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/pending_order_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart';
class PendingOrdersViewModel extends BaseViewModel {
bool hasError = false;
PendingOrderService _pendingOrderService = locator<PendingOrderService>();
List<PendingOrderModel> get pendingOrdersList =>
_pendingOrderService.pendingOrderList;
Future getPendingOrders({int patientId, int admissionNo}) async {
hasError = false;
setState(ViewState.Busy);
await _pendingOrderService.getPendingOrders(
patientId: patientId, admissionNo: admissionNo);
if (_pendingOrderService.hasError) {
error = _pendingOrderService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
}

@ -1,11 +1,13 @@
import 'package:doctor_app_flutter/core/service/authentication_service.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/service/operation_report_servive.dart';
import 'package:doctor_app_flutter/core/service/pending_order_service.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/operation_report_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
@ -103,6 +105,7 @@ void setupLocator() {
locator.registerLazySingleton(() => VideoCallService());
locator.registerLazySingleton(() => AnalyticsService());
locator.registerLazySingleton(() => OperationReportService());
locator.registerLazySingleton(() => PendingOrderService());
/// View Model
locator.registerFactory(() => DoctorReplayViewModel());
@ -132,4 +135,5 @@ void setupLocator() {
locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel());
locator.registerFactory(() => OperationReportViewModel());
locator.registerFactory(() => PendingOrdersViewModel());
}

@ -0,0 +1,76 @@
class PendingOrderRequestModel {
bool isDentalAllowedBackend;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int deviceTypeID;
String tokenID;
int patientID;
int admissionNo;
String sessionID;
int projectID;
String setupID;
bool patientOutSA;
int patientType;
int patientTypeID;
PendingOrderRequestModel(
{this.isDentalAllowedBackend,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.deviceTypeID,
this.tokenID,
this.patientID,
this.admissionNo,
this.sessionID,
this.projectID,
this.setupID,
this.patientOutSA,
this.patientType,
this.patientTypeID});
PendingOrderRequestModel.fromJson(Map<String, dynamic> json) {
isDentalAllowedBackend = json['isDentalAllowedBackend'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientID = json['PatientID'];
admissionNo = json['AdmissionNo'];
sessionID = json['SessionID'];
projectID = json['ProjectID'];
setupID = json['SetupID'];
patientOutSA = json['PatientOutSA'];
patientType = json['PatientType'];
patientTypeID = json['PatientTypeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientID'] = this.patientID;
data['AdmissionNo'] = this.admissionNo;
data['SessionID'] = this.sessionID;
data['ProjectID'] = this.projectID;
data['SetupID'] = this.setupID;
data['PatientOutSA'] = this.patientOutSA;
data['PatientType'] = this.patientType;
data['PatientTypeID'] = this.patientTypeID;
return data;
}
}

@ -0,0 +1,15 @@
class PendingOrderModel {
String notes;
PendingOrderModel({this.notes});
PendingOrderModel.fromJson(Map<String, dynamic> json) {
notes = json['Notes'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Notes'] = this.notes;
return data;
}
}

@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/medical_report/Medic
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart';
import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/operation_report/operation_report.dart';
import 'package:doctor_app_flutter/screens/patients/profile/pending_orders/pending_orders_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/refer-patient-screen-in-patient.dart';
@ -69,6 +70,7 @@ const String ADD_SICKLEAVE = 'add-sickleave';
const String RADIOLOGY_PATIENT = 'radiology-patient';
const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab';
const String GET_OPERATION_REPORT = 'operation-report';
const String PENDING_ORDERS = 'pending-orders';
//todo: change the routing way.
var routes = {
@ -113,4 +115,5 @@ var routes = {
PATIENT_ECG: (_) => ECGPage(),
ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(),
GET_OPERATION_REPORT: (_) => OperationReportScreen(),
PENDING_ORDERS: (_) => PendingOrdersScreen(),
};

@ -93,7 +93,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
body: model.operationReportList == null ||
model.operationReportList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote)
error: TranslationBase.of(context).noDataAvailable)
: Container(
color: Colors.grey[200],
child: Column(

@ -0,0 +1,64 @@
import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:flutter/material.dart';
class PendingOrdersScreen extends StatelessWidget {
const PendingOrdersScreen({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<PendingOrdersViewModel>(
onModelReady: (model) => model.getPendingOrders(
patientId: patient.patientMRN,
admissionNo: int.parse(patient.admissionNo)),
builder:
(BuildContext context, PendingOrdersViewModel model, Widget child) =>
AppScaffold(
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
isShowAppBar: true,
baseViewModel: model,
appBarTitle: "Pending Orders",
body: model.pendingOrdersList == null ||
model.pendingOrdersList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).noDataAvailable)
: Container(
child: ListView.builder(
itemCount: model.pendingOrdersList.length,
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: Color(0xFF707070), width: 0.30),
),
child: Padding(
padding: EdgeInsets.all(8.0),
child:
AppText(model.pendingOrdersList[index].notes),
),
),
);
})),
),
);
}
}

@ -133,6 +133,13 @@ class ProfileGridForInPatient extends StatelessWidget {
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
PatientProfileCardModel(
"Pending",
"Orders",
PENDING_ORDERS,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
];
return Padding(

Loading…
Cancel
Save