diff --git a/lib/core/service/radiology_service.dart b/lib/core/service/radiology_service.dart index 3f40b723..68504d2c 100644 --- a/lib/core/service/radiology_service.dart +++ b/lib/core/service/radiology_service.dart @@ -27,9 +27,9 @@ class RadiologyService extends BaseService { }, body: body); } - Future getPatientRadOrders(PatiantInformtion patient) async { + Future getPatientRadOrders(PatiantInformtion patient , {isInPatient = false}) async { String url = GET_PATIENT_ORDERS; - if(patient.patientType == 1) { + if(isInPatient) { url = GET_IN_PATIENT_ORDERS; } hasError = false; @@ -38,7 +38,7 @@ class RadiologyService extends BaseService { onSuccess: (dynamic response, int statusCode) { finalRadiologyList.clear(); String label = "ListRAD"; - if(patient.patientType == 1) { + if(isInPatient) { label ="List_GetRadOreders"; } response[label].forEach((radiology) { diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index d35b2c14..8ce1175c 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -137,11 +137,12 @@ class ProcedureViewModel extends BaseViewModel { } else setState(ViewState.Idle); //await getProcedure(mrn: mrn); + } - void getPatientRadOrders(PatiantInformtion patient,{String patientType}) async { + void getPatientRadOrders(PatiantInformtion patient,{String patientType, bool isInPatient = false}) async { setState(ViewState.Busy); - await _radiologyService.getPatientRadOrders(patient); + await _radiologyService.getPatientRadOrders(patient, isInPatient:isInPatient); if (_radiologyService.hasError) { error = _radiologyService.error; if(patientType=="7") diff --git a/lib/core/viewModel/radiology_view_model.dart b/lib/core/viewModel/radiology_view_model.dart index 4370b47f..4e3768dc 100644 --- a/lib/core/viewModel/radiology_view_model.dart +++ b/lib/core/viewModel/radiology_view_model.dart @@ -20,9 +20,9 @@ class RadiologyViewModel extends BaseViewModel { ? _finalRadiologyListClinic : _finalRadiologyListHospital; - void getPatientRadOrders(PatiantInformtion patient) async { + void getPatientRadOrders(PatiantInformtion patient, {isInPatient = false}) async { setState(ViewState.Busy); - await _radiologyService.getPatientRadOrders(patient); + await _radiologyService.getPatientRadOrders(patient, isInPatient:isInPatient); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 30cc7dcf..697cf4ec 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -644,6 +644,7 @@ class _PatientsScreenState extends State { isSearch, "arrivalType": arrivalType, + "isInpatient":isInpatient }); }, ); diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 277bc472..4d749b0d 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -26,6 +26,7 @@ import '../../../routes.dart'; class PatientProfileScreen extends StatelessWidget { PatiantInformtion patient; bool isFromSearch = false; + bool isInpatient = false; @override Widget build(BuildContext context) { @@ -39,52 +40,10 @@ class PatientProfileScreen extends StatelessWidget { String to = routeArgs['to']; if (routeArgs.containsKey("isSearch")) { isFromSearch = routeArgs['isSearch']; + isInpatient = routeArgs['isInpatient']; } return BaseView( - onModelReady: (patientViewModel) async { - PatientModel patientReq = PatientModel( - ProjectID: 0, - ClinicID: 0, - DoctorID: 0, - FirstName: "0", - MiddleName: "0", - LastName: "0", - PatientMobileNumber: "0", - PatientIdentificationID: "0", - PatientID: patient.patientId, - From: "0", - To: "0", - LanguageID: 2, - stamp: "2020-03-02T13:56:39.170Z", - IPAdress: "11.11.11.11", - VersionID: 1.2, - Channel: 9, - TokenID: "@dm!n", - SessionID: "5G0yXn0Jnq", - IsLoginForDoctorApp: true, - PatientOutSA: false); - - if (patientType == "1" && - (patient.admissionNo == null || - patient.admissionNo == "0")) { - patientViewModel - .getPatientList(patientReq, "1", isBusyLocal: false) - .then((response) { - if (response['MessageStatus'] == 1) { - if (response['List_MyInPatient'] != null) { - List patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; - patient.admissionNo = patientList[0].admissionNo; - patient.admissionDate = patientList[0].admissionDate; - } else { - DrAppToastMsg.showErrorToast('No patient'); - } - } - }).catchError((error) { - print(error); - }); - } - }, builder: (_, patientViewModel, w) => AppScaffold( baseViewModel: patientViewModel, appBarTitle: TranslationBase.of(context).patientProfile, @@ -115,21 +74,27 @@ class PatientProfileScreen extends StatelessWidget { arrivalType: arrivalType, from: from, to: to, + isInpatient:false + // isFromSearch:isFromSearch ) - : patientType == "1" + : isInpatient ? ProfileMedicalInfoWidgetInPatient( patient: patient, patientType: patientType, arrivalType: arrivalType, from: from, to: to, - ) + isInpatient:isInpatient, + + + ) : ProfileMedicalInfoWidget( patient: patient, patientType: patientType, arrivalType: arrivalType, from: from, to: to, + isInpatient:isInpatient ), ], ), diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index cb05d8a6..19ae8dd5 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -28,10 +28,11 @@ class RadiologyHomePage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; + bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) => - model.getPatientRadOrders(patient, patientType: patientType), + model.getPatientRadOrders(patient, patientType: patientType, isInPatient: isInpatient), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100], diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index 7de9bccf..91a29ee2 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -18,6 +18,7 @@ class PatientProfileButton extends StatelessWidget { final String url = "assets/images/"; final bool isDisable; final bool isLoading; + final bool isInpatient; final Function onTap; PatientProfileButton( @@ -33,7 +34,7 @@ class PatientProfileButton extends StatelessWidget { this.onTap, this.isLoading = false, this.from, - this.to}) + this.to, this.isInpatient}) : super(key: key); @override @@ -127,7 +128,8 @@ class PatientProfileButton extends StatelessWidget { 'from': from, 'to': to, 'patientType': patientType, - 'arrivalType': arrivalType + 'arrivalType': arrivalType, + '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 52e16416..131df93c 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -22,6 +22,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; + final bool isInpatient; ProfileMedicalInfoWidget( {Key key, @@ -29,7 +30,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { this.patientType, this.arrivalType, this.from, - this.to}); + this.to, this.isInpatient}); @override Widget build(BuildContext context) { @@ -80,6 +81,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, + isInpatient:isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).service, @@ -165,7 +167,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).admission, nameLine2: TranslationBase.of(context).request, icon: 'patient/admission_req.png'), - if (patientType == "1") + if (isInpatient) PatientProfileButton( key: key, patient: patient, @@ -175,7 +177,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'patient/Progress_notes.png'), - if (patientType == "1") + if (isInpatient) 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 95c7630c..9be09f58 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 @@ -22,6 +22,9 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; + final bool isInpatient; + + ProfileMedicalInfoWidgetInPatient( {Key key, @@ -29,7 +32,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { this.patientType, this.arrivalType, this.from, - this.to}); + this.to, this.isInpatient}); @override Widget build(BuildContext context) { @@ -68,6 +71,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, + isInpatient: isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).result, 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 a9ca3d5f..7eba5c66 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -13,6 +13,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; + final bool isInpatient; ProfileMedicalInfoWidgetSearch( {Key key, @@ -20,7 +21,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { this.patientType, this.arrivalType, this.from, - this.to}); + this.to, this.isInpatient}); @override Widget build(BuildContext context) { @@ -68,6 +69,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, + isInpatient:isInpatient, route: RADIOLOGY_PATIENT, nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).service,