2019-08-09:中位数计算
2019-08-09 本文已影响0人
AI_Finance
select "首剂抗生素中位数" as "指标名称", first_time as "数值" from
(
select @ID:=@ID+1 AS ID, first_time from
(
select detail.uuid, TIMESTAMPDIFF(HOUR, csa.admission_date, if(antibiotic_execute_date is not null, antibiotic_execute_date, antibiotic_create_date)) as first_time from cap_statistics_antibiotic as csa
join yd_patient_11_basic_info as detail
on detail.uuid=csa.uuid
-- where { discharge_date BETWEEN [ startTime2 ]} AND {[ endTime2 ]}
-- AND { inpatient_department = [ inpatient_department ]}
-- AND { disease_name = [disease_class_name ]}
-- AND { diagnosis_category = [ diagnose_class_name ]}
) as a, (SELECT @ID:=0) as b
order by first_time
) t where id = ((@ID+1) div 2)