This study proposes an artificial intelligence of things (AIoT) system for electrocardiogram (ECG) analysis and cardiac disease detection. The system includes a front-end IoT-based hardware, a user interface on smart device's application (APP), a cloud database, and an AI platform for cardiac disease detection. The front-end IoT-based hardware, a wearable ECG patch that includes an analog front-end circuit and a Bluetooth module, can detect ECG signals. The APP on smart devices can not only display users' real-time ECG signals but also label unusual signals instantly and reach real-time disease detection. These ECG signals will be uploaded to the cloud database. The cloud database is used to store each user's ECG signals, which forms a big-data database for AI algorithm to detect cardiac disease. The algorithm proposed by this study is based on convolutional neural network and the average accuracy is 94.96%. The ECG dataset applied in this study is collected from patients in Tainan Hospital, Ministry of Health and Welfare. Moreover, signal verification was also performed by a cardiologist.