openmrs-android-sdk/src/main/java/com/openmrs/android_sdk/library/dao/VisitDAO.java
/**
     * Save or update observable.
     *
     * @param visit     the visit
     * @param patientId the patient id
     * @return the observable
     */
Save or update observable.
@param visit     the visit
@param patientId the patient id
@return the observable
Save or update observable . @param visit the visit @param patientId the patient id @return the observable
public Observable<Long> saveOrUpdate(Visit visit, long patientId) {
        return AppDatabaseHelper.createObservableIO(() -> {
            Long visitId = visit.getId();
            if (visitId == null) {
                visitId = getVisitsIDByUUID(visit.getUuid()).toBlocking().first();
            }
            if (visitId > 0) {
                updateVisit(visit, visitId, patientId);
            } else {
                visitId = saveVisit(visit, patientId);
            }
            return visitId;
        });
    }
public Observable < Long > saveOrUpdate ( Visit visit , long patientId ) { return AppDatabaseHelper . createObservableIO ( ( ) -> { Long visitId = visit . getId ( ) ; if ( visitId == null ) { visitId = getVisitsIDByUUID ( visit . getUuid ( ) ) . toBlocking ( ) . first ( ) ; } if ( visitId > 0 ) { updateVisit ( visit , visitId , patientId ) ; } else { visitId = saveVisit ( visit , patientId ) ; } return visitId ; } ) ; }
Save or update observable.
Save or update observable .