| 1 | SPNPM2N ;SD/AB-GET NUMERATOR FOR PM #2 ;4/9/98
 | 
|---|
| 2 |  ;;2.0;Spinal Cord Dysfunction;**6**;01/02/1997
 | 
|---|
| 3 | MAIN ;-- Called from MAIN^SPNPM2
 | 
|---|
| 4 |  ;-- This program will get the NUMERATOR for Program Measure #2
 | 
|---|
| 5 |  ;-- The program will loop thru the ^TMP($J,"SPNPM2","TOT_PTF",DFN) global which contains all SCD Pts who have PTF records associated with their SCD DATE OF ONSET in the SCD-R file
 | 
|---|
| 6 |  ;-- The NUMERATOR count will be the number of these patients who have a least 2 FIM scores between the Admission Date and Discharge Date in the respective PTF record
 | 
|---|
| 7 |  ;-- Quit if no ^TMP($J,"SPNPM2","TOT_PTF") global found
 | 
|---|
| 8 |  ;  WDE/added the set below to take in-account for no global found
 | 
|---|
| 9 |  S SPN("TOT_NUM")=0
 | 
|---|
| 10 |  I '$D(^TMP($J,"SPNPM2","TOT_PTF")) D EXIT Q
 | 
|---|
| 11 |  D LOOP
 | 
|---|
| 12 | EXIT ;
 | 
|---|
| 13 |  Q
 | 
|---|
| 14 | LOOP ;-- Loop thru the ^TMP($J,"SPNPM2","TOT_PTF",DFN) global
 | 
|---|
| 15 |  S (SPN("DFN"),SPN("TOT_NUM"))=0
 | 
|---|
| 16 |  F  S SPN("DFN")=$O(^TMP($J,"SPNPM2","TOT_PTF",SPN("DFN"))) Q:'+SPN("DFN")  D
 | 
|---|
| 17 |  .;--Initialize Total # FIM counter (TOT_FIM)
 | 
|---|
| 18 |  .S SPN("TOT_FIM")=0
 | 
|---|
| 19 |  .;-- See if FIM data exists for this Pt, if so check FIM and Dates Recorded
 | 
|---|
| 20 |  .I $D(^SPNL(154.1,"AA",2,SPN("DFN"))) D
 | 
|---|
| 21 |  ..;-- Get Admission and D/C Dates
 | 
|---|
| 22 |  ..S SPN("ADM_DT")=$P($G(^TMP($J,"SPNPM2","TOT_PTF",SPN("DFN"))),U),SPN("DC_DT")=$P($G(^(SPN("DFN"))),U,2)
 | 
|---|
| 23 |  ..S SPN("FIM_DT")=0
 | 
|---|
| 24 |  ..F  S SPN("FIM_DT")=$O(^SPNL(154.1,"AA",2,SPN("DFN"),SPN("FIM_DT"))) Q:'+SPN("FIM_DT")  D
 | 
|---|
| 25 |  ...;-- Check to see if FIM Date is between Admission and D/C Dates, if not then quit
 | 
|---|
| 26 |  ...I SPN("FIM_DT")<SPN("ADM_DT")&(SPN("FIM_DT")>SPN("DC_DT")) Q
 | 
|---|
| 27 |  ...S SPN("FIM_IEN")=0
 | 
|---|
| 28 |  ...F  S SPN("FIM_IEN")=$O(^SPNL(154.1,"AA",2,SPN("DFN"),SPN("FIM_DT"),SPN("FIM_IEN"))) Q:'+SPN("FIM_IEN")  D
 | 
|---|
| 29 |  ....;-- Find out if Total FIM Score achieved, if so count as completed FIM score
 | 
|---|
| 30 |  ....S SPN("TOT_SCORE")=$$EN3^SPNFUTL0(SPN("FIM_IEN"))
 | 
|---|
| 31 |  ....I SPN("TOT_SCORE")'["ERR" S SPN("TOT_FIM")=SPN("TOT_FIM")+1
 | 
|---|
| 32 |  ....Q
 | 
|---|
| 33 |  ...Q
 | 
|---|
| 34 |  ..Q
 | 
|---|
| 35 |  .I SPN("TOT_FIM")>1 S SPN("TOT_NUM")=SPN("TOT_NUM")+1
 | 
|---|
| 36 |  .Q
 | 
|---|
| 37 |  Q
 | 
|---|