|
|
|
@ -25,19 +25,13 @@ class UpdateSubjectivePage extends StatefulWidget {
|
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
|
final int currentIndex;
|
|
|
|
|
|
|
|
|
|
UpdateSubjectivePage(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.changePageViewIndex,
|
|
|
|
|
this.patientInfo,
|
|
|
|
|
this.changeLoadingState,
|
|
|
|
|
this.currentIndex});
|
|
|
|
|
UpdateSubjectivePage({Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
implements SubjectiveCallBack {
|
|
|
|
|
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> implements SubjectiveCallBack {
|
|
|
|
|
bool isChiefExpand = false;
|
|
|
|
|
bool isHistoryExpand = false;
|
|
|
|
|
bool isAllergiesExpand = false;
|
|
|
|
@ -53,67 +47,43 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
if (model.patientHistoryList.isNotEmpty) {
|
|
|
|
|
model.patientHistoryList.forEach((element) {
|
|
|
|
|
if (element.historyType ==
|
|
|
|
|
MasterKeysService.HistoryFamily.getMasterKeyService()) {
|
|
|
|
|
if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) {
|
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.HistoryFamily,
|
|
|
|
|
id: element.historyId,
|
|
|
|
|
);
|
|
|
|
|
if (history != null) {
|
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
|
SoapUtils.generateMySelectedHistory(
|
|
|
|
|
history: history,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isLocal: false);
|
|
|
|
|
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.historyType ==
|
|
|
|
|
MasterKeysService.HistoryMedical.getMasterKeyService()) {
|
|
|
|
|
if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
|
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.HistoryMedical,
|
|
|
|
|
id: element.historyId,
|
|
|
|
|
);
|
|
|
|
|
if (history != null) {
|
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
|
SoapUtils.generateMySelectedHistory(
|
|
|
|
|
history: history,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isLocal: false);
|
|
|
|
|
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.historyType ==
|
|
|
|
|
MasterKeysService.HistorySports.getMasterKeyService()) {
|
|
|
|
|
if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
|
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.HistorySports,
|
|
|
|
|
id: element.historyId,
|
|
|
|
|
);
|
|
|
|
|
if (history != null) {
|
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
|
SoapUtils.generateMySelectedHistory(
|
|
|
|
|
history: history,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isLocal: false);
|
|
|
|
|
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (element.historyType ==
|
|
|
|
|
MasterKeysService.HistorySurgical.getMasterKeyService()) {
|
|
|
|
|
if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
|
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.HistorySurgical,
|
|
|
|
|
id: element.historyId,
|
|
|
|
|
);
|
|
|
|
|
if (history != null) {
|
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
|
SoapUtils.generateMySelectedHistory(
|
|
|
|
|
history: history,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isLocal: false);
|
|
|
|
|
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -124,17 +94,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
getAllergies(SOAPViewModel model) async {
|
|
|
|
|
if (model.patientAllergiesList.isNotEmpty) {
|
|
|
|
|
model.patientAllergiesList.forEach((element) {
|
|
|
|
|
MasterKeyModel selectedAllergy = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.Allergies,
|
|
|
|
|
id: element.allergyDiseaseId,
|
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
|
MasterKeyModel selectedAllergy = model.getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
|
|
|
|
|
MasterKeyModel selectedAllergySeverity;
|
|
|
|
|
if (element.severity == 0) {
|
|
|
|
|
selectedAllergySeverity = MasterKeyModel(
|
|
|
|
|
id: 0,
|
|
|
|
|
typeId: MasterKeysService.AllergySeverity.getMasterKeyService(),
|
|
|
|
|
nameAr: '',
|
|
|
|
|
nameEn: '');
|
|
|
|
|
selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
|
|
|
|
|
} else {
|
|
|
|
|
selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
@ -142,17 +105,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MySelectedAllergy mySelectedAllergy =
|
|
|
|
|
SoapUtils.generateMySelectedAllergy(
|
|
|
|
|
allergy: selectedAllergy,
|
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
|
createdBy: element.createdBy,
|
|
|
|
|
remark: element.remarks,
|
|
|
|
|
isLocal: false,
|
|
|
|
|
allergySeverity: selectedAllergySeverity);
|
|
|
|
|
MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(
|
|
|
|
|
allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy, remark: element.remarks, isLocal: false, allergySeverity: selectedAllergySeverity);
|
|
|
|
|
|
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null)
|
|
|
|
|
myAllergiesList.add(mySelectedAllergy);
|
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -168,14 +124,11 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
|
|
|
|
|
if (model.patientChiefComplaintList.isNotEmpty) {
|
|
|
|
|
isChiefExpand = true;
|
|
|
|
|
complaintsController.text = Utils.parseHtmlString(
|
|
|
|
|
model.patientChiefComplaintList[0].chiefComplaint);
|
|
|
|
|
complaintsController.text = Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint);
|
|
|
|
|
illnessController.text = model.patientChiefComplaintList[0].hopi;
|
|
|
|
|
medicationController.text =
|
|
|
|
|
!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty
|
|
|
|
|
? model.patientChiefComplaintList[0].currentMedication +
|
|
|
|
|
'\n \n'
|
|
|
|
|
: model.patientChiefComplaintList[0].currentMedication;
|
|
|
|
|
medicationController.text = model.patientChiefComplaintList[0].currentMedication != null ? !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty
|
|
|
|
|
? model.patientChiefComplaintList[0].currentMedication + '\n \n'
|
|
|
|
|
: model.patientChiefComplaintList[0].currentMedication : "";
|
|
|
|
|
}
|
|
|
|
|
if (widget.patientInfo.admissionNo == null) {
|
|
|
|
|
await getHistory(model);
|
|
|
|
@ -214,17 +167,14 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
complaintsController: complaintsController,
|
|
|
|
|
illnessController: illnessController,
|
|
|
|
|
medicationController: medicationController,
|
|
|
|
|
complaintsControllerError:
|
|
|
|
|
model.complaintsControllerError,
|
|
|
|
|
complaintsControllerError: model.complaintsControllerError,
|
|
|
|
|
illnessControllerError: model.illnessControllerError,
|
|
|
|
|
medicationControllerError:
|
|
|
|
|
model.medicationControllerError,
|
|
|
|
|
medicationControllerError: model.medicationControllerError,
|
|
|
|
|
),
|
|
|
|
|
isExpanded: isChiefExpand,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 4 : 2),
|
|
|
|
|
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2),
|
|
|
|
|
),
|
|
|
|
|
if (widget.patientInfo.admissionNo == null)
|
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
@ -236,15 +186,12 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
UpdateHistoryWidget(myHistoryList: myHistoryList)
|
|
|
|
|
],
|
|
|
|
|
children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
|
|
|
|
|
),
|
|
|
|
|
isExpanded: isHistoryExpand,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 4 : 2),
|
|
|
|
|
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2),
|
|
|
|
|
),
|
|
|
|
|
if (widget.patientInfo.admissionNo == null)
|
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
@ -268,8 +215,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
isExpanded: isAllergiesExpand,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 20 : 10),
|
|
|
|
|
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -280,10 +226,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addSubjectiveInfo(
|
|
|
|
|
{SOAPViewModel model,
|
|
|
|
|
List<MySelectedAllergy> myAllergiesList,
|
|
|
|
|
List<MySelectedHistory> myHistoryList}) async {
|
|
|
|
|
addSubjectiveInfo({SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
|
|
|
|
|
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
|
formKey.currentState.save();
|
|
|
|
@ -292,8 +235,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
model.complaintsControllerError = '';
|
|
|
|
|
model.medicationControllerError = '';
|
|
|
|
|
model.illnessControllerError = '';
|
|
|
|
|
if (complaintsController.text.isNotEmpty &&
|
|
|
|
|
illnessController.text.isNotEmpty) {
|
|
|
|
|
if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty) {
|
|
|
|
|
await model.postSubjectServices(
|
|
|
|
|
patientInfo: widget.patientInfo,
|
|
|
|
|
complaintsText: complaintsController.text,
|
|
|
|
@ -309,32 +251,25 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (complaintsController.text.isEmpty) {
|
|
|
|
|
model.complaintsControllerError =
|
|
|
|
|
TranslationBase.of(context).emptyMessage;
|
|
|
|
|
model.complaintsControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (illnessController.text.isEmpty) {
|
|
|
|
|
model.illnessControllerError =
|
|
|
|
|
TranslationBase.of(context).emptyMessage;
|
|
|
|
|
model.illnessControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (medicationController.text.isEmpty) {
|
|
|
|
|
model.medicationControllerError =
|
|
|
|
|
TranslationBase.of(context).emptyMessage;
|
|
|
|
|
model.medicationControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.changeLoadingState(false);
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).chiefComplaintErrorMsg);
|
|
|
|
|
Utils.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Function nextFunction(model) {
|
|
|
|
|
addSubjectiveInfo(
|
|
|
|
|
model: model,
|
|
|
|
|
myAllergiesList: myAllergiesList,
|
|
|
|
|
myHistoryList: myHistoryList);
|
|
|
|
|
addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|