From a502308a8a712f25ff7b0f52449b0b8b45379b88 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 1 Aug 2021 16:18:36 +0300 Subject: [PATCH] finish update on soap --- lib/core/viewModel/SOAP_view_model.dart | 18 +- .../viewModel/authentication_view_model.dart | 3 +- lib/models/SOAP/GetPhysicalExamReqModel.dart | 3 + .../post_physical_exam_request_model.dart | 186 +++++------ .../assessment/update_assessment_page.dart | 68 +---- .../objective/update_objective_page.dart | 289 +++++++++--------- .../soap_update/plan/update_plan_page.dart | 75 ++--- .../soap_update/update_soap_index.dart | 39 ++- 8 files changed, 329 insertions(+), 352 deletions(-) diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index e9c59d90..0c6004e2 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -27,6 +27,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objectiveCallBack.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.dart'; @@ -356,8 +357,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientPhysicalExam( - GetPhysicalExamReqModel getPhysicalExamReqModel) async { + Future getPatientPhysicalExam(PatiantInformtion patientInfo, + ) async { + + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo.toString(), + appointmentNo: int.parse( + patientInfo.appointmentNo.toString(), + ), + ); + if(patientInfo.admissionNo !=null &&patientInfo.admissionNo.isNotEmpty) + getPhysicalExamReqModel.admissionNo =int.parse(patientInfo.admissionNo); + else + getPhysicalExamReqModel.admissionNo = 0; setState(ViewState.Busy); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); if (_SOAPService.hasError) { diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 6e075bc2..d6cd0790 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -299,8 +299,7 @@ class AuthenticationViewModel extends BaseViewModel { clinicID: clinicInfo.clinicID, license: true, projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2);//TODO change the lan + languageID: 2);///TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); if (_authService.hasError) { error = _authService.error; diff --git a/lib/models/SOAP/GetPhysicalExamReqModel.dart b/lib/models/SOAP/GetPhysicalExamReqModel.dart index 5145c419..241bac57 100644 --- a/lib/models/SOAP/GetPhysicalExamReqModel.dart +++ b/lib/models/SOAP/GetPhysicalExamReqModel.dart @@ -1,6 +1,7 @@ class GetPhysicalExamReqModel { int patientMRN; int appointmentNo; + int admissionNo; String episodeID; String from; String to; @@ -10,6 +11,7 @@ class GetPhysicalExamReqModel { GetPhysicalExamReqModel({ this.patientMRN, this.appointmentNo, + this.admissionNo, this.episodeID, this.from, this.to, @@ -31,6 +33,7 @@ class GetPhysicalExamReqModel { final Map data = new Map(); data['PatientMRN'] = this.patientMRN; data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; data['EpisodeID'] = this.episodeID; data['From'] = this.from; data['To'] = this.to; diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index 52836232..41fb4507 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -1,12 +1,13 @@ - class PostPhysicalExamRequestModel { - List listHisProgNotePhysicalExaminationVM; + List + listHisProgNotePhysicalExaminationVM; PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel.fromJson(Map json) { if (json['listHisProgNotePhysicalExaminationVM'] != null) { - listHisProgNotePhysicalExaminationVM = new List(); + listHisProgNotePhysicalExaminationVM = + new List(); json['listHisProgNotePhysicalExaminationVM'].forEach((v) { listHisProgNotePhysicalExaminationVM .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); @@ -17,98 +18,105 @@ class PostPhysicalExamRequestModel { Map toJson() { final Map data = new Map(); if (this.listHisProgNotePhysicalExaminationVM != null) { - data['listHisProgNotePhysicalExaminationVM'] = - this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); + data['listHisProgNotePhysicalExaminationVM'] = this + .listHisProgNotePhysicalExaminationVM + .map((v) => v.toJson()) + .toList(); } return data; } } - class ListHisProgNotePhysicalExaminationVM { - int episodeId; - int appointmentNo; - int examType; - int examId; - int patientMRN; - bool isNormal; - bool isAbnormal; - bool notExamined; - String examName; - String examinationTypeName; - int examinationType; - String remarks; - bool isNew; - int createdBy; - String createdOn; - String createdByName; - int editedBy; - String editedOn; - String editedByName; +class ListHisProgNotePhysicalExaminationVM { + int episodeId; + int appointmentNo; + int admissionNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + bool notExamined; + String examName; + String examinationTypeName; + int examinationType; + String remarks; + bool isNew; + int createdBy; + String createdOn; + String createdByName; + int editedBy; + String editedOn; + String editedByName; - ListHisProgNotePhysicalExaminationVM( - {this.episodeId, - this.appointmentNo, - this.examType, - this.examId, - this.patientMRN, - this.isNormal, - this.isAbnormal, - this.notExamined, - this.examName, - this.examinationTypeName, - this.examinationType, - this.remarks, - this.isNew, - this.createdBy, - this.createdOn, - this.createdByName, - this.editedBy, - this.editedOn, - this.editedByName}); + ListHisProgNotePhysicalExaminationVM( + {this.episodeId, + this.appointmentNo, + this.admissionNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.notExamined, + this.examName, + this.examinationTypeName, + this.examinationType, + this.remarks, + this.isNew, + this.createdBy, + this.createdOn, + this.createdByName, + this.editedBy, + this.editedOn, + this.editedByName}); - ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { - episodeId = json['episodeId']; - appointmentNo = json['appointmentNo']; - examType = json['examType']; - examId = json['examId']; - patientMRN = json['patientMRN']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - notExamined = json['notExamined']; - examName = json['examName']; - examinationTypeName = json['examinationTypeName']; - examinationType = json['examinationType']; - remarks = json['remarks']; - isNew = json['isNew']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - createdByName = json['createdByName']; - editedBy = json['editedBy']; - editedOn = json['editedOn']; - editedByName = json['editedByName']; - } + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + admissionNo = json['AdmissionNo']; - 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['notExamined'] = this.notExamined; - data['examName'] = this.examName; - data['examinationTypeName'] = this.examinationTypeName; - data['examinationType'] = this.examinationType; - data['remarks'] = this.remarks; - data['isNew'] = this.isNew; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['createdByName'] = this.createdByName; - data['editedBy'] = this.editedBy; - data['editedOn'] = this.editedOn; - data['editedByName'] = this.editedByName; - return data; - } + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + examName = json['examName']; + examinationTypeName = json['examinationTypeName']; + examinationType = json['examinationType']; + remarks = json['remarks']; + isNew = json['isNew']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + createdByName = json['createdByName']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + editedByName = json['editedByName']; } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['examName'] = this.examName; + data['examinationTypeName'] = this.examinationTypeName; + data['examinationType'] = this.examinationType; + data['remarks'] = this.remarks; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['createdByName'] = this.createdByName; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['editedByName'] = this.editedByName; + return data; + } +} diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 4941b0ed..6f476c65 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -475,73 +475,7 @@ class _UpdateAssessmentPageState extends State implements ), ), ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - fontColor: Colors.black, - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(1); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - - - }, - ), - ), - ], - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - )), + ),), ); } diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index db0484da..7109f21b 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -44,7 +44,8 @@ class UpdateObjectivePage extends StatefulWidget { _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); } -class _UpdateObjectivePageState extends State implements ObjectiveCallBack { +class _UpdateObjectivePageState extends State + implements ObjectiveCallBack { bool isSysExaminationExpand = false; List mySelectedExamination = List(); @@ -67,13 +68,8 @@ class _UpdateObjectivePageState extends State implements Ob onModelReady: (model) async { model.setObjectiveCallBack(this); mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString())); - await model.getPatientPhysicalExam(getPhysicalExamReqModel); + + await model.getPatientPhysicalExam(widget.patientInfo); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { await model.getMasterLookup(MasterKeysService.PhysicalExamination); @@ -102,109 +98,108 @@ class _UpdateObjectivePageState extends State implements Ob widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - - children: [ - SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex), - ExpandableSOAPWidget( - headerTitle: - TranslationBase.of(context).physicalSystemExamination, - onTap: () { - setState(() { - isSysExaminationExpand = !isSysExaminationExpand; - }); - }, - child: Column( - children: [ - SOAPOpenItems( - label: - "${TranslationBase.of(context).addExamination}", - onTap: () { - openExaminationList(context); - }, + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), + ExpandableSOAPWidget( + headerTitle: + TranslationBase.of(context).physicalSystemExamination, + onTap: () { + setState(() { + isSysExaminationExpand = !isSysExaminationExpand; + }); + }, + child: Column( + children: [ + SOAPOpenItems( + label: + "${TranslationBase.of(context).addExamination}", + onTap: () { + openExaminationList(context); + }, + ), + if (mySelectedExamination.isNotEmpty && + mySelectedExamination.first.isLocal) + Row( + children: [ + AppText( + "New", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Color(0xFFCC9B14), + ), + ], ), - if (mySelectedExamination.isNotEmpty && - mySelectedExamination.first.isLocal) - Row( - children: [ - AppText( - "New", - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - color: Color(0xFFCC9B14), - ), - ], - ), - Column( - children: mySelectedExamination - .sublist( - 0, - model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) - .map((examination) { - return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); - }); - }).toList(), + Column( + children: mySelectedExamination + .sublist( + 0, + model.getFirstIndexForOldExamination( + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); + }); + }).toList(), + ), + if (mySelectedExamination.isNotEmpty && + model.getFirstIndexForOldExamination( + mySelectedExamination) > + -1) + Row( + children: [ + AppText( + "Verified", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Colors.green, + ), + ], ), - if (mySelectedExamination.isNotEmpty && - model.getFirstIndexForOldExamination( - mySelectedExamination) > - -1) - Row( - children: [ - AppText( - "Verified", - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - color: Colors.green, - ), - ], - ), - Column( - children: mySelectedExamination - .sublist(model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) - .map((examination) { - return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); - }); - }).toList(), - ) - ], - ), - isExpanded: isSysExaminationExpand, + Column( + children: mySelectedExamination + .sublist(model.getFirstIndexForOldExamination( + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); + }); + }).toList(), + ) + ], ), - SizedBox( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 14 : 12), - ) - ], - ), + isExpanded: isSysExaminationExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 14 : 12), + ) + ], ), ), ), + ), ), ); } @@ -213,6 +208,7 @@ class _UpdateObjectivePageState extends State implements Ob // TODO Elham* widget.changePageViewIndex(2); + /// TODO Elham* move this logic to view model // if (mySelectedExamination.isNotEmpty) { // widget.changeLoadingState(true); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -225,33 +221,41 @@ class _UpdateObjectivePageState extends State implements Ob // null) // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = // []; - // + // ListHisProgNotePhysicalExaminationVM + // listHisProgNotePhysicalExaminationVM = + // ListHisProgNotePhysicalExaminationVM( + // patientMRN: widget.patientInfo.patientMRN, + // episodeId: widget.patientInfo.episodeNo, + // appointmentNo: widget.patientInfo.appointmentNo, + // remarks: exam.remark ?? '', + // createdBy: exam.createdBy ?? doctorProfile.doctorID, + // createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), + // editedBy: doctorProfile.doctorID, + // editedOn: DateTime.now().toIso8601String(), + // examId: exam.selectedExamination.id, + // examType: exam.selectedExamination.typeId, + // isAbnormal: exam.isAbnormal, + // isNormal: exam.isNormal, + // notExamined: exam.notExamined, + // examinationType: exam.isNormal + // ? 1 + // : exam.isAbnormal + // ? 2 + // : 3, + // examinationTypeName: exam.isNormal + // ? "Normal" + // : exam.isAbnormal + // ? 'AbNormal' + // : "Not Examined", + // isNew: exam.isNew, + // ); + // if (widget.patientInfo.admissionNo != null && + // widget.patientInfo.admissionNo.isNotEmpty) { + // listHisProgNotePhysicalExaminationVM.admissionNo = + // int.parse(widget.patientInfo.admissionNo); + // } // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - // .add(ListHisProgNotePhysicalExaminationVM( - // patientMRN: widget.patientInfo.patientMRN, - // episodeId: widget.patientInfo.episodeNo, - // appointmentNo: widget.patientInfo.appointmentNo, - // remarks: exam.remark ?? '', - // createdBy: exam.createdBy ?? doctorProfile.doctorID, - // createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), - // editedBy: doctorProfile.doctorID, - // editedOn: DateTime.now().toIso8601String(), - // examId: exam.selectedExamination.id, - // examType: exam.selectedExamination.typeId, - // isAbnormal: exam.isAbnormal, - // isNormal: exam.isNormal, - // notExamined: exam.notExamined, - // examinationType: exam.isNormal - // ? 1 - // : exam.isAbnormal - // ? 2 - // : 3, - // examinationTypeName: exam.isNormal - // ? "Normal" - // : exam.isAbnormal - // ? 'AbNormal' - // : "Not Examined", - // isNew: exam.isNew)); + // .add(listHisProgNotePhysicalExaminationVM); // }); // // if (model.patientPhysicalExamList.isEmpty) { @@ -297,15 +301,16 @@ class _UpdateObjectivePageState extends State implements Ob FadePage( page: AddExaminationPage( mySelectedExamination: mySelectedExamination, - addSelectedExamination: (List mySelectedExaminationLocal ) { + addSelectedExamination: + (List mySelectedExaminationLocal) { setState(() { - { - mySelectedExaminationLocal.forEach((element) { + { + mySelectedExaminationLocal.forEach((element) { if ((mySelectedExamination.singleWhere( (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == null) { mySelectedExamination.add(element); } @@ -313,12 +318,12 @@ class _UpdateObjectivePageState extends State implements Ob /// remove items. List removedList = []; - mySelectedExamination.forEach((element) { + mySelectedExamination.forEach((element) { if ((mySelectedExaminationLocal.singleWhere( (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == null) { removedList.add(element); } @@ -337,7 +342,7 @@ class _UpdateObjectivePageState extends State implements Ob } @override - nextFunction(model) async { + nextFunction(model) async { await submitUpdateObjectivePage(model); } } diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index b40b0a29..c17b593f 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -28,6 +28,8 @@ class UpdatePlanPage extends StatefulWidget { final Function changePageViewIndex; final PatiantInformtion patientInfo; final Function changeLoadingState; + final Function changeStateFun; + final SOAPViewModel sOAPViewModel; final int currentIndex; @@ -36,7 +38,7 @@ class UpdatePlanPage extends StatefulWidget { this.changePageViewIndex, this.patientInfo, this.changeLoadingState, - this.currentIndex}); + this.currentIndex, this.sOAPViewModel, this.changeStateFun}); @override _UpdatePlanPageState createState() => _UpdatePlanPageState(); @@ -84,26 +86,27 @@ class _UpdatePlanPageState extends State implements PlanCallBack episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); + await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel); ///TODO set progressNote in model; - if (model.patientProgressNoteList.isNotEmpty) { + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = isAddProgress; - model.isAddProgress = isAddProgress; + widget.sOAPViewModel.isAddProgress = isAddProgress; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; }); } } @@ -112,7 +115,7 @@ class _UpdatePlanPageState extends State implements PlanCallBack Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - model.setPlanCallBack(this); + widget.sOAPViewModel.setPlanCallBack(this); GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( appointmentNo: @@ -121,26 +124,27 @@ class _UpdatePlanPageState extends State implements PlanCallBack episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); + await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel); - if (model.patientProgressNoteList.isNotEmpty) { + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; setState(() { isAddProgress = false; - model.isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; }); } widget.changeLoadingState(false); @@ -188,6 +192,8 @@ class _UpdatePlanPageState extends State implements PlanCallBack onChanged: (value) { setState(() { patientProgressNote.planNote = value; + model.progressNoteText = value; + widget.changeStateFun(); }); }, ), @@ -301,6 +307,7 @@ class _UpdatePlanPageState extends State implements PlanCallBack onTap: () { setState(() { isAddProgress = true; + widget.sOAPViewModel.isAddProgress = true; }); }, child: Icon( @@ -342,17 +349,17 @@ class _UpdatePlanPageState extends State implements PlanCallBack doctorID: '', editedBy: ''); - if (model.patientProgressNoteList.isEmpty) { - await model.postProgressNote(postProgressNoteRequestModel); + if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { + await widget.sOAPViewModel.postProgressNote(postProgressNoteRequestModel); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; - await model.patchProgressNote(postProgressNoteRequestModel); + await widget.sOAPViewModel.patchProgressNote(postProgressNoteRequestModel); } - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); + if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.sOAPViewModel.error); } else { GetGetProgressNoteReqModel getGetProgressNoteReqModel = @@ -363,25 +370,25 @@ class _UpdatePlanPageState extends State implements PlanCallBack episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); - if (model.patientProgressNoteList.isNotEmpty) { + await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel); + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = false; - model.isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; }); } } diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 7265e90e..77c395e5 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -60,6 +60,11 @@ class _UpdateSoapIndexState extends State }); } + void changeStateFun(){ + setState(() { + + }); + } @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; @@ -94,25 +99,27 @@ class _UpdateSoapIndexState extends State }, scrollDirection: Axis.horizontal, children: [ - UpdateSubjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateObjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), + // UpdateSubjectivePage( + // changePageViewIndex: changePageViewIndex, + // currentIndex: _currentIndex, + // patientInfo: patient, + // changeLoadingState: changeLoadingState), + // UpdateObjectivePage( + // changePageViewIndex: changePageViewIndex, + // currentIndex: _currentIndex, + // patientInfo: patient, + // changeLoadingState: changeLoadingState), + // UpdateAssessmentPage( + // changePageViewIndex: changePageViewIndex, + // currentIndex: _currentIndex, + // patientInfo: patient, + // changeLoadingState: changeLoadingState), UpdatePlanPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, + sOAPViewModel: model, + changeStateFun: changeStateFun, changeLoadingState: changeLoadingState) ], ), @@ -123,7 +130,7 @@ class _UpdateSoapIndexState extends State ], ), ), - bottomSheet: Container( + bottomSheet:_isLoading?Container(height: 0,): Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(