diff --git a/assets/images/svgs/add-square.svg b/assets/images/svgs/add-square.svg new file mode 100644 index 00000000..6c6363f5 --- /dev/null +++ b/assets/images/svgs/add-square.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svgs/unavailable.svg b/assets/images/svgs/unavailable.svg new file mode 100644 index 00000000..7e692d97 --- /dev/null +++ b/assets/images/svgs/unavailable.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c31788f9..422ceb8b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1160,6 +1160,7 @@ const Map> localizedValues = { "afterOrderCreation": {"en": "After order created, you cannot modify the principal diagnosis, Do you want to continue?", "ar":"بعد إنشاء الطلب، لا يمكنك تعديل التشخيص الأساسي، هل تريد المتابعة؟"}, "principalCoveredOrNot": {"en": "Principal Diagnosis is not covered for this patient", "ar":"لا يتم تغطية التشخيص الرئيسي لهذا المريض"}, "complexDiagnosis": {"en": "Complex Diagnosis", "ar":"التشخيص المعقد"}, + "noComplaintsFound": {"en": "No Chief Complaints added, please add it from the button above", "ar":"لم تتم إضافة شكاوى رئيسية ، يرجى إضافتها من الزر أعلاه"}, diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 80162a49..afb3319d 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -290,6 +290,7 @@ class _PatientProfileScreenState extends State with Single eventCategory: "Patient Profile ", eventAction: "Update Episode", ); + //todo change the navigator to vida plus screen if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || patient.patientStatusType == 43 || isInpatient) { Navigator.of(context).pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart index 62b9258c..465eb02d 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart @@ -1,11 +1,33 @@ +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; -// class CheifComplaints extends StatelessWidget{ -// final List complaints; -// -// @override -// Widget build(BuildContext context) { -// -// } -// -// } \ No newline at end of file +class UpdateChiefComplaints extends StatelessWidget { + final List complaints; + + const UpdateChiefComplaints({Key? key, required this.complaints}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(12.0), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AddChiefComplaint( + onAddCheifComplaintClicked: () {}, + ), + if (complaints.isEmpty) ...{ + EmptyComplaints() + } else ...{ + ListView.builder( + itemBuilder: (_, index) => ComplaintItems(complaints[index], onCrossClicked:(){ + + })) + } + ]), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart new file mode 100644 index 00000000..e36e627f --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart @@ -0,0 +1,31 @@ +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AddChiefComplaint extends StatelessWidget{ + final VoidCallback onAddCheifComplaintClicked; + + const AddChiefComplaint({super.key, required this.onAddCheifComplaintClicked}); + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: AppButton( + icon: SvgPicture.asset('assets/images/svgs/add-square.svg'), + title: TranslationBase.of(context).previous, + color: Colors.grey[300]!, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + disabled: true, + onPressed: () async { + onAddCheifComplaintClicked(); + }, + ), + ), + ], + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart new file mode 100644 index 00000000..46f1914f --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart @@ -0,0 +1,5 @@ +// import 'package:flutter/material.dart'; +// +// class ComplaintItems extends StatelessWidget{ +// +// } \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart new file mode 100644 index 00000000..1c8d4802 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart @@ -0,0 +1,25 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import '../../../../../../../utils/translations_delegate_base_utils.dart'; + +class EmptyComplaints extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment : MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/svgs/unavailable.svg'), + SizedBox(height: 10,), + AppText( + TranslationBase.of(context).noComplaintsFound, + fontSize: 12, + fontWeight: FontWeight.w400, + color: Color(0xFFADADAD), + ) + ], + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page.dart new file mode 100644 index 00000000..e3f728ed --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page.dart @@ -0,0 +1,274 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_history.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +import 'chief_complaint/chief_complaints.dart'; + + + +class UpdateSubjectivePage extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + final PatiantInformtion patientInfo; + final int currentIndex; + + UpdateSubjectivePage({Key? key, required this.changePageViewIndex, required this.patientInfo, required this.changeLoadingState, required this.currentIndex}); + + @override + _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); +} + +class _UpdateSubjectivePageState extends State implements SubjectiveCallBack { + bool isChiefExpand = false; + bool isHistoryExpand = false; + bool isAllergiesExpand = false; + TextEditingController illnessController = TextEditingController(); + TextEditingController complaintsController = TextEditingController(); + TextEditingController medicationController = TextEditingController(); + + final formKey = GlobalKey(); + List myAllergiesList = []; + List myHistoryList = []; + + getHistory(SOAPViewModel model) async { + widget.changeLoadingState(true); + if (model.patientHistoryList.isNotEmpty) { + model.patientHistoryList.forEach((element) { + 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); + myHistoryList.add(mySelectedHistory); + } + } + 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); + myHistoryList.add(mySelectedHistory); + } + } + 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); + myHistoryList.add(mySelectedHistory); + } + } + 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); + myHistoryList.add(mySelectedHistory); + } + } + }); + } + } + + 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? selectedAllergySeverity; + if (element.severity == 0) { + selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + } else { + selectedAllergySeverity = model.getOneMasterKey( + masterKeys: MasterKeysService.AllergySeverity, + id: element.severity, + )!; + } + + 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); + }); + } + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + myAllergiesList.clear(); + myHistoryList.clear(); + model.setSubjectiveCallBack(this); + await model.onUpdateSubjectStepStart(widget.patientInfo); + + if (model.patientChiefComplaintList.isNotEmpty) { + isChiefExpand = true; + complaintsController.text = Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint!); + illnessController.text = model.patientChiefComplaintList[0].hopi!; + 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); + + await getAllergies(model); + } + + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).chiefComplaints, + onTap: () { + setState(() { + isChiefExpand = !isChiefExpand; + }); + }, + child: UpdateChiefComplaints( + complaints: [], + ), + isExpanded: isChiefExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + if (widget.patientInfo.admissionNo == null) + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).histories, + isRequired: false, + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Column( + children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], + ), + isExpanded: isHistoryExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + if (widget.patientInfo.admissionNo == null) + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).allergiesSoap, + isRequired: false, + onTap: () { + setState(() { + isAllergiesExpand = !isAllergiesExpand; + }); + }, + child: Column( + children: [ + UpdateAllergiesWidget( + myAllergiesList: myAllergiesList, + ), + SizedBox( + height: 30, + ), + ], + ), + isExpanded: isAllergiesExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), + ), + ], + ), + ), + ), + ), + ), + ); + } + + addSubjectiveInfo({required SOAPViewModel model, required List myAllergiesList, required List myHistoryList}) async { + if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); + widget.changeLoadingState(true); + formKey.currentState!.save(); + formKey.currentState!.validate(); + + model.complaintsControllerError = ''; + model.medicationControllerError = ''; + model.illnessControllerError = ''; + if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty) { + await model.postSubjectServices( + patientInfo: widget.patientInfo, + complaintsText: complaintsController.text, + medicationText: medicationController.text, + illnessText: illnessController.text, + myHistoryList: myHistoryList, + myAllergiesList: myAllergiesList, + ); + + widget.changeLoadingState(true); + + widget.changePageViewIndex(1); + } else { + setState(() { + if (complaintsController.text.isEmpty) { + model.complaintsControllerError = TranslationBase.of(context).emptyMessage; + } + + if (illnessController.text.isEmpty) { + model.illnessControllerError = TranslationBase.of(context).emptyMessage; + } + + if (medicationController.text.isEmpty) { + model.medicationControllerError = TranslationBase.of(context).emptyMessage; + } + }); + + widget.changeLoadingState(false); + Utils.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); + } + } + + @override + Function nextFunction(model) { + addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList.where((i) => i.isChecked).toList(), myHistoryList: myHistoryList); + return () {}; + } +} diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index e2579e3d..c456d65f 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1463,6 +1463,9 @@ class TranslationBase { String get complexDiagnosis => localizedValues['complexDiagnosis']![locale.languageCode]!; String get updateAssessmentDetails => localizedValues['updateAssessmentDetails']![locale.languageCode]!; + + String get noComplaintsFound => + localizedValues['noComplaintsFound']![locale.languageCode]!; } class TranslationBaseDelegate extends LocalizationsDelegate {