At present, there are many problems in the existing content-based medical image retrieval (CBMIR) algorithms. The most important problem is the lack of feature extraction, resulting in the imperfect expression of semantic information and the lack of data-based learning ability. Meanwhile, the characteristic dimension is high, which affects the performance of image retrieval. In order to solve these problems, this paper presents a fully convolutional dense network (FCDN) algorithm, which solves the gap between the extracted lowlevel features and high-level semantic features. In order to improve the accuracy and efficiency of retrieval, the concept of Joint distance is proposed in this paper. Since the image information of lung nodules extracted from different layers of the network is different, the minimum Joint distance is selected by comparing the minimum Hamming distances of the layers 4, 17 and 25 of the similar images retrieved. Compared with other methods, the average accuracy of the lung nodule image retrieval can reach 91.17% under the 64-bit hash code length, the average time for retrieving a lung slice is 4.8×10-5 s, The search results not only express the rich semantic features of the image, but also improve the retrieval efficiency. And the retrieval performance is better than other network structures to help doctors assist in diagnosis.