First step from examination

merge-requests/197/head
Elham Rababah 5 years ago committed by Sultan Khan
parent cde56a82f2
commit 4df3b1fb40

@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'base_service.dart'; import 'base_service.dart';
class LookupService extends BaseService { class LookupService extends BaseService {
List<MasterKeyModel> listOfAllergies = []; List<MasterKeyModel> listOfAllergies = [];
List<MasterKeyModel> get allergySeverityList => _allergySeverityList; List<MasterKeyModel> get allergySeverityList => _allergySeverityList;
@ -26,7 +25,7 @@ class LookupService extends BaseService {
List<MasterKeyModel> get historySurgicalList => _historySurgicalList; List<MasterKeyModel> get historySurgicalList => _historySurgicalList;
List<MasterKeyModel> _historySurgicalList = []; List<MasterKeyModel> _historySurgicalList = [];
List<MasterKeyModel> listOfPhysiotherapyGoals = []; List<MasterKeyModel> listOfPhysiotherapyGoals = [];
Future getMasterLookup(MasterKeysService masterKeys) async { Future getMasterLookup(MasterKeysService masterKeys) async {
hasError = false; hasError = false;
@ -35,12 +34,12 @@ class LookupService extends BaseService {
}; };
await baseAppClient.post(GET_MASTER_LOOKUP_LIST, await baseAppClient.post(GET_MASTER_LOOKUP_LIST,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
setMasterLookupInCorrectArray( setMasterLookupInCorrectArray(
response['MasterLookUpList']['entityList'], masterKeys); response['MasterLookUpList']['entityList'], masterKeys);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
} }
setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) {
@ -48,59 +47,55 @@ class LookupService extends BaseService {
case MasterKeysService.Allergies: case MasterKeysService.Allergies:
listOfAllergies.clear(); listOfAllergies.clear();
entryList.forEach((v) { entryList.forEach((v) {
listOfAllergies listOfAllergies.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.HistoryFamily: case MasterKeysService.HistoryFamily:
_historyFamilyList.clear(); _historyFamilyList.clear();
entryList.forEach((v) { entryList.forEach((v) {
_historyFamilyList _historyFamilyList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.HistoryMedical: case MasterKeysService.HistoryMedical:
_historyMedicalList.clear(); _historyMedicalList.clear();
entryList.forEach((v) { entryList.forEach((v) {
_historyMedicalList _historyMedicalList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.HistorySocial: case MasterKeysService.HistorySocial:
historySocialList.clear(); historySocialList.clear();
entryList.forEach((v) { entryList.forEach((v) {
historySocialList historySocialList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.HistorySports: case MasterKeysService.HistorySports:
_historySportList.clear(); _historySportList.clear();
entryList.forEach((v) { entryList.forEach((v) {
_historySportList _historySportList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v)); });
}); break; break;
case MasterKeysService.HistorySurgical: case MasterKeysService.HistorySurgical:
_historySurgicalList.clear(); _historySurgicalList.clear();
entryList.forEach((v) { entryList.forEach((v) {
_historySurgicalList _historySurgicalList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.PhysicalExamination: case MasterKeysService.PhysicalExamination:
return 59; _physicalExaminationList.clear();
entryList.forEach((v) {
_physicalExaminationList.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.AllergySeverity: case MasterKeysService.AllergySeverity:
_allergySeverityList.clear(); _allergySeverityList.clear();
entryList.forEach((v) { entryList.forEach((v) {
_allergySeverityList _allergySeverityList.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
case MasterKeysService.physiotherapyGoals: case MasterKeysService.physiotherapyGoals:
listOfPhysiotherapyGoals.clear(); listOfPhysiotherapyGoals.clear();
entryList.forEach((v) { entryList.forEach((v) {
listOfPhysiotherapyGoals listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v));
.add(MasterKeyModel.fromJson(v));
}); });
break; break;
} }

@ -29,6 +29,7 @@ class SOAPViewModel extends BaseViewModel {
List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList; List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList;
List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList; List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList;
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList];
List<MasterKeyModel> get physicalExaminationList => _SOAPService.physicalExaminationList;

@ -30,6 +30,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
int _currentIndex = 0; int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList= List(); List<MySelectedAllergy> myAllergiesList= List();
List<MasterKeyModel> myHistoryList = List(); List<MasterKeyModel> myHistoryList = List();
List<MasterKeyModel> myExaminationList = List();
changePageViewIndex(pageIndex) { changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex); _controller.jumpToPage(pageIndex);
} }
@ -153,7 +154,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,),
ObjectivePage(changePageViewIndex: changePageViewIndex,), ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList),
AssessmentPage(changePageViewIndex: changePageViewIndex,), AssessmentPage(changePageViewIndex: changePageViewIndex,),
PlanPage(changePageViewIndex: changePageViewIndex,) PlanPage(changePageViewIndex: changePageViewIndex,)
], ],

@ -1,4 +1,9 @@
import 'package:doctor_app_flutter/config/config.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/screens/base/base_view.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/shared/Text.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/TextFields.dart';
@ -7,15 +12,16 @@ 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/divider_with_spaces_around.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/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:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart';
class ObjectivePage extends StatefulWidget { class ObjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final List<MasterKeyModel> myExaminationList;
ObjectivePage({Key key, this.changePageViewIndex}); ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList});
@override @override
_ObjectivePageState createState() => _ObjectivePageState(); _ObjectivePageState createState() => _ObjectivePageState();
@ -117,115 +123,136 @@ class _ObjectivePageState extends State<ObjectivePage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Container( Column(
margin: children: widget.myExaminationList.map((examination) {
EdgeInsets.only(left: 15, right: 15, top: 15), return Container(
child: Column( margin: EdgeInsets.only(
children: [ left: 15, right: 15, top: 15),
Row( child: Column(children: [
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts('Abdomen'.toUpperCase(),
variant: "bodyText",
bold: true,
color: Colors.black)
],
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row( Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( Texts(examination.nameEn.toUpperCase(),
child: Center( variant: "bodyText",
child: Container( bold: true,
height: screenSize.height * 0.070, color: Colors.black)
decoration: containerBorderDecoration( ],
Colors.white,Colors.grey ),
), SizedBox(
child: Center( height: 8,
child: Padding( ),
padding: const EdgeInsets.all(8.0), Row(
child: Text( mainAxisAlignment:
"Normal", MainAxisAlignment.spaceBetween,
style: TextStyle( children: [
fontSize: 12, Row(
color: children: [
Colors.black, //Colors.black, InkWell(
fontWeight: FontWeight.bold, child: Center(
child: Container(
height:
screenSize.height *
0.070,
decoration:
containerBorderDecoration(
Colors.white,
Colors.grey),
child: Center(
child: Padding(
padding:
const EdgeInsets
.all(8.0),
child: Text(
"Normal",
style: TextStyle(
fontSize: 12,
color:
Colors.black,
//Colors.black,
fontWeight:
FontWeight
.bold,
),
),
), ),
), )),
), ),
)), onTap: () {}),
SizedBox(
width: 12,
), ),
onTap: () { InkWell(
child: Center(
}), child: Container(
SizedBox(width: 12,), height:
InkWell( screenSize.height *
child: Center( 0.070,
child: Container( decoration:
height: screenSize.height * 0.070, containerBorderDecoration(
decoration: containerBorderDecoration( Color(0xFF515A5D),
Color(0xFF515A5D), Colors.black Colors.black),
), child: Center(
child: Center( child: Padding(
child: Padding( padding:
padding: const EdgeInsets.all(8.0), const EdgeInsets
child: Text( .all(8.0),
"Abnormal", child: Text(
style: TextStyle( "Abnormal",
fontSize: 12, style: TextStyle(
color: fontSize: 12,
Colors.white, //Colors.black, color:
fontWeight: FontWeight.bold, Colors.white,
//Colors.black,
fontWeight:
FontWeight
.bold,
),
),
), ),
), )),
), ),
)), onTap: () {}),
), ],
onTap: () { ),
InkWell(
}), child: Icon(
FontAwesomeIcons.trash,
color: Colors.grey,
size: 20,
),
onTap: ()=>removeExamination(examination),
)
], ],
), ),
Icon( SizedBox(
FontAwesomeIcons.trash, height: 20,
color: Colors.grey, ),
size: 20, Container(
) margin: EdgeInsets.only(
], left: 10, right: 10, top: 15),
), child: TextFields(
SizedBox( hintText: "Remarks",
height: 20, fontSize: 13.5,
), // hintColor: Colors.black,
Container( fontWeight: FontWeight.w600,
margin: EdgeInsets.only(left: 10, right: 10, top: 15), maxLines: 25,
child: TextFields( minLines: 13,
hintText: "Remarks", controller: remarksController,
fontSize: 13.5, validator: (value) {
// hintColor: Colors.black, if (value == null)
fontWeight: FontWeight.w600, return TranslationBase.of(context)
maxLines: 25, .emptyMessage;
minLines: 13, else
controller: remarksController, return null;
validator: (value) { }),
if (value == null) ),
return TranslationBase.of(context).emptyMessage; SizedBox(
else height: 20,
return null; ),
}), ]));
), }).toList(),
SizedBox(
height: 20,
),
],
),
) )
], ],
) )
@ -249,10 +276,23 @@ class _ObjectivePageState extends State<ObjectivePage> {
)); ));
} }
removeExamination(MasterKeyModel masterKey) {
Iterable<MasterKeyModel> history = widget.myExaminationList.where(
(element) =>
masterKey.id == element.id && masterKey.typeId == element.typeId);
if (history.length > 0)
setState(() {
widget.myExaminationList.remove(history.first);
});
}
openExaminationList(BuildContext context) { openExaminationList(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery
InputDecoration textFieldSelectorDecoration( .of(context)
String hintText, String selectedText, bool isDropDown) { .size;
InputDecoration textFieldSelectorDecoration(String hintText,
String selectedText, bool isDropDown) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -275,228 +315,174 @@ class _ObjectivePageState extends State<ObjectivePage> {
); );
} }
;
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (context) { builder: (context) {
return FractionallySizedBox( return AddExaminationDailog(
heightFactor: 0.7, myExaminationList: widget.myExaminationList,
child: Container( addSelectedExamination: () {
child: FractionallySizedBox( setState(() {
widthFactor: 0.9, Navigator.of(context).pop();
child: Column( });
crossAxisAlignment: CrossAxisAlignment.start, },
children: [ removeExamination: (masterKey) => removeExamination(masterKey),);
SizedBox( });
height: 16, }
), }
AppText(
"Examinations", class AddExaminationDailog extends StatefulWidget {
fontWeight: FontWeight.bold, final List<MasterKeyModel> myExaminationList;
fontSize: 16, final Function addSelectedExamination;
), final Function (MasterKeyModel) removeExamination;
SizedBox(
height: 16, const AddExaminationDailog(
), {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination})
Container( : super(key: key);
height: MediaQuery.of(context).size.height * 0.5,
child: Center( @override
child: Container( _AddExaminationDailogState createState() => _AddExaminationDailogState();
margin: EdgeInsets.only(top: 15), }
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), class _AddExaminationDailogState extends State<AddExaminationDailog> {
color: Colors.white), @override
child: ListView( Widget build(BuildContext context) {
children: [ return FractionallySizedBox(
Column( 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: [ children: [
Row( SizedBox(
children: [ height: 16,
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), AppText(
Row( "Examinations",
children: [ fontWeight: FontWeight.bold,
Checkbox( fontSize: 16,
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), SizedBox(
Row( height: 16,
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), NetworkBaseView(
Row( baseViewModel: model,
children: [ child: Container(
Checkbox( height:
value: true, MediaQuery
activeColor: Colors.red[800], .of(context)
onChanged: (bool newValue) { .size
setState(() {}); .height * 0.5,
}), child: Center(
Expanded( child: Container(
child: Padding( margin: EdgeInsets.only(top: 15),
padding: const EdgeInsets.symmetric( decoration: BoxDecoration(
horizontal: 10, vertical: 0), borderRadius: BorderRadius
child: Texts('Examinations', .circular(12),
variant: "bodyText", color: Colors.white),
bold: true, child: ListView(
color: Colors.black), children: [
), Column(
), children: model
], .physicalExaminationList
.map((examinationInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
examinationInfo),
activeColor:
Colors.red[800],
onChanged:
(
bool newValue) {
setState(() {
if (isServiceSelected(
examinationInfo
)) {
widget
.removeExamination(
examinationInfo
);
}
else {
widget
.myExaminationList
.add(
examinationInfo);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
examinationInfo
.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
), ),
DividerWithSpacesAround(), SizedBox(
Row( height: 10,
children: [
Checkbox(
value: true,
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts('Examinations',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
), ),
DividerWithSpacesAround(), if (model.state == ViewState.Idle)
], AppButton(
), title: "Add SELECTED Examinations"
], .toUpperCase(),
), onPressed: () {
)), widget.addSelectedExamination();
), },
SizedBox( ),
height: 10, ]),
), ))),
AppButton( )),
title: "Add SELECTED Examinations".toUpperCase(), );
onPressed: () {},
),
]),
)),
);
});
} }
}
isServiceSelected(MasterKeyModel masterKey) {
Iterable<MasterKeyModel> history =
widget
.myExaminationList
.where((element) =>
masterKey.id == element.id && masterKey.typeId == element.typeId);
if (history.length > 0) {
return true;
}
return false;
}
}

Loading…
Cancel
Save