prevent passing data and first step from refactor examinations

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

@ -7,20 +7,23 @@ class MySelectedExamination {
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);
}); });
}); });
}); });

@ -44,8 +44,8 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container( Container(
padding: padding: EdgeInsets.only(
EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16), left: 16, top: 70, right: 16, bottom: 16),
color: Colors.white, color: Colors.white,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -90,19 +90,20 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
child: Column( child: Column(
children: [ children: [
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
mySelectedExamination:
widget.mySelectedExamination,
masterList: model.physicalExaminationList, masterList: model.physicalExaminationList,
isServiceSelected: (master) => isServiceSelected: (master) =>
isServiceSelected(master), isServiceSelected(master),
removeHistory: (history) { removeExamination: (history) {
setState(() { setState(() {
widget.removeExamination(history); widget.removeExamination(history);
}); });
}, },
addHistory: (selectedExamination) { addExamination: (selectedExamination) {
setState(() {
widget.mySelectedExamination widget.mySelectedExamination
.add(selectedExamination); .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() {
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; 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,9 +126,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Row( child: InkWell(
children: [
InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
status = 1; status = 1;
@ -124,7 +135,9 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
examination.isAbnormal = false; examination.isAbnormal = false;
examination.notExamined = false; examination.notExamined = false;
}, },
child: Container( child: Row(
children: [
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,7 +156,6 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
),
AppText( AppText(
TranslationBase.of(context).normal, TranslationBase.of(context).normal,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -151,11 +163,10 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier * 1.6,
), ),
], ],
),
)), )),
Expanded( Expanded(
child: Row( child: InkWell(
children: [
InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
status = 2; status = 2;
@ -164,7 +175,9 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
examination.isAbnormal = true; examination.isAbnormal = true;
examination.notExamined = false; examination.notExamined = false;
}, },
child: Container( child: Row(
children: [
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,7 +196,6 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
),
AppText( AppText(
TranslationBase.of(context).abnormal, TranslationBase.of(context).abnormal,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -191,11 +203,11 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier * 1.6,
), ),
], ],
),
)), )),
if (!examination.isLocal)
Expanded( Expanded(
child: Row( child: InkWell(
children: [
InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
status = 3; status = 3;
@ -204,7 +216,9 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
examination.isAbnormal = false; examination.isAbnormal = false;
examination.notExamined = true; examination.notExamined = true;
}, },
child: Container( child: Row(
children: [
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,
@ -223,7 +237,6 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
),
Expanded( Expanded(
child: AppText( child: AppText(
TranslationBase.of(context).notExamined, TranslationBase.of(context).notExamined,
@ -233,6 +246,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
], ],
),
)), )),
], ],
), ),
@ -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 =
GetPhysicalExamReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
@ -83,12 +85,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
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,23 +209,27 @@ 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
.add(ListHisProgNotePhysicalExaminationVM(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '', remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID, createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: exam.createdOn?? createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
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,
@ -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,7 +335,9 @@ 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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox( SizedBox(
height: 16, 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