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_GetLabs.sql | Thu Jun 7 16:53:36 2018 UTC |
| 2 | REFDOC_2.3_06072018.zip\REFDOC 2.3_06072018\NVCC\SQL | NVCC_usp_GetLabs.sql | Fri Jun 22 12:37:39 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 218 |
| 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 | SET ANSI_N ULLS ON | |
| 5 | GO | |
| 6 | ||
| 7 | SET QUOTED _IDENTIFIE R ON | |
| 8 | GO | |
| 9 | ||
| 10 | ||
| 11 | CREATE PRO CEDURE [ap p].[NVCC_u sp_GetLabs ] | |
| 12 | -- Add the p arameters for the st ored proce dure here | |
| 13 | @p id bigint --this i s the pati entSID | |
| 14 | AS | |
| 15 | --======== ========== ========== ========== ========== ========== ========== ========== === | |
| 16 | --Requesto r : Non Va C oordinated Care Proj ect | |
| 17 | --Author : Jerr y Kohler ( Original s cript by D r. Charles Demosthen es) | |
| 18 | --Object/S P Name : NVCC_u sp_GetLabs | |
| 19 | --Server :
|
|
| 20 | --Data Bas e : NWIC_Pan elMgmt | |
| 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-0 6-2016 | |
| 29 | -- | |
| 30 | --Last Cha nged : 02-1 8-2016 | |
| 31 | --Last Cha nged By : Jerry Kohler - N orthwest I nnovation Center (NW IC) | |
| 32 | --Reason F or Change : Reques t to also provide th e name of the statio n. | |
| 33 | -- | |
| 34 | --Changed : 02-1 6-2016 | |
| 35 | --Changed By : Jerry Kohl er - North west Innov ation Cent er (NWIC) | |
| 36 | --Reason F or Change : We onl y want the most rece nt value f or any of the | |
| 37 | -- labs . | |
| 38 | -- | |
| 39 | --Changed : 01-1 2-2016 | |
| 40 | --Changed By : Jerry Kohl er - North west Innov ation Cent er (NWIC) | |
| 41 | --Reason F or Change : Remove d station parameter in order t o expand t he search | |
| 42 | -- for a patient' s labs fro m a single station t o any | |
| 43 | -- stat ion a pati ent is ass ociated wi th by acqu iring all | |
| 44 | -- Pati entSIDs fr om the pas sed SIDs I CN. | |
| 45 | -- | |
| 46 | --Changed : 01-1 1-2016 | |
| 47 | --Changed By : Jerry Kohl er - North west Innov ation Cent er (NWIC) | |
| 48 | --Reason F or Change : Integr ated into the NWIC l ab process whereby l ab test | |
| 49 | -- name s are dete rmined by combinatio ns of LOIN C or workl oad | |
| 50 | -- code s, and not relying o n the faci lities to normalize or | |
| 51 | -- stan dardize th eir lab te st names. | |
| 52 | -- | |
| 53 | --Purpose : Retr ieve resul ts for cer tain lab t ests withi n the last 15 | |
| 54 | -- mont hs and pas s that dat a back to the NVCC a pplication . | |
| 55 | --======== ========== ========== ========== ========== ========== ========== ========== === | |
| 56 | BEGIN | |
| 57 | -- SET NOCOUNT ON added to prevent ex tra result sets from | |
| 58 | -- inte rfering wi th SELECT statements . | |
| 59 | SET NOC OUNT ON; | |
| 60 | ||
| 61 | WITH La bsLast15Mo nths AS | |
| 62 | ( | |
| 63 | SELECT lab.Sta3n | |
| 64 | , lab.LabChe mSID | |
| 65 | , tst.LabChe mTestName | |
| 66 | , tst.LabChe mPrintTest Name | |
| 67 | , lab.LabChe mSpecimenD ateTime | |
| 68 | , lab.LabChe mResultVal ue | |
| 69 | , iif(lab.Un its is null,' ',l ab.Units) as units | |
| 70 | , iif(lab.Ab normal is null,' ',l ab.Abnorma l) as abno rmal | |
| 71 | , iif(lab.Re fHigh is null,' ',l ab.RefHigh ) as RefHi gh | |
| 72 | , iif(lab.Re fLow is null,' ',l ab.RefLow) as RefLow | |
| 73 | , lab.LabChe mResultNum ericValue | |
| 74 | , lab.LabChe mTestSID | |
| 75 | , lab.Patien tSID | |
| 76 | , ROW_NUMBER () over (p artition b y tst.LabC hemTestNam e order by lab.LabCh emSpecimen DateTime D ESC) AS Ro wNum | |
| 77 | FROM C DWWork.Che m.LabChem AS lab | |
| 78 | INNER J OIN CDWWor k.dim.LabC hemTest AS tst ON la b.LabChemT estSID = t st.LabChem TestSID | |
| 79 | WHERE l ab.patient sid IN (Se lect PtSID from App. udf_AllPat ientsSIDs( @pid)) | |
| 80 | AND l ab.LabChem TestSID IN (Select r .LabChemTe stSID | |
| 81 | From [ NWIC_Panel Mgmt].[Pan elMgmt].[P MMasterLab Index] r | |
| 82 | Where r .TestGroup IN (Selec t Distinct s.TestGro up | |
| 83 | Fro m [NWIC_Pa nelMgmt].[ PanelMgmt] .[PMMaster CohortLabT estGroups] s | |
| 84 | Joi n [NWIC_Pa nelMgmt].[ PanelMgmt] .[PMMaster LabTestGro upsCohort] t | |
| 85 | O n t.TestGr oup = s.Te stGroup | |
| 86 | Wher e t.Cohort = 'NVCC') | |
| 87 | ) --Patie nt SID 244 0025 is a good test case | |
| 88 | AND l ab.LabChem CompleteDa teTime >= DATEADD(mo nth, -15, GETDATE()) | |
| 89 | ) | |
| 90 | ||
| 91 | SELECT Sta3n | |
| 92 | , App.udf_St ationName (Sta3n) AS StationNa me | |
| 93 | , LabChemSID | |
| 94 | , LabChemTes tName | |
| 95 | , LabChemPri ntTestName | |
| 96 | , LabChemSpe cimenDateT ime | |
| 97 | , LabChemRes ultValue | |
| 98 | , units | |
| 99 | , abnormal | |
| 100 | , RefHigh | |
| 101 | , RefLow | |
| 102 | , LabChemRes ultNumeric Value | |
| 103 | , LabChemTes tSID | |
| 104 | , PatientSID | |
| 105 | FROM L absLast15M onths | |
| 106 | WHERE R owNum = 1 | |
| 107 | ||
| 108 | END | |
| 109 | ||
| 110 | GO |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.