In the field of natural language processing, relation extraction (RE) aims to identify the relationship between entities from text and is a vital step for subsequent tasks such as question answering and Knowledge Graph (KG). Comparing to the general domain text the relationship extraction from electronic medical records (EMRs) is more challenging due to the high-density distribution of entities of EMRs. In addition, relationship extraction usually suffers from the long-tail problem. The training data mainly focuses on a few types of relations, leading to the lack of sufficient annotations for the remaining types of relations, which is more severe in electronic medical records. To address the above problems, this paper proposes a segmented attentional Convolutional Neural Network (CNN+SegAtt) for medical relationship extraction and combines it with modified typed entity representations, which significantly improve the semantic learning ability from electronic medical records. A loss function with category weights is also proposed to facilitate the extraction of long-tail relationships. Experiments are conducted on the publicly available medical corpus 2010 i2b2/VA. The results show that the value of F1 reached 73.13%, better than that of existing methods, and the values of F1 for the small category samples are also significantly improved.