diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart index 6ea6e6cf..24c83004 100644 --- a/lib/core/service/labs_service.dart +++ b/lib/core/service/labs_service.dart @@ -13,21 +13,21 @@ class LabsService extends BaseService { List patientLabOrdersList = List(); Future getPatientLabOrdersList( - PatiantInformtion patient, bool isArrived) async { + PatiantInformtion patient, bool isInpatient) async { hasError = false; Map body = Map(); String url = ""; - if (isArrived) { + if (isInpatient) { + url = GET_PATIENT_LAB_OREDERS; + } else { body['isDentalAllowedBackend'] = false; url = GET_Patient_LAB_ORDERS; - } else { - url = GET_PATIENT_LAB_OREDERS; } await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabOrdersList.clear(); - if (isArrived) { + if (!isInpatient) { response['ListPLO'].forEach((hospital) { patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); }); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 8ce1175c..3a269d57 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -227,14 +227,11 @@ class ProcedureViewModel extends BaseViewModel { return labResultLists; } - void getLabs(PatiantInformtion patient,{bool isArrived}) async { + void getLabs(PatiantInformtion patient, {bool isInpatient = false}) async { setState(ViewState.Busy); - await _labsService.getPatientLabOrdersList(patient, isArrived); + await _labsService.getPatientLabOrdersList(patient, isInpatient); if (_labsService.hasError) { error = _labsService.error; - if(isArrived) - setState(ViewState.ErrorLocal); - else setState(ViewState.Error); } else { _labsService.patientLabOrdersList.forEach((element) { diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 697cf4ec..17f04980 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -642,6 +642,8 @@ class _PatientsScreenState extends State { .getTo, "isSearch": isSearch, + "isInpatient": + isInpatient, "arrivalType": arrivalType, "isInpatient":isInpatient diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 5a02eb8d..81524593 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -29,9 +29,10 @@ class LabsHomePage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; + bool isInpatient = routeArgs['isInpatient']; print(arrivalType); return BaseView( - onModelReady: (model) => model.getLabs(patient,isArrived: ( patient.patientStatusType == 43)), + onModelReady: (model) => model.getLabs(patient, isInpatient: isInpatient), builder: (context, ProcedureViewModel model, widget) => AppScaffold( baseViewModel: model, backgroundColor: Colors.grey[100], diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 4d749b0d..a14f96e8 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -40,6 +40,8 @@ class PatientProfileScreen extends StatelessWidget { String to = routeArgs['to']; if (routeArgs.containsKey("isSearch")) { isFromSearch = routeArgs['isSearch']; + } + if (routeArgs.containsKey("isInpatient")) { isInpatient = routeArgs['isInpatient']; } @@ -67,34 +69,31 @@ class PatientProfileScreen extends StatelessWidget { child: SingleChildScrollView( child: Column( children: [ - isFromSearch - ? ProfileMedicalInfoWidgetSearch( + isInpatient + ? ProfileMedicalInfoWidgetInPatient( patient: patient, patientType: patientType, arrivalType: arrivalType, from: from, to: to, - isInpatient:false - // isFromSearch:isFromSearch + isInpatient:isInpatient, ) - : isInpatient - ? ProfileMedicalInfoWidgetInPatient( + : isFromSearch + ? ProfileMedicalInfoWidgetSearch( patient: patient, patientType: patientType, arrivalType: arrivalType, from: from, to: to, - isInpatient:isInpatient, - - - ) + isInpatient:false + ) : ProfileMedicalInfoWidget( patient: patient, patientType: patientType, arrivalType: arrivalType, from: from, to: to, - isInpatient:isInpatient + isInpatient:isInpatient ), ], ), @@ -104,7 +103,8 @@ class PatientProfileScreen extends StatelessWidget { ], ), ), - if (patient.patientStatusType !=null && patient.patientStatusType == 43 ) + if (patient.patientStatusType != null && + patient.patientStatusType == 43) BaseView( onModelReady: (model) async {}, builder: (_, model, w) => Positioned( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index f333a73f..0bf2fc95 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -30,12 +30,13 @@ class VitalSignDetailsScreen extends StatelessWidget { String arrivalType = routeArgs['arrivalType']; String from = routeArgs['from']; String to = routeArgs['to']; + bool isInpatient = routeArgs['isInpatient']; String imageBasePath = 'assets/images/'; String assetBasePath = "${imageBasePath}patient/vital_signs/"; return BaseView( onModelReady: (model) => - model.getPatientVitalSignHistory(patient, from, to, patientType == "1"), + model.getPatientVitalSignHistory(patient, from, to, isInpatient), builder: (_, mode, widget) => AppScaffold( baseViewModel: mode, isShowAppBar: true, diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index 91a29ee2..6267e522 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -13,12 +13,12 @@ class PatientProfileButton extends StatelessWidget { final PatiantInformtion patient; final String patientType; String arrivalType; + final bool isInPatient; String from; String to; final String url = "assets/images/"; final bool isDisable; final bool isLoading; - final bool isInpatient; final Function onTap; PatientProfileButton( @@ -34,7 +34,9 @@ class PatientProfileButton extends StatelessWidget { this.onTap, this.isLoading = false, this.from, - this.to, this.isInpatient}) + this.to, + this.isInPatient = false, + }) : super(key: key); @override @@ -129,7 +131,7 @@ class PatientProfileButton extends StatelessWidget { 'to': to, 'patientType': patientType, 'arrivalType': arrivalType, - 'isInpatient':isInpatient + 'isInpatient': isInPatient, }); } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 131df93c..5c2edcfb 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -44,7 +44,6 @@ class ProfileMedicalInfoWidget extends StatelessWidget { childAspectRatio: 1 / 1.0, crossAxisCount: 3, children: [ - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -81,7 +80,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, - isInpatient:isInpatient, + isInPatient:isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).service, @@ -134,7 +133,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).patientSick, nameLine2: TranslationBase.of(context).leave, icon: 'patient/patient_sick_leave.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (patient.appointmentNo!=null && patient.appointmentNo!=0) PatientProfileButton( key: key, patient: patient, @@ -145,7 +144,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).patient, nameLine2: TranslationBase.of(context).ucaf, icon: 'patient/ucaf.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (patient.appointmentNo!=null && patient.appointmentNo!=0) PatientProfileButton( key: key, patient: patient, @@ -156,7 +155,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).referral, nameLine2: TranslationBase.of(context).patient, icon: 'patient/refer_patient.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (patient.appointmentNo!=null && patient.appointmentNo!=0) PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart index 9be09f58..88811e1a 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart @@ -56,6 +56,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, route: VITAL_SIGN_DETAILS, + isInPatient: true, icon: 'patient/vital_signs.png'), PatientProfileButton( key: key, @@ -63,6 +64,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patientType: patientType, arrivalType: arrivalType, route: LAB_RESULT, + isInPatient: true, nameLine1: TranslationBase.of(context).lab, nameLine2: TranslationBase.of(context).result, icon: 'patient/lab_results.png'), @@ -71,7 +73,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, - isInpatient: isInpatient, + isInPatient: isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).result, @@ -141,6 +143,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patientType: patientType, arrivalType: arrivalType, route: REFER_IN_PATIENT_TO_DOCTOR, + isInPatient: true, nameLine1: TranslationBase.of(context).referral, nameLine2: TranslationBase.of(context).patient, icon: 'patient/refer_patient.png'), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index 7eba5c66..edca6000 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -69,7 +69,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, - isInpatient:isInpatient, + isInPatient:isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).service,