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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by Primary Diagnosis but display all diagnosis

Status
Not open for further replies.

pbohio

Programmer
Aug 23, 2010
3
US
I have a report that categorizes diagnosis into groups such as Pressure Ulcers, Surgical Wounds, etc. based on Diagnosis Order of 1 and the Diagnosis code.

I'm trying to group by the category, by patient, and include all other diagnosis for that patient under the main diagnosis category.

Example:
Pressure Ulcer

Jane Doe diacode 123 diaord 1 pressure ulcer
Jane Doe diacode 345 diaord 2 surgical wound
John Doe diacode 123 diaord 1 pressure ulcer
John Doe diacode 139 diaord 2 Celllitis

Open Wound
Peter Pan diacode 689 diaord 1 Open Wound
Peter Pan diacode 987 diaord 2 Osteo
Peter Pan diacode 884 diaord 3 Ulcer
Captain Hook diacode 689 diaord 1 Open Wound

When I group by the category, then the patient shows up under multiple categories. I've tried writing the details to the patient footer and that doesn't work either.

Any suggestions?

Thanks!

 
Create a SQL expression {%diagcat1}:

(
select max(`diagnosiscategory`)
from table A
where A.`diaord` = 1 and
A.`patientID` = table.`patientID`
)

The punctuation depends upon your datasource. If you cannot get this to compile, please copy and paste the SQL expression you tried into this thread.

Insert a group on {%diagcat1} and a second group on patient, and sort by diaord.

-LB
 
I'm fine with the sql experssion. However, to determine the names for the categories I had to create a formula. This what I need to group on for the primary diagnosis and show the secondary diagnosis under the primary category. Make sense?

WhileReadingRecords;
stringvar DiaDsc;
If {AdmDia.DiaOrd}=1 then
if {AdmDia.DiaCod} in ['99832', '99831','99830', '99883', 'V5831', '99851', '99859', '99760', '99762','99769', '9986'] then
diadsc :='Surgical Wounds' else

if {AdmDia.DiaCod} in ['4541', '4540', '4542', '4548', '45981'] then
diadsc :='Venus Ulcers' else

if {AdmDia.DiaCod} in ['70713', '70712', '70714', '70710', '70715', '70719', '70711', '7078', '7079']then
diadsc := 'Ulcers' else
diadsc :='Primary Diagnosis is Not Wound';
diadsc
 
Change the SQL expression to {%diacod}:

(
select max(`diacod`)
from table A
where A.`diaord` = 1 and
A.`patientID` = table.`patientID`
)

Then create a formula like this:

if {%diacod} in ['99832', '99831','99830', '99883', 'V5831', '99851', '99859', '99760', '99762','99769', '9986'] then
"Surgical Wounds" else
if {%diacod} in ['4541', '4540', '4542', '4548', '45981'] then
"Venus Ulcers" else
if {%diacod} in ['70713', '70712', '70714', '70710', '70715', '70719', '70711', '7078', '7079'] then
"Ulcers" else
"Primary Diagnosis is Not Wound"

Insert a group #1 on this and then a group on patient.

Not sure what you are intending for secondary diagnoses. The above should result in patients appearing in only one group #1, with their other records nested within the patient group.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top