Electronic health records (EHR) are rich heterogeneous collections of patient health information, whose broad adoption provides clinicians and researchers unprecedented opportunities for health informatics, disease-risk prediction, actionable clinical recommendations, and precision medicine. However, EHRs present several modeling challenges, including highly sparse data matrices, noisy irregular clinical notes, arbitrary biases in billing code assignment, diagnosis-driven lab tests leading to not-missing-at-random (NMAR) biases, and heterogeneous data types across clinical notes, billing codes, lab tests, and medications. To address these challenges, we present MixEHR, a multi-view Bayesian framework related to collaborative filtering and latent topic models for EHR data integration and modeling.To represent the latent disease mixture memberships for each patient, we factorize the highdimensional matrices of each clinical data type into a lower-rank basis matrix, and a common loading matrix that spans data types. We explicitly model the distribution of lab tests (e.g., lymphocyte cell counts) and lab results (e.g, abnormal or normal) as conditionallyindependent variables given latent disease variables, thereby accounting for NMAR mechanisms. To learn the model parameters, we introduce an efficient variational inference algorithm and its online-learning stochastic counterpart. We demonstrate the utility of our framework using real-world EHR data from the MIMIC-III database, Mayo Clinic Bipolar Disorder dataset, and 28-year longitudinal outpatient data extracted from Quebec Congenital Heart Disease database. Qualitatively, despite the extreme sparsity of the data, we find that MixEHR disease topics cluster into meaningful modules by their latent embeddings, and capture meaningful combinations of clinical features across heterogeneous data types, including labs, medications, procedures, and patient notes. Quantitatively, we observe superior prediction accuracy of diagnostic code and lab test imputation compared to the state-of-art methods. Finally, we leverage the learned lower dimensional patient mixture projections to predict prospective mortality of patients in critical conditions and classify bipolar disorder disease of the Mayo Clinic subjects. In all comparison, our proposed framework confers competitive performance compared to existing methods and reveals several meaningful disease topics related to the phenotypes of interest.