chief complaint in in patient

merge-requests/781/head
hussam al-habibeh 5 years ago
parent ab584c792a
commit 8c3fc3a6f7

@ -280,7 +280,6 @@ var SERVICES_PATIANT_HEADER_AR = [
"المريض الواصل" "المريض الواصل"
]; ];
const PRIMARY_COLOR = 0xff515B5D; const PRIMARY_COLOR = 0xff515B5D;
const TRANSACTION_NO = 0; const TRANSACTION_NO = 0;

@ -31,11 +31,7 @@ class UpdateObjectivePage extends StatefulWidget {
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
UpdateObjectivePage( UpdateObjectivePage(
{Key key, {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@override @override
_UpdateObjectivePageState createState() => _UpdateObjectivePageState(); _UpdateObjectivePageState createState() => _UpdateObjectivePageState();
@ -45,8 +41,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List(); List<MySelectedExamination> mySelectedExamination = List();
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -63,12 +58,10 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel(
GetPhysicalExamReqModel( patientMRN: widget.patientInfo.patientMRN,
patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(),
episodeID: widget.patientInfo.episodeNo.toString(), appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()));
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
@ -108,12 +101,9 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SOAPStepHeader( SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: headerTitle: TranslationBase.of(context).physicalSystemExamination,
TranslationBase.of(context).physicalSystemExamination,
onTap: () { onTap: () {
setState(() { setState(() {
isSysExaminationExpand = !isSysExaminationExpand; isSysExaminationExpand = !isSysExaminationExpand;
@ -122,8 +112,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
children: [ children: [
SOAPOpenItems( SOAPOpenItems(
label: label: "${TranslationBase.of(context).addExamination}",
"${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
openExaminationList(context); openExaminationList(context);
}, },
@ -131,8 +120,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Column( Column(
children: mySelectedExamination.map((examination) { children: mySelectedExamination.map((examination) {
return ExaminationItemCard(examination, () { return ExaminationItemCard(examination, () {
removeExamination( removeExamination(examination.selectedExamination);
examination.selectedExamination);
}); });
}).toList(), }).toList(),
) )
@ -214,40 +202,36 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel = PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
new PostPhysicalExamRequestModel();
mySelectedExamination.forEach((exam) { mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null)
null) postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = [];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
[];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM(
.add(ListHisProgNotePhysicalExaminationVM( patientMRN: widget.patientInfo.patientMRN,
patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo,
episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo,
appointmentNo: widget.patientInfo.appointmentNo, remarks: exam.remark ?? '',
remarks: exam.remark ?? '', createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdBy: exam.createdBy ?? doctorProfile.doctorID, createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID,
editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(),
editedOn: DateTime.now().toIso8601String(), examId: exam.selectedExamination.id,
examId: exam.selectedExamination.id, examType: exam.selectedExamination.typeId,
examType: exam.selectedExamination.typeId, isAbnormal: exam.isAbnormal,
isAbnormal: exam.isAbnormal, isNormal: exam.isNormal,
isNormal: exam.isNormal, notExamined: exam.notExamined,
notExamined: exam.notExamined, examinationType: exam.isNormal
examinationType: exam.isNormal ? 1
? 1 : exam.isAbnormal
: exam.isAbnormal ? 2
? 2 : 3,
: 3, examinationTypeName: exam.isNormal
examinationTypeName: exam.isNormal ? "Normal"
? "Normal" : exam.isAbnormal
: exam.isAbnormal ? 'AbNormal'
? 'AbNormal' : "Not Examined",
: "Not Examined", isNew: exam.isNew));
isNew: exam.isNew));
}); });
if (model.patientPhysicalExamList.isEmpty) { if (model.patientPhysicalExamList.isEmpty) {
@ -269,10 +253,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
removeExamination(MasterKeyModel masterKey) { removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = mySelectedExamination.where( Iterable<MySelectedExamination> history = mySelectedExamination.where((element) =>
(element) => masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId);
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0) if (history.length > 0)
setState(() { setState(() {
@ -302,11 +284,7 @@ class AddExaminationDailog extends StatefulWidget {
final Function addSelectedExamination; final Function addSelectedExamination;
final Function(MasterKeyModel) removeExamination; final Function(MasterKeyModel) removeExamination;
const AddExaminationDailog( const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination})
{Key key,
this.mySelectedExamination,
this.addSelectedExamination,
this.removeExamination})
: super(key: key); : super(key: key);
@override @override
@ -321,8 +299,7 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model await model.getMasterLookup(MasterKeysService.PhysicalExamination);
.getMasterLookup(MasterKeysService.PhysicalExamination);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -332,21 +309,19 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: Container( child: Container(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, SizedBox(
children: [ height: 16,
SizedBox( ),
height: 16, AppText(
), TranslationBase.of(context).physicalSystemExamination,
AppText( fontWeight: FontWeight.bold,
TranslationBase.of(context).physicalSystemExamination, fontSize: 16,
fontWeight: FontWeight.bold, ),
fontSize: 16, SizedBox(
), height: 16,
SizedBox( ),
height: 16, ]),
),
]),
))), ))),
)), )),
); );

@ -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);
} }

Loading…
Cancel
Save