赞
踩
在 MIMIC-IV 中,如果要求同一个ID的上一行的入院日期减去下一行的出院日期,可以使用如下 SQL 代码:
- WITH base_data AS (
- SELECT
- id,
- admit_dt,
- discharge_dt,
- LAG(discharge_dt) OVER (PARTITION BY id ORDER BY admit_dt) AS prev_discharge_dt
- FROM admissions
- )
- SELECT
- id,
- admit_dt - prev_discharge_dt AS time_between_stays
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。