Merge branch 'patient_app_services' into 'development'

Create procedure card

See merge request Cloud_Solution/doctor_app_flutter!400
merge-requests/401/head
Mohammad Aljammal 4 years ago
commit e038ec4333

@ -225,7 +225,7 @@ class ProcedureViewModel extends BaseViewModel {
await _labsService.getPatientLabOrdersList(patient); await _labsService.getPatientLabOrdersList(patient);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error; error = _labsService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else { } else {
_labsService.patientLabOrdersList.forEach((element) { _labsService.patientLabOrdersList.forEach((element) {
List<PatientLabOrdersList> patientLabOrdersClinic = List<PatientLabOrdersList> patientLabOrdersClinic =

@ -0,0 +1,142 @@
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/shared/Text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ProcedureCard extends StatelessWidget {
final Function onTap;
final EntityList entityList;
const ProcedureCard({Key key, this.onTap, this.entityList}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
width: double.maxFinite,
height: MediaQuery.of(context).size.height * .22,
margin: EdgeInsets.all(10),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: MediaQuery.of(context).size.height * .20,
width: 5,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
color: entityList.orderType == 1
? Colors.red[500]
: Colors.black,
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
left: projectViewModel.isArabic ? 0 : 15,
right: projectViewModel.isArabic ? 15 : 0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
entityList.orderType == 0
? 'Routine'
: 'Urgent',
color: entityList.orderType == 0
? Colors.black
: Colors.red[800],
fontWeight: FontWeight.w600,
),
SizedBox(
height: 5,
),
Texts(
entityList.procedureName,
bold: true,
fontSize: 14,
),
],
),
),
SizedBox(
width: 5,
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
'${DateUtils.getDayMonthYearDateFormatted(DateUtils.convertISOStringToDateTime(entityList.orderDate), isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
Texts(
'${DateUtils.getHour(DateUtils.convertISOStringToDateTime(entityList.orderDate))}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
],
),
Row(
children: [
Texts(
TranslationBase.of(context).orderNo,
color: Colors.grey,
fontSize: 12,
),
Texts(
entityList.orderNo.toString(),
color: Colors.grey,
fontSize: 12,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
entityList.remarks ?? '',
fontSize: 12,
),
Icon(Icons.edit)
],
)
],
),
onTap: onTap,
),
),
),
],
),
),
),
);
}
}

@ -7,37 +7,27 @@ import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ProcedureScreen extends StatefulWidget { import 'ProcedureCard.dart';
@override
_ProcedureScreenState createState() => _ProcedureScreenState();
}
class _ProcedureScreenState extends State<ProcedureScreen> { class ProcedureScreen extends StatelessWidget {
int selectedType = 0;
int testNum = 1;
PatiantInformtion patient;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
TextEditingController procedureController = TextEditingController();
//TODO Jammal
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedure(mrn: patient.patientId), onModelReady: (model) => model.getProcedure(mrn: patient.patientId),
builder: (BuildContext context, ProcedureViewModel model, Widget child) => builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold( AppScaffold(
isShowAppBar: true, isShowAppBar: false,
appBarTitle: TranslationBase.of(context).orderProcedure, appBarTitle: TranslationBase.of(context).orderProcedure,
body: NetworkBaseView( body: NetworkBaseView(
baseViewModel: model, baseViewModel: model,
@ -45,563 +35,94 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
Divider( patient, arrivalType ?? '0', patientType),
height: 1.0,
thickness: 1.0,
color: Colors.grey,
),
(model.procedureList.length != 0)
? SizedBox(
height: model.procedureList[0].rowcount == 0
? 200.0
: 10.0)
: SizedBox(height: 200.0),
//model.prescriptionList == null
(model.procedureList.length != 0)
? model.procedureList[0].rowcount == 0
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
model
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
child: Icon(
Icons.add,
color: Colors.black,
size: 45.0,
),
),
),
),
SizedBox( SizedBox(
height: 15.0, height: 12,
), ),
Row( Padding(
mainAxisAlignment: padding: const EdgeInsets.all(8.0),
MainAxisAlignment.center,
children: [
AppText(
'NO ORDER FOR PROCEDURE LISTED',
color: Colors.black,
fontWeight: FontWeight.w900,
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w700,
),
],
),
],
)
: Padding(
padding: EdgeInsets.all(16.0),
child: NetworkBaseView(
baseViewModel: model,
child: Column( child: Column(
mainAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
InkWell( Texts(
child: Container( 'Order Test or',
height: 50.0, style: "caption2",
width: 450.0, color: Colors.black,
decoration: BoxDecoration( fontSize: 13,
color: Colors.white,
border: Border.all(
color: Colors.grey),
borderRadius:
BorderRadius.circular(10.0),
), ),
child: Padding( Texts(
padding: EdgeInsets.all(8.0), 'Procedure',
child: Row( bold: true,
mainAxisAlignment: fontSize: 22,
MainAxisAlignment
.spaceBetween,
children: [
AppText(
TranslationBase.of(
context)
.addMoreProcedure,
fontWeight:
FontWeight.w100,
fontSize: 12.5,
), ),
Icon(
Icons.add,
color: Color(0XFFB8382C),
)
], ],
), ),
), ),
), if (patientType != null && patientType == '7')
InkWell(
onTap: () { onTap: () {
model //TODO Hussam call the add page here
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
}, },
child: Container(
width: double.maxFinite,
height: 140,
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(10),
), ),
// Container( child: Center(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(
// Radius.circular(6.0)),
// border: Border.all(
// width: 1.0,
// color: HexColor("#CCCCCC"))),
// child: AppTextFormField(
// labelText: 'Add more procedure',
// borderColor: Colors.white,
// //suffixIcon: Icons.search,
//
// //textInputType: TextInputType.number,
// inputFormatter: ONLY_NUMBERS,
// onTap: () {
// addSelectedProcedure(context);
// },
// ),
// ),
SizedBox(
height: 10.0,
),
...List.generate(
model.procedureList[0].rowcount,
(index) => Container(
color: Colors.white,
child: Column(
children: [
SizedBox(
height:
MediaQuery.of(context)
.size
.height *
0.022,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Container(
height: MediaQuery.of(
context)
.size
.height *
0.18,
width: MediaQuery.of(
context)
.size
.width *
0.135,
child: Column(
children: [
AppText(
DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.year
.toString(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
AppText(
Helpers.getMonth(model.procedureList[0].entityList[index].orderDate !=
null
? (DateTime.parse(model.procedureList[0].entityList[index].orderDate)
.month)
: DateTime.now()
.month)
.toUpperCase(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
AppText(
DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.day
.toString(),
color: model
.procedureList[
0]
.entityList[
index]
.orderType ==
1
? Color(
0xFFB9382C)
: Colors
.green),
],
),
),
Expanded(
child: Container( child: Container(
width: MediaQuery.of( height: 90,
context)
.size
.width *
0.05,
child: Column( child: Column(
children: [ children: [
Row(
children: [
AppText(
TranslationBase.of(context)
.codeNo +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
13.0,
),
AppText(
model
.procedureList[
0]
.entityList[
index]
.procedureId
.toString(),
fontSize:
12.0,
),
SizedBox(
width: 12.0,
),
AppText(
TranslationBase.of(context)
.orderType +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
13.0,
),
Expanded(
child: AppText(
model.procedureList[0].entityList[index].orderType ==
0
? 'Routine'
: 'Urgent',
fontSize:
13.5,
color: model.procedureList[0].entityList[index].orderType ==
1
? Color(0xFFB9382C)
: Colors.green),
),
],
),
Row(
children: [
AppText(
'Order.NO' +
" : ",
fontWeight:
FontWeight
.w700,
fontSize:
15.0,
),
AppText(
model
.procedureList[
0]
.entityList[
index]
.orderNo
.toString(),
fontSize:
13.0,
),
],
),
Row(
children: [
Container(
child:
Expanded(
child:
AppText(
model
.procedureList[0]
.entityList[index]
.procedureName,
fontWeight:
FontWeight.w800,
),
),
)
],
),
Row(
children: [
// AppText(
// TranslationBase.of(context)
// .price +
// " : ",
// fontWeight:
// FontWeight
// .w700,
// ),
// Expanded(
// child: AppText(
// model
// .procedureList[
// 0]
// .entityList[
// index]
// .price
// .toString(),
// fontSize:
// 13.0),
// )
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
Expanded(
child:
Container( Container(
height: MediaQuery.of(context) height: 40,
.size width: 40,
.height * decoration: BoxDecoration(
0.047, color: Colors.grey[600],
width: MediaQuery.of(context) borderRadius: BorderRadius.circular(10),
.size
.width *
0.10,
child:
AppText(
model.procedureList[0].entityList[index].remarks !=
null
? model.procedureList[0].entityList[index].remarks.toString()
: "",
fontSize:
11.5,
), ),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
), ),
), ),
],
), ),
SizedBox( SizedBox(
height: 20.0, height: 10,
), ),
Texts(
// SizedBox( 'Add More Procedure',
// height: 40, color: Colors.grey[600],
// ), fontWeight: FontWeight.w600,
],
),
),
),
Container(
child: Column(
children: [
InkWell(
child: Icon(
Icons.edit),
onTap: () {
// model
// .updateProcedure();
if (model.procedureList[0].entityList[index].categoryID == 02 ||
model
.procedureList[
0]
.entityList[
index]
.categoryID ==
03 ||
model
.procedureList[0]
.entityList[index]
.categoryID ==
55) {
updateProcedureForm(
context,
limetNo: model
.procedureList[
0]
.entityList[
index]
.lineItemNo,
model:
model,
orderNo: model
.procedureList[
0]
.entityList[
index]
.orderNo,
remarks: model
.procedureList[
0]
.entityList[
index]
.remarks,
procedureName: model
.procedureList[
0]
.entityList[
index]
.procedureName,
patient:
patient,
procedureId: model
.procedureList[
0]
.entityList[
index]
.procedureId,
categoreId: model
.procedureList[
0]
.entityList[
index]
.categoryID
.toString());
} else {
helpers.showErrorToast(
'You cant Update this Procedure');
}
},
) )
], ],
), ),
), ),
],
), ),
Divider(
height: 1.0,
thickness: 1.0,
color: Colors.grey,
), ),
],
),
),
),
],
), ),
), if (model.procedureList.isNotEmpty)
) ...List.generate(
: Column( model.procedureList[0].rowcount,
mainAxisAlignment: MainAxisAlignment.center, (index) => ProcedureCard(
crossAxisAlignment: CrossAxisAlignment.stretch, entityList: model.procedureList[0].entityList[index],
children: [ onTap: (){
InkWell( //TODO Hussam call the edit page here
onTap: () {
model
.getProcedureCategory()
.then((value) {
addSelectedProcedure(
context, model, patient);
});
//model.postPrescription();
}, },
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
child: Icon(
Icons.add,
color: Colors.black,
size: 45.0,
),
),
),
),
SizedBox(
height: 15.0,
), ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
'NO ORDER FOR PROCEDURE LISTED',
color: Colors.black,
fontWeight: FontWeight.w900,
), ),
], ],
), ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w700,
),
],
), ),
],
)
],
), ),
), ),
), ),
)),
); );
} }
} }

@ -7,6 +7,14 @@ class DateUtils {
return DateFormat(dateFormat).format(dateTime); return DateFormat(dateFormat).format(dateTime);
} }
static DateTime convertISOStringToDateTime(String date){
DateTime newDate;
newDate = DateTime.parse(date);
return newDate;
}
static String convertStringToDateFormat(String date, String dateFormat) { static String convertStringToDateFormat(String date, String dateFormat) {
DateTime dateTime = DateTime.parse(date); DateTime dateTime = DateTime.parse(date);
return convertDateToFormat(dateTime, dateFormat); return convertDateToFormat(dateTime, dateFormat);

Loading…
Cancel
Save