LRBLDAA ;AVAMC/REG/CYM - DONOR/DEFERRAL LETTERS ;6/28/96 19:11 ;
;;5.2;LAB SERVICE;**72,247**;Sep 27, 1994
;Per VHA Directive 97-033 this routine should not be modified. Medical Device # BK970021
D EN1^LRBLY S X=$P(^LRO(69.2,LRAA,8,65.9,1,0),"^",4)
W !!?29,"Post-visit letter list",! I X>0 W ?25,"There ",$S(X>1:"are ",1:"is "),X," donor",$S(X>1:"s",1:"")," on the list",!
ASK W !?25,"1. Add a donor to the list",!?25,"2. Remove a donor from the list",!?25,"3. Show the donors in the list",!?25,"4. Delete the donor letter list",!?25,"5. Print the donor letters"
R !!,"Select 1, 2, 3, 4, or 5: ",X:DTIME G:X=""!(X[U) END I X<1!(X>5)&("ARSDP"'[$E(X))&("arsdp"'[$E(X)) W $C(7),!!,"Select a number from 1 to 5",! G ASK
S LRX=$E(X) S:$A(LRX)>96 LRX=$C($A(LRX)-32) I LRX S LRX=$E("ARSDP",LRX)
G:LRX="P" P D @LRX G LRBLDAA
;
P W " Print post-visit donor letters" S X=0 D F I X W $C(7),!,"There are no letters to print." G LRBLDAA
S %DT="AEQP",%DT("A")="Print letters for visits no earlier than: " D ^%DT K %DT G:Y<1 END S LRSDT=9999999-Y
S ZTRTN="QUE^LRBLDAA" D BEG^LRUTL G:POP!($D(ZTSK)) END
QUE U IO D T
S LRP=0 F LRA=0:0 S LRP=$O(^LRO(69.2,LRAA,8,65.9,1,"B",LRP)) Q:LRP="" F LRI=0:0 S LRI=$O(^LRO(69.2,LRAA,8,65.9,1,"B",LRP,LRI)) Q:'LRI I $D(^LRE(LRI,0)),'$P(^(0),"^",10) D B
D END^LRUTL,END Q
B S LRW=$O(^LRE(LRI,5,0)) Q:LRW>LRSDT S LRW=^(LRW,0),LRY=$P(LRW,"^",2) Q:LRY="" I LRY'="N" Q:$P(LRW,"^",11)'="H"
S LRL=LRY(LRY) Q:'LRL D SET^LRBLDAL,EN1^LRBLDAL Q
;
A W " Add a donor to the list"
A1 S DIC("A")="Select BLOOD DONOR to add to list: ",DIC=65.5,DIC(0)="AEQM",DIC("S")="I '$P(^(0),U,10)" D ^DIC K DIC Q:Y<1
S LRP=$P(Y,U,2),X=+Y G:$D(^LRO(69.2,LRAA,8,65.9,1,X,0)) A1
L +^LRO(69.2,LRAA,8,65.9) S ^LRO(69.2,LRAA,8,65.9,1,X,0)=LRP,^LRO(69.2,LRAA,8,65.9,1,"B",LRP,X)="",Y=^LRO(69.2,LRAA,8,65.9,1,0),^(0)=$P(Y,"^",1,2)_"^"_X_"^"_($P(Y,"^",4)+1) L -^LRO(69.2,LRAA,8,65.9) G A1
;
R W " Remove a donor from list"
R1 S X=0 D F I X W !,"All donors have been removed from the list." Q
W ! S DIC="^LRO(69.2,LRAA,8,65.9,1,",DIC(0)="AEQM",DIC("A")="Select BLOOD DONOR to remove: " D ^DIC K DIC Q:Y<1 S X=+Y,LRP=$P(Y,U,2)
L +^LRO(69.2,LRAA,8,65.9) K ^LRO(69.2,LRAA,8,65.9,1,X),^LRO(69.2,LRAA,8,65.9,1,"B",LRP,X) S Y=^LRO(69.2,LRAA,8,65.9,1,0),X(1)=$O(^(0)),^(0)=$P(Y,"^",1,2)_"^"_X(1)_"^"_($P(Y,"^",4)-1) L -^LRO(69.2,LRAA,8,65.9) G R1
;
S W " Show the donors in the list" S X=0 D F I X W $C(7),!,"There are no blood donors in the list." Q
W @IOF S A(1)=21,X="" S P=0 F R=1:1 S P=$O(^LRO(69.2,LRAA,8,65.9,1,"B",P)) Q:P=""!(X["^") F L=0:0 S L=$O(^LRO(69.2,LRAA,8,65.9,1,"B",P,L)) Q:'L!(X["^") D W
Q
W W:R#2=1 !,$J(R,2),")",?5,P W:R#2=0 ?40,$J(R,2),")",?44,P S L(R)=L D:$Y>A(1) M Q
M S A(1)=$Y+21 R !,"Enter return to continue: ",X:DTIME W $C(13),$J("",80),$C(13) Q
;
D W " Delete the donor letter list" S X=0 D F I X W $C(7),!,"There is no list to delete." Q
W !,"Are you sure you want to delete the donor letter list " S %=2 D YN^LRU Q:%'=1 K ^LRO(69.2,LRAA,8,65.9,1) Q
;
T D FIELD^DID(65.54,1,"","POINTER","X") S X=X("POINTER") F Y=1:1 S Z=$P(X,";",Y) Q:Z="" S Z(1)=$P(Z,":"),Z(2)=$P(Z,":",2),Z(3)=$O(^LAB(65.9,"B",Z(2),0)),LRY(Z(1))=Z(3)_"^"_Z(2)
Q
F S:'$P(^LRO(69.2,LRAA,8,65.9,1,0),"^",4) X=1 Q
;
END D V^LRU Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRBLDAA 3290 printed Nov 22, 2024@17:20:28 Page 2
LRBLDAA ;AVAMC/REG/CYM - DONOR/DEFERRAL LETTERS ;6/28/96 19:11 ;
+1 ;;5.2;LAB SERVICE;**72,247**;Sep 27, 1994
+2 ;Per VHA Directive 97-033 this routine should not be modified. Medical Device # BK970021
+3 DO EN1^LRBLY
SET X=$PIECE(^LRO(69.2,LRAA,8,65.9,1,0),"^",4)
+4 WRITE !!?29,"Post-visit letter list",!
IF X>0
WRITE ?25,"There ",$SELECT(X>1:"are ",1:"is "),X," donor",$SELECT(X>1:"s",1:"")," on the list",!
ASK WRITE !?25,"1. Add a donor to the list",!?25,"2. Remove a donor from the list",!?25,"3. Show the donors in the list",!?25,"4. Delete the donor letter list",!?25,"5. Print the donor letters"
+1 READ !!,"Select 1, 2, 3, 4, or 5: ",X:DTIME
if X=""!(X[U)
GOTO END
IF X<1!(X>5)&("ARSDP"'[$EXTRACT(X))&("arsdp"'[$EXTRACT(X))
WRITE $CHAR(7),!!,"Select a number from 1 to 5",!
GOTO ASK
+2 SET LRX=$EXTRACT(X)
if $ASCII(LRX)>96
SET LRX=$CHAR($ASCII(LRX)-32)
IF LRX
SET LRX=$EXTRACT("ARSDP",LRX)
+3 if LRX="P"
GOTO P
DO @LRX
GOTO LRBLDAA
+4 ;
P WRITE " Print post-visit donor letters"
SET X=0
DO F
IF X
WRITE $CHAR(7),!,"There are no letters to print."
GOTO LRBLDAA
+1 SET %DT="AEQP"
SET %DT("A")="Print letters for visits no earlier than: "
DO ^%DT
KILL %DT
if Y<1
GOTO END
SET LRSDT=9999999-Y
+2 SET ZTRTN="QUE^LRBLDAA"
DO BEG^LRUTL
if POP!($DATA(ZTSK))
GOTO END
QUE USE IO
DO T
+1 SET LRP=0
FOR LRA=0:0
SET LRP=$ORDER(^LRO(69.2,LRAA,8,65.9,1,"B",LRP))
if LRP=""
QUIT
FOR LRI=0:0
SET LRI=$ORDER(^LRO(69.2,LRAA,8,65.9,1,"B",LRP,LRI))
if 'LRI
QUIT
IF $DATA(^LRE(LRI,0))
IF '$PIECE(^(0),"^",10)
DO B
+2 DO END^LRUTL
DO END
QUIT
B SET LRW=$ORDER(^LRE(LRI,5,0))
if LRW>LRSDT
QUIT
SET LRW=^(LRW,0)
SET LRY=$PIECE(LRW,"^",2)
if LRY=""
QUIT
IF LRY'="N"
if $PIECE(LRW,"^",11)'="H"
QUIT
+1 SET LRL=LRY(LRY)
if 'LRL
QUIT
DO SET^LRBLDAL
DO EN1^LRBLDAL
QUIT
+2 ;
A WRITE " Add a donor to the list"
A1 SET DIC("A")="Select BLOOD DONOR to add to list: "
SET DIC=65.5
SET DIC(0)="AEQM"
SET DIC("S")="I '$P(^(0),U,10)"
DO ^DIC
KILL DIC
if Y<1
QUIT
+1 SET LRP=$PIECE(Y,U,2)
SET X=+Y
if $DATA(^LRO(69.2,LRAA,8,65.9,1,X,0))
GOTO A1
+2 LOCK +^LRO(69.2,LRAA,8,65.9)
SET ^LRO(69.2,LRAA,8,65.9,1,X,0)=LRP
SET ^LRO(69.2,LRAA,8,65.9,1,"B",LRP,X)=""
SET Y=^LRO(69.2,LRAA,8,65.9,1,0)
SET ^(0)=$PIECE(Y,"^",1,2)_"^"_X_"^"_($PIECE(Y,"^",4)+1)
LOCK -^LRO(69.2,LRAA,8,65.9)
GOTO A1
+3 ;
R WRITE " Remove a donor from list"
R1 SET X=0
DO F
IF X
WRITE !,"All donors have been removed from the list."
QUIT
+1 WRITE !
SET DIC="^LRO(69.2,LRAA,8,65.9,1,"
SET DIC(0)="AEQM"
SET DIC("A")="Select BLOOD DONOR to remove: "
DO ^DIC
KILL DIC
if Y<1
QUIT
SET X=+Y
SET LRP=$PIECE(Y,U,2)
+2 LOCK +^LRO(69.2,LRAA,8,65.9)
KILL ^LRO(69.2,LRAA,8,65.9,1,X),^LRO(69.2,LRAA,8,65.9,1,"B",LRP,X)
SET Y=^LRO(69.2,LRAA,8,65.9,1,0)
SET X(1)=$ORDER(^(0))
SET ^(0)=$PIECE(Y,"^",1,2)_"^"_X(1)_"^"_($PIECE(Y,"^",4)-1)
LOCK -^LRO(69.2,LRAA,8,65.9)
GOTO R1
+3 ;
S WRITE " Show the donors in the list"
SET X=0
DO F
IF X
WRITE $CHAR(7),!,"There are no blood donors in the list."
QUIT
+1 WRITE @IOF
SET A(1)=21
SET X=""
SET P=0
FOR R=1:1
SET P=$ORDER(^LRO(69.2,LRAA,8,65.9,1,"B",P))
if P=""!(X["^")
QUIT
FOR L=0:0
SET L=$ORDER(^LRO(69.2,LRAA,8,65.9,1,"B",P,L))
if 'L!(X["^")
QUIT
DO W
+2 QUIT
W if R#2=1
WRITE !,$JUSTIFY(R,2),")",?5,P
if R#2=0
WRITE ?40,$JUSTIFY(R,2),")",?44,P
SET L(R)=L
if $Y>A(1)
DO M
QUIT
M SET A(1)=$Y+21
READ !,"Enter return to continue: ",X:DTIME
WRITE $CHAR(13),$JUSTIFY("",80),$CHAR(13)
QUIT
+1 ;
D WRITE " Delete the donor letter list"
SET X=0
DO F
IF X
WRITE $CHAR(7),!,"There is no list to delete."
QUIT
+1 WRITE !,"Are you sure you want to delete the donor letter list "
SET %=2
DO YN^LRU
if %'=1
QUIT
KILL ^LRO(69.2,LRAA,8,65.9,1)
QUIT
+2 ;
T DO FIELD^DID(65.54,1,"","POINTER","X")
SET X=X("POINTER")
FOR Y=1:1
SET Z=$PIECE(X,";",Y)
if Z=""
QUIT
SET Z(1)=$PIECE(Z,":")
SET Z(2)=$PIECE(Z,":",2)
SET Z(3)=$ORDER(^LAB(65.9,"B",Z(2),0))
SET LRY(Z(1))=Z(3)_"^"_Z(2)
+1 QUIT
F if '$PIECE(^LRO(69.2,LRAA,8,65.9,1,0),"^",4)
SET X=1
QUIT
+1 ;
END DO V^LRU
QUIT