add new medication service
parent
956afab2b4
commit
42feae9a2e
@ -0,0 +1,299 @@
|
|||||||
|
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:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class InterventionMedicationScreen extends StatefulWidget {
|
||||||
|
const InterventionMedicationScreen({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InterventionMedicationScreenState createState() => _InterventionMedicationScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InterventionMedicationScreenState extends State<InterventionMedicationScreen> {
|
||||||
|
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: int.parse(patient.admissionNo),
|
||||||
|
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
|
||||||
|
? Center(
|
||||||
|
child: ErrorMessage(
|
||||||
|
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: Colors.white,
|
||||||
|
widget: Column(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
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: 13,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: AppText(
|
||||||
|
model
|
||||||
|
.admissionOrderList[
|
||||||
|
index]
|
||||||
|
.createdByName
|
||||||
|
.toString() ??
|
||||||
|
'',
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
isCopyable: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(
|
||||||
|
context)
|
||||||
|
.procedureName
|
||||||
|
.toString() +
|
||||||
|
": ",
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
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: 13,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: AppText(
|
||||||
|
model
|
||||||
|
.admissionOrderList[
|
||||||
|
index]
|
||||||
|
.orderNo
|
||||||
|
.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,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
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:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../../config/config.dart';
|
||||||
|
import '../../../../routes.dart';
|
||||||
|
import 'intervention_medication.dart';
|
||||||
|
|
||||||
|
class NewMedicationScreen extends StatefulWidget {
|
||||||
|
const NewMedicationScreen({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_NewMedicationScreenState createState() => _NewMedicationScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NewMedicationScreenState extends State<NewMedicationScreen> {
|
||||||
|
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: int.parse(patient.admissionNo),
|
||||||
|
patientId: patient.patientMRN),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
//appBarTitle: TranslationBase.of(context).progressNote,
|
||||||
|
appBar: PatientProfileAppBar(
|
||||||
|
patient,
|
||||||
|
isInpatient: true,
|
||||||
|
),
|
||||||
|
body: model.admissionOrderList == null ||
|
||||||
|
model.admissionOrderList.length == 0
|
||||||
|
? Center(
|
||||||
|
child: ErrorMessage(
|
||||||
|
error: TranslationBase.of(context).noDataAvailable,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(left: 130,top: 300),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
DatePicker.showDatePicker(context,
|
||||||
|
showTitleActions: true,
|
||||||
|
minTime: DateTime(1990, 3, 5),
|
||||||
|
maxTime: DateTime(2022, 6, 7), onChanged: (date) {
|
||||||
|
print('change $date');
|
||||||
|
}, onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
}, currentTime: DateTime.now(), locale: LocaleType.en);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Select Date From',
|
||||||
|
style: TextStyle(color: Colors.blue),
|
||||||
|
)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
DatePicker.showDatePicker(context,
|
||||||
|
showTitleActions: true,
|
||||||
|
minTime: DateTime(1990, 3, 5),
|
||||||
|
maxTime: DateTime(2022, 6, 7), onChanged: (date) {
|
||||||
|
print('change $date');
|
||||||
|
}, onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
}, currentTime: DateTime.now(), locale: LocaleType.en);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Select Date To',
|
||||||
|
style: TextStyle(color: Colors.blue),
|
||||||
|
)),
|
||||||
|
|
||||||
|
RaisedButton(
|
||||||
|
onPressed: () => {
|
||||||
|
INTERVENTION_MEDICATION,
|
||||||
|
},
|
||||||
|
child:
|
||||||
|
Text('Search'),
|
||||||
|
color: AppGlobal.appGreenColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue