From dd971ffddb2fd36f968820d357362e68aef46d05 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 25 Oct 2021 17:41:38 +0300 Subject: [PATCH 1/7] 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/7] 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 7b8312fe260a1ad8205bdf55e47c06c51363e383 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 26 Oct 2021 11:57:19 +0300 Subject: [PATCH 3/7] make register patient feature --- assets/images/patient_register.png | Bin 0 -> 969 bytes lib/config/localized_values.dart | 4 +- .../patient/PatientRegisterService.dart | 5 + .../viewModel/PatientRegisterViewModel.dart | 8 + lib/locator.dart | 4 + lib/screens/home/home_patient_card.dart | 47 ++-- lib/screens/home/home_screen.dart | 23 +- .../profile/UCAF/page-stepper-widget.dart | 12 +- .../register_patient/RegisterPatientPage.dart | 212 ++++++++++++++++++ .../RegisterSearchPatientPage.dart | 201 +++++++++++++++++ lib/util/translations_delegate_base.dart | 2 + .../text_fields/app-textfield-custom.dart | 1 + 12 files changed, 496 insertions(+), 23 deletions(-) create mode 100644 assets/images/patient_register.png create mode 100644 lib/core/service/patient/PatientRegisterService.dart create mode 100644 lib/core/viewModel/PatientRegisterViewModel.dart create mode 100644 lib/screens/patients/register_patient/RegisterPatientPage.dart create mode 100644 lib/screens/patients/register_patient/RegisterSearchPatientPage.dart diff --git a/assets/images/patient_register.png b/assets/images/patient_register.png new file mode 100644 index 0000000000000000000000000000000000000000..c55935bc90aff3c7976a51d5cb5d7dcaa8a4df60 GIT binary patch literal 969 zcmb`GUr19?9LK-sp1ZMocjxZi3=GFwYlJToO^ArVayVH9)wIwgVw-ah>0EP>FFgoJ zF9m}L@=b&&iLxU4_cX#FLNsedX%A7o1U+a}2$8qnQO1mn2>Kq*IUj!i&hMPdHD8%; zq3;ey!e9(wG+@4yY9gV~(f!eV;mF?RWrtJ+lB5H@>0CD2(&TIJIP4R)l46PeOo`Xn zsqVLzqB`(AxQ734CZ#LcpP-<5nz<|;PR(`^SEg2YKyZA8&kD}AMMD%bLR^zt#qm{q zGMC9w%wrLs$Yce-A>Ps3b3&XYBs$iT>4UAbx6|~XA5pZRiTJ;&{GNTIz_zad&zEiS zVc_l%P&He&1x5hpY2eOuCYFsYHzU(3b$0`wF9VJa!2J|ZJ4=n0bIaf24|nxZj)(5q zMl!cGwD&U&n40SwJLbRc zI#b=gZhCw&9>SBh`R1Kh7H{8MTsqG;^Wo49b>hqR?+;mZ@PquoS-jdh7WlNM^3=r* G=Ifu<+MR^} literal 0 HcmV?d00001 diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b711124f..93c3a2de 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -710,5 +710,7 @@ const Map> localizedValues = { "ar":"نوع الطلب"}, "special": {"en": "Special", "ar": "خاص"}, "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} , - "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"} + "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"}, + "registerNewPatient": {"en": "Register\nNew Patient", "ar": "تسجيل\n مريض جديد"}, + "registeraPatient": {"en": "Register a Patient", "ar": "تسجيل المريض"}, }; diff --git a/lib/core/service/patient/PatientRegisterService.dart b/lib/core/service/patient/PatientRegisterService.dart new file mode 100644 index 00000000..a7013a3c --- /dev/null +++ b/lib/core/service/patient/PatientRegisterService.dart @@ -0,0 +1,5 @@ +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientRegisterService extends BaseService{ + +} \ No newline at end of file diff --git a/lib/core/viewModel/PatientRegisterViewModel.dart b/lib/core/viewModel/PatientRegisterViewModel.dart new file mode 100644 index 00000000..43aa7500 --- /dev/null +++ b/lib/core/viewModel/PatientRegisterViewModel.dart @@ -0,0 +1,8 @@ +import 'package:doctor_app_flutter/core/service/patient/PatientRegisterService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientRegisterViewModel extends BaseViewModel { + PatientRegisterService _service = locator(); +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index b5f651eb..04266041 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -23,6 +23,7 @@ import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; +import 'core/service/patient/PatientRegisterService.dart'; import 'core/service/patient/ReferralService.dart'; import 'core/service/patient/out_patient_service.dart'; import 'core/service/patient/patient-doctor-referral-service.dart'; @@ -49,6 +50,7 @@ import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; +import 'core/viewModel/PatientRegisterViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; @@ -103,6 +105,7 @@ void setupLocator() { locator.registerLazySingleton(() => VideoCallService()); locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); + locator.registerLazySingleton(() => PatientRegisterService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -132,4 +135,5 @@ void setupLocator() { locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => OperationReportViewModel()); + locator.registerFactory(() => PatientRegisterViewModel()); } diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index b388a7e2..a0d0bce7 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; class HomePatientCard extends StatelessWidget { final Color backgroundColor; final IconData cardIcon; + final String cardIconImage; final Color backgroundIconColor; final String text; final Color textColor; @@ -15,11 +16,12 @@ class HomePatientCard extends StatelessWidget { HomePatientCard({ @required this.backgroundColor, @required this.backgroundIconColor, - @required this.cardIcon, + this.cardIcon, + this.cardIconImage, @required this.text, @required this.textColor, @required this.onTap, - this.iconSize = 30, + this.iconSize = 30, }); @override @@ -38,24 +40,41 @@ class HomePatientCard extends StatelessWidget { children: [ Container( margin: EdgeInsets.only(top: 18, left: 10), - color:Colors.transparent, - - child: Icon( - cardIcon, - size: iconSize * 2, - color: backgroundIconColor, - ), + color: Colors.transparent, + child: cardIcon != null + ? Icon( + cardIcon, + size: iconSize * 2, + color: backgroundIconColor, + ) + : IconButton( + icon: Image.asset( + 'assets/images/patient_register.png', + width: iconSize * 2, + height: iconSize * 2, + fit: BoxFit.fill, + ), + iconSize: iconSize * 2, + color: backgroundIconColor, + onPressed: () => null, + ), ), Container( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - cardIcon, - size: iconSize, - color: textColor, - ), + cardIcon != null + ? Icon( + cardIcon, + size: iconSize, + color: textColor, + ) + : Image.asset( + cardIconImage, + height: iconSize, + width: iconSize, + ), SizedBox( height: 4, ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 495a70b0..1ab61717 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/screens/patients/In_patient/in_patient_screen import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterPatientPage.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -254,8 +255,8 @@ class _HomeScreenState extends State { else Container( child: ErrorMessage( - error: model.error, - )), + error: model.error, + )), FractionallySizedBox( // widthFactor: 0.90, child: Container( @@ -313,7 +314,6 @@ class _HomeScreenState extends State { ), ) ]), - ]), ), ); @@ -396,6 +396,23 @@ class _HomeScreenState extends State { )); changeColorIndex(); + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIconImage: 'assets/images/patient_register.png', + textColor: textColors[colorIndex], + text: TranslationBase.of(context).registerNewPatient, + onTap: () { + Navigator.push( + context, + FadePage( + page: RegisterPatientPage(), + ), + ); + }, + )); + changeColorIndex(); + patientCards.add(HomePatientCard( backgroundColor: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], diff --git a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart index da0381ed..6d9838f4 100644 --- a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart +++ b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart @@ -16,8 +16,9 @@ class PageStepperWidget extends StatelessWidget { final int stepsCount; final int currentStepIndex; final Size screenSize; + final List stepsTitles; - PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize}); + PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize, this.stepsTitles}); @override Widget build(BuildContext context) { @@ -33,10 +34,10 @@ class PageStepperWidget extends StatelessWidget { for (int i = 1; i <= stepsCount; i++) if (i == currentStepIndex) StepWidget(i, true, i == stepsCount, i < currentStepIndex, - dividerWidth) + dividerWidth, stepsTitles: stepsTitles,) else StepWidget(i, false, i == stepsCount, i < currentStepIndex, - dividerWidth) + dividerWidth, stepsTitles: stepsTitles,) ], ) ], @@ -52,9 +53,10 @@ class StepWidget extends StatelessWidget { final bool isFinalStep; final bool isStepFinish; final double dividerWidth; + final List stepsTitles; StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, - this.dividerWidth); + this.dividerWidth, {this.stepsTitles}); @override Widget build(BuildContext context) { @@ -106,7 +108,7 @@ class StepWidget extends StatelessWidget { height: 8, ), AppText( - "${TranslationBase.of(context).step} $index", + stepsTitles == null ? "${TranslationBase.of(context).step} $index" : "${stepsTitles[index - 1]}", fontWeight: FontWeight.bold, color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black, fontFamily: 'Poppins', diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart new file mode 100644 index 00000000..ab85d820 --- /dev/null +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -0,0 +1,212 @@ +import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import 'RegisterSearchPatientPage.dart'; + +class RegisterPatientPage extends StatefulWidget { + const RegisterPatientPage({Key key}) : super(key: key); + + @override + _RegisterPatientPageState createState() => _RegisterPatientPageState(); +} + +class _RegisterPatientPageState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + bool _isLoading = false; + + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + setState(() { + _currentIndex = pageIndex; + }); + } + + void changeLoadingState(bool isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + void initState() { + _controller = new PageController(); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + isLoading: _isLoading, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).registeraPatient, + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + PageStepperWidget( + stepsCount: 3, + currentStepIndex: _currentIndex + 1, + screenSize: screenSize, + stepsTitles: [ + "Search", + "Activation", + "Confirmation", + ], + ), + SizedBox( + height: 10, + ), + Expanded( + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + RegisterSearchPatientPage(), + ]), + ), + ), + ], + ), + )), + _isLoading + ? Container( + height: 0, + ) + : pagerButtons(model), + ], + ), + ), + ); + } + + Widget pagerButtons(PatientRegisterViewModel model) { + switch (_currentIndex) { + case 2: + return Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).noteConfirm, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFF359846), + color: Color(0xFF359846), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () {}, + ), + ), + ), + ], + ), + ); + default: + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).next, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () { + changePageViewIndex(_currentIndex + 1); + }, + ), + ), + ), + ], + ), + ); + } + } +} diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart new file mode 100644 index 00000000..3aafe5bd --- /dev/null +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -0,0 +1,201 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class RegisterSearchPatientPage extends StatefulWidget { + const RegisterSearchPatientPage({Key key}) : super(key: key); + + @override + _RegisterSearchPatientPageState createState() => + _RegisterSearchPatientPageState(); +} + +class _RegisterSearchPatientPageState extends State { + String countryError; + dynamic _selectedCountry; + + final _phoneController = TextEditingController(); + String phoneError; + + final _idController = TextEditingController(); + String idError; + + DateTime _birthDate; + String birthdateError; + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + children: [ + Expanded( + child: Container( + width: double.infinity, + margin: EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "Please enter mobile number or Identification number", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.w800, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Country", + isTextFieldHasSuffix: true, + validationError: countryError, + dropDownText: _selectedCountry != null + ? _selectedCountry['nameEn'] + : null, + enabled: false, + /*onClick: model.dietTypesList != null && model.dietTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { + setState(() { + _selectedCountry = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getDietTypes(patient.patientId) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.dietTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { + setState(() { + _selectedCountry = selectedValue; + }); + }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); + } + },*/ + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Phone Number", + inputType: TextInputType.phone, + controller: _phoneController, + validationError: phoneError, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "ID Number", + inputType: TextInputType.phone, + controller: _idController, + validationError: idError, + ), + SizedBox( + height: 12, + ), + AppText( + "Calender", + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w800, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Birthdate", + dropDownText: _birthDate != null + ? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy-MM-dd")}" + : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: birthdateError, + suffixIcon: IconButton( + icon: Icon( + Icons.calendar_today, + color: Colors.black, + ), + onPressed: null, + ), + onClick: () { + if (_birthDate == null) { + _birthDate = DateTime.now(); + } + _selectDate(context, _birthDate, (picked) { + setState(() { + _birthDate = picked; + }); + }); + }, + ), + ], + ), + ), + ), + ), + ], + ), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 59f66811..58e17a94 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1106,6 +1106,8 @@ class TranslationBase { String get requestType => localizedValues['requestType'][locale.languageCode]; String get allClinic => localizedValues['allClinic'][locale.languageCode]; String get notReplied => localizedValues['notReplied'][locale.languageCode]; + String get registerNewPatient => localizedValues['registerNewPatient'][locale.languageCode]; + String get registeraPatient => localizedValues['registeraPatient'][locale.languageCode]; } diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index cd97c8d4..086375bb 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -146,6 +146,7 @@ class _AppTextFieldCustomState extends State { ? TextAlign.right : TextAlign.left, focusNode: _focusNode, + textAlignVertical: TextAlignVertical.center, decoration: TextFieldsUtils .textFieldSelectorDecoration( widget.hintText, null, true), From 9689044be791dcd9e6570c246a2610f11adff8cd Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 26 Oct 2021 12:14:39 +0300 Subject: [PATCH 4/7] Add models and create vm, services for patient registration --- android/app/src/main/AndroidManifest.xml | 2 +- lib/config/config.dart | 11 +- .../CheckActivationCodeModel.dart | 112 +++++++++++ .../CheckPatientForRegistrationModel.dart | 80 ++++++++ .../PatientRegistrationModel.dart | 185 ++++++++++++++++++ ...PNotificationTypeForRegistrationModel.dart | 109 +++++++++++ .../service/PatientRegistrationService.dart | 51 +++++ lib/core/service/base/base_service.dart | 34 ---- .../PatientRegistrationViewModel.dart | 59 ++++++ .../viewModel/patient-referral-viewmodel.dart | 10 - lib/locator.dart | 4 + 11 files changed, 610 insertions(+), 47 deletions(-) create mode 100644 lib/core/model/PatientRegistration/CheckActivationCodeModel.dart create mode 100644 lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart create mode 100644 lib/core/model/PatientRegistration/PatientRegistrationModel.dart create mode 100644 lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart create mode 100644 lib/core/service/PatientRegistrationService.dart create mode 100644 lib/core/viewModel/PatientRegistrationViewModel.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 82805ecc..9cd98ee3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + forRegisteration = json['ForRegisteration']; + activationCode = json['activationCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['ForRegisteration'] = this.forRegisteration; + data['activationCode'] = this.activationCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart new file mode 100644 index 00000000..3465cf8d --- /dev/null +++ b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart @@ -0,0 +1,80 @@ +class CheckPatientForRegistrationModel { + int patientIdentificationID; + int patientMobileNumber; + String zipCode; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String tokenID; + int patientID; + bool isRegister; + String dOB; + int isHijri; + + CheckPatientForRegistrationModel( + {this.patientIdentificationID, + this.patientMobileNumber, + this.zipCode, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.tokenID, + this.patientID, + this.isRegister, + this.dOB, + this.isHijri}); + + CheckPatientForRegistrationModel.fromJson(Map json) { + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + zipCode = json['ZipCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientID = json['PatientID']; + isRegister = json['isRegister']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['ZipCode'] = this.zipCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientID'] = this.patientID; + data['isRegister'] = this.isRegister; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart new file mode 100644 index 00000000..83ff53d7 --- /dev/null +++ b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart @@ -0,0 +1,185 @@ +class PatientRegistrationModel { + Patientobject patientobject; + String patientIdentificationID; + String patientMobileNumber; + String logInTokenID; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String tokenID; + String dOB; + int isHijri; + String healthId; + String zipCode; + + PatientRegistrationModel( + {this.patientobject, + this.patientIdentificationID, + this.patientMobileNumber, + this.logInTokenID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.tokenID, + this.dOB, + this.isHijri, + this.healthId, + this.zipCode}); + + PatientRegistrationModel.fromJson(Map json) { + patientobject = json['Patientobject'] != null + ? new Patientobject.fromJson(json['Patientobject']) + : null; + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + logInTokenID = json['LogInTokenID']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + zipCode = json['ZipCode']; + } + + Map toJson() { + final Map data = new Map(); + if (this.patientobject != null) { + data['Patientobject'] = this.patientobject.toJson(); + } + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['LogInTokenID'] = this.logInTokenID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + data['ZipCode'] = this.zipCode; + return data; + } +} + +class Patientobject { + bool tempValue; + int patientIdentificationType; + String patientIdentificationNo; + int mobileNumber; + int patientOutSA; + String firstNameN; + String middleNameN; + String lastNameN; + String firstName; + String middleName; + String lastName; + String strDateofBirth; + String dateofBirth; + int gender; + String nationalityID; + String dateofBirthN; + String emailAddress; + String sourceType; + String preferredLanguage; + String marital; + String eHealthIDField; + + Patientobject( + {this.tempValue, + this.patientIdentificationType, + this.patientIdentificationNo, + this.mobileNumber, + this.patientOutSA, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.firstName, + this.middleName, + this.lastName, + this.strDateofBirth, + this.dateofBirth, + this.gender, + this.nationalityID, + this.dateofBirthN, + this.emailAddress, + this.sourceType, + this.preferredLanguage, + this.marital, + this.eHealthIDField}); + + Patientobject.fromJson(Map json) { + tempValue = json['TempValue']; + patientIdentificationType = json['PatientIdentificationType']; + patientIdentificationNo = json['PatientIdentificationNo']; + mobileNumber = json['MobileNumber']; + patientOutSA = json['PatientOutSA']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + strDateofBirth = json['StrDateofBirth']; + dateofBirth = json['DateofBirth']; + gender = json['Gender']; + nationalityID = json['NationalityID']; + dateofBirthN = json['DateofBirthN']; + emailAddress = json['EmailAddress']; + sourceType = json['SourceType']; + preferredLanguage = json['PreferredLanguage']; + marital = json['Marital']; + eHealthIDField = json['eHealthIDField']; + } + + Map toJson() { + final Map data = new Map(); + data['TempValue'] = this.tempValue; + data['PatientIdentificationType'] = this.patientIdentificationType; + data['PatientIdentificationNo'] = this.patientIdentificationNo; + data['MobileNumber'] = this.mobileNumber; + data['PatientOutSA'] = this.patientOutSA; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['StrDateofBirth'] = this.strDateofBirth; + data['DateofBirth'] = this.dateofBirth; + data['Gender'] = this.gender; + data['NationalityID'] = this.nationalityID; + data['DateofBirthN'] = this.dateofBirthN; + data['EmailAddress'] = this.emailAddress; + data['SourceType'] = this.sourceType; + data['PreferredLanguage'] = this.preferredLanguage; + data['Marital'] = this.marital; + data['eHealthIDField'] = this.eHealthIDField; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart new file mode 100644 index 00000000..8244a95f --- /dev/null +++ b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart @@ -0,0 +1,109 @@ +class SendActivationCodeByOTPNotificationTypeForRegistrationModel { + int patientMobileNumber; + String mobileNo; + int projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + int nationalID; + int patientIdentificationID; + int oTPSendType; + int languageID; + double versionID; + int channel; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String dOB; + int isHijri; + String healthId; + + SendActivationCodeByOTPNotificationTypeForRegistrationModel( + {this.patientMobileNumber, + this.mobileNo, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.oTPSendType, + this.languageID, + this.versionID, + this.channel, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.dOB, + this.isHijri, + this.healthId}); + + SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( + Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + oTPSendType = json['OTP_SendType']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + channel = json['Channel']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['OTP_SendType'] = this.oTPSendType; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + return data; + } +} diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart new file mode 100644 index 00000000..fefa9021 --- /dev/null +++ b/lib/core/service/PatientRegistrationService.dart @@ -0,0 +1,51 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientRegistrationService extends BaseService { + checkPatientForRegistration( + CheckPatientForRegistrationModel registrationModel) async { + hasError = false; + await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + sendActivationCodeByOTPNotificationType( + SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel) async { + hasError = false; + await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + checkActivationCode(CheckActivationCodeModel registrationModel) async { + hasError = false; + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + registrationPatient(PatientRegistrationModel registrationModel) async { + hasError = false; + await baseAppClient.post(PATIENT_REGISTRATION, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } +} diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index ade01d9b..58526da7 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,5 +1,4 @@ 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/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -44,38 +43,5 @@ class BaseService { } } - Future getPatientArrivalList(String date,{String fromDate, int patientMrn = -1, int appointmentNo = -1}) async{ - hasError = false; - Map body = Map(); - body['From'] = fromDate == null ? date : fromDate; - body['To'] = date; - body['PageIndex'] = 0; - body['PageSize'] = 0; - if(patientMrn != -1){ - body['PatientMRN'] = patientMrn; - } - if(appointmentNo != -1){ - body['AppointmentNo'] = appointmentNo; - } - - await baseAppClient.post( - ARRIVED_PATIENT_URL, - onSuccess: (dynamic response, int statusCode) { - patientArrivalList.clear(); - - if(response['patientArrivalList']['entityList'] != null){ - response['patientArrivalList']['entityList'].forEach((v) { - PatiantInformtion item = PatiantInformtion.fromJson(v); - patientArrivalList.add(item); - }); - } - }, - onFailure: (String error, int statusCode) { - hasError = true; - this.error = error; - }, - body: body, - ); - } } diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart new file mode 100644 index 00000000..6dddffcd --- /dev/null +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -0,0 +1,59 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/service/PatientRegistrationService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientRegistrationViewModel extends BaseViewModel { + PatientRegistrationService _patientRegistrationService = + locator(); + + Future checkPatientForRegistration( + CheckPatientForRegistrationModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService + .checkPatientForRegistration(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future sendActivationCodeByOTPNotificationType( + SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService + .sendActivationCodeByOTPNotificationType(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future checkActivationCode(CheckActivationCodeModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService.checkActivationCode(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future registrationPatient(PatientRegistrationModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService.registrationPatient(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 4240e848..93635629 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -256,17 +256,7 @@ class PatientReferralViewModel extends BaseViewModel { } } - Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { - setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } - } Future getReferralFrequencyList() async { setState(ViewState.Busy); diff --git a/lib/locator.dart b/lib/locator.dart index b5f651eb..08efa5e4 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -14,6 +14,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/AnalyticsService.dart'; import 'core/service/NavigationService.dart'; +import 'core/service/PatientRegistrationService.dart'; import 'core/service/VideoCallService.dart'; import 'core/service/home/dasboard_service.dart'; import 'core/service/home/doctor_reply_service.dart'; @@ -49,6 +50,7 @@ import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; +import 'core/viewModel/PatientRegistrationViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; @@ -103,6 +105,7 @@ void setupLocator() { locator.registerLazySingleton(() => VideoCallService()); locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); + locator.registerLazySingleton(() => PatientRegistrationService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -132,4 +135,5 @@ void setupLocator() { locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => OperationReportViewModel()); + locator.registerFactory(() => PatientRegistrationViewModel()); } From 331b27c3ec164b8d7659e3e65c60ed983133cb0a Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 26 Oct 2021 12:19:35 +0300 Subject: [PATCH 5/7] fix merge issue --- lib/core/service/patient/PatientRegisterService.dart | 5 ----- lib/core/viewModel/PatientRegisterViewModel.dart | 8 -------- lib/locator.dart | 5 +---- .../register_patient/RegisterPatientPage.dart | 7 +++---- .../register_patient/RegisterSearchPatientPage.dart | 11 ++++++----- 5 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 lib/core/service/patient/PatientRegisterService.dart delete mode 100644 lib/core/viewModel/PatientRegisterViewModel.dart diff --git a/lib/core/service/patient/PatientRegisterService.dart b/lib/core/service/patient/PatientRegisterService.dart deleted file mode 100644 index a7013a3c..00000000 --- a/lib/core/service/patient/PatientRegisterService.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; - -class PatientRegisterService extends BaseService{ - -} \ No newline at end of file diff --git a/lib/core/viewModel/PatientRegisterViewModel.dart b/lib/core/viewModel/PatientRegisterViewModel.dart deleted file mode 100644 index 43aa7500..00000000 --- a/lib/core/viewModel/PatientRegisterViewModel.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:doctor_app_flutter/core/service/patient/PatientRegisterService.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; - -import '../../locator.dart'; - -class PatientRegisterViewModel extends BaseViewModel { - PatientRegisterService _service = locator(); -} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 4e1d52fd..243905d8 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -26,7 +26,6 @@ import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; -import 'core/service/patient/PatientRegisterService.dart'; import 'core/service/patient/ReferralService.dart'; import 'core/service/patient/out_patient_service.dart'; import 'core/service/patient/patient-doctor-referral-service.dart'; @@ -54,7 +53,6 @@ import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/PatientRegistrationViewModel.dart'; -import 'core/viewModel/PatientRegisterViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; @@ -110,7 +108,6 @@ void setupLocator() { locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); locator.registerLazySingleton(() => PendingOrderService()); - locator.registerLazySingleton(() => PatientRegisterService()); locator.registerLazySingleton(() => PatientRegistrationService()); /// View Model @@ -143,5 +140,5 @@ void setupLocator() { locator.registerFactory(() => OperationReportViewModel()); locator.registerFactory(() => PatientRegistrationViewModel()); locator.registerFactory(() => PendingOrdersViewModel()); - locator.registerFactory(() => PatientRegisterViewModel()); + } diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index ab85d820..8b79225d 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -1,6 +1,5 @@ -import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -53,7 +52,7 @@ class _RegisterPatientPageState extends State Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, @@ -116,7 +115,7 @@ class _RegisterPatientPageState extends State ); } - Widget pagerButtons(PatientRegisterViewModel model) { + Widget pagerButtons(PatientRegistrationViewModel model) { switch (_currentIndex) { case 2: return Container( diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index 3aafe5bd..5260cc3b 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -1,14 +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/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; + import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; + import 'package:doctor_app_flutter/util/translations_delegate_base.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/dialogs/dailog-list-select.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; + import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -37,7 +38,7 @@ class _RegisterSearchPatientPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, From 93bcfff7a0b5527331e133b1c3d1847d2254ea49 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Oct 2021 15:26:10 +0300 Subject: [PATCH 6/7] 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 7/7] 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, ),