prevent passing data and first step from refactor examinations

merge-requests/773/head
Elham Rababh 3 years ago
parent 993a266d4f
commit c69f122713

@ -1,26 +1,29 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination { class MySelectedExamination {
MasterKeyModel selectedExamination; MasterKeyModel selectedExamination;
String remark; String remark;
bool isNormal; bool isNormal;
bool isAbnormal; bool isAbnormal;
bool notExamined; bool notExamined;
bool isNew; bool isNew;
bool isLocal;
int createdBy; int createdBy;
String createdOn; String createdOn;
String editedOn; String editedOn;
MySelectedExamination( MySelectedExamination({
{this.selectedExamination, this.selectedExamination,
this.remark, this.remark,
this.isNormal = false, this.isNormal = false,
this.isAbnormal = false, this.isAbnormal = false,
this.notExamined = true, this.notExamined = true,
this.isNew = true, this.isNew = true,
this.createdBy, this.createdOn, this.isLocal = true,
this.createdBy,
this.editedOn,}); this.createdOn,
this.editedOn,
});
MySelectedExamination.fromJson(Map<String, dynamic> json) { MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null selectedExamination = json['selectedExamination'] != null
@ -34,6 +37,7 @@ class MySelectedExamination {
createdBy = json['createdBy']; createdBy = json['createdBy'];
createdOn = json['createdOn']; createdOn = json['createdOn'];
editedOn = json['editedOn']; editedOn = json['editedOn'];
isLocal = json['isLocal'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -50,6 +54,7 @@ class MySelectedExamination {
data['createdBy'] = this.createdBy; data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn; data['createdOn'] = this.createdOn;
data['editedOn'] = this.editedOn; data['editedOn'] = this.editedOn;
data['isLocal'] = this.isLocal;
return data; return data;
} }

@ -26,14 +26,12 @@ import 'add_assessment_details.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget { class UpdateAssessmentPage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
List<MySelectedAssessment> mySelectedAssessmentList;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
UpdateAssessmentPage( UpdateAssessmentPage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.mySelectedAssessmentList,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.currentIndex}); this.changeLoadingState, this.currentIndex});
@ -43,13 +41,14 @@ class UpdateAssessmentPage extends StatefulWidget {
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> { class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
bool isAssessmentExpand = false; bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.mySelectedAssessmentList.clear(); mySelectedAssessmentList.clear();
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
@ -96,7 +95,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
createdOn: element.createdOn, createdOn: element.createdOn,
icdCode10ID: element.icdCode10ID); icdCode10ID: element.icdCode10ID);
widget.mySelectedAssessmentList.add(temMySelectedAssessment); mySelectedAssessmentList.add(temMySelectedAssessment);
} }
}); });
} }
@ -147,7 +146,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 20, height: 20,
), ),
Column( Column(
children: widget.mySelectedAssessmentList children: mySelectedAssessmentList
.map((assessment) { .map((assessment) {
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
@ -501,14 +500,15 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
color: Colors.red[700], color: Colors.red[700],
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
if (widget.mySelectedAssessmentList.isEmpty) { if (mySelectedAssessmentList.isEmpty) {
Helpers.showErrorToast( Helpers.showErrorToast(
TranslationBase TranslationBase
.of(context) .of(context)
.assessmentErrorMsg); .assessmentErrorMsg);
} else { } else {
widget.changePageViewIndex(3);
widget.changeLoadingState(true); widget.changeLoadingState(true);
widget.changePageViewIndex(3);
} }
}, },
), ),
@ -542,11 +542,11 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
mySelectedAssessment: assessment, mySelectedAssessment: assessment,
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo,
isUpdate: isUpdate, isUpdate: isUpdate,
mySelectedAssessmentList: widget.mySelectedAssessmentList, mySelectedAssessmentList: mySelectedAssessmentList,
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, addSelectedAssessment: (MySelectedAssessment mySelectedAssessment,
bool isUpdate) async { bool isUpdate) async {
setState(() { setState(() {
widget.mySelectedAssessmentList.add(mySelectedAssessment); mySelectedAssessmentList.add(mySelectedAssessment);
}); });
}); });
}); });

@ -31,79 +31,80 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model.getMasterLookup(MasterKeysService.PhysicalExamination);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
backgroundColor: Color.fromRGBO(248, 248, 248, 1), backgroundColor: Color.fromRGBO(248, 248, 248, 1),
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding:
EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Container(
child: AppText( padding: EdgeInsets.only(
"${TranslationBase.of(context).addExamination}", left: 16, top: 70, right: 16, bottom: 16),
fontSize: SizeConfig.textMultiplier * 3.3, color: Colors.white,
color: Colors.black, child: Row(
fontWeight: FontWeight.w700, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: AppText(
"${TranslationBase.of(context).addExamination}",
fontSize: SizeConfig.textMultiplier * 3.3,
color: Colors.black,
fontWeight: FontWeight.w700,
),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Icon(
Icons.clear,
size: 40,
),
)
],
), ),
), ),
InkWell( Expanded(
onTap: () { child: SingleChildScrollView(
Navigator.of(context).pop();
},
child: Icon(
Icons.clear,
size: 40,
),
)
],
),
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.all(16.0),
padding: EdgeInsets.all(0.0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.fromBorderSide(BorderSide(
color: Colors.grey.shade400,
width: 0.4,
)),
),
child: Column( child: Column(
children: [ children: [
ExaminationsListSearchWidget( Container(
masterList: model.physicalExaminationList, margin: EdgeInsets.all(16.0),
isServiceSelected: (master) => padding: EdgeInsets.all(0.0),
isServiceSelected(master), decoration: BoxDecoration(
removeHistory: (history) { shape: BoxShape.rectangle,
setState(() { color: Colors.white,
widget.removeExamination(history); borderRadius: BorderRadius.circular(12),
}); border: Border.fromBorderSide(BorderSide(
}, color: Colors.grey.shade400,
addHistory: (selectedExamination) { width: 0.4,
setState(() { )),
widget.mySelectedExamination ),
.add(selectedExamination); child: Column(
children: [
ExaminationsListSearchWidget(
mySelectedExamination:
widget.mySelectedExamination,
masterList: model.physicalExaminationList,
isServiceSelected: (master) =>
isServiceSelected(master),
removeExamination: (history) {
setState(() {
widget.removeExamination(history);
}); });
}, },
addExamination: (selectedExamination) {
widget.mySelectedExamination
.add(selectedExamination);
// setState(() {});
},
), ),
], ],
), ),

@ -14,19 +14,21 @@ import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class AddExaminationWidget extends StatefulWidget { class AddExaminationWidget extends StatefulWidget {
MasterKeyModel item; MasterKeyModel item;
final Function(MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addHistory; final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
bool isExpand; bool isExpand;
final Function expandClick; final Function expandClick;
final List<MySelectedExamination> mySelectedExamination;
AddExaminationWidget({ AddExaminationWidget({
this.item, this.item,
this.removeHistory, this.removeExamination,
this.addHistory, this.addExamination,
this.isServiceSelected, this.isServiceSelected,
this.isExpand, this.isExpand,
this.expandClick, this.expandClick,
this.mySelectedExamination,
}); });
@override @override
@ -40,7 +42,17 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
@override @override
void initState() { void initState() {
examination.selectedExamination = widget.item; if (getSelectedExam(widget.item) != null) {
examination = getSelectedExam(widget.item);
status = examination.isNormal
? 1
: examination.isAbnormal
? 2
: 3;
remarksController.text = examination.remark;
} else {
examination.selectedExamination = widget.item;
}
super.initState(); super.initState();
} }
@ -70,14 +82,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
if (widget.isServiceSelected(widget.item)) { if (widget.isServiceSelected(widget.item)) {
widget.removeHistory(widget.item); if (!examination.isLocal)
widget.removeExamination(widget.item);
widget.expandClick(); widget.expandClick();
} else { } else {
examination.isNormal = status == 1; examination.isNormal = status == 1;
examination.isAbnormal = status == 2; examination.isAbnormal = status == 2;
examination.notExamined = status == 3; examination.notExamined = status == 3;
examination.remark = remarksController.text; examination.remark = remarksController.text;
widget.addHistory(examination); widget.addExamination(examination);
widget.expandClick(); widget.expandClick();
} }
}); });
@ -113,18 +126,18 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Row( child: InkWell(
children: [ onTap: () {
InkWell( setState(() {
onTap: () { status = 1;
setState(() { });
status = 1; examination.isNormal = true;
}); examination.isAbnormal = false;
examination.isNormal = true; examination.notExamined = false;
examination.isAbnormal = false; },
examination.notExamined = false; child: Row(
}, children: [
child: Container( Container(
padding: EdgeInsets.all(2.0), padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6), margin: EdgeInsets.symmetric(horizontal: 6),
width: 20, width: 20,
@ -143,28 +156,28 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
), AppText(
AppText( TranslationBase.of(context).normal,
TranslationBase.of(context).normal, fontWeight: FontWeight.normal,
fontWeight: FontWeight.normal, fontFamily: 'Poppins',
fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6,
fontSize: SizeConfig.textMultiplier * 1.6, ),
), ],
], ),
)), )),
Expanded( Expanded(
child: Row( child: InkWell(
children: [ onTap: () {
InkWell( setState(() {
onTap: () { status = 2;
setState(() { });
status = 2; examination.isNormal = false;
}); examination.isAbnormal = true;
examination.isNormal = false; examination.notExamined = false;
examination.isAbnormal = true; },
examination.notExamined = false; child: Row(
}, children: [
child: Container( Container(
padding: EdgeInsets.all(2.0), padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6), margin: EdgeInsets.symmetric(horizontal: 6),
width: 20, width: 20,
@ -183,57 +196,58 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
), AppText(
AppText( TranslationBase.of(context).abnormal,
TranslationBase.of(context).abnormal, fontWeight: FontWeight.normal,
fontWeight: FontWeight.normal, fontFamily: 'Poppins',
fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6,
fontSize: SizeConfig.textMultiplier * 1.6, ),
), ],
], ),
)), )),
Expanded( if (!examination.isLocal)
Expanded(
child: InkWell(
onTap: () {
setState(() {
status = 3;
});
examination.isNormal = false;
examination.isAbnormal = false;
examination.notExamined = true;
},
child: Row( child: Row(
children: [ children: [
InkWell( Container(
onTap: () { padding: EdgeInsets.all(2.0),
setState(() { margin: EdgeInsets.symmetric(horizontal: 6),
status = 3; width: 20,
}); height: 20,
examination.isNormal = false;
examination.isAbnormal = false;
examination.notExamined = true;
},
child: Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: status == 3 color: Colors.white,
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all(color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status == 3
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
), ),
), ),
), Expanded(
), child: AppText(
Expanded( TranslationBase.of(context).notExamined,
child: AppText( fontWeight: FontWeight.normal,
TranslationBase.of(context).notExamined, fontFamily: 'Poppins',
fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 1.6,
fontFamily: 'Poppins', ),
fontSize: SizeConfig.textMultiplier * 1.6, ),
), ],
), ),
], )),
)),
], ],
), ),
Container( Container(
@ -256,4 +270,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
); );
} }
MySelectedExamination getSelectedExam(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = widget.mySelectedExamination.where(
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) {
return exam.first;
}
return null;
}
} }

@ -40,25 +40,6 @@ class ExaminationItemCard extends StatelessWidget {
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
), ),
)), )),
Row(
children: [
AppText(
TranslationBase.of(context).remove,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
color: Colors.red.shade800,
fontSize: SizeConfig.textMultiplier * 1.8,
),
InkWell(
onTap: removeExamination,
child: Icon(
Icons.clear,
size: 20,
color: Colors.red.shade800,
),
)
],
),
], ],
), ),
AppText( AppText(
@ -79,6 +60,7 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox( SizedBox(
height: 4, height: 4,
), ),
if(examination.remark.isEmpty)
AppText( AppText(
examination.remark, examination.remark,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,

@ -8,16 +8,17 @@ import 'package:flutter/material.dart';
import 'add_examination_widget.dart'; import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget { class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addHistory; final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel> masterList; final List<MasterKeyModel> masterList;
final List<MySelectedExamination> mySelectedExamination;
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
{this.removeHistory, {this.removeExamination,
this.addHistory, this.addExamination,
this.isServiceSelected, this.isServiceSelected,
this.masterList}); this.masterList, this.mySelectedExamination});
@override @override
_ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState createState() =>
@ -61,8 +62,9 @@ class _ExaminationsListSearchWidgetState
...items.mapIndexed((index, item) { ...items.mapIndexed((index, item) {
return AddExaminationWidget( return AddExaminationWidget(
item: item, item: item,
addHistory: widget.addHistory, addExamination: widget.addExamination,
removeHistory: widget.removeHistory, removeExamination: widget.removeExamination,
mySelectedExamination: widget.mySelectedExamination,
isServiceSelected: widget.isServiceSelected, isServiceSelected: widget.isServiceSelected,
isExpand: index == expandedIndex, isExpand: index == expandedIndex,
expandClick: () { expandClick: () {

@ -28,13 +28,11 @@ class UpdateObjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
final List<MySelectedExamination> mySelectedExamination;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
UpdateObjectivePage( UpdateObjectivePage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.mySelectedExamination,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.currentIndex}); this.currentIndex});
@ -45,8 +43,10 @@ class UpdateObjectivePage extends StatefulWidget {
class _UpdateObjectivePageState extends State<UpdateObjectivePage> { class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List();
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -62,11 +62,13 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( GetPhysicalExamReqModel getPhysicalExamReqModel =
patientMRN: widget.patientInfo.patientMRN, GetPhysicalExamReqModel(
episodeID: widget.patientInfo.episodeNo.toString(), patientMRN: widget.patientInfo.patientMRN,
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
@ -79,16 +81,18 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
id: element.examId, id: element.examId,
); );
MySelectedExamination tempEam = MySelectedExamination( MySelectedExamination tempEam = MySelectedExamination(
selectedExamination: examMaster, selectedExamination: examMaster,
remark: element.remarks, remark: element.remarks,
isNormal: element.isNormal, isNormal: element.isNormal,
createdBy: element.createdBy, createdBy: element.createdBy,
createdOn:element.createdOn , createdOn: element.createdOn,
editedOn: element.editedOn, editedOn: element.editedOn,
notExamined: element.notExamined, notExamined: element.notExamined,
isNew: element.isNew, isNew: element.isNew,
isAbnormal: element.isAbnormal,); isLocal: false,
widget.mySelectedExamination.add(tempEam); isAbnormal: element.isAbnormal,
);
mySelectedExamination.add(tempEam);
}); });
} }
@ -104,9 +108,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).physicalSystemExamination, headerTitle:
TranslationBase.of(context).physicalSystemExamination,
onTap: () { onTap: () {
setState(() { setState(() {
isSysExaminationExpand = !isSysExaminationExpand; isSysExaminationExpand = !isSysExaminationExpand;
@ -115,15 +122,17 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
children: [ children: [
SOAPOpenItems( SOAPOpenItems(
label: "${TranslationBase.of(context).addExamination}", label:
"${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
openExaminationList(context); openExaminationList(context);
}, },
), ),
Column( Column(
children: widget.mySelectedExamination.map((examination) { children: mySelectedExamination.map((examination) {
return ExaminationItemCard(examination, () { return ExaminationItemCard(examination, () {
removeExamination(examination.selectedExamination); removeExamination(
examination.selectedExamination);
}); });
}).toList(), }).toList(),
) )
@ -200,41 +209,45 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
submitUpdateObjectivePage(SOAPViewModel model) async { submitUpdateObjectivePage(SOAPViewModel model) async {
if (widget.mySelectedExamination.isNotEmpty) { if (mySelectedExamination.isNotEmpty) {
widget.changeLoadingState(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); PostPhysicalExamRequestModel postPhysicalExamRequestModel =
widget.mySelectedExamination.forEach((exam) { new PostPhysicalExamRequestModel();
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) mySelectedExamination.forEach((exam) {
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
[];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM( postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
patientMRN: widget.patientInfo.patientMRN, .add(ListHisProgNotePhysicalExaminationVM(
episodeId: widget.patientInfo.episodeNo, patientMRN: widget.patientInfo.patientMRN,
appointmentNo: widget.patientInfo.appointmentNo, episodeId: widget.patientInfo.episodeNo,
remarks: exam.remark ?? '', appointmentNo: widget.patientInfo.appointmentNo,
createdBy: exam.createdBy ?? doctorProfile.doctorID, remarks: exam.remark ?? '',
createdOn: exam.createdOn?? createdBy: exam.createdBy ?? doctorProfile.doctorID,
DateTime.now().toIso8601String(), createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID, editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(), editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id, examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId, examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal, isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal, isNormal: exam.isNormal,
notExamined: exam.notExamined, notExamined: exam.notExamined,
examinationType: exam.isNormal examinationType: exam.isNormal
? 1 ? 1
: exam.isAbnormal : exam.isAbnormal
? 2 ? 2
: 3, : 3,
examinationTypeName: exam.isNormal examinationTypeName: exam.isNormal
? "Normal" ? "Normal"
: exam.isAbnormal : exam.isAbnormal
? 'AbNormal' ? 'AbNormal'
: "Not Examined", : "Not Examined",
isNew: exam.isNew)); isNew: exam.isNew));
}); });
if (model.patientPhysicalExamList.isEmpty) { if (model.patientPhysicalExamList.isEmpty) {
@ -244,11 +257,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
widget.changeLoadingState(false);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
widget.changeLoadingState(true); widget.changeLoadingState(false);
// TODO Elham* return this
// widget.changeLoadingState(true);
widget.changePageViewIndex(2); //widget.changePageViewIndex(2);
} }
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
@ -256,12 +272,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
removeExamination(MasterKeyModel masterKey) { removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = widget.mySelectedExamination.where((element) => Iterable<MySelectedExamination> history = mySelectedExamination.where(
masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); (element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0) if (history.length > 0)
setState(() { setState(() {
widget.mySelectedExamination.remove(history.first); mySelectedExamination.remove(history.first);
}); });
} }
@ -270,7 +288,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
context, context,
FadePage( FadePage(
page: AddExaminationPage( page: AddExaminationPage(
mySelectedExamination: widget.mySelectedExamination, mySelectedExamination: mySelectedExamination,
addSelectedExamination: () { addSelectedExamination: () {
setState(() { setState(() {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -287,7 +305,11 @@ class AddExaminationDailog extends StatefulWidget {
final Function addSelectedExamination; final Function addSelectedExamination;
final Function(MasterKeyModel) removeExamination; final Function(MasterKeyModel) removeExamination;
const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) const AddExaminationDailog(
{Key key,
this.mySelectedExamination,
this.addSelectedExamination,
this.removeExamination})
: super(key: key); : super(key: key);
@override @override
@ -302,7 +324,8 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model
.getMasterLookup(MasterKeysService.PhysicalExamination);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -312,19 +335,21 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: Container( child: Container(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.start,
height: 16, children: [
), SizedBox(
AppText( height: 16,
TranslationBase.of(context).physicalSystemExamination, ),
fontWeight: FontWeight.bold, AppText(
fontSize: 16, TranslationBase.of(context).physicalSystemExamination,
), fontWeight: FontWeight.bold,
SizedBox( fontSize: 16,
height: 16, ),
), SizedBox(
]), height: 16,
),
]),
))), ))),
)), )),
); );

@ -27,14 +27,12 @@ class UpdatePlanPage extends StatefulWidget {
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
GetPatientProgressNoteResModel patientProgressNote;
UpdatePlanPage( UpdatePlanPage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.patientProgressNote,
this.currentIndex}); this.currentIndex});
@override @override
@ -44,6 +42,7 @@ class UpdatePlanPage extends StatefulWidget {
class _UpdatePlanPageState extends State<UpdatePlanPage> { class _UpdatePlanPageState extends State<UpdatePlanPage> {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = true; bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote =GetPatientProgressNoteResModel();
TextEditingController progressNoteController = TextEditingController(text: null); TextEditingController progressNoteController = TextEditingController(text: null);
@ -62,7 +61,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.patientProgressNote.planNote != null) { if (patientProgressNote.planNote != null) {
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
}); });
@ -83,12 +82,12 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
if (model.patientProgressNoteList.isNotEmpty) { if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote);
widget.patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName;
widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn;
widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn;
widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName;
widget.patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo; patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
@ -133,14 +132,14 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
maxLines: 4, maxLines: 4,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
onChanged: (value) { onChanged: (value) {
widget.patientProgressNote.planNote = value; patientProgressNote.planNote = value;
}, },
), ),
), ),
SizedBox( SizedBox(
height: 9, height: 9,
), ),
if (widget.patientProgressNote.planNote != null && !isAddProgress) if (patientProgressNote.planNote != null && !isAddProgress)
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5, left: 5,
@ -160,15 +159,15 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
fontSize: 12, fontSize: 12,
), ),
AppText( AppText(
widget.patientProgressNote.appointmentNo.toString() ?? '', patientProgressNote.appointmentNo.toString() ?? '',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
], ],
), ),
AppText( AppText(
widget.patientProgressNote.createdOn != null patientProgressNote.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted( ? AppDateUtils.getDayMonthYearDateFormatted(
DateTime.parse(widget.patientProgressNote.createdOn)) DateTime.parse(patientProgressNote.createdOn))
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
@ -185,14 +184,14 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
'Condition: ', 'Condition: ',
fontSize: 12, fontSize: 12,
), ),
AppText(widget.patientProgressNote.mName ?? '', AppText(patientProgressNote.mName ?? '',
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
], ],
), ),
AppText( AppText(
widget.patientProgressNote.createdOn != null patientProgressNote.createdOn != null
? AppDateUtils.getHour( ? AppDateUtils.getHour(
DateTime.parse(widget.patientProgressNote.createdOn)) DateTime.parse(patientProgressNote.createdOn))
: AppDateUtils.getHour(DateTime.now()), : AppDateUtils.getHour(DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
@ -287,11 +286,11 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
setState(() { setState(() {
widget.patientProgressNote.createdByName = patientProgressNote.createdByName =
widget.patientProgressNote.createdByName ?? doctorProfile.doctorName; patientProgressNote.createdByName ?? doctorProfile.doctorName;
widget.patientProgressNote.editedByName = doctorProfile.doctorName; patientProgressNote.editedByName = doctorProfile.doctorName;
widget.patientProgressNote.createdOn = DateTime.now().toString(); patientProgressNote.createdOn = DateTime.now().toString();
widget.patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
isAddProgress = !isAddProgress; isAddProgress = !isAddProgress;
}); });
submitPlan(model); submitPlan(model);
@ -320,11 +319,12 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
submitPlan(SOAPViewModel model) async { submitPlan(SOAPViewModel model) async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
widget.changeLoadingState(true);
PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
planNote: widget.patientProgressNote.planNote, planNote: patientProgressNote.planNote,
doctorID: '', doctorID: '',
editedBy: ''); editedBy: '');
@ -339,10 +339,13 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
} }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
widget.changePageViewIndex(4, isChangeState: false); widget.changePageViewIndex(4, isChangeState: false);
} }
widget.changeLoadingState(false);
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
} }

@ -338,7 +338,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} }
if (myHistoryList.length != 0) { if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList); await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {

@ -31,11 +31,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
int _currentIndex = 0; int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = List(); List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List(); List<MySelectedHistory> myHistoryList = List();
List<MySelectedExamination> mySelectedExamination = List();
List<MySelectedAssessment> mySelectedAssessment = List();
GetPatientProgressNoteResModel patientProgressNote =
GetPatientProgressNoteResModel();
changePageViewIndex(pageIndex,{isChangeState = true}) { changePageViewIndex(pageIndex,{isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) if (pageIndex != _currentIndex && isChangeState)
@ -110,20 +106,17 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
UpdateObjectivePage( UpdateObjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
mySelectedExamination: mySelectedExamination,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateAssessmentPage( UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
mySelectedAssessmentList: mySelectedAssessment,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdatePlanPage( UpdatePlanPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
patientProgressNote: patientProgressNote,
changeLoadingState: changeLoadingState) changeLoadingState: changeLoadingState)
], ],
), ),

Loading…
Cancel
Save