get admission orders

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

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

@ -1,22 +1,27 @@
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/admisson_orders/admission_orders_model.dart';
import 'package:doctor_app_flutter/models/admisson_orders/admission_orders_request_model.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> _pendingOrderList = List();
List<PendingOrderModel> get pendingOrderList => _pendingOrderList;
List<AdmissionOrdersModel> _admissionOrderList = List();
List<AdmissionOrdersModel> get admissionOrderList => _admissionOrderList;
Future getPendingOrders(
{PendingOrderRequestModel pendingOrderRequestModel,
int patientId,
int admissionNo}) async {
pendingOrderRequestModel = PendingOrderRequestModel(
patientID: patientId,
admissionNo: admissionNo,
patientTypeID: 1,
patientType: 1,
);
patientID: patientId,
admissionNo: admissionNo,
patientTypeID: 1,
patientType: 1,
setupID: "010266");
hasError = false;
await baseAppClient.post(GET_PENDING_ORDERS,
@ -33,4 +38,31 @@ class PendingOrderService extends BaseService {
super.error = error;
}, body: pendingOrderRequestModel.toJson());
}
Future getAdmissionOrders(
{AdmissionOrdersRequestModel admissionOrdersRequestModel,
int patientId,
int admissionNo}) async {
admissionOrdersRequestModel = AdmissionOrdersRequestModel(
patientID: patientId,
admissionNo: admissionNo,
patientTypeID: 1,
patientType: 1,
setupID: "010266");
hasError = false;
await baseAppClient.post(GET_ADMISSION_ORDERS,
onSuccess: (dynamic response, int statusCode) {
print("Success");
//admissionOrderList.clear();
response['List_AdmissionOrders'].forEach(
(v) {
_admissionOrderList.add(AdmissionOrdersModel.fromJson(v));
},
);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: admissionOrdersRequestModel.toJson());
}
}

@ -2,6 +2,7 @@ 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/admisson_orders/admission_orders_model.dart';
import 'package:doctor_app_flutter/models/pending_orders/pending_orders_model.dart';
class PendingOrdersViewModel extends BaseViewModel {
@ -11,6 +12,9 @@ class PendingOrdersViewModel extends BaseViewModel {
List<PendingOrderModel> get pendingOrdersList =>
_pendingOrderService.pendingOrderList;
List<AdmissionOrdersModel> get admissionOrderList =>
_pendingOrderService.admissionOrderList;
Future getPendingOrders({int patientId, int admissionNo}) async {
hasError = false;
setState(ViewState.Busy);
@ -23,4 +27,17 @@ class PendingOrdersViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
}
Future getAdmissionOrders({int patientId, int admissionNo}) async {
hasError = false;
setState(ViewState.Busy);
await _pendingOrderService.getAdmissionOrders(
patientId: patientId, admissionNo: admissionNo);
if (_pendingOrderService.hasError) {
error = _pendingOrderService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
}

@ -0,0 +1,52 @@
class AdmissionOrdersModel {
int procedureID;
String procedureName;
String procedureNameN;
int orderNo;
int doctorID;
int clinicID;
String createdOn;
int createdBy;
String editedOn;
int editedBy;
AdmissionOrdersModel(
{this.procedureID,
this.procedureName,
this.procedureNameN,
this.orderNo,
this.doctorID,
this.clinicID,
this.createdOn,
this.createdBy,
this.editedOn,
this.editedBy});
AdmissionOrdersModel.fromJson(Map<String, dynamic> json) {
procedureID = json['ProcedureID'];
procedureName = json['ProcedureName'];
procedureNameN = json['ProcedureNameN'];
orderNo = json['OrderNo'];
doctorID = json['DoctorID'];
clinicID = json['ClinicID'];
createdOn = json['CreatedOn'];
createdBy = json['CreatedBy'];
editedOn = json['EditedOn'];
editedBy = json['EditedBy'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProcedureID'] = this.procedureID;
data['ProcedureName'] = this.procedureName;
data['ProcedureNameN'] = this.procedureNameN;
data['OrderNo'] = this.orderNo;
data['DoctorID'] = this.doctorID;
data['ClinicID'] = this.clinicID;
data['CreatedOn'] = this.createdOn;
data['CreatedBy'] = this.createdBy;
data['EditedOn'] = this.editedOn;
data['EditedBy'] = this.editedBy;
return data;
}
}

@ -0,0 +1,76 @@
class AdmissionOrdersRequestModel {
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;
AdmissionOrdersRequestModel(
{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});
AdmissionOrdersRequestModel.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;
}
}

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart
import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart';
import 'package:doctor_app_flutter/screens/patients/ECGPage.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/admission-orders/admission_orders_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart';
@ -71,6 +72,7 @@ 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';
const String ADMISSION_ORDERS = 'admission-orders';
//todo: change the routing way.
var routes = {
@ -116,4 +118,5 @@ var routes = {
ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(),
GET_OPERATION_REPORT: (_) => OperationReportScreen(),
PENDING_ORDERS: (_) => PendingOrdersScreen(),
ADMISSION_ORDERS: (_) => AdmissionOrdersScreen(),
};

@ -0,0 +1,351 @@
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_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/date-utils.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/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AdmissionOrdersScreen extends StatefulWidget {
const AdmissionOrdersScreen({Key key}) : super(key: key);
@override
_AdmissionOrdersScreenState createState() => _AdmissionOrdersScreenState();
}
class _AdmissionOrdersScreenState extends State<AdmissionOrdersScreen> {
bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PendingOrdersViewModel>(
onModelReady: (model) => model.getAdmissionOrders(
admissionNo: 2014005178, patientId: patient.patientMRN),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
//appBarTitle: TranslationBase.of(context).progressNote,
appBar: PatientProfileAppBar(
patient,
isInpatient: true,
),
body: model.admissionOrderList == null ||
model.admissionOrderList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).noDataAvailable)
: Container(
color: Colors.grey[200],
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(12.0),
child: Column(
children: [
Row(
children: [
AppText(
TranslationBase.of(context).admission,
fontSize: 15.0,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).orders,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
],
),
],
),
),
Expanded(
child: Container(
child: ListView.builder(
itemCount: model.admissionOrderList.length,
itemBuilder: (BuildContext ctxt, int index) {
return FractionallySizedBox(
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
// bgColor: model.admissionOrderList[index]
// .status ==
// 1 &&
// authenticationViewModel
// .doctorProfile.doctorID !=
// model
// .patientProgressNoteList[
// index]
// .createdBy
// ? Color(0xFFCC9B14)
// : model.patientProgressNoteList[index]
// .status ==
// 4
// ? Colors.red.shade700
// : model.patientProgressNoteList[index]
// .status ==
// 2
// ? Colors.green[600]
// : Color(0xFFCC9B14),
widget: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
width: 10,
),
SizedBox(
width: 10,
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.60,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
TranslationBase.of(
context)
.createdBy
.toString(),
fontSize: 10,
),
Expanded(
child: AppText(
model
.admissionOrderList[
index]
.createdBy
.toString() ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
TranslationBase.of(
context)
.procedureName
.toString(),
fontSize: 10,
),
Expanded(
child: AppText(
model
.admissionOrderList[
index]
.procedureName
.toString() ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
AppText(
TranslationBase.of(
context)
.orderNo
.toString(),
fontSize: 10,
),
Expanded(
child: AppText(
model
.admissionOrderList[
index]
.orderNo
.toString() ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12,
isCopyable: true,
),
),
],
),
// Row(
// crossAxisAlignment:
// CrossAxisAlignment
// .start,
// children: [
// AppText(
// TranslationBase.of(
// context)
// .createdBy
// .toString(),
// fontSize: 10,
// ),
// Expanded(
// child: AppText(
// model
// .admissionOrderList[
// index]
// .createdBy
// .toString() ??
// '',
// fontWeight:
// FontWeight.w600,
// fontSize: 12,
// isCopyable: true,
// ),
// ),
// ],
// ),
],
),
),
Column(
children: [
AppText(
model
.admissionOrderList[
index]
.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils
.getDateTimeFromServerFormat(model
.admissionOrderList[
index]
.createdOn),
isArabic:
projectViewModel
.isArabic,
isMonthShort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
),
AppText(
model
.admissionOrderList[
index]
.createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.admissionOrderList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
isCopyable: true,
),
],
crossAxisAlignment:
CrossAxisAlignment.end,
)
],
),
SizedBox(
height: 8,
),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.start,
// children: [
// Expanded(
// child: AppText(
// model
// .admissionOrderList[
// index]
// .notes,
// fontSize: 10,
// isCopyable: true,
// ),
// ),
// ])
],
),
SizedBox(
height: 20,
),
],
),
),
);
}),
),
),
],
),
),
),
);
}
}

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

Loading…
Cancel
Save