1 | RMPRUTL2 ;PHX/HPL-Patient Letter Date look-up in chronological order ;05/22/1995
|
---|
2 | ;;3.0;PROSTHETICS;;Feb 09, 1996
|
---|
3 | EN1 ;entry point to ask patient
|
---|
4 | I '$D(RMPR) D DIV4^RMPRSIT
|
---|
5 | D GETPAT^RMPRUTIL Q:'$D(RMPRDFN)
|
---|
6 | EN ;entry point pass RMPRDFN
|
---|
7 | ;return RMPRPRIN as ien of 665.4 if a selection is made, otherwise
|
---|
8 | ;RMPRIN is PASSED BACK AS -1.
|
---|
9 | I $G(RMPRDFN)'>0 S:$G(DFN)>0 RMPRDFN=DFN D:$G(DFN)'>0 EN1^RMPRUTL2
|
---|
10 | I '$D(^RMPR(665.4,"AH",RMPRDFN)) W !!,$C(7),?5,"NO LETTERS FOR THIS PATIENT!" S RMPRIN=-1 Q
|
---|
11 | N RMPRBDT,DIC,RI,DR,RB,DA,RMPLET,DIQ,Y,RO
|
---|
12 | S (RMPRBDT,RI,RB,RO)=0,RMPRIN=-1,DIC=665.4,DR=".01;1;2;4;11",DIQ="RMPRLET"
|
---|
13 | W !!,"#",?5,"Patient",?28,"Type of letter",?45,"Employee"
|
---|
14 | W ?65,"Date of letter"
|
---|
15 | W !,RMPR("L")
|
---|
16 | F S RMPRBDT=$O(^RMPR(665.4,"AH",RMPRDFN,RMPRBDT)) Q:RMPRBDT="" D Q:RO=1
|
---|
17 | .;check for more than one letter per day
|
---|
18 | .S DA=0
|
---|
19 | .F S DA=$O(^RMPR(665.4,"AH",RMPRDFN,RMPRBDT,DA)) Q:'DA D Q:RO=1
|
---|
20 | ..S RI=RI+1,RI(RI)=DA D EN^DIQ1 Q:'$D(RMPRLET)
|
---|
21 | ..S RB=RB+1
|
---|
22 | ..W !,RI
|
---|
23 | ..W ?5,RMPRLET(665.4,DA,.01),?28,$G(RMPRLET(665.4,DA,1))
|
---|
24 | ..W ?45,$E($G(RMPRLET(665.4,DA,4)),1,15)
|
---|
25 | ..W ?65,$G(RMPRLET(665.4,DA,2))_$G(RMPRLET(665.4,DA,11))
|
---|
26 | ..K RMPRLET
|
---|
27 | ..I RB>4&(RMPRIN<1) D ASK Q:RMPRIN>0 S RB=0
|
---|
28 | G:$D(DTOUT)!($D(DUOUT)) EXIT
|
---|
29 | I RMPRIN'>0 S:'RI(RI) RI=RI-1 D ASK Q
|
---|
30 | G EXIT
|
---|
31 | Q
|
---|
32 | ASK ;get record
|
---|
33 | I RMPRBDT="",DA="" W !!,"End of Patient's Letter Listing."
|
---|
34 | W !!,"Enter '^' to stop or "
|
---|
35 | N DIR S DIR(0)="NO^1:"_RI_":0" D ^DIR
|
---|
36 | I ($D(DTOUT))!($D(DUOUT)) S RO=1 Q
|
---|
37 | I +Y>0 S RMPRIN=RI(Y),RO=1 Q
|
---|
38 | Q
|
---|
39 | EXIT ;common exit point
|
---|
40 | K DTOUT,DUOUT,RMPRBDT
|
---|
41 | Q
|
---|