|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
|
|
|
@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
@ -54,20 +56,11 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeID: widget.patientInfo.episodeNo.toString(),
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo);
|
|
|
|
|
|
|
|
|
|
getHistoryReqModel.historyType =
|
|
|
|
|
MasterKeysService.HistoryFamily.getMasterKeyService();
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel, isFirst: true);
|
|
|
|
|
getHistoryReqModel.historyType =
|
|
|
|
|
MasterKeysService.HistoryMedical.getMasterKeyService();
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel);
|
|
|
|
|
getHistoryReqModel.historyType =
|
|
|
|
|
MasterKeysService.HistorySurgical.getMasterKeyService();
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel);
|
|
|
|
|
getHistoryReqModel.historyType =
|
|
|
|
|
MasterKeysService.HistorySports.getMasterKeyService();
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel);
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
doctorID: '',
|
|
|
|
|
editedBy: '');
|
|
|
|
|
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel,isFirst: true);
|
|
|
|
|
|
|
|
|
|
if (model.patientHistoryList.isNotEmpty) {
|
|
|
|
|
if (model.historyFamilyList.isEmpty) {
|
|
|
|
|
@ -147,58 +140,64 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAllergies(SOAPViewModel model) async {
|
|
|
|
|
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
doctorID: '',
|
|
|
|
|
editedBy: '');
|
|
|
|
|
await model.getPatientAllergy(generalGetReqForSOAP);
|
|
|
|
|
if (model.patientAllergiesList.isNotEmpty) {
|
|
|
|
|
if (model.allergiesList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.Allergies);
|
|
|
|
|
if (model.allergySeverityList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.AllergySeverity);
|
|
|
|
|
|
|
|
|
|
model.patientAllergiesList.forEach((element) {
|
|
|
|
|
MasterKeyModel selectedAllergy = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.Allergies,
|
|
|
|
|
id: element.allergyDiseaseId,
|
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
|
MasterKeyModel selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
|
id: element.severity,
|
|
|
|
|
);
|
|
|
|
|
MySelectedAllergy mySelectedAllergy = MySelectedAllergy(
|
|
|
|
|
selectedAllergy: selectedAllergy,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
createdBy: element.createdBy,
|
|
|
|
|
selectedAllergySeverity: selectedAllergySeverity);
|
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null)
|
|
|
|
|
widget.myAllergiesList.add(mySelectedAllergy);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
widget.myAllergiesList.clear();
|
|
|
|
|
widget.myHistoryList.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo);
|
|
|
|
|
GetChiefComplaintReqModel getChiefComplaintReqModel =
|
|
|
|
|
GetChiefComplaintReqModel(
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
episodeID: widget.patientInfo.episodeNo);
|
|
|
|
|
episodeID: widget.patientInfo.episodeNo,
|
|
|
|
|
doctorID: '');
|
|
|
|
|
await model.getPatientChiefComplaint(getChiefComplaintReqModel);
|
|
|
|
|
if (model.patientChiefComplaintList.isNotEmpty) {
|
|
|
|
|
complaintsController.text = helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint)
|
|
|
|
|
;
|
|
|
|
|
complaintsController.text = helpers.parseHtmlString(
|
|
|
|
|
model.patientChiefComplaintList[0].chiefComplaint);
|
|
|
|
|
illnessController.text = model.patientChiefComplaintList[0].hopi;
|
|
|
|
|
}
|
|
|
|
|
await model.getPatientAllergy(generalGetReqForSOAP);
|
|
|
|
|
if (model.patientAllergiesList.isNotEmpty) {
|
|
|
|
|
if (model.allergiesList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.Allergies);
|
|
|
|
|
if (model.allergySeverityList.isEmpty)
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.AllergySeverity);
|
|
|
|
|
|
|
|
|
|
model.patientAllergiesList.forEach((element) {
|
|
|
|
|
MasterKeyModel selectedAllergy = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.Allergies,
|
|
|
|
|
id: element.allergyDiseaseId,
|
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
|
MasterKeyModel selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
|
id: element.severity,
|
|
|
|
|
);
|
|
|
|
|
MySelectedAllergy mySelectedAllergy = MySelectedAllergy(
|
|
|
|
|
selectedAllergy: selectedAllergy,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
selectedAllergySeverity: selectedAllergySeverity);
|
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null)
|
|
|
|
|
widget.myAllergiesList.add(mySelectedAllergy);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await getHistory(model);
|
|
|
|
|
|
|
|
|
|
await getAllergies(model);
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
@ -472,29 +471,30 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
{List<MySelectedAllergy> myAllergiesList, SOAPViewModel model}) async {
|
|
|
|
|
PostAllergyRequestModel postAllergyRequestModel =
|
|
|
|
|
new PostAllergyRequestModel();
|
|
|
|
|
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
|
|
|
|
|
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
|
|
|
|
|
widget.myAllergiesList.forEach((allergy) {
|
|
|
|
|
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==
|
|
|
|
|
null)
|
|
|
|
|
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
|
|
|
|
|
//TODO: make static value dynamic
|
|
|
|
|
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM
|
|
|
|
|
.add(ListHisProgNotePatientAllergyDiseaseVM(
|
|
|
|
|
allergyDiseaseId: allergy.selectedAllergy.id,
|
|
|
|
|
allergyDiseaseType: allergy.selectedAllergy.typeId,
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
severity: allergy.selectedAllergySeverity.id,
|
|
|
|
|
remarks: allergy.remark,
|
|
|
|
|
createdBy: 4709,
|
|
|
|
|
//
|
|
|
|
|
createdOn: DateTime.now().toIso8601String(),
|
|
|
|
|
//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
editedBy: 4709,
|
|
|
|
|
editedOn: DateTime.now().toIso8601String(),
|
|
|
|
|
//"2020-08-14T20:37:22.780Z",
|
|
|
|
|
isChecked: false,
|
|
|
|
|
isUpdatedByNurse: false));
|
|
|
|
|
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(
|
|
|
|
|
ListHisProgNotePatientAllergyDiseaseVM(
|
|
|
|
|
allergyDiseaseId: allergy.selectedAllergy.id,
|
|
|
|
|
allergyDiseaseType: allergy.selectedAllergy.typeId,
|
|
|
|
|
patientMRN: widget.patientInfo.patientMRN,
|
|
|
|
|
episodeId: widget.patientInfo.episodeNo,
|
|
|
|
|
appointmentNo: widget.patientInfo.appointmentNo,
|
|
|
|
|
severity: allergy.selectedAllergySeverity.id,
|
|
|
|
|
remarks: allergy.remark,
|
|
|
|
|
createdBy: allergy.createdBy??doctorProfile.doctorID,
|
|
|
|
|
createdOn: DateTime.now().toIso8601String(),
|
|
|
|
|
editedBy: doctorProfile.doctorID,
|
|
|
|
|
editedOn: DateTime.now().toIso8601String(),
|
|
|
|
|
isChecked: allergy.isChecked,
|
|
|
|
|
isUpdatedByNurse: false));
|
|
|
|
|
});
|
|
|
|
|
if (model.patientAllergiesList.isEmpty) {
|
|
|
|
|
await model.postAllergy(postAllergyRequestModel);
|
|
|
|
|
@ -510,7 +510,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
postHistories(
|
|
|
|
|
{List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async {
|
|
|
|
|
PostHistoriesRequestModel postHistoriesRequestModel =
|
|
|
|
|
new PostHistoriesRequestModel();
|
|
|
|
|
new PostHistoriesRequestModel(doctorID: '');
|
|
|
|
|
widget.myHistoryList.forEach((history) {
|
|
|
|
|
if (postHistoriesRequestModel.listMedicalHistoryVM == null)
|
|
|
|
|
postHistoriesRequestModel.listMedicalHistoryVM = [];
|
|
|
|
|
|