diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 4c55f3e7..b186f58d 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -84,7 +84,9 @@ class SOAPService extends LookupService { List clinicsList = []; List patientConditionList = []; Map> specialityDetails = {}; + Map patientConditionMap = {}; Map diagnosisTypeList = {}; + Map diagnosisTypeTypeMapWithIdAsKey = {}; Map conditionTypeList = {}; Map conditionTypeMapWithIdAsKey = {}; List icdVersionList = []; @@ -783,7 +785,10 @@ class SOAPService extends LookupService { await baseAppClient.post(DIAGNOSIS_TYPE, onSuccess: (dynamic response, int statusCode) { response['ListDiagnosisTypeModel']['resultData'] - .forEach((v) => diagnosisTypeList[v['name']] = v['diagnosisType']); + .forEach((v) { + diagnosisTypeList[v['name']] = v['diagnosisType']; + diagnosisTypeTypeMapWithIdAsKey[v['diagnosisType']] = v['name']; + }); }, onFailure: (String error, int statusCode) { searchChiefComplaintListVidaPlus.clear(); hasError = true; @@ -1379,11 +1384,14 @@ class SOAPService extends LookupService { Map request = {}; var success = false; patientConditionList.clear(); + patientConditionMap.clear(); await baseAppClient.post(GET_PATIENT_CLINIC, onSuccess: (dynamic response, int statusCode) { response['ListPatientConditionProgress']['resultData'].forEach((v) => - v['PATIENT_CONDITION'].forEach((item) => - patientConditionList.add(PatientCondition.fromJson(item)))); + v['PATIENT_CONDITION'].forEach((item) { + patientConditionList.add(PatientCondition.fromJson(item)); + patientConditionMap[item['code']]= item['name']; + })); success = false; }, onFailure: (String error, int statusCode) { success = false; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index f086dfab..aaf137ad 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -1413,6 +1413,11 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.showAuditBottomSheet = status; } + + getProgressNoteAndCondition(PatiantInformtion information) async{ + getPatientConditionList(); + getProgressNote(information); + } getProgressNote(PatiantInformtion patientInformation) async { setState(ViewState.BusyLocal); await _SOAPService.getProgressNoteNew(patientInformation); @@ -1590,4 +1595,9 @@ class SOAPViewModel extends BaseViewModel { print('the value is ${_SOAPService.conditionTypeMapWithIdAsKey[key.trim()]}'); return _SOAPService.conditionTypeList[key.trim()]; } + + String? getPatientConditionValue(String key){ + + return _SOAPService.patientConditionMap[key.trim()]; + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart index 1d971c0a..db343091 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -103,15 +104,14 @@ class _UpdatePlanPageVidaPlusState extends State widget.sOAPViewModel.setPlanCallBack(this); WidgetsBinding.instance.addPostFrameCallback((_) async { widget.changeLoadingState(true); - - model.getProgressNote(widget.patientInfo); + model.getProgressNoteAndCondition(widget.patientInfo); widget.changeLoadingState(false); - }); }, builder: (_, model, w) => AppScaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, isShowAppBar: false, + isLoading: model.state == ViewState.BusyLocal, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -160,7 +160,7 @@ class _UpdatePlanPageVidaPlusState extends State ), } else ...{ Divider(), - ListOfNotes(notes: model.progressNote) + ListOfNotes(notes: model.progressNote, model: model,) } // if (mySelectedExamination.isEmpty) ...{ diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart index cbabae2b..cadf51a3 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart @@ -2,75 +2,128 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plu import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + class ProgressNoteItem extends StatelessWidget { final String type; final String speciality; final String Notes; - // final String status; + final String patientCondition; + final String doctorName; + final String modifiedOn; const ProgressNoteItem( {super.key, required this.type, required this.speciality, required this.Notes, - // required this.status + required this.patientCondition, + required this.doctorName, + required this.modifiedOn, }); @override Widget build(BuildContext context) => Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( + Row( children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).type}:", - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - SizedBox( - width: 4, - ), - AppText( - type, - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - ], - ), - SizedBox( - height: 8, - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).speciality}:", - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - SizedBox( - width: 4, - ), - AppText( - speciality, - color: Color(0XFF2B353E), - fontSize: 10, - fontWeight: FontWeight.w500, - ), - ], - ), - ], + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).type}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + type, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).speciality}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + speciality, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).doctorName}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + doctorName, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).dateTime}", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + getDateAndTime(modifiedOn), + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + ], + ), ), - // Align( - // alignment: Alignment.topRight, child: Status(status: status)) + Visibility( + visible: patientCondition.isNotEmpty, + child: Status(status: patientCondition)) ], ), SizedBox( @@ -84,4 +137,10 @@ class ProgressNoteItem extends StatelessWidget { ), ], ); + + String getDateAndTime(String dateTime) { + if (dateTime.isEmpty) return ''; + DateTime now = DateTime.now(); + return DateFormat('dd/MM/yyyy hh:mm a').format(now); + } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart index 1f5d2c81..03700f6f 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart @@ -1,20 +1,31 @@ import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/progress_note.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart'; import 'package:flutter/material.dart'; -class ListOfNotes extends StatelessWidget{ +class ListOfNotes extends StatelessWidget { final List notes; + final SOAPViewModel model; + + const ListOfNotes({super.key, required this.notes, required this.model}); - const ListOfNotes({super.key, required this.notes}); @override Widget build(BuildContext context) => Flexible( - child: ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (_, index) =>ProgressNoteItem(type: notes[index].progressNotesTypesName ?? '', speciality: notes[index].specialityName ?? '', Notes: notes[index].progressNote?? ''), - separatorBuilder: (_, __) => Divider(), - itemCount: notes.length), - ); - -} \ No newline at end of file + child: ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (_, index) => ProgressNoteItem( + type: notes[index].progressNotesTypesName ?? '', + speciality: notes[index].specialityName ?? '', + Notes: notes[index].progressNote ?? '', + patientCondition: model.getPatientConditionValue( + notes[index].patientCondition ?? '') ?? + '', + doctorName: notes[index].userFullName ?? '', + modifiedOn: notes[index].modifiedOn ?? '', + ), + separatorBuilder: (_, __) => Divider(), + itemCount: notes.length), + ); +}