公式
P t = { D c u r + T p if ( D c u r + T p ) > ( D c u r + T d ) D c u r + T p + 1 d a y if ( D c u r + T p ) ≤ ( D c u r + T d ) P_t = \begin{cases} D_{cur}+T_p &\text{if } ( D_{cur}+T_p) \gt ( D_{cur}+T_d) \\ D_{cur}+T_p+1_{day} &\text{if } ( D_{cur}+T_p) \leq ( D_{cur}+T_d) \end{cases} Pt={Dcur+TpDcur+Tp+1dayif (Dcur+Tp)>(Dcur+Td)if (Dcur+Tp)≤(Dcur+Td)
- P t P_t Pt: 服药日期和时间
- D c u r D_{cur} Dcur: 发药日期
- T p T_p Tp: 服药时间
- 1 d a y 1_{day} 1day: 1天
- T d T_d Td: 跨天时间
应用
示例:今日(2024/08/07 09:46:03)上午使用设备分包当日下午16点到第二日16点之间的长期医嘱。其频次为Tid,对应定义该频次的服药时间为(8:00:00、12:00:00、18:00:00)。
已知:
D c u r = 2024 / 08 / 07 D_{cur}=2024/08/07 Dcur=2024/08/07
T p = { 08 : 00 : 00 12 : 00 : 00 18 : 00 : 00 T_{p}=\begin{cases} 08:00:00 \\ 12:00:00 \\ 18:00:00 \end{cases} Tp=⎩ ⎨ ⎧08:00:0012:00:0018:00:00
T d = 16 : 00 : 00 T_{d}=16:00:00 Td=16:00:00
根据公式可以计算出服药时间:
P t = { 2024 / 08 / 07 08 : 00 : 00 + 1 d a y ( 2024 / 08 / 07 08 : 00 : 00 ) < ( 2024 / 08 / 07 16 : 00 : 00 ) 2024 / 08 / 07 12 : 00 : 00 + 1 d a y ( 2024 / 08 / 07 12 : 00 : 00 ) < ( 2024 / 08 / 07 16 : 00 : 00 ) 2024 / 08 / 07 18 : 00 : 00 ( 2024 / 08 / 07 18 : 00 : 00 ) > ( 2024 / 08 / 07 16 : 00 : 00 ) P_t = \begin{cases} 2024/08/07\space08:00:00 + 1_{day} {\space\space\space } ( 2024/08/07\space08:00:00) \lt ( 2024/08/07\space16:00:00) \\ 2024/08/07\space12:00:00 + 1_{day} {\space\space\space } ( 2024/08/07\space12:00:00) \lt ( 2024/08/07\space16:00:00) \\ 2024/08/07\space18:00:00 {\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space } ( 2024/08/07\space18:00:00) \gt ( 2024/08/07\space16:00:00) \end{cases} Pt=⎩ ⎨ ⎧2024/08/07 08:00:00+1day (2024/08/07 08:00:00)<(2024/08/07 16:00:00)2024/08/07 12:00:00+1day (2024/08/07 12:00:00)<(2024/08/07 16:00:00)2024/08/07 18:00:00 (2024/08/07 18:00:00)>(2024/08/07 16:00:00)
P t = { 2024 / 08 / 08 08 : 00 : 00 2024 / 08 / 08 12 : 00 : 00 2024 / 08 / 07 18 : 00 : 00 P_t = \begin{cases} 2024/08/08\space08:00:00 \\ 2024/08/08\space12:00:00 \\ 2024/08/07\space18:00:00 \end{cases} Pt=⎩ ⎨ ⎧2024/08/08 08:00:002024/08/08 12:00:002024/08/07 18:00:00