1 | SPNLRD ;ISC-SF/GB-SCD PATIENT FOLLOW-UP (LAST SEEN) REPORT ;6/23/95 12:11
|
---|
2 | ;;2.0;Spinal Cord Dysfunction;**12,19**;01/02/1997
|
---|
3 | ASK(QLIST,ABORT) ; Report-specific question
|
---|
4 | N DIR,Y,DIRUT,ANS,UNITS,LEN,NUM
|
---|
5 | S DIR(0)="154.91,4" ; file #,field # from Site Parameters file
|
---|
6 | S DIR("A")="Show patients last seen more than how long ago?"
|
---|
7 | S DIR("B")=$P($G(^SPNL(154.91,1,0)),U,5) ; 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 | ; Enter a date; Optional; no minimum; the "since" date is the maximum
|
---|
17 | ;S DIR(0)="DO^:"_QLIST("SINCE")_":EX"
|
---|
18 | S QLIST("LOOK FROM")="2800101" ; Our default
|
---|
19 | ;S DIR("A")="Start searching the records from"
|
---|
20 | ;S DIR("?")="How far back should we look?"
|
---|
21 | ;S DIR("B")="2800101" ; whatever is in the Site Parameters file
|
---|
22 | ;D ^DIR I $D(DIRUT) S ABORT=1 Q
|
---|
23 | ;S QLIST("LOOK FROM")=Y
|
---|
24 | Q
|
---|
25 | GATHER(DFN,FDATE,TDATE,HIUSERS,QLIST) ;
|
---|
26 | D GATHER^SPNLGIFU(DFN,QLIST("LOOK FROM"),DT,QLIST("SINCE")) ; gather follow up loss risks
|
---|
27 | Q
|
---|
28 | PRINT(FACNAME,XFDATE,XTDATE,HIUSERS,QLIST,ABORT) ;
|
---|
29 | ; PAGELEN Number of lines per page
|
---|
30 | ; TITLE Array of header lines (titles)
|
---|
31 | N TITLE,PAGELEN
|
---|
32 | S PAGELEN=IOSL-3
|
---|
33 | S TYPEFMT=4
|
---|
34 | S TITLE(1)=$$CENTER^SPNLRU("SCD - Patient Follow Up")
|
---|
35 | S TITLE(2)=$$CENTER^SPNLRU(FACNAME)
|
---|
36 | I $D(SPNLTRM1) S TITLE(2.5)=$$CENTER^SPNLRU(SPNLTRM1)
|
---|
37 | S TITLE(3)=$$CENTER^SPNLRU("Patients at Risk of Loss to Follow Up")
|
---|
38 | S TITLE(4)=$$CENTER^SPNLRU("(Not seen in over "_QLIST("PERIOD")_", since before "_$$DATEFMT^SPNLRUDT(QLIST("SINCE"),TYPEFMT))_")"
|
---|
39 | D P1(.TITLE,PAGELEN,.ABORT) Q:ABORT
|
---|
40 | Q
|
---|
41 | P1(TITLE,PAGELEN,ABORT) ;
|
---|
42 | N LASTSEEN,PAT
|
---|
43 | S TITLE(5)=""
|
---|
44 | ; " 1 2 3 4 5 6"
|
---|
45 | S TITLE(6)="Last Seen Name Last Four"
|
---|
46 | D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
|
---|
47 | S LASTSEEN=""
|
---|
48 | F S LASTSEEN=$O(^TMP("SPN",$J,"FU",LASTSEEN)) Q:LASTSEEN="" D Q:ABORT
|
---|
49 | . S PAT=""
|
---|
50 | . F S PAT=$O(^TMP("SPN",$J,"FU",LASTSEEN,PAT)) Q:PAT="" D Q:ABORT
|
---|
51 | . . I $Y>PAGELEN D HEADER^SPNLRU(.TITLE,.ABORT) Q:ABORT
|
---|
52 | . . W !,$S(LASTSEEN=0:"no record",1:$E(LASTSEEN,4,5)_"/"_$E(LASTSEEN,6,7)_"/"_$S($E(LASTSEEN,2)>7:"19"_$E(LASTSEEN,2,3),1:"20"_$E(LASTSEEN,2,3)))
|
---|
53 | . . W ?14,$P(PAT,U,1),?52,$P(PAT,U,2)
|
---|
54 | Q
|
---|