Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Number of days patient was on ventilator

$
0
0

Here is the sample data.

Ventilator info by patient visit

The problem with the data is the patient is put on ventilator from time to time if you see for the patient_id 3 with a visit id of 300 he was put on ventilator multiple times during his course of stay in the hospital.

Say the pateint 3 was put on ventilator from Feb 05 to Feb 11 which comes up to 7 days. Even if he is put on ventilator for an hour that  day it is counted as 1 day. Even though there are two rows for patient 3 Feb 11 is already included from Feb 05 to Feb 11 window, the sql must give count only 7 days.

Again, if you look patient 4 with visit 150 he has vent from Jan 18 - Jan 20 =3 days and Jan 20- Jan 23 =3 days not 4 as Jan 20 is already taken in above 3 day window.

could any one please help to nail this down.

Thanks Everyone in advance.



Mahanaz Syed


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>