\begin{tikzpicture}[node distance=2.5cm]
\tikzstyle{process} = [rectangle, minimum width=1.5cm, minimum height=0.8cm, text centered, draw=black]
\tikzstyle{resource} = [rectangle, minimum height=0.8cm, text centered]
\tikzstyle{arrow} = [thick,->,>=stealth]
\node (start)[process] {ward};
\node (stage1)[process, right of=start, xshift= 0.5cm]{PHU};
\node (stage2)[process, right of=stage1]{OR};
\node (stage3)[process, right of=stage2, xshift=0.5cm]{PACU};
\node (stage4)[process, right of=stage3]{ICU};
\node (nurse)[resource, below of=stage1, yshift=0.6cm, xshift= 1.25cm]{nurses (circulating/scrub/anesthetist)};
\node (surgeon)[resource, above of=stage2, yshift= -1cm, text width=5cm]{surgeons/anesthesiologist/ tools and equipment};
\node (bed)[resource, below of=stage3, yshift= 1.2cm]{recovery bed};
\node (discharge)[resource, below of=start, yshift= 1.2cm]{patient discharge};
\node (arrival)[resource, left of=start, text width=1.3cm]{patient arrival};
\draw [arrow] (arrival)--(start);
\draw [arrow] (start)--(stage1);
\draw [arrow] (start)--(discharge);
\draw [arrow] (nurse)--(stage1);
\draw [arrow] (stage1)--(stage2);
\draw [arrow] (nurse)--(stage2);
\draw [arrow] (surgeon)--(stage2);
\draw [arrow] (stage2)--(stage3);
\draw [arrow] (bed)--(stage3);
\draw [arrow, densely dashed] (stage3)--(stage4);
\draw [arrow] (nurse)-|(stage4);
\draw [arrow] (stage3) -- +(0,2.2) -| (start);
\draw [arrow, densely dashed] (stage4) -- +(0,2.2) -- +(-2.5,2.2);
\end{tikzpicture}
答案1
您可以使用|-
来确定正确的点
笔记:
- 我给改变的线条添加了颜色,以便于定位(将来要记住这一点平均能量损失)。
- 根据薛定谔的猫的评论,我将 替换为
\tikzstyle
。\tikzset
参见应该使用 \tikzset 还是 \tikzstyle 来定义 TikZ 样式? 。 - 从 |- 线中间连接
|-
可能是关于使用和的有用参考-|
。
代码:
\documentclass[10pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[node distance=2.5cm]
\tikzset{process/.style={rectangle, minimum width=1.5cm, minimum height=0.8cm, text centered, draw=black}}
\tikzset{resource/.style={rectangle, minimum height=0.8cm, text centered}}
\tikzset{arrow/.style={thick,->,>=stealth}}
\node (start)[process] {ward};
\node (stage1)[process, right of=start, xshift= 0.5cm]{PHU};
\node (stage2)[process, right of=stage1]{OR};
\node (stage3)[process, right of=stage2, xshift=0.5cm]{PACU};
\node (stage4)[process, right of=stage3]{ICU};
\node (nurse)[resource, below of=stage1, yshift=0.6cm, xshift= 1.25cm]{nurses (circulating/scrub/anesthetist)};
\node (surgeon)[resource, above of=stage2, yshift= -1cm, text width=5cm]{surgeons/anesthesiologist/ tools and equipment};
\node (bed)[resource, below of=stage3, yshift= 1.2cm]{recovery bed};
\node (discharge)[resource, below of=start, yshift= 1.2cm]{patient discharge};
\node (arrival)[resource, left of=start, text width=1.3cm]{patient arrival};
\draw [arrow] (arrival)--(start);
\draw [arrow] (start)--(stage1);
\draw [arrow] (start)--(discharge);
\draw [arrow, <-, red] (stage1) -- (stage1 |- nurse.north);
\draw [arrow] (stage1)--(stage2);
\draw [arrow, <-, blue] (stage2) -- (stage2 |- nurse.north);
\draw [arrow] (surgeon)--(stage2);
\draw [arrow] (stage2)--(stage3);
\draw [arrow] (bed)--(stage3);
\draw [arrow, densely dashed] (stage3)--(stage4);
\draw [arrow] (nurse)-|(stage4);
\draw [arrow] (stage3) -- +(0,2.2) -| (start);
\draw [arrow, densely dashed] (stage4) -- +(0,2.2) -- +(-2.5,2.2);
\end{tikzpicture}
\end{document}