source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNPM2D.m@ 1306

Last change on this file since 1306 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1SPNPM2D ;SD/AB-GET DENOMINATOR FOR PM #2 ;4/9/98
2 ;;2.0;Spinal Cord Dysfunction;**6**;01/02/1997
3MAIN ;-- Called from MAIN^SPNPM2
4 ;-- Get ADMISSION DENOMINATOR for PM #2
5 D GETDEN1
6 ;-- Get DISCHARGE DENOMINATOR for PM #2
7 D GETDEN2
8 D GETADM
9 D GETDIS
10 D GETONS
11 D GETICD
12 D GETPTF ;-- THIS RETURNS PTF DENOMINATOR TOTAL FOR PM #2
13EXIT ;
14 Q
15GETDEN1 ;-- Loop thru all Pts in ^TMP($J,"SPNPM2","ALL_SCD",DFN) and determine if Pt has admission during given FY, has DATE OF ONSET between 4/1/96 and 9/30/97, and has an SCI ICD-9 code in any PTF record
16 ;-- Get ADMISSION DENOMINATOR (TOT_DENOM1) for PM #2
17 ;-- Initalize SPN("DFN"), SPN("TOT_CNT"), and SPN("TOT_DENOM1") variables
18 S (SPN("DFN"),SPN("TOT_CNT"),SPN("TOT_DENOM1"))=0
19 ;-- Quit if '$D(^TMP($J,"SPNPM2","ALL_SCD"))
20 Q:'$D(^TMP($J,"SPNPM2","ALL_SCD"))
21 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","ALL_SCD",SPN("DFN"))) Q:'+SPN("DFN") D
22 .S SPN("TOT_CNT")=SPN("TOT_CNT")+1
23 .;-- Check to see if Pt is in "TOT_ADM", "TOT_ONSET", and "TOT_ICD" nodes of ^TMP($J,"SPNPM2") global
24 .;-- If so then increment TOT_DENOM1 counter and store into ^TMP($J,"SPNPM2","DENOM1",DFN)
25 .I $D(^TMP($J,"SPNPM2","TOT_ADM",SPN("DFN")))&($D(^TMP($J,"SPNPM2","TOT_ONSET",SPN("DFN"))))&($D(^TMP($J,"SPNPM2","TOT_ICD",SPN("DFN")))) D
26 ..S SPN("TOT_DENOM1")=SPN("TOT_DENOM1")+1
27 ..Q
28 .Q
29 Q
30GETDEN2 ;-- Loop thru all Pts in ^TMP($J,"SPNPM2","ALL_SCD",DFN) and determine if Pt has discharge during given FY, has DATE OF ONSET between 4/1/96 and 9/30/97, and has an SCI ICD-9 code in any PTF record
31 ;-- Get DISCHARGE DENOMINATOR (TOT_DENOM2) for PM #2
32 ;-- Initalize SPN("DFN"), SPN("TOT_CNT"), and SPN("TOT_DENOM2") variables
33 S (SPN("DFN"),SPN("TOT_CNT"),SPN("TOT_DENOM2"))=0
34 ;-- Quit if '$D(^TMP($J,"SPNPM2","ALL_SCD"))
35 Q:'$D(^TMP($J,"SPNPM2","ALL_SCD"))
36 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","ALL_SCD",SPN("DFN"))) Q:'+SPN("DFN") D
37 .S SPN("TOT_CNT")=SPN("TOT_CNT")+1
38 .;-- Check to see if Pt is in "TOT_DIS", "TOT_ONSET", and "TOT_ICD" nodes of ^TMP($J,"SPNPM2") global
39 .;-- If so then increment TOT_DENOM2 counter and store into ^TMP($J,"SPNPM2","DENOM2",DFN)
40 .I $D(^TMP($J,"SPNPM2","TOT_DIS",SPN("DFN")))&($D(^TMP($J,"SPNPM2","TOT_ONSET",SPN("DFN"))))&($D(^TMP($J,"SPNPM2","TOT_ICD",SPN("DFN")))) D
41 ..S SPN("TOT_DENOM2")=SPN("TOT_DENOM2")+1
42 ..Q
43 .Q
44 Q
45GETADM ;-- Get total count for ^TMP($J,"SPNPM2","TOT_ADM",DFN) nodes
46 S (SPN("DFN"),SPN("TOT_ADM"))=0
47 ;-- Quit if '$D(^TMP($J,"SPNPM2","TOT_ADM"))
48 Q:'$D(^TMP($J,"SPNPM2","TOT_ADM"))
49 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_ADM",SPN("DFN"))) Q:'+SPN("DFN") D
50 .S SPN("TOT_ADM")=SPN("TOT_ADM")+1
51 .Q
52 Q
53GETDIS ;-- Get total count for ^TMP($J,"SPNPM2","TOT_DIS",DFN) nodes
54 S (SPN("DFN"),SPN("TOT_DIS"))=0
55 ;-- Quit if '$D(^TMP($J,"SPNPM2","TOT_DIS"))
56 Q:'$D(^TMP($J,"SPNPM2","TOT_DIS"))
57 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_DIS",SPN("DFN"))) Q:'+SPN("DFN") D
58 .S SPN("TOT_DIS")=SPN("TOT_DIS")+1
59 .Q
60 Q
61GETONS ;-- Get total count for ^TMP($J,"SPNPM2","TOT_ONSET",DFN) nodes
62 S (SPN("DFN"),SPN("TOT_ONSET"))=0
63 ;-- Quit if '$D(^TMP($J,"SPNPM2","TOT_ONSET"))
64 Q:'$D(^TMP($J,"SPNPM2","TOT_ONSET"))
65 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_ONSET",SPN("DFN"))) Q:'+SPN("DFN") D
66 .S SPN("TOT_ONSET")=SPN("TOT_ONSET")+1
67 .Q
68 Q
69GETICD ;-- Get total count for ^TMP($J,"SPNPM2","TOT_ICD",DFN) nodes
70 S (SPN("DFN"),SPN("TOT_ICD"))=0
71 ;-- Quit if '$D(^TMP($J,"SPNPM2","TOT_ICD"))
72 Q:'$D(^TMP($J,"SPNPM2","TOT_ICD"))
73 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_ICD",SPN("DFN"))) Q:'+SPN("DFN") D
74 .S SPN("TOT_ICD")=SPN("TOT_ICD")+1
75 .Q
76 Q
77GETPTF ;-- Get total count for ^TMP($J,"SPNPM2","TOT_PTF",DFN) nodes - THIS IS DENOMINATOR FOR PM #2!
78 S (SPN("DFN"),SPN("TOT_PTF"))=0
79 ;-- Quit if '$D(^TMP($J,"SPNPM2","TOT_PTF"))
80 Q:'$D(^TMP($J,"SPNPM2","TOT_PTF"))
81 F S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_PTF",SPN("DFN"))) Q:'+SPN("DFN") D
82 .S SPN("TOT_PTF")=SPN("TOT_PTF")+1
83 .Q
84 Q
Note: See TracBrowser for help on using the repository browser.