Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding readmissions within 28 days of a previous discharge 3

Status
Not open for further replies.

ap22

Technical User
May 26, 2003
6
AU
Hi

I need to write a query that lists details on patients readmitted to hospital within 28 days of their last discharge. The table has been designed so each admission has a separate row in the admission table. I am able to write a duplicate query on the patient id so that all the patients who came in more than once within a two month specified period are displayed. However I have not been able to work out how to only show details of those patients in the two month period specified who were readmitted within 28 days of their last discharge.

Any help would be greatly appreciated
ap22
 
Assume a table called PatientAdmit with the following structure:

PatientID
AdmitDate

The follwing query will provide you what you need:

SELECT PatientAdmit.patientID, PatientAdmit.admitDate, Min(PatientAdmit_1.admitDate) AS MinOfadmitDate, Min([patientAdmit_1].[admitDate])-[patientAdmit].[admitDate] AS Day_span
FROM PatientAdmit INNER JOIN PatientAdmit AS PatientAdmit_1 ON PatientAdmit.patientID = PatientAdmit_1.patientID
WHERE (((PatientAdmit_1.admitDate)>[patientAdmit].[admitDate]))
GROUP BY PatientAdmit.patientID, PatientAdmit.admitDate
HAVING (((Min([patientAdmit_1].[admitDate])-[patientAdmit].[admitDate])<=28));

Just paste the preceeding text into a query in SQL view.


Here's an example of what the query would yield on this data set:

patientID admitDate
1111 12/2/2002
1111 1/1/2003
1111 1/29/2003
1111 2/14/2003
1111 2/16/2003
2222 2/1/2002
2222 8/14/2002

Query yields:

patientID admitDate MinOfadmitDate Day_span
1111 1/1/2003 1/29/2003 28
1111 1/29/2003 2/14/2003 16
1111 2/14/2003 2/16/2003 2
 
Code:
SELECT DISTINCTROW PoHeader.PoNum, PoHeader_1.PoNum, PoHeader.SchId, PoHeader.PoDt, PoHeader_1.PoDt, (DateDiff(&quot;d&quot;,[PoHeader].[PoDt],[PoHeader_1].[PoDt])) AS DeltDays
FROM PoHeader LEFT JOIN PoHeader AS PoHeader_1 ON PoHeader.SchId = PoHeader_1.SchId
WHERE ((((DateDiff(&quot;d&quot;,[PoHeader].[PoDt],[PoHeader_1].[PoDt])))>0 And ((DateDiff(&quot;d&quot;,[PoHeader].[PoDt],[PoHeader_1].[PoDt])))<29))
ORDER BY PoHeader.PoNum
WITH OWNERACCESS OPTION;

Obviously, you need some work re the above to come even close to matching YOUR db structure, such as changing hte table and field names. After that, there remains several issues:

[tab]All matches are listed individually, so that for instance a record (admission) occured four tmes is shpown as four seperate entries.

[tab]The syntax shown does not include any date range limitation, thus ALL re-admissionw with the specified interval will be shown, regardless of when such occured, so you would need to add the daterange criteria into your query. That raises the question which is less straight fporward. Wheather to include re-admissions when ONE of the admission dats falls into the range but the other does not? For example, If a data range of last year were used (5/26/2002 to 5/26/2003) and a parient was admitted on 5/14/2002, discharged on 5/17/2002, and (re) admitted on 5/27/2002), should htat count as a readmission, and thus be shown?

[tab]The 'parameters' are fixed (i.e. the interval considered is one to 28 days). In general, fixed parameter would be avoided as it SEVERLY limits the flexability / use of the query -OR- greatly increases the effort / work involved in it's use.



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Thanks for that I used Micheal's answer as I tried mpastore but kept getting a message about using an aggregrate function which I could not solve. I am now getting everyone readmitted within 28 days. Thanks for the added comments Michael.I have to do this query every month for the hospital so no patient gets missed as we look back at all data for the month preceding. Before this we had to do it manually so everyone here thanks you both for your help.

ap22
 
ap22-

Don't be too quick with the kudos. If the real problem, as stated in your title and original posting, is &quot;Finding readmissions within 28 days of a previous discharge&quot; you might look close at the two responses and see if you find any reference to a discharge date. I couldn't!

Instead, what appeared was a comparison between carefully sculpted sample admittance dates. Definitely not the same thing.

If you think the problem--as originally stated--is solved, you might want to look a little closer.
 
app22,

You are absolutely right, star for you. Here is modified logic for following table:

patientID admitDate DischDate
1111 12/2/2002 12/4/2002
1111 12/14/2002 1/1/2003
1111 1/29/2003 2/3/2003
1111 2/14/2003 2/25/2003
1111 3/28/2003 3/29/2003
2222 2/1/2002 4/4/2002
2222 8/14/2002 8/23/2002
Table: patient_admit

Query:

SELECT Patient_Admit.patientID, Patient_Admit.DischDate, Min(PatientAdmit_1.admitDate) AS MinOfadmitDate, Min(patientAdmit_1.admitDate)-Patient_Admit.DischDate AS Day_span
FROM Patient_Admit INNER JOIN Patient_Admit AS PatientAdmit_1 ON Patient_Admit.patientID = PatientAdmit_1.patientID
WHERE (((PatientAdmit_1.admitDate)>[Patient_Admit].[DischDate]))
GROUP BY Patient_Admit.patientID, Patient_Admit.DischDate
HAVING (((Min([patientAdmit_1].[admitDate])-[Patient_Admit].[DischDate])<=28));

Yields:


patientID DischDate MinOfadmitDate Day_span
1111 12/4/2002 12/14/2002 10
1111 1/1/2003 1/29/2003 28
1111 2/3/2003 2/14/2003 11
 
Sorry, I meant that star for raskew, but app22 you deserve also for my earlier shortcomings. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top