|
|
|
@ -34,11 +34,7 @@ class UpdateSubjectivePage extends StatefulWidget {
|
|
|
|
final int currentIndex;
|
|
|
|
final int currentIndex;
|
|
|
|
|
|
|
|
|
|
|
|
UpdateSubjectivePage(
|
|
|
|
UpdateSubjectivePage(
|
|
|
|
{Key key,
|
|
|
|
{Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
|
|
|
|
this.changePageViewIndex,
|
|
|
|
|
|
|
|
this.patientInfo,
|
|
|
|
|
|
|
|
this.changeLoadingState,
|
|
|
|
|
|
|
|
this.currentIndex});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
|
|
|
|
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
|
|
|
|
@ -55,8 +51,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
String medicationControllerError = '';
|
|
|
|
String medicationControllerError = '';
|
|
|
|
String illnessControllerError = '';
|
|
|
|
String illnessControllerError = '';
|
|
|
|
final formKey = GlobalKey<FormState>();
|
|
|
|
final formKey = GlobalKey<FormState>();
|
|
|
|
List<MySelectedAllergy> myAllergiesList=List();
|
|
|
|
List<MySelectedAllergy> myAllergiesList = List();
|
|
|
|
List<MySelectedHistory> myHistoryList=List();
|
|
|
|
List<MySelectedHistory> myHistoryList = List();
|
|
|
|
|
|
|
|
|
|
|
|
getHistory(SOAPViewModel model) async {
|
|
|
|
getHistory(SOAPViewModel model) async {
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
@ -67,7 +63,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
doctorID: '',
|
|
|
|
doctorID: '',
|
|
|
|
editedBy: '');
|
|
|
|
editedBy: '');
|
|
|
|
|
|
|
|
|
|
|
|
await model.getPatientHistories(getHistoryReqModel,isFirst: true);
|
|
|
|
await model.getPatientHistories(getHistoryReqModel, isFirst: true);
|
|
|
|
|
|
|
|
|
|
|
|
if (model.patientHistoryList.isNotEmpty) {
|
|
|
|
if (model.patientHistoryList.isNotEmpty) {
|
|
|
|
if (model.historyFamilyList.isEmpty) {
|
|
|
|
if (model.historyFamilyList.isEmpty) {
|
|
|
|
@ -84,15 +80,14 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
model.patientHistoryList.forEach((element) {
|
|
|
|
model.patientHistoryList.forEach((element) {
|
|
|
|
if (element.historyType ==
|
|
|
|
if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) {
|
|
|
|
MasterKeysService.HistoryFamily.getMasterKeyService()) {
|
|
|
|
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
MasterKeyModel history = model.getOneMasterKey(
|
|
|
|
masterKeys: MasterKeysService.HistoryFamily,
|
|
|
|
masterKeys: MasterKeysService.HistoryFamily,
|
|
|
|
id: element.historyId,
|
|
|
|
id: element.historyId,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (history != null) {
|
|
|
|
if (history != null) {
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
|
|
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
|
|
|
|
selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
|
|
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -103,8 +98,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
id: element.historyId,
|
|
|
|
id: element.historyId,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (history != null) {
|
|
|
|
if (history != null) {
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
|
|
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
|
|
|
|
selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
|
|
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -115,8 +110,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
id: element.historyId,
|
|
|
|
id: element.historyId,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (history != null) {
|
|
|
|
if (history != null) {
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
|
|
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
|
|
|
|
selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
|
|
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -127,8 +122,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
id: element.historyId,
|
|
|
|
id: element.historyId,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (history != null) {
|
|
|
|
if (history != null) {
|
|
|
|
MySelectedHistory mySelectedHistory =
|
|
|
|
MySelectedHistory mySelectedHistory = MySelectedHistory(
|
|
|
|
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
|
|
|
|
selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
|
|
|
|
|
|
|
|
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
myHistoryList.add(mySelectedHistory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -157,7 +152,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
selectedAllergySeverity = MasterKeyModel(
|
|
|
|
selectedAllergySeverity = MasterKeyModel(
|
|
|
|
id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
|
|
|
|
id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
selectedAllergySeverity = model.getOneMasterKey(
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
masterKeys: MasterKeysService.AllergySeverity,
|
|
|
|
id: element.severity,
|
|
|
|
id: element.severity,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -168,7 +163,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
isChecked: element.isChecked,
|
|
|
|
createdBy: element.createdBy,
|
|
|
|
createdBy: element.createdBy,
|
|
|
|
remark: element.remarks,
|
|
|
|
remark: element.remarks,
|
|
|
|
isLocal : false,
|
|
|
|
isLocal: false,
|
|
|
|
selectedAllergySeverity: selectedAllergySeverity);
|
|
|
|
selectedAllergySeverity: selectedAllergySeverity);
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
|
|
|
|
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -218,9 +213,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
|
|
|
|
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
headerTitle: TranslationBase.of(context)
|
|
|
|
headerTitle: TranslationBase.of(context).chiefComplaints,
|
|
|
|
.chiefComplaints
|
|
|
|
|
|
|
|
,
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
isChiefExpand = !isChiefExpand;
|
|
|
|
isChiefExpand = !isChiefExpand;
|
|
|
|
@ -241,9 +234,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
headerTitle: TranslationBase
|
|
|
|
headerTitle: TranslationBase.of(context).histories,
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.histories,
|
|
|
|
|
|
|
|
isRequired: false,
|
|
|
|
isRequired: false,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
@ -259,10 +250,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
ExpandableSOAPWidget(
|
|
|
|
headerTitle: TranslationBase
|
|
|
|
headerTitle: TranslationBase.of(context).allergiesSoap,
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.allergiesSoap
|
|
|
|
|
|
|
|
,
|
|
|
|
|
|
|
|
isRequired: false,
|
|
|
|
isRequired: false,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
@ -282,7 +270,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
isExpanded: isAllergiesExpand,
|
|
|
|
isExpanded: isAllergiesExpand,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height:MediaQuery.of(context).size.height * 0.16,
|
|
|
|
height: MediaQuery.of(context).size.height * 0.16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -314,8 +302,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
color: Colors.red[700],
|
|
|
|
color: Colors.red[700],
|
|
|
|
//loading: model.state == ViewState.BusyLocal,
|
|
|
|
//loading: model.state == ViewState.BusyLocal,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
addSubjectiveInfo(
|
|
|
|
addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
|
|
|
|
model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -333,8 +320,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
|
|
|
|
|
|
|
|
addSubjectiveInfo(
|
|
|
|
addSubjectiveInfo(
|
|
|
|
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
|
|
|
|
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
|
|
|
|
if(FocusScope.of(context).hasFocus)
|
|
|
|
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
widget.changeLoadingState(true);
|
|
|
|
formKey.currentState.save();
|
|
|
|
formKey.currentState.save();
|
|
|
|
formKey.currentState.validate();
|
|
|
|
formKey.currentState.validate();
|
|
|
|
@ -367,25 +353,17 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
if (complaintsController.text.isEmpty) {
|
|
|
|
if (complaintsController.text.isEmpty) {
|
|
|
|
complaintsControllerError = TranslationBase
|
|
|
|
complaintsControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage;
|
|
|
|
|
|
|
|
} else if (complaintsController.text.length < 25) {
|
|
|
|
} else if (complaintsController.text.length < 25) {
|
|
|
|
complaintsControllerError = TranslationBase
|
|
|
|
complaintsControllerError = TranslationBase.of(context).chiefComplaintLength;
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.chiefComplaintLength;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (illnessController.text.isEmpty) {
|
|
|
|
if (illnessController.text.isEmpty) {
|
|
|
|
illnessControllerError = TranslationBase
|
|
|
|
illnessControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (medicationController.text.isEmpty) {
|
|
|
|
if (medicationController.text.isEmpty) {
|
|
|
|
medicationControllerError = TranslationBase
|
|
|
|
medicationControllerError = TranslationBase.of(context).emptyMessage;
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.emptyMessage;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -455,14 +433,12 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
|
|
|
|
));
|
|
|
|
));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.patientHistoryList.isEmpty) {
|
|
|
|
if (model.patientHistoryList.isEmpty) {
|
|
|
|
await model.postHistories(postHistoriesRequestModel);
|
|
|
|
await model.postHistories(postHistoriesRequestModel);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
await model.patchHistories(postHistoriesRequestModel);
|
|
|
|
await model.patchHistories(postHistoriesRequestModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|