diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index d2c4eb1f..32edf34f 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -30,13 +30,19 @@ class BaseService { } } - Future getPatientArrivalList(String date,{String fromDate}) async{ + 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( GET_PATIENT_ARRIVAL_LIST, diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 251407ef..35747c37 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -133,4 +133,19 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { + setState(ViewState.Busy); + + await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn, appointmentNo: appointmentNo); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + /* + * model + .getPatientArrivalList()*/ } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 4282141c..4f2e7e28 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -16,35 +16,6 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - /*Future getPatientArrivalList(String date, PatiantInformtion patient, - {String fromDate}) async { - // TODO when arrival list work un comment below lines - *//* setState(ViewState.Busy); - await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); - if (_vitalSignService.hasError) { - error = _vitalSignService.error; - setState(ViewState.Error); - } else { - await getPatientVitalSign(patient); - }*//* - makeVitalSignDemoData(); - } - - PatientArrivalEntity getPatientAppointmentEntity(PatiantInformtion patient) { - String ffName = "${patient.firstName} ${patient.lastName}"; - String fmfName = - "${patient.firstName} ${patient.middleName} ${patient.lastName}"; - - for (var element in patientArrivalList) { - int index = patientArrivalList.indexOf(element); - if (element.patientName == ffName || element.patientName == fmfName) { - return element; - } - // print("patient index: $index"); - } - return null; - }*/ - Future getPatientVitalSign(PatiantInformtion patient) async { setState(ViewState.Busy); await _vitalSignService.getPatientVitalSign(patient); diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 4428da8d..0a655231 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -11,9 +11,12 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.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/borderedButton.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../routes.dart'; + class UcafDetailScreen extends StatefulWidget { @override _UcafDetailScreenState createState() => _UcafDetailScreenState(); @@ -36,32 +39,73 @@ class _UcafDetailScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: Container( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientHeaderWidgetNoAvatar(patient), - SizedBox( - height: 10, - ), - Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), + body: Column( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - treatmentStepsBar( - context, model, screenSize, patient), + PatientHeaderWidgetNoAvatar(patient), SizedBox( - height: 16, + height: 10, + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar( + context, model, screenSize, patient), + SizedBox( + height: 16, + ), + ...getSelectedTreatmentStepItem(context, model), + ], + ), ), - ...getSelectedTreatmentStepItem(context, model), ], ), ), - ], + ), ), - ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: BorderedButton( + TranslationBase.of(context).save, + hasBorder: true, + vPadding: 16, + hPadding: 8, + borderColor: HexColor("#B8382B"), + backgroundColor: HexColor("#B8382B"), + textColor: Colors.white, + fontSize: SizeConfig.textMultiplier * 2.0, + handler: () {}, + ), + ), + Container( + margin: + EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 16), + child: BorderedButton( + TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 16, + hPadding: 8, + borderColor: Colors.white, + backgroundColor: Colors.white, + textColor: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.2, + handler: () { + Navigator.of(context).popUntil((route){ + return route.settings.name == PATIENTS_PROFILE; + }); + + }, + ), + ), + ], ), )); } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 4c9d41e0..1019ede4 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.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/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; @@ -13,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../routes.dart'; + class MyReferralDetailScreen extends StatelessWidget { PendingReferral pendingReferral; @@ -25,6 +28,14 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral = routeArgs['referral']; return BaseView( + onModelReady: (model) => model.getPatientDetails( + DateUtils.convertStringToDateFormat( + DateTime.now().subtract(Duration(days: 350)).toString(), + "yyyy-MM-dd"), + DateUtils.convertStringToDateFormat( + DateTime.now().toString(), "yyyy-MM-dd"), + pendingReferral.patientID, + pendingReferral.sourceAppointmentNo), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, @@ -63,8 +74,10 @@ class MyReferralDetailScreen extends StatelessWidget { patientName: pendingReferral.patientName, referralStatus: null, isReferredTo: false, - isSameBranch: pendingReferral.isReferralDoctorSameBranch, - referralDoctorName: pendingReferral.referredByDoctorInfo, + isSameBranch: + pendingReferral.isReferralDoctorSameBranch, + referralDoctorName: + pendingReferral.referredByDoctorInfo, clinicDescription: null, remark: pendingReferral.remarksFromSource, ), @@ -73,7 +86,8 @@ class MyReferralDetailScreen extends StatelessWidget { childAspectRatio: 1.8, crossAxisSpacing: 8, mainAxisSpacing: 10, - controller: new ScrollController(keepScrollOffset: false), + controller: + new ScrollController(keepScrollOffset: false), shrinkWrap: true, padding: const EdgeInsets.all(4.0), crossAxisCount: 2, @@ -82,8 +96,10 @@ class MyReferralDetailScreen extends StatelessWidget { key: key, // patient: patient, // route: RADIOLOGY, - nameLine1: TranslationBase.of(context).previewHealth, - nameLine2: TranslationBase.of(context).summaryReport, + nameLine1: + TranslationBase.of(context).previewHealth, + nameLine2: + TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), PatientProfileButton( key: key, @@ -95,7 +111,7 @@ class MyReferralDetailScreen extends StatelessWidget { PatientProfileButton( key: key, // patient: patient, - // route: VITAL_SIGN_DETAILS, + route: PATIENT_VITAL_SIGN, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, icon: 'heartbeat.png'), @@ -119,7 +135,7 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: (){ + handler: () { model.responseReferral(pendingReferral, true); }, ), @@ -135,7 +151,7 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: (){ + handler: () { model.responseReferral(pendingReferral, false); }, ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 8860a7dc..c39c7c95 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -44,13 +44,12 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: TranslationBase.of(context).episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), - if(selectedPatientType == 6 || selectedPatientType == 7) PatientProfileButton( key: key, patient: patient, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, - route: PATIENT_VITAL_SIGN, + route: (selectedPatientType == 6 || selectedPatientType == 7) ? PATIENT_VITAL_SIGN : VITAL_SIGN_DETAILS, icon: 'heartbeat.png'), if(selectedPatientType != 7) PatientProfileButton(