|
|
|
|
@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
|
|
|
|
|
@ -51,7 +52,7 @@ class UpdateObjectivePageVidaPlus extends StatefulWidget {
|
|
|
|
|
class _UpdateObjectivePageVidaPlusState
|
|
|
|
|
extends State<UpdateObjectivePageVidaPlus> implements ObjectiveCallBack {
|
|
|
|
|
bool isSysExaminationExpand = false;
|
|
|
|
|
List<MySelectedExamination> mySelectedExamination = [];
|
|
|
|
|
List<PatientPhysicalExamination> mySelectedExamination = [];
|
|
|
|
|
|
|
|
|
|
BoxDecoration containerBorderDecoration(
|
|
|
|
|
Color containerColor, Color borderColor) {
|
|
|
|
|
@ -74,37 +75,6 @@ class _UpdateObjectivePageVidaPlusState
|
|
|
|
|
if (model.patientPhysicalExaminationList == 0) {
|
|
|
|
|
model.getPhysicalExamination(widget.patientInfo);
|
|
|
|
|
}
|
|
|
|
|
// model.getPatientPhysicalExam(widget.patientInfo);
|
|
|
|
|
model.setObjectiveCallBack(this);
|
|
|
|
|
mySelectedExamination.clear();
|
|
|
|
|
model.isAddExamInProgress = true;
|
|
|
|
|
await model.getPatientPhysicalExam(widget.patientInfo);
|
|
|
|
|
if (model.patientPhysicalExamList.isNotEmpty) {
|
|
|
|
|
if (model.physicalExaminationList.length == 0) {
|
|
|
|
|
await model
|
|
|
|
|
.getMasterLookup(MasterKeysService.PostPhysicalExaminationModel);
|
|
|
|
|
}
|
|
|
|
|
model.patientPhysicalExamList.forEach((element) {
|
|
|
|
|
MasterKeyModel? examMaster = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.PostPhysicalExaminationModel,
|
|
|
|
|
id: element.examId,
|
|
|
|
|
);
|
|
|
|
|
MySelectedExamination tempEam =
|
|
|
|
|
SoapUtils.generateMySelectedExamination(
|
|
|
|
|
examination: examMaster,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isNormal: element.isNormal,
|
|
|
|
|
createdBy: element.createdBy,
|
|
|
|
|
createdOn: element.createdOn,
|
|
|
|
|
editedOn: element.editedOn,
|
|
|
|
|
notExamined: element.notExamined,
|
|
|
|
|
isNew: element.isNew,
|
|
|
|
|
isLocal: false,
|
|
|
|
|
isAbnormal: element.isAbnormal,
|
|
|
|
|
);
|
|
|
|
|
mySelectedExamination.add(tempEam);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
@ -220,177 +190,143 @@ class _UpdateObjectivePageVidaPlusState
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submitUpdateObjectivePage(SOAPViewModel model) async {
|
|
|
|
|
if (mySelectedExamination.isNotEmpty) {
|
|
|
|
|
if (!model.isAddExamInProgress &&
|
|
|
|
|
widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo!.isNotEmpty) {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
} else {
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
Map<String, dynamic> 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);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (model.patientPhysicalExamList.isEmpty) {
|
|
|
|
|
await model.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
} else {
|
|
|
|
|
await model.patchPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
Utils.showErrorToast(model.error);
|
|
|
|
|
if (widget.patientInfo.admissionNo != null &&
|
|
|
|
|
widget.patientInfo.admissionNo!.isNotEmpty) {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
model.isAddExamInProgress = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
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 {
|
|
|
|
|
Utils.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeExamination(MasterKeyModel masterKey) {
|
|
|
|
|
Iterable<MySelectedExamination> history = mySelectedExamination.where(
|
|
|
|
|
(element) =>
|
|
|
|
|
masterKey.id == element.selectedExamination!.id &&
|
|
|
|
|
masterKey.typeId == element.selectedExamination!.typeId);
|
|
|
|
|
// submitUpdateObjectivePage(SOAPViewModel model) async {
|
|
|
|
|
// if (mySelectedExamination.isNotEmpty) {
|
|
|
|
|
// if (!model.isAddExamInProgress &&
|
|
|
|
|
// widget.patientInfo.admissionNo != null &&
|
|
|
|
|
// widget.patientInfo.admissionNo!.isNotEmpty) {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// } else {
|
|
|
|
|
// widget.changeLoadingState(true);
|
|
|
|
|
// Map<String, dynamic> 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);
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
// if (model.patientPhysicalExamList.isEmpty) {
|
|
|
|
|
// await model.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
// } else {
|
|
|
|
|
// await model.patchPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
// widget.changeLoadingState(false);
|
|
|
|
|
// Utils.showErrorToast(model.error);
|
|
|
|
|
// if (widget.patientInfo.admissionNo != null &&
|
|
|
|
|
// widget.patientInfo.admissionNo!.isNotEmpty) {
|
|
|
|
|
// // Navigator.of(context).pop();
|
|
|
|
|
// model.isAddExamInProgress = false;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// 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 {
|
|
|
|
|
// Utils.showErrorToast(TranslationBase.of(context).examinationErrorMsg);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (history.length > 0) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (history.first.isLocal) {
|
|
|
|
|
mySelectedExamination.remove(history.first);
|
|
|
|
|
} else {
|
|
|
|
|
history.first.notExamined = true;
|
|
|
|
|
history.first.isNormal = false;
|
|
|
|
|
history.first.isAbnormal = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// removeExamination(MasterKeyModel masterKey) {
|
|
|
|
|
// Iterable<MySelectedExamination> history = mySelectedExamination.where(
|
|
|
|
|
// (element) =>
|
|
|
|
|
// masterKey.id == element.selectedExamination!.id &&
|
|
|
|
|
// masterKey.typeId == element.selectedExamination!.typeId);
|
|
|
|
|
//
|
|
|
|
|
// if (history.length > 0) {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// if (history.first.isLocal) {
|
|
|
|
|
// mySelectedExamination.remove(history.first);
|
|
|
|
|
// } else {
|
|
|
|
|
// history.first.notExamined = true;
|
|
|
|
|
// history.first.isNormal = false;
|
|
|
|
|
// history.first.isAbnormal = false;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
openExaminationList(BuildContext context) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddExaminationPageVidaPlus(
|
|
|
|
|
mySelectedExamination: mySelectedExamination,
|
|
|
|
|
addSelectedExamination:
|
|
|
|
|
(List<MySelectedExamination> mySelectedExaminationLocal) {
|
|
|
|
|
pushAddExamination(mySelectedExaminationLocal);
|
|
|
|
|
|
|
|
|
|
// mySelectedExaminationLocal.forEach((element) {
|
|
|
|
|
// if (mySelectedExamination.singleWhere(
|
|
|
|
|
// (it) =>
|
|
|
|
|
// it.selectedExamination!.id ==
|
|
|
|
|
// element.selectedExamination!.id,
|
|
|
|
|
// orElse: () => MySelectedExamination()) ==
|
|
|
|
|
// MySelectedExamination()) {
|
|
|
|
|
// mySelectedExamination.insert(0, element);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
/// remove items.
|
|
|
|
|
// List<MySelectedExamination> removedList = [];
|
|
|
|
|
// mySelectedExamination.forEach((element) {
|
|
|
|
|
// if (mySelectedExaminationLocal.singleWhere(
|
|
|
|
|
// (it) =>
|
|
|
|
|
// it.selectedExamination!.id ==
|
|
|
|
|
// element.selectedExamination!.id,
|
|
|
|
|
// orElse: () => MySelectedExamination()) ==
|
|
|
|
|
// MySelectedExamination()) {
|
|
|
|
|
// removedList.add(element);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// removedList.forEach((element) {
|
|
|
|
|
// removeExamination(element.selectedExamination!);
|
|
|
|
|
// });
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// setState(() {});
|
|
|
|
|
},
|
|
|
|
|
removeExamination: (masterKey) => removeExamination(masterKey)),
|
|
|
|
|
patientInfo: widget.patientInfo,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
nextFunction(model) async {
|
|
|
|
|
await submitUpdateObjectivePage(model);
|
|
|
|
|
// await submitUpdateObjectivePage(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pushAddExamination(
|
|
|
|
|
List<MySelectedExamination> mySelectedExaminationLocal) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddDetailsToExaminationVidaPlus(
|
|
|
|
|
mySelectedExamination: mySelectedExamination,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
// void pushAddExamination(
|
|
|
|
|
// List<MySelectedExamination> mySelectedExaminationLocal) {
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// FadePage(
|
|
|
|
|
// page: AddDetailsToExaminationVidaPlus(
|
|
|
|
|
// mySelectedExamination: mySelectedExamination,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|