Difference between revisions of "Problem Views"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | They are stored in Problem.ProblemIncludeFlags. This field is a bitmask, so you'll have to do a bitwise OR (ampersand in T-SQL) to determine whether a problem is in a particular view. The bit values and sample query are below. | + | They are stored in Problem.ProblemIncludeFlags. This field is a bitmask, so you'll have to do a bitwise OR (ampersand in T-SQL) to determine whether a problem is in a particular view. The bit values and sample query are below. |
+ | |||
− | Currently, a problem may only be in one of the bottom four views (PMH, PSH, | + | Currently, a problem may only be in one of the bottom four views (PMH, PSH, PHx, FHx) and in active. In short, you can make querying more efficient by comparing integer values. For example, if you wanted to pull any problems in Family History, you could have your WHERE clause look like: WHERE ProblemIncludeFlags IN (16, 17). 16 Would be Family History only, 17 would be FHx + Active. |
− | + | ||
− | 0x00000001 -- Active | + | |
− | 0x00000002 -- PMH (Past Medical History) | + | Decimal values: |
− | 0x00000004 -- PSH (Past Surgical History) | + | * 1 -- Active |
− | 0x00000008 -- | + | * 2 -- PMH (Past Medical History) |
− | 0x00000010 -- | + | * 4 -- PSH (Past Surgical History) |
− | + | * 8 -- PHx (Personal / Social History) | |
− | < | + | * 16 -- FHx (Family History) |
+ | |||
+ | |||
+ | Hex values: | ||
+ | * 0x00000001 -- Active | ||
+ | * 0x00000002 -- PMH (Past Medical History) | ||
+ | * 0x00000004 -- PSH (Past Surgical History) | ||
+ | * 0x00000008 -- PHx (Personal / Social History) | ||
+ | * 0x00000010 -- FHx (Family History) | ||
+ | |||
+ | |||
+ | Common combined values: | ||
+ | * 1 -- Active | ||
+ | * 2 -- PMH | ||
+ | * 3 -- Active, PMH | ||
+ | * 4 -- PSH | ||
+ | * 5 -- Active, PSH | ||
+ | * 8 -- PHx | ||
+ | * 9 -- Active, PHx | ||
+ | * 16 -- FHx | ||
+ | * 17 -- Active, FHx | ||
+ | * 18 -- PMH, FHx | ||
+ | * 20 -- PSH, FHx | ||
+ | * 24 -- PHx, FHx | ||
+ | |||
+ | |||
+ | <source lang=tsql> | ||
-- Select all PMH problems for a particular patient | -- Select all PMH problems for a particular patient | ||
SELECT * FROM Problem p (NOLOCK) | SELECT * FROM Problem p (NOLOCK) | ||
Line 15: | Line 42: | ||
WHERE ph.PatientID = 182484 | WHERE ph.PatientID = 182484 | ||
AND (p.ProblemIncludeFlags & 0x00000002) <> 0 | AND (p.ProblemIncludeFlags & 0x00000002) <> 0 | ||
− | </ | + | </source> |
Revision as of 01:13, 5 May 2010
They are stored in Problem.ProblemIncludeFlags. This field is a bitmask, so you'll have to do a bitwise OR (ampersand in T-SQL) to determine whether a problem is in a particular view. The bit values and sample query are below.
Currently, a problem may only be in one of the bottom four views (PMH, PSH, PHx, FHx) and in active. In short, you can make querying more efficient by comparing integer values. For example, if you wanted to pull any problems in Family History, you could have your WHERE clause look like: WHERE ProblemIncludeFlags IN (16, 17). 16 Would be Family History only, 17 would be FHx + Active.
Decimal values:
- 1 -- Active
- 2 -- PMH (Past Medical History)
- 4 -- PSH (Past Surgical History)
- 8 -- PHx (Personal / Social History)
- 16 -- FHx (Family History)
Hex values:
- 0x00000001 -- Active
- 0x00000002 -- PMH (Past Medical History)
- 0x00000004 -- PSH (Past Surgical History)
- 0x00000008 -- PHx (Personal / Social History)
- 0x00000010 -- FHx (Family History)
Common combined values:
- 1 -- Active
- 2 -- PMH
- 3 -- Active, PMH
- 4 -- PSH
- 5 -- Active, PSH
- 8 -- PHx
- 9 -- Active, PHx
- 16 -- FHx
- 17 -- Active, FHx
- 18 -- PMH, FHx
- 20 -- PSH, FHx
- 24 -- PHx, FHx
-- Select all PMH problems for a particular patient
SELECT * FROM Problem p (NOLOCK)
INNER JOIN Problem_Header ph (NOLOCK) ON ph.CurrentProblemID = p.ID
WHERE ph.PatientID = 182484
AND (p.ProblemIncludeFlags & 0x00000002) <> 0