diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index d9abcd5e..043753b2 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -79,11 +79,12 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - // if (!parsed['IsAuthenticated']) { - // await helpers.logout(); - // - // helpers.showErrorToast('Your session expired Please login agian'); - // } else + if (!parsed['IsAuthenticated']) { + // TODO: return it back when IsAuthenticated work fine in all service + // await helpers.logout(); + + helpers.showErrorToast('Your session expired Please login agian'); + } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart new file mode 100644 index 00000000..3b6685c8 --- /dev/null +++ b/lib/models/SOAP/my_selected_examination.dart @@ -0,0 +1,33 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + + MySelectedExamination( + {this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false}); + + MySelectedExamination.fromJson(Map json) { + + selectedExamination = json['selectedExamination'] != null + ? new MasterKeyModel.fromJson(json['selectedExamination']) + : null; + remark = json['remark']; + remark = json['isNormal']; + remark = json['isAbnormal']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedExamination != null) { + data['selectedExamination'] = this.selectedExamination.toJson(); + } + data['remark'] = this.remark; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + return data; + } +} diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart new file mode 100644 index 00000000..f9f23897 --- /dev/null +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -0,0 +1,99 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class PostPhysicalExamRequestModel { + List listHisProgNotePhysicalVM; + + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + + PostPhysicalExamRequestModel.fromJson(Map json) { + if (json['listHisProgNotePhysicalVM'] != null) { + listHisProgNotePhysicalVM = new List(); + json['listHisProgNotePhysicalVM'].forEach((v) { + listHisProgNotePhysicalVM + .add(new ListHisProgNotePhysicalVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePhysicalVM != null) { + data['listHisProgNotePhysicalVM'] = + this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListHisProgNotePhysicalVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + bool notExamined; + MasterKeyModel masterDescription; + + ListHisProgNotePhysicalVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.notExamined, + this.masterDescription}); + + ListHisProgNotePhysicalVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + notExamined = json['notExamined']; + masterDescription = json['masterDescription'] != null + ? new MasterKeyModel.fromJson(json['masterDescription']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['notExamined'] = this.notExamined; + if (this.masterDescription != null) { + data['masterDescription'] = this.masterDescription.toJson(); + } + return data; + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 4e8c0873..705bc85f 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -30,7 +31,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); - List myExaminationList = List(); + List mySelectedExamination = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -154,7 +155,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList), + ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index c3e8d5db..a1b91864 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -19,9 +20,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; - final List myExaminationList; + final List mySelectedExamination; - ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList}); + ObjectivePage( + {Key key, this.changePageViewIndex, this.mySelectedExamination}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -29,7 +31,6 @@ class ObjectivePage extends StatefulWidget { class _ObjectivePageState extends State { bool isSysExaminationExpand = false; - List examinationsList; TextEditingController remarksController = TextEditingController(); BoxDecoration containerBorderDecoration( @@ -124,7 +125,8 @@ class _ObjectivePageState extends State { height: 20, ), Column( - children: widget.myExaminationList.map((examination) { + children: + widget.mySelectedExamination.map((examination) { return Container( margin: EdgeInsets.only( left: 15, right: 15, top: 15), @@ -133,7 +135,10 @@ class _ObjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(examination.nameEn.toUpperCase(), + Texts( + examination + .selectedExamination.nameEn + .toUpperCase(), variant: "bodyText", bold: true, color: Colors.black) @@ -216,13 +221,14 @@ class _ObjectivePageState extends State { ], ), InkWell( - + child: Icon( FontAwesomeIcons.trash, color: Colors.grey, size: 20, ), - onTap: ()=>removeExamination(examination), + onTap: () => removeExamination( + examination.selectedExamination), ) ], ), @@ -277,13 +283,15 @@ class _ObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.myExaminationList.where( + Iterable history = widget.mySelectedExamination + .where( (element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { - widget.myExaminationList.remove(history.first); + widget.mySelectedExamination.remove(history.first); }); } @@ -321,7 +329,7 @@ class _ObjectivePageState extends State { context: context, builder: (context) { return AddExaminationDailog( - myExaminationList: widget.myExaminationList, + mySelectedExamination: widget.mySelectedExamination, addSelectedExamination: () { setState(() { Navigator.of(context).pop(); @@ -333,12 +341,12 @@ class _ObjectivePageState extends State { } class AddExaminationDailog extends StatefulWidget { - final List myExaminationList; + final List mySelectedExamination; final Function addSelectedExamination; final Function (MasterKeyModel) removeExamination; const AddExaminationDailog( - {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination}) + {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) : super(key: key); @override @@ -422,10 +430,13 @@ class _AddExaminationDailogState extends State { ); } else { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: examinationInfo + ); widget - .myExaminationList + .mySelectedExamination .add( - examinationInfo); + mySelectedExamination); } }); }), @@ -475,12 +486,13 @@ class _AddExaminationDailogState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable history = + Iterable exam = widget - .myExaminationList + .mySelectedExamination .where((element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); - if (history.length > 0) { + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { return true; } return false;