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_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) {

@ -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;

@ -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<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['AdmissionNo'] = this.admissionNo;
data['EpisodeID'] = this.episodeID;
data['From'] = this.from;
data['To'] = this.to;

@ -1,12 +1,13 @@
class PostPhysicalExamRequestModel {
List<ListHisProgNotePhysicalExaminationVM> listHisProgNotePhysicalExaminationVM;
List<ListHisProgNotePhysicalExaminationVM>
listHisProgNotePhysicalExaminationVM;
PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM});
PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listHisProgNotePhysicalExaminationVM'] != null) {
listHisProgNotePhysicalExaminationVM = new List<ListHisProgNotePhysicalExaminationVM>();
listHisProgNotePhysicalExaminationVM =
new List<ListHisProgNotePhysicalExaminationVM>();
json['listHisProgNotePhysicalExaminationVM'].forEach((v) {
listHisProgNotePhysicalExaminationVM
.add(new ListHisProgNotePhysicalExaminationVM.fromJson(v));
@ -17,16 +18,19 @@ class PostPhysicalExamRequestModel {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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 {
class ListHisProgNotePhysicalExaminationVM {
int episodeId;
int appointmentNo;
int admissionNo;
int examType;
int examId;
int patientMRN;
@ -48,6 +52,7 @@ class PostPhysicalExamRequestModel {
ListHisProgNotePhysicalExaminationVM(
{this.episodeId,
this.appointmentNo,
this.admissionNo,
this.examType,
this.examId,
this.patientMRN,
@ -69,6 +74,8 @@ class PostPhysicalExamRequestModel {
ListHisProgNotePhysicalExaminationVM.fromJson(Map<String, dynamic> json) {
episodeId = json['episodeId'];
appointmentNo = json['appointmentNo'];
admissionNo = json['AdmissionNo'];
examType = json['examType'];
examId = json['examId'];
patientMRN = json['patientMRN'];
@ -92,6 +99,7 @@ class PostPhysicalExamRequestModel {
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;
@ -111,4 +119,4 @@ class PostPhysicalExamRequestModel {
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();
}
class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements ObjectiveCallBack {
class _UpdateObjectivePageState extends State<UpdateObjectivePage>
implements ObjectiveCallBack {
bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List();
@ -67,13 +68,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> 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);
@ -112,7 +108,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SOAPStepHeader(
currentIndex: widget.currentIndex,
@ -213,6 +208,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> 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,9 +221,9 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
// null)
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
// [];
//
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
// .add(ListHisProgNotePhysicalExaminationVM(
// ListHisProgNotePhysicalExaminationVM
// listHisProgNotePhysicalExaminationVM =
// ListHisProgNotePhysicalExaminationVM(
// patientMRN: widget.patientInfo.patientMRN,
// episodeId: widget.patientInfo.episodeNo,
// appointmentNo: widget.patientInfo.appointmentNo,
@ -251,7 +247,15 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
// : exam.isAbnormal
// ? 'AbNormal'
// : "Not Examined",
// isNew: exam.isNew));
// isNew: exam.isNew,
// );
// if (widget.patientInfo.admissionNo != null &&
// widget.patientInfo.admissionNo.isNotEmpty) {
// listHisProgNotePhysicalExaminationVM.admissionNo =
// int.parse(widget.patientInfo.admissionNo);
// }
// postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
// .add(listHisProgNotePhysicalExaminationVM);
// });
//
// if (model.patientPhysicalExamList.isEmpty) {
@ -297,7 +301,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements Ob
FadePage(
page: AddExaminationPage(
mySelectedExamination: mySelectedExamination,
addSelectedExamination: (List<MySelectedExamination> mySelectedExaminationLocal ) {
addSelectedExamination:
(List<MySelectedExamination> mySelectedExaminationLocal) {
setState(() {
{
mySelectedExaminationLocal.forEach((element) {

@ -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<UpdatePlanPage> 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<UpdatePlanPage> implements PlanCallBack
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
model.setPlanCallBack(this);
widget.sOAPViewModel.setPlanCallBack(this);
GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel(
appointmentNo:
@ -121,26 +124,27 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> 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<UpdatePlanPage> implements PlanCallBack
onChanged: (value) {
setState(() {
patientProgressNote.planNote = value;
model.progressNoteText = value;
widget.changeStateFun();
});
},
),
@ -301,6 +307,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack
onTap: () {
setState(() {
isAddProgress = true;
widget.sOAPViewModel.isAddProgress = true;
});
},
child: Icon(
@ -342,17 +349,17 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> 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<UpdatePlanPage> 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;
});
}
}

@ -60,6 +60,11 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
});
}
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<UpdateSoapIndex>
},
scrollDirection: Axis.horizontal,
children: <Widget>[
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<UpdateSoapIndex>
],
),
),
bottomSheet: Container(
bottomSheet:_isLoading?Container(height: 0,): Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(

Loading…
Cancel
Save