You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
521 lines
24 KiB
Dart
521 lines
24 KiB
Dart
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
|
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
|
|
import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_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/shared/master_key_checkbox_search_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_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/divider_with_spaces_around.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
class ObjectivePage extends StatefulWidget {
|
|
final Function changePageViewIndex;
|
|
final List<MySelectedExamination> mySelectedExamination;
|
|
|
|
ObjectivePage(
|
|
{Key key, this.changePageViewIndex, this.mySelectedExamination});
|
|
|
|
@override
|
|
_ObjectivePageState createState() => _ObjectivePageState();
|
|
}
|
|
|
|
class _ObjectivePageState extends State<ObjectivePage> {
|
|
bool isSysExaminationExpand = false;
|
|
TextEditingController remarksController = TextEditingController();
|
|
|
|
BoxDecoration containerBorderDecoration(
|
|
Color containerColor, Color borderColor) {
|
|
return BoxDecoration(
|
|
color: containerColor,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.all(Radius.circular(6)),
|
|
border: Border.fromBorderSide(BorderSide(
|
|
color: borderColor,
|
|
width: 0.5,
|
|
)),
|
|
);
|
|
}
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies),
|
|
builder: (_, model, w) => AppScaffold(
|
|
isShowAppBar: false,
|
|
body: SingleChildScrollView(
|
|
physics: ScrollPhysics(),
|
|
child: Center(
|
|
child: FractionallySizedBox(
|
|
widthFactor: 0.9,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
HeaderBodyExpandableNotifier(
|
|
headerWidget: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Texts('Physical/System Examination',
|
|
variant:
|
|
isSysExaminationExpand ? "bodyText" : '',
|
|
bold: isSysExaminationExpand ? true : false,
|
|
color: Colors.black),
|
|
Icon(
|
|
FontAwesomeIcons.asterisk,
|
|
color: AppGlobal.appPrimaryColor,
|
|
size: 12,
|
|
)
|
|
],
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
isSysExaminationExpand =
|
|
!isSysExaminationExpand;
|
|
});
|
|
},
|
|
child: Icon(isSysExaminationExpand
|
|
? EvaIcons.minus
|
|
: EvaIcons.plus))
|
|
],
|
|
),
|
|
bodyWidget: Column(children: [
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Column(
|
|
children: [
|
|
Container(
|
|
margin:
|
|
EdgeInsets.only(left: 10, right: 10, top: 15),
|
|
child: TextFields(
|
|
hintText: "Add Examination",
|
|
fontSize: 13.5,
|
|
onTapTextFields: () {
|
|
openExaminationList(context);
|
|
},
|
|
readOnly: true,
|
|
// hintColor: Colors.black,
|
|
suffixIcon: EvaIcons.plusCircleOutline,
|
|
suffixIconColor: AppGlobal.appPrimaryColor,
|
|
fontWeight: FontWeight.w600,
|
|
// controller: messageController,
|
|
validator: (value) {
|
|
if (value == null)
|
|
return TranslationBase.of(context)
|
|
.emptyMessage;
|
|
else
|
|
return null;
|
|
}),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Column(
|
|
children:
|
|
widget.mySelectedExamination.map((examination) {
|
|
return Container(
|
|
margin: EdgeInsets.only(
|
|
left: 15, right: 15, top: 15),
|
|
child: Column(children: [
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Texts(
|
|
examination
|
|
.selectedExamination.nameEn
|
|
.toUpperCase(),
|
|
variant: "bodyText",
|
|
bold: true,
|
|
color: Colors.black)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
InkWell(
|
|
child: Center(
|
|
child: Container(
|
|
height:
|
|
screenSize.height *
|
|
0.070,
|
|
decoration:
|
|
containerBorderDecoration(
|
|
examination
|
|
.isNormal
|
|
? Color(
|
|
0xFF515A5D)
|
|
: Colors
|
|
.white,
|
|
Colors.grey),
|
|
child: Center(
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets
|
|
.all(8.0),
|
|
child: Text(
|
|
"Normal",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color:
|
|
examination
|
|
.isNormal
|
|
? Colors.white
|
|
: Colors
|
|
.black,
|
|
//Colors.black,
|
|
fontWeight:
|
|
FontWeight
|
|
.bold,
|
|
),
|
|
),
|
|
),
|
|
)),
|
|
),
|
|
onTap: () {
|
|
setState(() {
|
|
examination.isAbnormal =
|
|
!examination.isAbnormal;
|
|
examination.isNormal =
|
|
!examination.isNormal;
|
|
});
|
|
}),
|
|
SizedBox(
|
|
width: 12,
|
|
),
|
|
InkWell(
|
|
child: Center(
|
|
child: Container(
|
|
height:
|
|
screenSize.height *
|
|
0.070,
|
|
decoration:
|
|
containerBorderDecoration(
|
|
examination
|
|
.isAbnormal
|
|
? Color(
|
|
0xFF515A5D)
|
|
: Colors
|
|
.white,
|
|
Colors.black),
|
|
child: Center(
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets
|
|
.all(8.0),
|
|
child: Text(
|
|
"Abnormal",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color:
|
|
examination
|
|
.isAbnormal
|
|
? Colors.white
|
|
: Colors
|
|
.black,
|
|
//Colors.black,
|
|
fontWeight:
|
|
FontWeight
|
|
.bold,
|
|
),
|
|
),
|
|
),
|
|
)),
|
|
),
|
|
onTap: () {
|
|
setState(() {
|
|
examination.isAbnormal =
|
|
!examination.isAbnormal;
|
|
examination.isNormal =
|
|
!examination.isNormal;
|
|
});
|
|
}),
|
|
],
|
|
),
|
|
InkWell(
|
|
|
|
child: Icon(
|
|
FontAwesomeIcons.trash,
|
|
color: Colors.grey,
|
|
size: 20,
|
|
),
|
|
onTap: () => removeExamination(
|
|
examination.selectedExamination),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10, right: 10, top: 15),
|
|
child: TextFields(
|
|
hintText: "Remarks",
|
|
fontSize: 13.5,
|
|
// hintColor: Colors.black,
|
|
fontWeight: FontWeight.w600,
|
|
maxLines: 25,
|
|
minLines: 13,
|
|
controller: remarksController,
|
|
validator: (value) {
|
|
if (value == null)
|
|
return TranslationBase.of(context)
|
|
.emptyMessage;
|
|
else
|
|
return null;
|
|
}),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
]));
|
|
}).toList(),
|
|
)
|
|
],
|
|
)
|
|
]),
|
|
isExpand: isSysExaminationExpand,
|
|
),
|
|
DividerWithSpacesAround(height: 30,),
|
|
AppButton(
|
|
title: TranslationBase.of(context).next,
|
|
loading: model.state == ViewState.BusyLocal,
|
|
onPressed: () async {
|
|
await submitObjectivePage(model);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)));
|
|
}
|
|
|
|
submitObjectivePage(SOAPViewModel model) async {
|
|
// if(widget.mySelectedExamination.isNotEmpty){
|
|
// PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
|
|
// widget.mySelectedExamination.forEach((exam) {
|
|
// if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
|
|
// null)
|
|
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = [];
|
|
//
|
|
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(
|
|
// ListHisProgNotePhysicalExaminationVM(
|
|
// patientMRN: 3120690,
|
|
// episodeId: 200012117,
|
|
// appointmentNo: 2016054573,
|
|
// remarks: exam.remark ?? '',
|
|
// createdBy: 1485,
|
|
// createdOn: DateTime.now().toIso8601String(),
|
|
// editedBy: 1485,
|
|
// editedOn: DateTime.now().toIso8601String(),
|
|
// examId: exam.selectedExamination.id,
|
|
// examType: exam.selectedExamination.typeId,
|
|
// isAbnormal: exam.isAbnormal,
|
|
// isNormal: exam.isNormal,
|
|
// masterDescription: exam.selectedExamination,
|
|
// notExamined: false
|
|
//
|
|
// ));
|
|
// });
|
|
//
|
|
// await model.postPhysicalExam(postPhysicalExamRequestModel);
|
|
//
|
|
// if (model.state == ViewState.ErrorLocal) {
|
|
// helpers.showErrorToast(model.error);
|
|
// } else {
|
|
// widget.changePageViewIndex(2);
|
|
// }
|
|
// } else {
|
|
// helpers.showErrorToast('Please add required field correctly');
|
|
// }
|
|
|
|
widget.changePageViewIndex(2);
|
|
|
|
|
|
|
|
}
|
|
|
|
removeExamination(MasterKeyModel masterKey) {
|
|
Iterable<MySelectedExamination> history = widget.mySelectedExamination
|
|
.where(
|
|
(element) =>
|
|
masterKey.id == element.selectedExamination.id &&
|
|
masterKey.typeId == element.selectedExamination.typeId);
|
|
|
|
if (history.length > 0)
|
|
setState(() {
|
|
widget.mySelectedExamination.remove(history.first);
|
|
});
|
|
}
|
|
|
|
openExaminationList(BuildContext context) {
|
|
final screenSize = MediaQuery
|
|
.of(context)
|
|
.size;
|
|
InputDecoration textFieldSelectorDecoration(String hintText,
|
|
String selectedText, bool isDropDown) {
|
|
return InputDecoration(
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
disabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
hintText: selectedText != null ? selectedText : hintText,
|
|
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null,
|
|
hintStyle: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.grey.shade600,
|
|
),
|
|
);
|
|
}
|
|
|
|
showModalBottomSheet(
|
|
backgroundColor: Colors.white,
|
|
isScrollControlled: true,
|
|
context: context,
|
|
builder: (context) {
|
|
return AddExaminationDailog(
|
|
mySelectedExamination: widget.mySelectedExamination,
|
|
addSelectedExamination: () {
|
|
setState(() {
|
|
Navigator.of(context).pop();
|
|
});
|
|
},
|
|
removeExamination: (masterKey) => removeExamination(masterKey),);
|
|
});
|
|
}
|
|
}
|
|
|
|
class AddExaminationDailog extends StatefulWidget {
|
|
final List<MySelectedExamination> mySelectedExamination;
|
|
final Function addSelectedExamination;
|
|
final Function (MasterKeyModel) removeExamination;
|
|
|
|
const AddExaminationDailog(
|
|
{Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination})
|
|
: super(key: key);
|
|
|
|
@override
|
|
_AddExaminationDailogState createState() => _AddExaminationDailogState();
|
|
}
|
|
|
|
class _AddExaminationDailogState extends State<AddExaminationDailog> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FractionallySizedBox(
|
|
heightFactor: 0.7,
|
|
child: BaseView<SOAPViewModel>(
|
|
onModelReady: (model) async {
|
|
if (model.physicalExaminationList.length == 0) {
|
|
await model.getMasterLookup(
|
|
MasterKeysService.PhysicalExamination);
|
|
}
|
|
},
|
|
builder: (_, model, w) =>
|
|
AppScaffold(
|
|
// baseViewModel: model,
|
|
isShowAppBar: false,
|
|
body: Center(
|
|
child: Container(
|
|
child: FractionallySizedBox(
|
|
widthFactor: 0.9,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
AppText(
|
|
"Examinations",
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
SizedBox(
|
|
height: 16,
|
|
),
|
|
|
|
NetworkBaseView(
|
|
baseViewModel: model,
|
|
child: MasterKeyCheckboxSearchWidget(
|
|
model: model,
|
|
masterList: model.physicalExaminationList,
|
|
removeHistory: (history){
|
|
setState(() {
|
|
widget.removeExamination(history);
|
|
});
|
|
},
|
|
addHistory: (history){
|
|
setState(() {
|
|
MySelectedExamination mySelectedExamination = new MySelectedExamination(
|
|
selectedExamination: history
|
|
);
|
|
widget
|
|
.mySelectedExamination
|
|
.add(
|
|
mySelectedExamination);
|
|
});
|
|
},
|
|
addSelectedHistories: (){
|
|
widget.addSelectedExamination();
|
|
},
|
|
isServiceSelected: (master) =>isServiceSelected(master),
|
|
),
|
|
),
|
|
|
|
]),
|
|
))),
|
|
)),
|
|
);
|
|
}
|
|
|
|
isServiceSelected(MasterKeyModel masterKey) {
|
|
Iterable<MySelectedExamination> exam =
|
|
widget
|
|
.mySelectedExamination
|
|
.where((element) =>
|
|
masterKey.id == element.selectedExamination.id &&
|
|
masterKey.typeId == element.selectedExamination.typeId);
|
|
if (exam.length > 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|