finish update on soap

episode_fixes
Elham Rababh 5 years ago
parent e58ce34aa4
commit a502308a8a

@ -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_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/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/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/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/objective/objectiveCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.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); setState(ViewState.Idle);
} }
Future getPatientPhysicalExam( Future getPatientPhysicalExam(PatiantInformtion patientInfo,
GetPhysicalExamReqModel getPhysicalExamReqModel) async { ) 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); setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {

@ -299,8 +299,7 @@ class AuthenticationViewModel extends BaseViewModel {
clinicID: clinicInfo.clinicID, clinicID: clinicInfo.clinicID,
license: true, license: true,
projectID: clinicInfo.projectID, projectID: clinicInfo.projectID,
tokenID: '', languageID: 2);///TODO change the lan
languageID: 2);//TODO change the lan
await _authService.getDoctorProfileBasedOnClinic(docInfo); await _authService.getDoctorProfileBasedOnClinic(docInfo);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;

@ -1,6 +1,7 @@
class GetPhysicalExamReqModel { class GetPhysicalExamReqModel {
int patientMRN; int patientMRN;
int appointmentNo; int appointmentNo;
int admissionNo;
String episodeID; String episodeID;
String from; String from;
String to; String to;
@ -10,6 +11,7 @@ class GetPhysicalExamReqModel {
GetPhysicalExamReqModel({ GetPhysicalExamReqModel({
this.patientMRN, this.patientMRN,
this.appointmentNo, this.appointmentNo,
this.admissionNo,
this.episodeID, this.episodeID,
this.from, this.from,
this.to, this.to,
@ -31,6 +33,7 @@ class GetPhysicalExamReqModel {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo; data['AppointmentNo'] = this.appointmentNo;
data['AdmissionNo'] = this.admissionNo;
data['EpisodeID'] = this.episodeID; data['EpisodeID'] = this.episodeID;
data['From'] = this.from; data['From'] = this.from;
data['To'] = this.to; data['To'] = this.to;

@ -1,12 +1,13 @@
class PostPhysicalExamRequestModel { class PostPhysicalExamRequestModel {
List<ListHisProgNotePhysicalExaminationVM> listHisProgNotePhysicalExaminationVM; List<ListHisProgNotePhysicalExaminationVM>
listHisProgNotePhysicalExaminationVM;
PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM});
PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) { PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listHisProgNotePhysicalExaminationVM'] != null) { if (json['listHisProgNotePhysicalExaminationVM'] != null) {
listHisProgNotePhysicalExaminationVM = new List<ListHisProgNotePhysicalExaminationVM>(); listHisProgNotePhysicalExaminationVM =
new List<ListHisProgNotePhysicalExaminationVM>();
json['listHisProgNotePhysicalExaminationVM'].forEach((v) { json['listHisProgNotePhysicalExaminationVM'].forEach((v) {
listHisProgNotePhysicalExaminationVM listHisProgNotePhysicalExaminationVM
.add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v));
@ -17,98 +18,105 @@ class PostPhysicalExamRequestModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listHisProgNotePhysicalExaminationVM != null) { if (this.listHisProgNotePhysicalExaminationVM != null) {
data['listHisProgNotePhysicalExaminationVM'] = data['listHisProgNotePhysicalExaminationVM'] = this
this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); .listHisProgNotePhysicalExaminationVM
.map((v) => v.toJson())
.toList();
} }
return data; return data;
} }
} }
class ListHisProgNotePhysicalExaminationVM { class ListHisProgNotePhysicalExaminationVM {
int episodeId; int episodeId;
int appointmentNo; int appointmentNo;
int examType; int admissionNo;
int examId; int examType;
int patientMRN; int examId;
bool isNormal; int patientMRN;
bool isAbnormal; bool isNormal;
bool notExamined; bool isAbnormal;
String examName; bool notExamined;
String examinationTypeName; String examName;
int examinationType; String examinationTypeName;
String remarks; int examinationType;
bool isNew; String remarks;
int createdBy; bool isNew;
String createdOn; int createdBy;
String createdByName; String createdOn;
int editedBy; String createdByName;
String editedOn; int editedBy;
String editedByName; String editedOn;
String editedByName;
ListHisProgNotePhysicalExaminationVM( ListHisProgNotePhysicalExaminationVM(
{this.episodeId, {this.episodeId,
this.appointmentNo, this.appointmentNo,
this.examType, this.admissionNo,
this.examId, this.examType,
this.patientMRN, this.examId,
this.isNormal, this.patientMRN,
this.isAbnormal, this.isNormal,
this.notExamined, this.isAbnormal,
this.examName, this.notExamined,
this.examinationTypeName, this.examName,
this.examinationType, this.examinationTypeName,
this.remarks, this.examinationType,
this.isNew, this.remarks,
this.createdBy, this.isNew,
this.createdOn, this.createdBy,
this.createdByName, this.createdOn,
this.editedBy, this.createdByName,
this.editedOn, this.editedBy,
this.editedByName}); this.editedOn,
this.editedByName});
ListHisProgNotePhysicalExaminationVM.fromJson(Map<String, dynamic> json) { ListHisProgNotePhysicalExaminationVM.fromJson(Map<String, dynamic> json) {
episodeId = json['episodeId']; episodeId = json['episodeId'];
appointmentNo = json['appointmentNo']; appointmentNo = json['appointmentNo'];
examType = json['examType']; admissionNo = json['AdmissionNo'];
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<String, dynamic> toJson() { examType = json['examType'];
final Map<String, dynamic> data = new Map<String, dynamic>(); examId = json['examId'];
data['episodeId'] = this.episodeId; patientMRN = json['patientMRN'];
data['appointmentNo'] = this.appointmentNo; isNormal = json['isNormal'];
data['examType'] = this.examType; isAbnormal = json['isAbnormal'];
data['examId'] = this.examId; notExamined = json['notExamined'];
data['patientMRN'] = this.patientMRN; examName = json['examName'];
data['isNormal'] = this.isNormal; examinationTypeName = json['examinationTypeName'];
data['isAbnormal'] = this.isAbnormal; examinationType = json['examinationType'];
data['notExamined'] = this.notExamined; remarks = json['remarks'];
data['examName'] = this.examName; isNew = json['isNew'];
data['examinationTypeName'] = this.examinationTypeName; createdBy = json['createdBy'];
data['examinationType'] = this.examinationType; createdOn = json['createdOn'];
data['remarks'] = this.remarks; createdByName = json['createdByName'];
data['isNew'] = this.isNew; editedBy = json['editedBy'];
data['createdBy'] = this.createdBy; editedOn = json['editedOn'];
data['createdOn'] = this.createdOn; editedByName = json['editedByName'];
data['createdByName'] = this.createdByName;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['editedByName'] = this.editedByName;
return data;
}
} }
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -475,73 +475,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> 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,
),
],
),
)),
); );
} }

@ -44,7 +44,8 @@ class UpdateObjectivePage extends StatefulWidget {
_UpdateObjectivePageState createState() => _UpdateObjectivePageState(); _UpdateObjectivePageState createState() => _UpdateObjectivePageState();
} }
class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements ObjectiveCallBack { class _UpdateObjectivePageState extends State<UpdateObjectivePage>
implements ObjectiveCallBack {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List(); List<MySelectedExamination> mySelectedExamination = List();
@ -67,13 +68,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
onModelReady: (model) async { onModelReady: (model) async {
model.setObjectiveCallBack(this); model.setObjectiveCallBack(this);
mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel( await model.getPatientPhysicalExam(widget.patientInfo);
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model.getMasterLookup(MasterKeysService.PhysicalExamination);
@ -102,109 +98,108 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
widget.changeLoadingState(false); widget.changeLoadingState(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Center( child: Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: [ SOAPStepHeader(
SOAPStepHeader( currentIndex: widget.currentIndex,
currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget(
ExpandableSOAPWidget( headerTitle:
headerTitle: TranslationBase.of(context).physicalSystemExamination,
TranslationBase.of(context).physicalSystemExamination, onTap: () {
onTap: () { setState(() {
setState(() { isSysExaminationExpand = !isSysExaminationExpand;
isSysExaminationExpand = !isSysExaminationExpand; });
}); },
}, child: Column(
child: Column( children: [
children: [ SOAPOpenItems(
SOAPOpenItems( label:
label: "${TranslationBase.of(context).addExamination}",
"${TranslationBase.of(context).addExamination}", onTap: () {
onTap: () { openExaminationList(context);
openExaminationList(context); },
}, ),
if (mySelectedExamination.isNotEmpty &&
mySelectedExamination.first.isLocal)
Row(
children: [
AppText(
"New",
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
color: Color(0xFFCC9B14),
),
],
), ),
if (mySelectedExamination.isNotEmpty && Column(
mySelectedExamination.first.isLocal) children: mySelectedExamination
Row( .sublist(
children: [ 0,
AppText( model.getFirstIndexForOldExamination(
"New", mySelectedExamination) ==
fontWeight: FontWeight.w600, -1
fontFamily: 'Poppins', ? 0
color: Color(0xFFCC9B14), : model.getFirstIndexForOldExamination(
), mySelectedExamination))
], .map((examination) {
), return ExaminationItemCard(examination, () {
Column( removeExamination(
children: mySelectedExamination examination.selectedExamination);
.sublist( });
0, }).toList(),
model.getFirstIndexForOldExamination( ),
mySelectedExamination) == if (mySelectedExamination.isNotEmpty &&
-1 model.getFirstIndexForOldExamination(
? 0 mySelectedExamination) >
: model.getFirstIndexForOldExamination( -1)
mySelectedExamination)) Row(
.map((examination) { children: [
return ExaminationItemCard(examination, () { AppText(
removeExamination( "Verified",
examination.selectedExamination); fontWeight: FontWeight.w600,
}); fontFamily: 'Poppins',
}).toList(), color: Colors.green,
),
],
), ),
if (mySelectedExamination.isNotEmpty && Column(
model.getFirstIndexForOldExamination( children: mySelectedExamination
mySelectedExamination) > .sublist(model.getFirstIndexForOldExamination(
-1) mySelectedExamination) ==
Row( -1
children: [ ? 0
AppText( : model.getFirstIndexForOldExamination(
"Verified", mySelectedExamination))
fontWeight: FontWeight.w600, .map((examination) {
fontFamily: 'Poppins', return ExaminationItemCard(examination, () {
color: Colors.green, removeExamination(
), examination.selectedExamination);
], });
), }).toList(),
Column( )
children: mySelectedExamination ],
.sublist(model.getFirstIndexForOldExamination(
mySelectedExamination) ==
-1
? 0
: model.getFirstIndexForOldExamination(
mySelectedExamination))
.map((examination) {
return ExaminationItemCard(examination, () {
removeExamination(
examination.selectedExamination);
});
}).toList(),
)
],
),
isExpanded: isSysExaminationExpand,
), ),
SizedBox( isExpanded: isSysExaminationExpand,
height: SizeConfig.heightMultiplier * ),
(SizeConfig.isHeightVeryShort ? 14 : 12), SizedBox(
) height: SizeConfig.heightMultiplier *
], (SizeConfig.isHeightVeryShort ? 14 : 12),
), )
],
), ),
), ),
), ),
),
), ),
); );
} }
@ -213,6 +208,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
// TODO Elham* // TODO Elham*
widget.changePageViewIndex(2); widget.changePageViewIndex(2);
/// TODO Elham* move this logic to view model
// if (mySelectedExamination.isNotEmpty) { // if (mySelectedExamination.isNotEmpty) {
// widget.changeLoadingState(true); // widget.changeLoadingState(true);
// Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -225,33 +221,41 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
// null) // null)
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = // 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 // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
// .add(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));
// }); // });
// //
// if (model.patientPhysicalExamList.isEmpty) { // if (model.patientPhysicalExamList.isEmpty) {
@ -297,15 +301,16 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
FadePage( FadePage(
page: AddExaminationPage( page: AddExaminationPage(
mySelectedExamination: mySelectedExamination, mySelectedExamination: mySelectedExamination,
addSelectedExamination: (List<MySelectedExamination> mySelectedExaminationLocal ) { addSelectedExamination:
(List<MySelectedExamination> mySelectedExaminationLocal) {
setState(() { setState(() {
{ {
mySelectedExaminationLocal.forEach((element) { mySelectedExaminationLocal.forEach((element) {
if ((mySelectedExamination.singleWhere( if ((mySelectedExamination.singleWhere(
(it) => (it) =>
it.selectedExamination.id == it.selectedExamination.id ==
element.selectedExamination.id, element.selectedExamination.id,
orElse: () => null)) == orElse: () => null)) ==
null) { null) {
mySelectedExamination.add(element); mySelectedExamination.add(element);
} }
@ -313,12 +318,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
/// remove items. /// remove items.
List<MySelectedExamination> removedList = []; List<MySelectedExamination> removedList = [];
mySelectedExamination.forEach((element) { mySelectedExamination.forEach((element) {
if ((mySelectedExaminationLocal.singleWhere( if ((mySelectedExaminationLocal.singleWhere(
(it) => (it) =>
it.selectedExamination.id == it.selectedExamination.id ==
element.selectedExamination.id, element.selectedExamination.id,
orElse: () => null)) == orElse: () => null)) ==
null) { null) {
removedList.add(element); removedList.add(element);
} }
@ -337,7 +342,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
} }
@override @override
nextFunction(model) async { nextFunction(model) async {
await submitUpdateObjectivePage(model); await submitUpdateObjectivePage(model);
} }
} }

@ -28,6 +28,8 @@ class UpdatePlanPage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final Function changeLoadingState; final Function changeLoadingState;
final Function changeStateFun;
final SOAPViewModel sOAPViewModel;
final int currentIndex; final int currentIndex;
@ -36,7 +38,7 @@ class UpdatePlanPage extends StatefulWidget {
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.currentIndex}); this.currentIndex, this.sOAPViewModel, this.changeStateFun});
@override @override
_UpdatePlanPageState createState() => _UpdatePlanPageState(); _UpdatePlanPageState createState() => _UpdatePlanPageState();
@ -84,26 +86,27 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
///TODO set progressNote in model; ///TODO set progressNote in model;
if (model.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString( progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote); widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName; widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn; widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn; widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName; widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = isAddProgress; isAddProgress = isAddProgress;
model.isAddProgress = isAddProgress; widget.sOAPViewModel.isAddProgress = isAddProgress;
widget.sOAPViewModel.progressNoteText = progressNoteController.text;
}); });
} }
} }
@ -112,7 +115,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setPlanCallBack(this); widget.sOAPViewModel.setPlanCallBack(this);
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel( GetGetProgressNoteReqModel(
appointmentNo: appointmentNo:
@ -121,26 +124,27 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString( progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote); widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName; widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn; widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn; widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName; widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.progressNoteText = progressNoteController.text;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false; widget.sOAPViewModel.isAddProgress = false;
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState(false);
@ -188,6 +192,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
patientProgressNote.planNote = value; patientProgressNote.planNote = value;
model.progressNoteText = value;
widget.changeStateFun();
}); });
}, },
), ),
@ -301,6 +307,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
onTap: () { onTap: () {
setState(() { setState(() {
isAddProgress = true; isAddProgress = true;
widget.sOAPViewModel.isAddProgress = true;
}); });
}, },
child: Icon( child: Icon(
@ -342,17 +349,17 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
doctorID: '', doctorID: '',
editedBy: ''); editedBy: '');
if (model.patientProgressNoteList.isEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) {
await model.postProgressNote(postProgressNoteRequestModel); await widget.sOAPViewModel.postProgressNote(postProgressNoteRequestModel);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; postProgressNoteRequestModel.editedBy = doctorProfile.doctorID;
await model.patchProgressNote(postProgressNoteRequestModel); await widget.sOAPViewModel.patchProgressNote(postProgressNoteRequestModel);
} }
if (model.state == ViewState.ErrorLocal) { if (widget.sOAPViewModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(widget.sOAPViewModel.error);
} else { } else {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
@ -363,25 +370,25 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString( progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote); widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName; widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn; widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn = patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn; widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName = patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName; widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo = patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false; widget.sOAPViewModel.isAddProgress = false;
}); });
} }
} }

@ -60,6 +60,11 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
}); });
} }
void changeStateFun(){
setState(() {
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -94,25 +99,27 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
UpdateSubjectivePage( // UpdateSubjectivePage(
changePageViewIndex: changePageViewIndex, // changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, // currentIndex: _currentIndex,
patientInfo: patient, // patientInfo: patient,
changeLoadingState: changeLoadingState), // changeLoadingState: changeLoadingState),
UpdateObjectivePage( // UpdateObjectivePage(
changePageViewIndex: changePageViewIndex, // changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, // currentIndex: _currentIndex,
patientInfo: patient, // patientInfo: patient,
changeLoadingState: changeLoadingState), // changeLoadingState: changeLoadingState),
UpdateAssessmentPage( // UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex, // changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, // currentIndex: _currentIndex,
patientInfo: patient, // patientInfo: patient,
changeLoadingState: changeLoadingState), // changeLoadingState: changeLoadingState),
UpdatePlanPage( UpdatePlanPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
sOAPViewModel: model,
changeStateFun: changeStateFun,
changeLoadingState: changeLoadingState) changeLoadingState: changeLoadingState)
], ],
), ),
@ -123,7 +130,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
], ],
), ),
), ),
bottomSheet: Container( bottomSheet:_isLoading?Container(height: 0,): Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(

Loading…
Cancel
Save