openmrs-android-sdk/src/main/java/com/openmrs/android_sdk/library/api/services/EncounterService.java
/**
     * Add encounter.
     *
     * @param encountercreate  the encountercreate
     * @param callbackListener the callback listener
     */
Add encounter.
@param encountercreate  the encountercreate
@param callbackListener the callback listener
Add encounter . @param encountercreate the encountercreate @param callbackListener the callback listener
public void addEncounter(final Encountercreate encountercreate, @Nullable DefaultResponseCallback callbackListener) {
        if (NetworkUtils.isOnline()) {
            new VisitDAO().getActiveVisitByPatientId(encountercreate.getPatientId())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(visit -> {
                        if (visit != null) {
                            encountercreate.setVisit(visit.getUuid());
                            if (callbackListener != null) {
                                syncEncounter(encountercreate, callbackListener);
                            } else {
                                syncEncounter(encountercreate);
                            }
                        } else {
                            startNewVisitForEncounter(encountercreate);
                        }
                    });
        } else {
            ToastUtil.error(getString(R.string.form_data_will_be_synced_later_error_message));
        }
    }
public void addEncounter ( final Encountercreate encountercreate , @ Nullable DefaultResponseCallback callbackListener ) { if ( NetworkUtils . isOnline ( ) ) { new VisitDAO ( ) . getActiveVisitByPatientId ( encountercreate . getPatientId ( ) ) . observeOn ( AndroidSchedulers . mainThread ( ) ) . subscribe ( visit -> { if ( visit != null ) { encountercreate . setVisit ( visit . getUuid ( ) ) ; if ( callbackListener != null ) { syncEncounter ( encountercreate , callbackListener ) ; } else { syncEncounter ( encountercreate ) ; } } else { startNewVisitForEncounter ( encountercreate ) ; } } ) ; } else { ToastUtil . error ( getString ( R . string . form_data_will_be_synced_later_error_message ) ) ; } }
Add encounter.
Add encounter .