1 | SPNHS0 ;HIRMFO/JCC-HEALTH SUMMARY: SCD EXTRACT ;10/23/01 10:33
|
---|
2 | ;;2.0;Spinal Cord Dysfunction;**10,16**;01/02/1997
|
---|
3 | EN(SPNDFN,SPNBEG,SPNEND,SPNMAX) ;
|
---|
4 | ;
|
---|
5 | ;Required:
|
---|
6 | ; SPNDFN = PATIENT file (#2) pointer
|
---|
7 | ; SPNBEG = Beginning date
|
---|
8 | ; SPNEND = Ending date
|
---|
9 | ;Optional:
|
---|
10 | ; SPNMAX = Maximum number of occurrences
|
---|
11 | ;Returns:
|
---|
12 | ; ^TMP("SPN",$J,0)=DATA FROM 154
|
---|
13 | ; ^TMP("SPN",$J,154,INVERSE_DATE_ONSET) =
|
---|
14 | ; ^TMP("SPN",$J,154.1,INVERSE_DATE_RECORDED,SPNIEN)=
|
---|
15 | ;
|
---|
16 | I +SPNMAX'>0 S SPNMAX=999
|
---|
17 | K ^TMP("SPN",$J)
|
---|
18 | I $O(^SPNL(154,"B",SPNDFN,0))'>0 G EXIT
|
---|
19 | S SPNIEN=$O(^SPNL(154.1,"B",SPNDFN,0))
|
---|
20 | S SPNCNT=0,SPNDATE=SPNEND+.0000001
|
---|
21 | F S SPNDATE=$O(^SPNL(154.1,"AB",SPNDFN,SPNDATE),-1) Q:SPNDATE'>0!(SPNCNT=SPNMAX) D
|
---|
22 | .I SPNDATE<SPNBEG Q
|
---|
23 | .S SPNIEN=0 F S SPNIEN=$O(^SPNL(154.1,"AB",SPNDFN,SPNDATE,SPNIEN)) Q:SPNIEN'>0 Q:SPNCNT=SPNMAX D ;
|
---|
24 | ..I $$GET1^DIQ(154.1,SPNIEN,.02,"I")>2 Q ; Must be a 4 or 7 level FIM
|
---|
25 | ..S SPNDMS=$$GET1^DIQ(154.1,SPNIEN,999.03)
|
---|
26 | ..S SPNDTY=$E($$GET1^DIQ(154.1,SPNIEN,.02),1,10)
|
---|
27 | ..S SPNDCS=$$GET1^DIQ(154.1,SPNIEN,999.04)
|
---|
28 | ..S SPNDTS=$$GET1^DIQ(154.1,SPNIEN,999.05)
|
---|
29 | ..S ^TMP("SPN",$J,154.1,9999999-SPNDATE,SPNIEN)=SPNDATE_"^"_SPNDMS_"^"_SPNDCS_"^"_SPNDTS_"^"_SPNDTY
|
---|
30 | ..S SPNCNT=SPNCNT+1
|
---|
31 | S SPNIEN=SPNDFN
|
---|
32 | S SPNRS=$$GET1^DIQ(154,SPNIEN,.03)
|
---|
33 | S SPNHI=$$GET1^DIQ(154,SPNIEN,2.1)
|
---|
34 | S SPNIS=$$GET1^DIQ(154,SPNIEN,2.3)
|
---|
35 | S SPNPC=$$GET1^DIQ(154,SPNIEN,8.1)
|
---|
36 | S SPNCOR=$$GET1^DIQ(154,SPNIEN,8.2)
|
---|
37 | S SPNCI=$$GET1^DIQ(154,SPNIEN,999.03)
|
---|
38 | S SPNEP=$$GET1^DIQ(154,SPNIEN,999.04)
|
---|
39 | S SPNMSST=$$GET1^DIQ(154,SPNIEN,2.2)
|
---|
40 | S ^TMP("SPN",$J,0)=SPNRS_"^"_SPNHI_"^"_SPNIS_"^"_SPNCI_"^"_SPNEP_"^"_SPNPC_"^"_SPNCOR_"^"_SPNMSST
|
---|
41 | S SPND1=0 F S SPND1=$O(^SPNL(154,SPNIEN,"E",SPND1)) Q:SPND1'>0 D ;
|
---|
42 | .S SPNONI=$$GET1^DIQ(154.004,SPND1_","_SPNDFN_",",.02,"I") ;DATE OF ONSET
|
---|
43 | .S SPNON=$$GET1^DIQ(154.004,SPND1_","_SPNDFN_",",.02,"I") ;DATE OF ONSET
|
---|
44 | .S SPNET=$$GET1^DIQ(154.004,SPND1_","_SPNDFN_",",.01) ;ETIOLOGY
|
---|
45 | .S SPNCB=$$GET1^DIQ(154.004,SPND1_","_SPNDFN_",",999.01) ;ONSET OF SCD CAUSED BY TRAUMA
|
---|
46 | .S ^TMP("SPN",$J,154,(9999999-SPNONI)_"^"_SPND1)=SPNON_"^"_SPNET_"^"_SPNCB
|
---|
47 | .Q
|
---|
48 | EXIT ;
|
---|
49 | K SPNRS,SPNHI,SPNIS,SPNCI,SPNEP,SPNON,SPNET,SPNCB,SPNDATE,SPNDMS,SPNDCS,SPNDTS,SPNCNT,SPNMAX,SPND1,SPNONI,SPNIEN,SPNDTY,SPNPC,SPNCOR,SPNMSST
|
---|
50 | Q
|
---|