The force-directed layout method is a classical approach used for knowledge graph visualization, and it distributes nodes in the visualization space uniformly through attractive and repulsive forces between nodes. However, since visualization of domain-specific knowledge graphs is often closely related to domain applications, the classical force-directed layout method cannot meet the visualization requirements of domain-specific knowledge graphs. Therefore, an improved force-directed layout method was proposed by analyzing the graph structure, data characteristics, and visualization requirements of query applications of medical record knowledge graphs, with the aim of supporting visualization technology for medical record knowledge graphs in clinical assisted diagnosis and treatment applications. In the method, based on the classical force-directed layout model, attractive force between nodes of the same level and same type, repulsive force between nodes of the same level but different types, and repulsive force between non-leaf and non-adjacent nodes to maintain the spacing were introduced. As a result, nodes of the same level and the same type were grouped into the same region, nodes of the same level but different types were distributed into separate regions, and nodes at different levels were distributed with reasonable spacing, thereby reducing node crowding and edge crossings; so that the data’s type characteristics, quantity characteristics, and community characteristics were revealed by the final generated visualization layout clearly. Additionally, node type and the number of same-level, same-type nodes were taken as factors determining edge length between nodes, and the node importance was represented through edge length, thereby further improving the rationality of the visualization layout and enhancing semantic visualization. Experimental results show that in terms of semantic visualization capability in vertical domains, the proposed method achieves an average improvement of 165.5% in the mean Node-Type Spatial Discriminability (NTSD) compared with the FR (Fruchterman-Reingold) method. As the visualization results, this method has better performance for electronic medical record knowledge graph visualization.