From dd971ffddb2fd36f968820d357362e68aef46d05 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 25 Oct 2021 17:41:38 +0300 Subject: [PATCH 1/4] first step from get diabetic --- lib/config/config.dart | 3 + .../GetDiabeticChartValuesRequestModel.dart | 44 ++++ .../GetDiabeticChartValuesResponseModel.dart | 36 +++ lib/core/service/patient/patient_service.dart | 25 ++ lib/core/viewModel/patient_view_model.dart | 84 +++++-- lib/routes.dart | 3 + .../diabetic_chart/diabetic_chart.dart | 134 ++++++++++ ...iabetic_details_blood_pressurewideget.dart | 123 +++++++++ .../line_chart_for_diabetic.dart | 237 ++++++++++++++++++ .../profile_gird_for_InPatient.dart | 7 + ...al_sign_details_blood_pressurewideget.dart | 27 -- 11 files changed, 677 insertions(+), 46 deletions(-) create mode 100644 lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart create mode 100644 lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart create mode 100644 lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart create mode 100644 lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart create mode 100644 lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 616e862a..d5ecf52c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -355,6 +355,9 @@ const NURSING_PROGRESS_NOTE = const GET_DIAGNOSIS_FOR_IN_PATIENT = "Services/DoctorApplication.svc/REST/DoctorApp_GetDiagnosisForInPatient"; +const GET_DIABETIC_CHART_VALUES = + "Services/DoctorApplication.svc/REST/DoctorApp_GetDiabeticChartValues"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart new file mode 100644 index 00000000..7fad3106 --- /dev/null +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart @@ -0,0 +1,44 @@ +class GetDiabeticChartValuesRequestModel { + int deviceTypeID; + int patientID; + int resultType; + int admissionNo; + String setupID; + bool patientOutSA; + int patientType; + int patientTypeID; + + GetDiabeticChartValuesRequestModel( + {this.deviceTypeID, + this.patientID, + this.resultType, + this.admissionNo, + this.setupID, + this.patientOutSA, + this.patientType, + this.patientTypeID}); + + GetDiabeticChartValuesRequestModel.fromJson(Map json) { + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + resultType = json['ResultType']; + admissionNo = json['AdmissionNo']; + setupID = json['SetupID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['ResultType'] = this.resultType; + data['AdmissionNo'] = this.admissionNo; + data['SetupID'] = this.setupID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart new file mode 100644 index 00000000..fa2c1ca2 --- /dev/null +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart @@ -0,0 +1,36 @@ +class GetDiabeticChartValuesResponseModel { + String resultType; + int admissionNo; + String dateChart; + int resultValue; + int createdBy; + String createdOn; + + GetDiabeticChartValuesResponseModel( + {this.resultType, + this.admissionNo, + this.dateChart, + this.resultValue, + this.createdBy, + this.createdOn}); + + GetDiabeticChartValuesResponseModel.fromJson(Map json) { + resultType = json['ResultType']; + admissionNo = json['AdmissionNo']; + dateChart = json['DateChart']; + resultValue = json['ResultValue']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ResultType'] = this.resultType; + data['AdmissionNo'] = this.admissionNo; + data['DateChart'] = this.dateChart; + data['ResultValue'] = this.resultValue; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index a3272201..f79e342c 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; @@ -66,6 +68,9 @@ class PatientService extends BaseService { List _diagnosisForInPatientList = []; List get diagnosisForInPatientList => _diagnosisForInPatientList; + List _diabeticChartValuesList = []; + + List get diabeticChartValuesList => _diabeticChartValuesList; // TODO: replace var with model var _insuranceApporvalsList = []; @@ -515,4 +520,24 @@ class PatientService extends BaseService { body: getDiagnosisForInPatientRequestModel.toJson(), ); } + + + Future getDiabeticChartValues(GetDiabeticChartValuesRequestModel getDiabeticChartValuesRequestModel) async { + hasError = false; + + await baseAppClient.post( + GET_DIABETIC_CHART_VALUES, + onSuccess: (dynamic response, int statusCode) { + _diabeticChartValuesList = []; + response['List_DiabeticChartValues'].forEach((v) { + _diabeticChartValuesList.add( GetDiabeticChartValuesResponseModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getDiabeticChartValuesRequestModel.toJson(), + ); + } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 38d23df9..ae52d07e 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; @@ -25,43 +27,59 @@ class PatientViewModel extends BaseViewModel { List get inPatientList => _patientService.inPatientList; - List get patientVitalSignList => _patientService.patientVitalSignList; + List get patientVitalSignList => + _patientService.patientVitalSignList; - List get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList; + List get patientVitalSignOrderdSubList => + _patientService.patientVitalSignOrderdSubList; - List get patientLabResultOrdersList => _patientService.patientLabResultOrdersList; + List get patientLabResultOrdersList => + _patientService.patientLabResultOrdersList; - List get patientPrescriptionsList => _patientService.patientPrescriptionsList; + List get patientPrescriptionsList => + _patientService.patientPrescriptionsList; List get prescriptionReportForInPatientList => _patientService.prescriptionReportForInPatientList; - List get prescriptionReport => _patientService.prescriptionReport; + List get prescriptionReport => + _patientService.prescriptionReport; - List get patientRadiologyList => _patientService.patientRadiologyList; + List get patientRadiologyList => + _patientService.patientRadiologyList; List get labResultList => _patientService.labResultList; get insuranceApporvalsList => _patientService.insuranceApporvalsList; - List get patientProgressNoteList => _patientService.patientProgressNoteList; - List get patientNursingProgressNoteList => _patientService.patientNursingProgressNoteList; - List get diagnosisForInPatientList => _patientService.diagnosisForInPatientList; + List get patientProgressNoteList => + _patientService.patientProgressNoteList; + + List get patientNursingProgressNoteList => + _patientService.patientNursingProgressNoteList; + + List get diagnosisForInPatientList => + _patientService.diagnosisForInPatientList; + List get diabeticChartValuesList => + _patientService.diabeticChartValuesList; List get clinicsList => _patientService.clinicsList; List get doctorsList => _patientService.doctorsList; - List get referralFrequencyList => _patientService.referalFrequancyList; + List get referralFrequencyList => + _patientService.referalFrequancyList; - Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async { + Future getPatientList(patient, patientType, + {bool isBusyLocal = false, isView}) async { var localRes; if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - localRes = await _patientService.getPatientList(patient, patientType, isView: isView); + localRes = await _patientService.getPatientList(patient, patientType, + isView: isView); if (_patientService.hasError) { error = _patientService.error; @@ -210,12 +228,16 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); + var doctorNamelist = _patientService.doctorsList + .map((value) => value['DoctorName'].toString()) + .toList(); return doctorNamelist; } List getClinicNameList() { - var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList(); + var clinicsNameslist = _patientService.clinicsList + .map((value) => value['ClinicDescription'].toString()) + .toList(); return clinicsNameslist; } @@ -230,8 +252,9 @@ class PatientViewModel extends BaseViewModel { } List getReferralNamesList() { - var referralNamesList = - _patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList(); + var referralNamesList = _patientService.referalFrequancyList + .map((value) => value['Description'].toString()) + .toList(); return referralNamesList; } @@ -277,7 +300,8 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + Future getInPatientList(PatientSearchRequestModel requestModel, + {bool isMyInpatient = false}) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -291,7 +315,8 @@ class PatientViewModel extends BaseViewModel { } } - Future getNursingProgressNote(GetNursingProgressNoteRequestModel requestModel) async { + Future getNursingProgressNote( + GetNursingProgressNoteRequestModel requestModel) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -303,7 +328,9 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } - Future getDiagnosisForInPatient(GetDiagnosisForInPatientRequestModel requestModel) async { + + Future getDiagnosisForInPatient( + GetDiagnosisForInPatientRequestModel requestModel) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -315,4 +342,23 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getDiabeticChartValues(PatiantInformtion patient, int resultType) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + GetDiabeticChartValuesRequestModel requestModel = + GetDiabeticChartValuesRequestModel( + patientID: patient.patientId, + admissionNo: int.parse(patient.admissionNo), + patientTypeID: 1, + patientType: 1, resultType: resultType, setupID: "010266"); + await _patientService.getDiabeticChartValues(requestModel); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/routes.dart b/lib/routes.dart index 46602d53..7c93fd0d 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/diabetic_chart.dart'; import 'package:doctor_app_flutter/screens/patients/profile/diagnosis/diagnosis_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; @@ -72,6 +73,7 @@ const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String GET_OPERATION_REPORT = 'operation-report'; const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; const String DIAGNOSIS_FOR_IN_PATIENT = 'get_diagnosis_for_in_patient'; +const String DIABETIC_CHART_VALUES = 'get_diabetic_chart_values'; //todo: change the routing way. var routes = { @@ -118,4 +120,5 @@ var routes = { GET_OPERATION_REPORT: (_) => OperationReportScreen(), NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), + DIABETIC_CHART_VALUES: (_) => DiabeticChart(), }; diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart new file mode 100644 index 00000000..ddecac97 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart @@ -0,0 +1,134 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:flutter/material.dart'; + +import 'diabetic_details_blood_pressurewideget.dart'; + +class DiabeticChart extends StatelessWidget { + DiabeticChart({ + Key key, + }) : super(key: key); + + List timeSeriesData1 = []; + List timeSeriesData2 = []; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + + return BaseView( + onModelReady: (model) async { + await model.getDiabeticChartValues(patient, 3); + generateData(model); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: SingleChildScrollView( + child: Column(children: [ + timeSeriesData1.length != 0 || timeSeriesData2.length != 0 + ? Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12)), + child: LineChartForDiabetic( + title: "Blood Glucose", + isOX: false, + timeSeries1: timeSeriesData1, + // timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16), + padding: + EdgeInsets.only(top: 16, right: 18.0, left: 16.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).graphDetails, + fontSize: SizeConfig.textMultiplier * 2.3, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + SizedBox( + height: 8, + ), + DiabeticDetails( + diabeticDetailsList: model.diabeticChartValuesList, + ), + ], + ), + ), + ], + ), + ) + : Container( + width: double.infinity, + height: MediaQuery.of(context).size.height, + child: Center( + child: + AppText(TranslationBase.of(context).vitalSignDetailEmpty), + ), + ), + ],), + ) + ), + ); + } + + generateData(PatientViewModel model) { + if (model.diabeticChartValuesList.length > 0) { + model.diabeticChartValuesList.toList().forEach( + (element) { + DateTime elementDate = + AppDateUtils.getDateTimeFromServerFormat(element.dateChart); + if (element.resultValue.toInt() != 0) + timeSeriesData1.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.resultValue.toDouble(), + ), + ); + if (element.resultValue.toInt() != 0) + timeSeriesData2.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.resultValue.toDouble(), + ), + ); + }, + ); + } + } +} diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart new file mode 100644 index 00000000..b3b1b581 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart @@ -0,0 +1,123 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DiabeticDetails extends StatefulWidget { + final List diabeticDetailsList; + + DiabeticDetails( + {Key key, this.diabeticDetailsList,}); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + margin: EdgeInsets.all(0), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Container( + padding: EdgeInsets.all(8), + child: AppText( + TranslationBase.of(context).date, + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.bold, + + fontFamily: 'Poppins', + ), + // height: 60, + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(8), + child: Container( + child: AppText( + "Result", + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + // height: 60 + ), + ), + ), + ], + ), + const Divider( + height: 1, + thickness: 1, + color: Colors.black, + ), + Table( + border: TableBorder( + horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + widget.diabeticDetailsList.forEach((diabetic) { + var data = diabetic.resultValue; + DateTime elementDate = + AppDateUtils.getDateTimeFromServerFormat(diabetic.dateChart); + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: AppText( + '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}', + // textAlign: TextAlign.center, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + + fontFamily: 'Poppins', + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: AppText( + '${diabetic.resultValue}', + // textAlign: TextAlign.center, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + + fontFamily: 'Poppins', + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart new file mode 100644 index 00000000..671230c2 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart @@ -0,0 +1,237 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartForDiabetic extends StatelessWidget { + final String title; + final List timeSeries1; + final int indexes; + final bool isOX; + + LineChartForDiabetic( + {this.title, this.timeSeries1, this.indexes, this.isOX= false}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Container( + padding: const EdgeInsets.only(right: 18.0, left: 16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 2.1, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + textAlign: TextAlign.center, + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries1.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries1.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + rotateAngle: -65, + //rotateAngle:-65, + interval: 100, + margin: 22, + getTitles: (value) { + if (timeSeries1.length < 15) { + if (timeSeries1.length > value.toInt()) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries1.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + // timeSeries2.forEach((element) { + // double resultValueDouble = element.sales; + // if (resultValueDouble > max) max = resultValueDouble; + // }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries1[0].sales; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + // timeSeries2.forEach((element) { + // double resultValueDouble = element.sales; + // if (resultValueDouble < min) min = resultValueDouble; + // }); + + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries1.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + } + + List spots2 = List(); + // for (int index = 0; index < timeSeries2.length; index++) { + // spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + // } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + List lineChartData = List(); + if(spots.isNotEmpty){ + lineChartData.add(lineChartBarData1); + } + if(spots2.isNotEmpty){ + lineChartData.add(lineChartBarData2); + } + return lineChartData; + } +} diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 6e3d785e..87e9a31b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -147,6 +147,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Diabetic", + "Chart", + DIABETIC_CHART_VALUES, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart index 1e593af7..69f45d6e 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -34,12 +34,6 @@ class _VitalSignDetailsWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - /*decoration: BoxDecoration( - color: Colors.transparent, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), - border: Border.all(color: Colors.grey, width: 1), - ),*/ margin: EdgeInsets.all(0), child: Container( color: Colors.transparent, @@ -52,13 +46,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: Container( padding: EdgeInsets.all(8), - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft:projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( TranslationBase.of(context).date, fontSize: SizeConfig.textMultiplier * 1.5, @@ -74,13 +61,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( padding: EdgeInsets.all(8), child: Container( - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( widget.title2, fontSize: SizeConfig.textMultiplier * 1.5, @@ -96,13 +76,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( padding: EdgeInsets.all(8), child: Container( - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( widget.title3, fontSize: SizeConfig.textMultiplier * 1.5, From 514e6c81c75d2b4a4e6bc459bb8aa00320adb56c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Oct 2021 11:14:22 +0300 Subject: [PATCH 2/4] finish diabetic --- .../model/diabetic_chart/DiabeticType.dart | 21 ++ lib/core/viewModel/patient_view_model.dart | 18 +- .../diabetic_chart/diabetic_chart.dart | 255 +++++++++++++----- 3 files changed, 223 insertions(+), 71 deletions(-) create mode 100644 lib/core/model/diabetic_chart/DiabeticType.dart diff --git a/lib/core/model/diabetic_chart/DiabeticType.dart b/lib/core/model/diabetic_chart/DiabeticType.dart new file mode 100644 index 00000000..26641e61 --- /dev/null +++ b/lib/core/model/diabetic_chart/DiabeticType.dart @@ -0,0 +1,21 @@ +class DiabeticType { + int value; + String nameEn; + String nameAr; + + DiabeticType({this.value, this.nameEn, this.nameAr}); + + DiabeticType.fromJson(Map json) { + value = json['value']; + nameEn = json['nameEn']; + nameAr = json['nameAr']; + } + + Map toJson() { + final Map data = new Map(); + data['value'] = this.value; + data['nameEn'] = this.nameEn; + data['nameAr'] = this.nameAr; + return data; + } +} diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index ae52d07e..1d5f087a 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -60,6 +60,7 @@ class PatientViewModel extends BaseViewModel { List get diagnosisForInPatientList => _patientService.diagnosisForInPatientList; + List get diabeticChartValuesList => _patientService.diabeticChartValuesList; @@ -343,20 +344,29 @@ class PatientViewModel extends BaseViewModel { } } - Future getDiabeticChartValues(PatiantInformtion patient, int resultType) async { + Future getDiabeticChartValues(PatiantInformtion patient, int resultType, + {bool isLocalBusy = false}) async { await getDoctorProfile(); - setState(ViewState.Busy); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); GetDiabeticChartValuesRequestModel requestModel = GetDiabeticChartValuesRequestModel( patientID: patient.patientId, admissionNo: int.parse(patient.admissionNo), patientTypeID: 1, - patientType: 1, resultType: resultType, setupID: "010266"); + patientType: 1, + resultType: resultType, + setupID: "010266"); await _patientService.getDiabeticChartValues(requestModel); if (_patientService.hasError) { error = _patientService.error; - setState(ViewState.ErrorLocal); + if (isLocalBusy) + setState(ViewState.ErrorLocal); + else + setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart index ddecac97..1aea89c2 100644 --- a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart @@ -1,11 +1,15 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/DiabeticType.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart'; import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; @@ -13,95 +17,192 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'diabetic_details_blood_pressurewideget.dart'; -class DiabeticChart extends StatelessWidget { +class DiabeticChart extends StatefulWidget { DiabeticChart({ Key key, }) : super(key: key); + @override + _DiabeticChartState createState() => _DiabeticChartState(); +} + +class _DiabeticChartState extends State { List timeSeriesData1 = []; + List timeSeriesData2 = []; + List diabeticType = [ + DiabeticType(nameAr: "Urine Glucose", nameEn: "Urine Glucose", value: 1), + DiabeticType(nameAr: "Urine Acet", nameEn: "Urine Acet", value: 2), + DiabeticType(nameAr: "Blood Glucose", nameEn: "Blood Glucose", value: 3), + DiabeticType(nameAr: "Blood Glucose(Glucometer)", nameEn: "Blood Glucose(Glucometer)", value: 4) + ]; + + DiabeticType selectedDiabeticType; + @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - + ProjectViewModel projectsProvider = Provider.of(context); return BaseView( onModelReady: (model) async { - await model.getDiabeticChartValues(patient, 3); + selectedDiabeticType = diabeticType[2]; + + await model.getDiabeticChartValues(patient, selectedDiabeticType.value, isLocalBusy: false); generateData(model); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: PatientProfileAppBar( - patient, - isInpatient: true, - ), - body: SingleChildScrollView( - child: Column(children: [ - timeSeriesData1.length != 0 || timeSeriesData2.length != 0 - ? Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), - child: LineChartForDiabetic( - title: "Blood Glucose", - isOX: false, - timeSeries1: timeSeriesData1, - // timeSeries2: timeSeriesData2, - indexes: timeSeriesData1.length ~/ 5.5, - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16), - padding: - EdgeInsets.only(top: 16, right: 18.0, left: 16.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).graphDetails, - fontSize: SizeConfig.textMultiplier * 2.3, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - SizedBox( - height: 8, - ), - DiabeticDetails( - diabeticDetailsList: model.diabeticChartValuesList, + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.7, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedDiabeticType.value, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return diabeticType + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + + padding: EdgeInsets.all(2), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: + BorderRadius.circular( + 20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + diabeticType + .length + .toString(), + color: Colors.white, + fontSize: projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign.center, + ), + )), + ], + ), + AppText( + selectedDiabeticType.nameEn, + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + await onChangeFunc(newValue, model, patient); + setState(() { + + }); + }, + items: diabeticType + .map((item) { + return DropdownMenuItem( + child: AppText( + item.nameEn, + textAlign: TextAlign.left, + ), + value: item.value, + ); + }).toList(), + )), + ), + timeSeriesData1.length != 0 || timeSeriesData2.length != 0 + ? Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12)), + child: LineChartForDiabetic( + title: selectedDiabeticType.nameEn, + isOX: false, + timeSeries1: timeSeriesData1, + // timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 8, vertical: 16), + padding: EdgeInsets.only( + top: 16, right: 18.0, left: 16.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).graphDetails, + fontSize: SizeConfig.textMultiplier * 2.3, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + SizedBox( + height: 8, + ), + DiabeticDetails( + diabeticDetailsList: + model.diabeticChartValuesList, + ), + ], + ), + ), + ], ), - ], - ), - ), - ], - ), - ) - : Container( - width: double.infinity, - height: MediaQuery.of(context).size.height, - child: Center( - child: - AppText(TranslationBase.of(context).vitalSignDetailEmpty), - ), + ) + : ErrorMessage(error: TranslationBase.of(context).noItem), + ], ), - ],), - ) - ), + )), ); } @@ -130,5 +231,25 @@ class DiabeticChart extends StatelessWidget { }, ); } + } + + onChangeFunc(newValue, PatientViewModel model, patient) async { + GifLoaderDialogUtils.showMyDialog(context); + setState(() { + selectedDiabeticType = diabeticType[newValue-1]; + timeSeriesData1.clear(); + timeSeriesData2.clear(); + }); + + await model.getDiabeticChartValues(patient, selectedDiabeticType.value,isLocalBusy:true); + if(model.state == ViewState.ErrorLocal){ + Helpers.showErrorToast(model.error); + } + generateData(model); + GifLoaderDialogUtils.hideDialog(context); + + + + } } From 93bcfff7a0b5527331e133b1c3d1847d2254ea49 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Oct 2021 15:26:10 +0300 Subject: [PATCH 3/4] fix doctors name --- lib/config/config.dart | 2 +- ...GetDiagnosisForInPatientResponseModel.dart | 6 +- .../GetNursingProgressNoteResposeModel.dart | 18 +- .../service/operation_report_servive.dart | 5 +- lib/routes.dart | 2 + .../profile/diagnosis/diagnosis_screen.dart | 2 +- .../nursing_note/nursing_note_screen.dart | 2 +- .../operation_report/operation_report.dart | 455 ++++++------------ .../update_operation_report.dart | 30 +- 9 files changed, 192 insertions(+), 330 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index fd14ecc6..078cfdc0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -346,7 +346,7 @@ const GET_MEDICATION_FOR_IN_PATIENT = const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient"; const GET_OPERATION_REPORT = - "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; + "Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; const UPDATE_OPERATION_REPORT = "Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport"; diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart index c4a4e528..1ec48964 100644 --- a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart @@ -8,6 +8,8 @@ class GetDiagnosisForInPatientResponseModel { String createdOn; int editedBy; String editedOn; + String createdByName; + String editedByName; GetDiagnosisForInPatientResponseModel( {this.iCDCode10ID, @@ -18,7 +20,7 @@ class GetDiagnosisForInPatientResponseModel { this.createdBy, this.createdOn, this.editedBy, - this.editedOn}); + this.editedOn, this.createdByName}); GetDiagnosisForInPatientResponseModel.fromJson(Map json) { iCDCode10ID = json['ICDCode10ID']; @@ -30,6 +32,8 @@ class GetDiagnosisForInPatientResponseModel { createdOn = json['CreatedOn']; editedBy = json['EditedBy']; editedOn = json['EditedOn']; + createdByName = json['CreatedByName']; + editedByName = json['EditedByName']; } Map toJson() { diff --git a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart index 55ede866..fb7fbcec 100644 --- a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart +++ b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart @@ -6,13 +6,19 @@ class GetNursingProgressNoteResposeModel { dynamic editedBy; dynamic editedOn; + String createdByName; + + String editedByName; + GetNursingProgressNoteResposeModel( {this.notes, - this.conditionType, - this.createdBy, - this.createdOn, - this.editedBy, - this.editedOn}); + this.conditionType, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.editedByName, + this.createdByName}); GetNursingProgressNoteResposeModel.fromJson(Map json) { notes = json['Notes']; @@ -21,6 +27,8 @@ class GetNursingProgressNoteResposeModel { createdOn = json['CreatedOn']; editedBy = json['EditedBy']; editedOn = json['EditedOn']; + createdByName = json['CreatedByName']; + editedByName = json['EditedByName']; } Map toJson() { diff --git a/lib/core/service/operation_report_servive.dart b/lib/core/service/operation_report_servive.dart index 4eb7ad8d..16a6ccec 100644 --- a/lib/core/service/operation_report_servive.dart +++ b/lib/core/service/operation_report_servive.dart @@ -5,14 +5,15 @@ import 'package:doctor_app_flutter/models/operation_report/get_operation_report_ import 'package:doctor_app_flutter/models/operation_report/get_operation_report_request_model.dart'; class OperationReportService extends BaseService { - List get _operationReportList => List(); + + List _operationReportList = []; List get operationReportList => _operationReportList; Future getOperationReport( {GetOperationReportRequestModel getOperationReportRequestModel, int patientId}) async { getOperationReportRequestModel = - GetOperationReportRequestModel(patientID: patientId); + GetOperationReportRequestModel(patientID: patientId, doctorID: ""); hasError = false; await baseAppClient.post(GET_OPERATION_REPORT, diff --git a/lib/routes.dart b/lib/routes.dart index 4e6cd2e2..da56ce33 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -124,6 +124,8 @@ var routes = { ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), GET_OPERATION_REPORT: (_) => OperationReportScreen(), PENDING_ORDERS: (_) => PendingOrdersScreen(), + NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), + DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), ADMISSION_ORDERS: (_) => AdmissionOrdersScreen(), DIABETIC_CHART_VALUES: (_) => DiabeticChart(), }; diff --git a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart index 2abc55ea..65e483b5 100644 --- a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart +++ b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart @@ -133,7 +133,7 @@ class _ProgressNoteState extends State { model .diagnosisForInPatientList[ index] - .createdBy + .createdByName .toString() ?? '', fontWeight: diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart index d683bab4..0fbac8bf 100644 --- a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -135,7 +135,7 @@ class _ProgressNoteState extends State { model .patientNursingProgressNoteList[ index] - .createdBy + .createdByName .toString() ?? '', fontWeight: diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 5e41092d..e02bb191 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -46,37 +46,12 @@ class _ProgressNoteState extends State { AuthenticationViewModel authenticationViewModel; ProjectViewModel projectViewModel; - getProgressNoteList(BuildContext context, PatientViewModel model, - {bool isLocalBusy = false}) async { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String token = await sharedPref.getString(TOKEN); - String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); - - print(type); - ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( - visitType: widget.visitType, - // if equal 5 then this will return progress note - admissionNo: int.parse(patient.admissionNo), - projectID: patient.projectId, - tokenID: token, - patientTypeID: patient.patientType, - languageID: 2); - model - .getPatientProgressNote(progressNoteRequest.toJson(), - isLocalBusy: isLocalBusy) - .then((c) { - notesList = model.patientProgressNoteList; - }); - } - @override Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - String arrivalType = routeArgs['arrivalType']; if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( @@ -133,283 +108,9 @@ class _ProgressNoteState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ - if (model.operationReportList[index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model - .operationReportList[ - index] - .createdBy) - AppText( - TranslationBase.of(context) - .notePending, - fontWeight: FontWeight.bold, - color: Color(0xFFCC9B14), - fontSize: 12, - ), - if (model.operationReportList[index] - .status == - 4) - AppText( - TranslationBase.of(context) - .noteCanceled, - fontWeight: FontWeight.bold, - color: Colors.red.shade700, - fontSize: 12, - ), - if (model.operationReportList[index] - .status == - 2) - AppText( - TranslationBase.of(context) - .noteVerified, - fontWeight: FontWeight.bold, - color: Colors.green[600], - fontSize: 12, - ), - if (model.operationReportList[index] - .status != - 2 && - model.operationReportList[index] - .status != - 4 && - authenticationViewModel - .doctorProfile.doctorID == - model - .operationReportList[ - index] - .createdBy) - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // UpdateNoteOrder( - // note: model - // .operationReportList[ - // index], - // patientModel: - // model, - // patient: - // patient, - // visitType: widget - // .visitType, - // isUpdate: true, - // )), - // ); - // }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: - BorderRadius.circular( - 10), - ), - // color:Colors.red[600], - - child: Row( - children: [ - Icon( - DoctorApp.edit_1, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - TranslationBase.of( - context) - .update, - fontSize: 10, - color: Colors.white, - ), - ], - ), - padding: EdgeInsets.all(6), - ), - ), - SizedBox( - width: 10, - ), - // InkWell( - // onTap: () async { - // showMyDialog( - // context: context, - // actionName: "verify", - // confirmFun: () async { - // GifLoaderDialogUtils - // .showMyDialog( - // context); - // UpdateNoteReqModel - // reqModel = - // UpdateNoteReqModel( - // admissionNo: int - // .parse(patient - // .admissionNo), - // cancelledNote: - // false, - // lineItemNo: model - // .patientProgressNoteList[ - // index] - // .lineItemNo, - // createdBy: model - // .patientProgressNoteList[ - // index] - // .createdBy, - // notes: model - // .patientProgressNoteList[ - // index] - // .notes, - // verifiedNote: true, - // patientTypeID: - // patient - // .patientType, - // patientOutSA: false, - // ); - // await model - // .updatePatientProgressNote( - // reqModel); - // await getProgressNoteList( - // context, model, - // isLocalBusy: - // true); - // GifLoaderDialogUtils - // .hideDialog( - // context); - // }); - // }, - // child: Container( - // decoration: BoxDecoration( - // color: Colors.green[600], - // borderRadius: - // BorderRadius.circular( - // 10), - // ), - // // color:Colors.red[600], - // - // child: Row( - // children: [ - // Icon( - // FontAwesomeIcons - // .check, - // size: 12, - // color: Colors.white, - // ), - // SizedBox( - // width: 2, - // ), - // AppText( - // TranslationBase.of( - // context) - // .noteVerify, - // fontSize: 10, - // color: Colors.white, - // ), - // ], - // ), - // padding: EdgeInsets.all(6), - // ), - // ), - SizedBox( - width: 10, - ), - // InkWell( - // onTap: () async { - // showMyDialog( - // context: context, - // actionName: - // TranslationBase.of( - // context) - // .cancel, - // confirmFun: () async { - // GifLoaderDialogUtils - // .showMyDialog( - // context, - // ); - // UpdateNoteReqModel - // reqModel = - // UpdateNoteReqModel( - // admissionNo: int - // .parse(patient - // .admissionNo), - // cancelledNote: true, - // lineItemNo: model - // .patientProgressNoteList[ - // index] - // .lineItemNo, - // createdBy: model - // .patientProgressNoteList[ - // index] - // .createdBy, - // notes: model - // .patientProgressNoteList[ - // index] - // .notes, - // verifiedNote: false, - // patientTypeID: - // patient - // .patientType, - // patientOutSA: false, - // ); - // await model - // .updatePatientProgressNote( - // reqModel); - // await getProgressNoteList( - // context, model, - // isLocalBusy: - // true); - // GifLoaderDialogUtils - // .hideDialog( - // context); - // }); - // }, - // child: Container( - // decoration: BoxDecoration( - // color: Colors.red[600], - // borderRadius: - // BorderRadius.circular( - // 10), - // ), - // // color:Colors.red[600], - // - // child: Row( - // children: [ - // Icon( - // FontAwesomeIcons - // .trash, - // size: 12, - // color: Colors.white, - // ), - // SizedBox( - // width: 2, - // ), - // AppText( - // 'Cancel', - // fontSize: 10, - // color: Colors.white, - // ), - // ], - // ), - // padding: EdgeInsets.all(6), - // ), - // ), - SizedBox( - width: 10, - ) - ], - ), - SizedBox( - height: 10, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -506,25 +207,153 @@ class _ProgressNoteState extends State { SizedBox( height: 8, ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - model - .operationReportList[ - index] - .remarks, + if (model.operationReportList[index] + .operationDate != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Operation Date : ", fontSize: 10, ), - ), - ]) + Expanded( + child: AppText( + AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils + .getDateTimeFromServerFormat(model + .operationReportList[ + index] + .operationDate), + isArabic: + projectViewModel + .isArabic, + isMonthShort: true), + fontSize: 10, + ), + ) + ]), + + if (model.operationReportList[index] + .timeStart != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Operation Time Start : ", + fontSize: 10, + ), + Expanded( + child: AppText( + model.operationReportList[index] + .timeStart, + fontSize: 10, + ), + ) + ]), + if (model.operationReportList[index] + .remarks != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Remarks : ", + fontSize: 10, + ), + Expanded( + child: AppText( + model + .operationReportList[ + index] + .remarks ?? + '', + fontSize: 10, + ), + ), + ]) ], ), + SizedBox( height: 20, ), + + // if ( + // authenticationViewModel + // .doctorProfile.doctorID == + // model + // .operationReportList[ + // index] + // .createdBy) + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + UpdateOperationReport( + operationReport: model + .operationReportList[ + index], + operationReportViewModel: + model, + patient: patient, + isUpdate: true, + )), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.green[600], + borderRadius: + BorderRadius.circular(10), + ), + // color:Colors.red[600], + + child: Row( + children: [ + Icon( + DoctorApp.edit_1, + size: 12, + color: Colors.white, + ), + SizedBox( + width: 2, + ), + AppText( + TranslationBase.of(context) + .update, + fontSize: 10, + color: Colors.white, + ), + ], + ), + padding: EdgeInsets.all(6), + ), + ), + SizedBox( + width: 10, + ), + SizedBox( + width: 10, + ), + ], + ), + + SizedBox( + height: 10, + ), ], ), ), diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index dc64acb5..a60c0cab 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_report_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; @@ -30,7 +31,7 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class UpdateOperationReport extends StatefulWidget { - final NoteModel note; + final GetOperationReportModel operationReport; final OperationReportViewModel operationReportViewModel; final PatiantInformtion patient; final int visitType; @@ -38,11 +39,11 @@ class UpdateOperationReport extends StatefulWidget { const UpdateOperationReport( {Key key, - this.note, this.operationReportViewModel, this.patient, this.visitType, - this.isUpdate}) + this.isUpdate, + this.operationReport}) : super(key: key); @override @@ -77,6 +78,7 @@ class _UpdateOperationReportState extends State { TextEditingController BloodTransfusedDetailController = TextEditingController(); TextEditingController anasthetistController = TextEditingController(); + TextEditingController OTReservationID = TextEditingController(); setSelectedType(int val) { setState(() { @@ -92,6 +94,8 @@ class _UpdateOperationReportState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + if(widget.isUpdate) + OTReservationID.text = widget.operationReport.oTReservationID.toString(); //TODO Elham* add translation to hints return AppScaffold( isShowAppBar: true, @@ -120,6 +124,18 @@ class _UpdateOperationReportState extends State { widthFactor: 0.9, child: Column( children: [ + AppTextFieldCustom( + hintText: "Reservation No", + //TranslationBase.of(context).addoperationReports, + controller: OTReservationID, + maxLines: 1, + minLines: 1, + enabled: false, + hasBorder: true, + ), + SizedBox( + height: 4, + ), AppTextFieldCustom( hintText: "Pre Op Diagmosis", //TranslationBase.of(context).addoperationReports, @@ -473,14 +489,15 @@ class _UpdateOperationReportState extends State { }); if (isFormValid()) { GifLoaderDialogUtils.showMyDialog(context); - await widget.operationReportViewModel.getDoctorProfile(); + await widget.operationReportViewModel.getDoctorProfile(); CreateUpdateOperationReportRequestModel createUpdateOperationReportRequestModel = CreateUpdateOperationReportRequestModel( inasion: inasionController.text, + /// TODO Elham* Add dynamic reservation - reservationNo: 0, + reservationNo:widget.operationReport.oTReservationID , preOpDiagmosis: preOpDiagmosisController.text, postOpDiagmosis: postOpDiagmosisNoteController.text, surgeon: surgeonController.text, @@ -503,7 +520,8 @@ class _UpdateOperationReportState extends State { bloodLossDetailController.text, patientID: widget.patient.patientId, admissionNo: int.parse(widget.patient.admissionNo), - createdBy: widget.operationReportViewModel.doctorProfile.doctorID, + createdBy: widget.operationReportViewModel + .doctorProfile.doctorID, setupID: SETUP_ID); await widget.operationReportViewModel.updateOperationReport( createUpdateOperationReportRequestModel); From 230ebaf445657d47aaa8bff9b3bdd6add49dd511 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Oct 2021 15:30:06 +0300 Subject: [PATCH 4/4] operation report --- .../operation_report/operation_report.dart | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index e02bb191..0db74f42 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -68,27 +68,6 @@ class _ProgressNoteState extends State { color: Colors.grey[200], child: Column( children: [ - AddNewOrder( - onTap: () async { - await locator().logEvent( - eventCategory: "Operation Report Screen", - eventAction: "Update Operation Report ", - ); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => UpdateOperationReport( - operationReportViewModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - ), - settings: RouteSettings(name: 'UpdateNoteOrder'), - ), - ); - }, - label: TranslationBase.of(context).operationReports, - ), model.operationReportList == null || model.operationReportList.length == 0 ? DrAppEmbeddedError( @@ -234,13 +213,12 @@ class _ProgressNoteState extends State { ), ) ]), - if (model.operationReportList[index] - .timeStart != + .timeStart != null) Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( "Operation Time Start : ", @@ -248,7 +226,9 @@ class _ProgressNoteState extends State { ), Expanded( child: AppText( - model.operationReportList[index] + model + .operationReportList[ + index] .timeStart, fontSize: 10, ), @@ -297,7 +277,14 @@ class _ProgressNoteState extends State { MainAxisAlignment.end, children: [ InkWell( - onTap: () { + onTap: () async { + await locator() + .logEvent( + eventCategory: + "Operation Report Screen", + eventAction: + "Update Operation Report ", + ); Navigator.push( context, MaterialPageRoute( @@ -332,8 +319,7 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - TranslationBase.of(context) - .update, + "Operation Reports", fontSize: 10, color: Colors.white, ),