From 8c3fc3a6f7dfc68dfdeb1fc434bdb3d61c734f0d Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 8 Aug 2021 09:56:19 +0300 Subject: [PATCH] chief complaint in in patient --- lib/config/config.dart | 1 - .../objective/update_objective_page.dart | 135 +++++++----------- .../subjective/update_subjective_page.dart | 74 ++++------ 3 files changed, 80 insertions(+), 130 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index bf398791..26c0445b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -280,7 +280,6 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض الواصل" ]; - const PRIMARY_COLOR = 0xff515B5D; const TRANSACTION_NO = 0; diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index dbd3b080..94f41595 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -31,11 +31,7 @@ class UpdateObjectivePage extends StatefulWidget { final PatiantInformtion patientInfo; UpdateObjectivePage( - {Key key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); @override _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); @@ -45,8 +41,7 @@ class _UpdateObjectivePageState extends State { bool isSysExaminationExpand = false; List mySelectedExamination = List(); - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -63,12 +58,10 @@ class _UpdateObjectivePageState extends State { return BaseView( onModelReady: (model) async { mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString())); + GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientPhysicalExam(getPhysicalExamReqModel); if (model.patientPhysicalExamList.isNotEmpty) { @@ -108,12 +101,9 @@ class _UpdateObjectivePageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget( - headerTitle: - TranslationBase.of(context).physicalSystemExamination, + headerTitle: TranslationBase.of(context).physicalSystemExamination, onTap: () { setState(() { isSysExaminationExpand = !isSysExaminationExpand; @@ -122,8 +112,7 @@ class _UpdateObjectivePageState extends State { child: Column( children: [ SOAPOpenItems( - label: - "${TranslationBase.of(context).addExamination}", + label: "${TranslationBase.of(context).addExamination}", onTap: () { openExaminationList(context); }, @@ -131,8 +120,7 @@ class _UpdateObjectivePageState extends State { Column( children: mySelectedExamination.map((examination) { return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); + removeExamination(examination.selectedExamination); }); }).toList(), ) @@ -214,40 +202,36 @@ class _UpdateObjectivePageState extends State { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: 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)); + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: 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 (model.patientPhysicalExamList.isEmpty) { @@ -269,10 +253,8 @@ class _UpdateObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable history = mySelectedExamination.where((element) => + masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { @@ -302,11 +284,7 @@ class AddExaminationDailog extends StatefulWidget { final Function addSelectedExamination; final Function(MasterKeyModel) removeExamination; - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) + const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) : super(key: key); @override @@ -321,8 +299,7 @@ class _AddExaminationDailogState extends State { child: BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); + await model.getMasterLookup(MasterKeysService.PhysicalExamination); } }, builder: (_, model, w) => AppScaffold( @@ -332,21 +309,19 @@ class _AddExaminationDailogState extends State { child: Container( child: FractionallySizedBox( widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - ]), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + ]), ))), )), ); diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index b4d7e96e..09fcaa59 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -34,11 +34,7 @@ class UpdateSubjectivePage extends StatefulWidget { final int currentIndex; UpdateSubjectivePage( - {Key key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); @@ -55,8 +51,8 @@ class _UpdateSubjectivePageState extends State { String medicationControllerError = ''; String illnessControllerError = ''; final formKey = GlobalKey(); - List myAllergiesList=List(); - List myHistoryList=List(); + List myAllergiesList = List(); + List myHistoryList = List(); getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); @@ -67,7 +63,7 @@ class _UpdateSubjectivePageState extends State { doctorID: '', editedBy: ''); - await model.getPatientHistories(getHistoryReqModel,isFirst: true); + await model.getPatientHistories(getHistoryReqModel, isFirst: true); if (model.patientHistoryList.isNotEmpty) { if (model.historyFamilyList.isEmpty) { @@ -84,15 +80,14 @@ class _UpdateSubjectivePageState extends State { } 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 = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } @@ -103,8 +98,8 @@ class _UpdateSubjectivePageState extends State { id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } @@ -115,8 +110,8 @@ class _UpdateSubjectivePageState extends State { id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } @@ -127,8 +122,8 @@ class _UpdateSubjectivePageState extends State { id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } @@ -157,7 +152,7 @@ class _UpdateSubjectivePageState extends State { selectedAllergySeverity = MasterKeyModel( id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); } else { - selectedAllergySeverity = model.getOneMasterKey( + selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, id: element.severity, ); @@ -168,7 +163,7 @@ class _UpdateSubjectivePageState extends State { isChecked: element.isChecked, createdBy: element.createdBy, remark: element.remarks, - isLocal : false, + isLocal: false, selectedAllergySeverity: selectedAllergySeverity); if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); }); @@ -218,9 +213,7 @@ class _UpdateSubjectivePageState extends State { children: [ SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context) - .chiefComplaints - , + headerTitle: TranslationBase.of(context).chiefComplaints, onTap: () { setState(() { isChiefExpand = !isChiefExpand; @@ -241,9 +234,7 @@ class _UpdateSubjectivePageState extends State { height: 30, ), ExpandableSOAPWidget( - headerTitle: TranslationBase - .of(context) - .histories, + headerTitle: TranslationBase.of(context).histories, isRequired: false, onTap: () { setState(() { @@ -259,10 +250,7 @@ class _UpdateSubjectivePageState extends State { height: 30, ), ExpandableSOAPWidget( - headerTitle: TranslationBase - .of(context) - .allergiesSoap - , + headerTitle: TranslationBase.of(context).allergiesSoap, isRequired: false, onTap: () { setState(() { @@ -282,7 +270,7 @@ class _UpdateSubjectivePageState extends State { isExpanded: isAllergiesExpand, ), 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 { color: Colors.red[700], //loading: model.state == ViewState.BusyLocal, onPressed: () async { - addSubjectiveInfo( - model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); + addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); }, ), ), @@ -333,8 +320,7 @@ class _UpdateSubjectivePageState extends State { addSubjectiveInfo( {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - if(FocusScope.of(context).hasFocus) - FocusScope.of(context).unfocus(); + if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); formKey.currentState.validate(); @@ -367,25 +353,17 @@ class _UpdateSubjectivePageState extends State { } else { setState(() { if (complaintsController.text.isEmpty) { - complaintsControllerError = TranslationBase - .of(context) - .emptyMessage; + complaintsControllerError = TranslationBase.of(context).emptyMessage; } else if (complaintsController.text.length < 25) { - complaintsControllerError = TranslationBase - .of(context) - .chiefComplaintLength; + complaintsControllerError = TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { - illnessControllerError = TranslationBase - .of(context) - .emptyMessage; + illnessControllerError = TranslationBase.of(context).emptyMessage; } if (medicationController.text.isEmpty) { - medicationControllerError = TranslationBase - .of(context) - .emptyMessage; + medicationControllerError = TranslationBase.of(context).emptyMessage; } }); @@ -455,14 +433,12 @@ class _UpdateSubjectivePageState extends State { )); }); - if (model.patientHistoryList.isEmpty) { await model.postHistories(postHistoriesRequestModel); } else { await model.patchHistories(postHistoriesRequestModel); } - if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); }