source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNLRE.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1SPNLRE ;ISC-SF/GB,SD/WDE SCD PT FOLLOW-UP (LAST ANNUAL EVAL) REPORT ;4/29/98
2 ;;2.0;Spinal Cord Dysfunction;**3,6,12,19**;01/02/1997
3ASK(QLIST,ABORT) ; Report-specific question
4 N DIR,Y,DIRUT,ANS,UNITS,LEN,NUM
5 S DIR(0)="154.91,5" ; file #,field # from Site Parameters file
6 S DIR("A")="Show Pts whose Last Annual Rehab Eval was more than how long ago"
7 S DIR("B")=$P($G(^SPNL(154.91,1,0)),U,6) ; from Site Parameters file
8 S:DIR("B")="" DIR("B")="1Y"
9 D ^DIR I $D(DIRUT) S ABORT=1 Q
10 S ANS=Y,LEN=$L(Y)
11 S UNITS=$E(ANS,LEN,LEN)
12 S NUM=+ANS
13 S UNITS=$S(UNITS="D":"Day",UNITS="W":"Week",UNITS="M":"Month",UNITS="Y":"Year",1:"Unit")_$S(NUM>1:"s",1:"")
14 S QLIST("PERIOD")=NUM_" "_UNITS
15 S QLIST("SINCE")=$$DATEMATH^SPNLRUDT(DT,"-"_ANS)
16 Q
17GATHER(DFN,FDATE,TDATE,HIUSERS,QLIST) ;
18 ; DFN Patient's internal entry number in the Patient file
19 ; FDATE "From" date
20 ; TDATE "Thru" date, default=today
21 ; Gathers patients who have not been seen since the SINCE date.
22 ; Data will be placed into the following global:
23 ; ^TMP("SPN",$J,"FU",
24 ; with the following nodes:
25 ; date last rehab eval,name^ssn) =""
26 N VADM,VA,ISDEAD,SSNLAST4,NAME,LASTEVAL
27 S LASTEVAL=$$ARD(DFN)
28 Q:LASTEVAL=""
29 Q:LASTEVAL'<QLIST("SINCE")
30 D DEM^VADPT ; Get patient demographics
31 ; We will ignore dead patients
32 S ISDEAD=+$P($G(VADM(6)),U,1)
33 Q:ISDEAD
34 S NAME=VADM(1)
35 S SSNLAST4=VA("BID")
36 S ^TMP("SPN",$J,"FU",LASTEVAL,NAME_"^"_SSNLAST4)=""
37 Q
38ARD(DFN) ;Get the latest annual rehab date
39 I '$O(^SPNL(154,DFN,"REHAB",0)) Q ""
40 N X,DAT1,DAT2
41 ; This subroutine will find the most current annual rehab received
42 S (X,DAT1,DAT2)=0
43 F S X=$O(^SPNL(154,DFN,"REHAB",X)) Q:X<1 D
44 .Q:'$D(^SPNL(154,DFN,"REHAB",X,0))
45 .S DAT2=$P(^SPNL(154,DFN,"REHAB",X,0),U,2)
46 .I DAT2>DAT1 S DAT1=DAT2
47 .Q
48 Q DAT1
49 ;
50PRINT(FACNAME,XFDATE,XTDATE,HIUSERS,QLIST,ABORT) ;
51 ; PAGELEN Number of lines per page
52 ; TITLE Array of header lines (titles)
53 N TITLE,PAGELEN
54 S PAGELEN=IOSL-3
55 S TYPEFMT=4
56 S TITLE(1)=$$CENTER^SPNLRU("SCD - Patient Follow Up")
57 S TITLE(2)=$$CENTER^SPNLRU(FACNAME)
58 I $D(SPNLTRM1) S TITLE(2.5)=$$CENTER^SPNLRU(SPNLTRM1)
59 S TITLE(3)=$$CENTER^SPNLRU("Patients at Risk of Loss to Follow Up")
60 S TITLE(4)=$$CENTER^SPNLRU("(Last Annual Rehab Eval Received over "_QLIST("PERIOD")_" ago, before "_$$DATEFMT^SPNLRUDT(QLIST("SINCE"),TYPEFMT))_")"
61 D P1(.TITLE,PAGELEN,.ABORT) Q:ABORT
62 Q
63P1(TITLE,PAGELEN,ABORT) ;
64 N LASTEVAL,PAT
65 S TITLE(5)=""
66 ; " 1 2 3 4 5 6"
67 S TITLE(6)="Last Eval Name Last Four"
68 D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
69 S LASTEVAL=""
70 F S LASTEVAL=$O(^TMP("SPN",$J,"FU",LASTEVAL)) Q:LASTEVAL="" D Q:ABORT
71 . S PAT=""
72 . F S PAT=$O(^TMP("SPN",$J,"FU",LASTEVAL,PAT)) Q:PAT="" D Q:ABORT
73 . . I $Y>PAGELEN D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
74 . . W !,$S(LASTEVAL=0:"no record",1:$E(LASTEVAL,4,5)_"/"_$E(LASTEVAL,6,7)_"/"_$S($E(LASTEVAL,2)>7:"19"_$E(LASTEVAL,2,3),1:"20"_$E(LASTEVAL,2,3)))
75 . . W ?14,$P(PAT,U,1),?52,$P(PAT,U,2)
76 Q
Note: See TracBrowser for help on using the repository browser.