Produced by Araxis Merge on 6/22/2018 9:28:20 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | REFDOC_2.3_06072018.zip\REFDOC 2.3_06072018\NVCC\SQL | NVCC_usp_GetSensDx.sql | Thu Jun 7 16:53:36 2018 UTC |
| 2 | REFDOC_2.3_06072018.zip\REFDOC 2.3_06072018\NVCC\SQL | NVCC_usp_GetSensDx.sql | Fri Jun 22 12:39:06 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 228 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | USE [NWIC_ PanelMgmt] | |
| 2 | GO | |
| 3 | ||
| 4 | /****** Ob ject: Sto redProcedu re [App].[ NVCC_usp_G etSensDx] Script Date: 1/29 /2016 4:22 :36 PM *** ***/ | |
| 5 | SET ANSI_N ULLS ON | |
| 6 | GO | |
| 7 | ||
| 8 | SET QUOTED _IDENTIFIE R ON | |
| 9 | GO | |
| 10 | ||
| 11 | ||
| 12 | ALTER PROC EDURE [App ].[NVCC_us p_GetSensD x] | |
| 13 | -- Add the p arameters for the st ored proce dure here | |
| 14 | @p id bigint -- this is the patie ntsid | |
| 15 | --======== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 16 | --Requesto r : Non Va Coordin ated Care Project | |
| 17 | --Author : Jerr y Kohler ( Original s cript by D r. Charles Demosthen es) | |
| 18 | --Object/S P Name : NVCC _usp_GetSe nsDx | |
| 19 | --Server :
|
|
| 20 | --Data Bas e : NWIC _PanelMgmt | |
| 21 | --Schema : app | |
| 22 | --Report : N/A | |
| 23 | --Folder : N/A | |
| 24 | --Report L oc : N/A | |
| 25 | --Job : None | |
| 26 | --Job Loc : None | |
| 27 | --Note : | |
| 28 | --Date Cre ated : 01-2 0-2016 | |
| 29 | -- | |
| 30 | --Changed : 01-2 0-2016 | |
| 31 | --Changed By : Jerr y Kohler | |
| 32 | --Reason F or Change : Remo ved statio n paramete r; we want the data for the | |
| 33 | -- pati ent no mat ter where that patie nt was tre ated. | |
| 34 | -- | |
| 35 | --Changed : 01-2 9-2016 | |
| 36 | --Changed By : Jerr y Kohler | |
| 37 | --Reason F or Change : Cons olidated s ome querie s the scri pt was doi ng into fe wer, | |
| 38 | -- smal ler ones s ince we no w have a t able conta ining all of | |
| 39 | -- the sensitive diagnoses & ICD SIDS (9 & 10) | |
| 40 | -- | |
| 41 | --Purpose : Retr ieve any s ensitive d iagnoses t hat may ex ist for a | |
| 42 | -- pati ent. If t here are a ny, they r equire spe cial handl ing | |
| 43 | -- to d etermine w hich outso urce partn ers can kn ow about t hem. | |
| 44 | --======== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 45 | AS | |
| 46 | ||
| 47 | BEGIN | |
| 48 | -- dec lare @pid bigint; se t @pid=171 7444; | |
| 49 | -- SET NOCOU NT ON adde d to preve nt extra r esult sets from | |
| 50 | -- interferi ng with SE LECT state ments. | |
| 51 | SE T NOCOUNT ON; | |
| 52 | ||
| 53 | DECLAR E @flag in t; | |
| 54 | SET @f lag=0; | |
| 55 | ||
| 56 | -- Che ck all of a patient' s recorded diagnoses against o ur table o f sensitiv e | |
| 57 | -- dia gnoses, an d record t he various diagnosis flags. | |
| 58 | SELECT --TOP 300 0 | |
| 59 | iif (p.icd10SI D>0,p.ICD1 0SID,p.ICD 9SID) as C ode | |
| 60 | ||
| 61 | ,iif (p.icd10si d>0,'ICD10 ','ICD9') as CodingS ystem | |
| 62 | ||
| 63 | ,iif (p.icd10si d>0, | |
| 64 | (select to p 1 s.Abus eDx from A pp.NVCC_Se nsitiveDxC odes s whe re p.icd10 sid = s.IC DSID), | |
| 65 | (select to p 1 t.Abus eDx from A pp.NVCC_Se nsitiveDxC odes t whe re p.icd9s id = t.ICD SID)) as A buseDx | |
| 66 | ||
| 67 | ,iif (p.icd10si d>0, | |
| 68 | (select to p 1 s.Sick leDx from App.NVCC_S ensitiveDx Codes s wh ere p.icd1 0sid = s.I CDSID), | |
| 69 | (select to p 1 t.Sick leDx from App.NVCC_S ensitiveDx Codes t wh ere p.icd9 sid = t.IC DSID)) as SickleDx | |
| 70 | ||
| 71 | ,iif (p.icd10si d>0, | |
| 72 | (select to p 1 s.HIVD x from App .NVCC_Sens itiveDxCod es s where p.icd10si d = s.ICDS ID), | |
| 73 | (select to p 1 t.HivD x from App .NVCC_Sens itiveDxCod es t where p.icd9sid = t.ICDSI D)) as HIV Dx | |
| 74 | INTO #ptsdx | |
| 75 | FROM CDWWork.Ou tpat.VDiag nosis p | |
| 76 | JOIN App.NVCC_S ensitiveDx Codes x on (p.ICD9SI D = x.ICDS ID OR p.IC D10SID = x .ICDSID) | |
| 77 | WHERE PatientSI D in (sele ct PTSid f rom [app]. [udf_AllPa tientsSIDs ](@pid)); | |
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | IF (( select sum (abusedx) from #ptsd x) > 0) s et @flag=@ flag+1; | |
| 82 | IF (( select sum (HIVdx) fr om #ptsdx) > 0) s et @flag=@ flag+4; | |
| 83 | IF (( select sum (sickledx) from #pts dx) > 0) s et @flag=@ flag+16; | |
| 84 | ||
| 85 | ||
| 86 | -- Ch eck all of a patient 's recorde d ICD code s recorded on his pr oblem list | |
| 87 | -- ag ainst our table of s ensitive d iagnoses, and record the vario us | |
| 88 | -- di agnosis fl ags. | |
| 89 | SELEC T prb.ICD9 SID | |
| 90 | ,prb.ICD1 0SID | |
| 91 | ,prb.Pati entSID | |
| 92 | ,x.AbuseD x | |
| 93 | ,x.Sickle Dx | |
| 94 | ,x.HIVDx | |
| 95 | INTO #ptsprb | |
| 96 | FROM CDWWork.Ou tpat.Probl emList AS prb | |
| 97 | INNER JOIN App. NVCC_Sensi tiveDxCode s x on (pr b.ICD9SID = x.ICDSID OR prb.IC D10SID = x .ICDSID) | |
| 98 | WHERE PatientSI D in (sele ct PTSid f rom [app]. [udf_AllPa tientsSIDs ](@pid)) | |
| 99 | AND prb.Activ eFlag = 'A ' | |
| 100 | AND prb.probl emlistcond ition <> ' H'; | |
| 101 | ||
| 102 | if (( select sum (abusedx) from #ptsp rb) > 0) s et @flag=@ flag+2; | |
| 103 | if (( select sum (HIVDx) fr om #ptsprb ) > 0) s et @flag=@ flag+8; | |
| 104 | if (( select sum (SickleDx) from #pts prb)> 0) s et @flag=@ flag+32; | |
| 105 | ||
| 106 | ||
| 107 | drop table #pts dx; | |
| 108 | drop table #pts prb; | |
| 109 | ||
| 110 | selec t @flag as sensdxfla g; | |
| 111 | --exe c [app].[N VCC_usp_Ge tSensDx] @ pid=171744 4; | |
| 112 | end; | |
| 113 | ||
| 114 | ||
| 115 | GO |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.