|
|
|
|
@ -68,7 +68,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
model.setObjectiveCallBack(this);
|
|
|
|
|
mySelectedExamination.clear();
|
|
|
|
|
|
|
|
|
|
model.isAddExamInProgress = true;
|
|
|
|
|
await model.getPatientPhysicalExam(widget.patientInfo);
|
|
|
|
|
if (model.patientPhysicalExamList.isNotEmpty) {
|
|
|
|
|
if (model.physicalExaminationList.length == 0) {
|
|
|
|
|
@ -208,75 +208,88 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage>
|
|
|
|
|
|
|
|
|
|
submitUpdateObjectivePage(SOAPViewModel model) async {
|
|
|
|
|
if (mySelectedExamination.isNotEmpty) {
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
if(!model.isAddExamInProgress && widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo.isNotEmpty) {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}else{
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
|
|
|
|
|
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
|
|
|
|
|
PostPhysicalExamRequestModel postPhysicalExamRequestModel =
|
|
|
|
|
new PostPhysicalExamRequestModel();
|
|
|
|
|
mySelectedExamination.forEach((exam) {
|
|
|
|
|
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
|
|
|
|
|
null)
|
|
|
|
|
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
|
|
|
|
|
[];
|
|
|
|
|
ListHisProgNotePhysicalExaminationVM
|
|
|
|
|
listHisProgNotePhysicalExaminationVM =
|
|
|
|
|
ListHisProgNotePhysicalExaminationVM(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo == null?0: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo == null?0: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);
|
|
|
|
|
} else {
|
|
|
|
|
listHisProgNotePhysicalExaminationVM.admissionNo = 0;
|
|
|
|
|
}
|
|
|
|
|
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
|
|
|
|
|
.add(listHisProgNotePhysicalExaminationVM);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
|
|
|
|
|
PostPhysicalExamRequestModel postPhysicalExamRequestModel =
|
|
|
|
|
new PostPhysicalExamRequestModel();
|
|
|
|
|
mySelectedExamination.forEach((exam) {
|
|
|
|
|
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
|
|
|
|
|
null)
|
|
|
|
|
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
|
|
|
|
|
[];
|
|
|
|
|
ListHisProgNotePhysicalExaminationVM
|
|
|
|
|
listHisProgNotePhysicalExaminationVM =
|
|
|
|
|
ListHisProgNotePhysicalExaminationVM(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo == null?0: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo == null?0: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);
|
|
|
|
|
if (model.patientPhysicalExamList.isEmpty) {
|
|
|
|
|
await model.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
} else {
|
|
|
|
|
listHisProgNotePhysicalExaminationVM.admissionNo = 0;
|
|
|
|
|
await model.patchPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
}
|
|
|
|
|
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
|
|
|
|
|
.add(listHisProgNotePhysicalExaminationVM);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (model.patientPhysicalExamList.isEmpty) {
|
|
|
|
|
await model.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
} else {
|
|
|
|
|
await model.patchPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
if(widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo.isNotEmpty) {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
if(widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo.isNotEmpty) {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
model.isAddExamInProgress = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
widget.changePageViewIndex(2);
|
|
|
|
|
}
|
|
|
|
|
if(widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo.isNotEmpty) {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
model.isAddExamInProgress = false;
|
|
|
|
|
} else {
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
widget.changePageViewIndex(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
|
|
|
|
|
}
|
|
|
|
|
|