LRVR ;DALOI/CJS/DALOI/FHS - LAB ROUTINE DATA VERIFICATION ;JUL 06, 2010 3:14 PM
;;5.2;LAB SERVICE;**42,153,263,286,1027**;NOV 01, 1997
N LRDUZ,LRVBY
D INIT G QUIT:$G(LREND)
S LRVBY=$$SELBY^LRWU4("Verify by")
I LRVBY=0 D QUIT Q
I LRVBY=2 D ^LRVRA,QUIT Q
DAT D ADATE^LRWU G:LRAD<1 QUIT
I $P(^LRO(68,LRAA,0),U,3)="D" F I=0:0 S I=$O(^LRO(68,LRAA,1,LRAD,1,I)) Q:I<1 I $D(^LRO(68,LRAA,1,LRAD,1,I,3)),'$P(^(3),U,4) S LRAN=I Q
S:$D(^LRO(68,LRAA,1,LRAD,2))&'LRAN LRAN=$P(^(2),U,4)
D
. N X
. S X=$S(+$P($G(^LAB(69.9,1,0)),U,7):+$P(^(0),U,7),1:1)
. S LRTM60=9999999-$$FMADD^XLFDT(DT,-X)
L10 S LRCFL="",EAMODE=1
K LRTEST,C5,LRSET,LRLDT,DIC,LRNM,LRNG,LRDL,LRDEL,T,LRFP,LRAB,LRVER,Y,Z
D WLN G QUIT:LREND
D ^LRVR1,NEXT
G L10
;
;
YN R X:DTIME Q:X=""!(X["N")!(X["Y") W !,"Answer 'Y' or 'N': " G YN
;
WLN ;
S LRNOP=0
K DIR,DIRUT,DTOUT,DUOUT
S DIR(0)="NAO^1:999999:0"
S DIR("A")="Accession NUMBER: ",DIR("?")="^D LW^LRVR"
I LRAN'="" S DIR("B")=LRAN
D ^DIR K DIR
I $D(DIRUT) G STOP
S LRAN=Y
I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) W !,"NOT ON FILE" S LRNOP=1
I '$G(LRNOP) D
. S LRDFN=+^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRCEN=$S($D(^(.1)):^(.1),1:0),LRODT=$S($P(^(0),U,4):$P(^(0),U,4),1:$P(^(0),U,3)),LRSN=$P(^(0),U,5)
. S LRORU3=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
I '$G(LRNOP),$P(LRORU3,U)="" W !?10,"No UID number for this accession",! S LRNOP=1
; I '$G(LRNOP) S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX W !,PNM,?30,SSN W:LRCEN !,"ORDER #: ",LRCEN
;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1027
I '$G(LRNOP) S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX W !,PNM,?30,HRCN W:LRCEN !,"ORDER #: ",LRCEN
;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1027
S LRCDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U)
I '$G(LRNOP),'$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",3) D
. N %DT,LRA1,LRA2,LRA3
. S %DT("B")=$$FMTE^XLFDT(LRCDT,"1")
. S LRSTATUS="C",LRA1=LRAA,LRA2=LRAD,LRA3=LRAN
. D P15^LROE1
. S LRAA=LRA1,LRAD=LRA2,LRAN=LRA3
. I LRCDT<1 S LRNOP=1 Q
. I '$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,3) S $P(^(3),U,3)=$$NOW^XLFDT
; If user did not update then go to next accession
I '$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,3) S LRNOP=1
S LRCDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U)
I $G(LRCDT)<1 S (LRCDT,LRNOP)=1
;
S LRSS=$P(^LRO(68,LRAA,0),U,2)
I '$G(LRNOP),LRSS'="CH" S LRNOP=1
; Check for valid pointer to file #63 and entry in file #63.
S LRIDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,5)
I '$G(LRNOP),LRIDT<1 W !,">>>>ERROR - NO POINTER TO FILE #63 - PLEASE NOTIFY SYSTEM MANAGER^ <<<<<",! S LRNOP=1
I '$G(LRNOP),'$D(^LR(LRDFN,LRSS,LRIDT,0)) W !,">>>>ERROR - NO ENTRY IN FILE #63 - PLEASE NOTIFY SYSTEM MANAGER<<^ <<<",! S LRNOP=1
;
I '$G(LRNOP),$D(^LRO(69,LRODT,1,LRSN)),'$D(^(LRSN,1)) W !,"This Order # has not been collected",$C(7) S LRNOP=1
I '$G(LRNOP),$D(^LRO(69,LRODT,1,LRSN,1)),$P(^LRO(69,LRODT,1,LRSN,1),U,4)'="C" W !,"You cannot verify an accession which has not been collected.",$C(7) S LRNOP=1
I $G(LRNOP) D NEXT G WLN
Q
;
;
LW ;
N S
W !,"Enter range of accession numbers which might apply."
D LRAN^LRWU3 Q:LREND
S LRDT=$$FMTE^XLFDT($$DT^XLFDT,"5F")
S S("LRAA")=LRAA,S("LRAD")=LRAD,S("LRAN")=LRAN
D W^LRWRKLST
S LREND=0,LRAA=S("LRAA"),LRAD=S("LRAD"),LRAN=S("LRAN")
Q
;
;
QUIT I $G(LRAN),$G(LRAA),$G(LRAD) S LREND=1 I $D(^LRO(68,LRAA,1,LRAD,0)) S:'$D(^(2)) ^(2)="^^" S ^(2)=$P(^(2),U,1,3)_U_LRAN_U_$P(^(2),U,5,99),LREND=1
;
CLEAN ;
I $D(LRCSQ),'$O(^XTMP("LRCAP",LRCSQ,DUZ,0)) K ^XTMP("LRCAP",LRCSQ,DUZ)
E I $D(LRAA) D:$P(LRPARAM,U,14)&($P($G(^LRO(68,+LRAA,0)),U,16)) STD^LRCAPV K LRIDIV
K DIR,LRCMTDSP,LRNOP,XP
D ^LRVRKIL
S ZTIO="",ZTRTN="LRCAPV2",ZTDTH=$H,ZTDESC="LAB LRCAPV2 ROUTINE"
D ^%ZTLOAD K ZTSK
Q
;
;
NEXT S LRAN=$O(^LRO(68,LRAA,1,LRAD,1,LRAN)) I LRAN'>0 W !,"LAST IN WORK LIST" S LRAN="^"
S LREND=0
Q
;
;
LIST W " the following tests: " F I=0:0 S I=$O(LRTST(I)) Q:I<1 W !,?10,$P(LRTST(I),"^",1)
Q
;
;
EXPAND D EXPLODE^LRGP2
SKPEX Q:$O(LRVTS(0)) ; READY TO GO
STOP S LREND=1
Q
;
;
INIT ;from LRVRW
N DIC,LRX
D ^LRPARAM Q:$G(LREND) S LREND=0,LRAN=0 K LRORD,LRDUZ
S DIC="^LRO(68.2,",DIC(0)="AEMZ",DIC("S")="S LRX=$P(^(0),U,12) Q:'$L(LRX) I $D(^XUSEC($P($G(^DIC(19.1,LRX,0)),U),DUZ))"
D ^DIC K DIC("S") G STOP:Y<1 S LRLL=+Y,LRTYPE=$P(Y(0),U,3)
S LRPROF=$O(^LRO(68.2,LRLL,10,0))
I LRPROF<1 S LREND=1 W !,"No profile defined." Q
S B=$O(^LRO(68.2,LRLL,10,LRPROF))
I B>0 S DIC="^LRO(68.2,"_LRLL_",10," D ^DIC G STOP:Y<1 S LRPROF=+Y
S X=^LRO(68.2,LRLL,10,LRPROF,0),LRAA=$P(X,U,2),LRPANEL=$P(X,U) I '$D(^LRO(68,LRAA,0))#2 W !?10,$C(7),"Error in your DATABASE. There is not an accession area # ",LRAA,!! Q
;
; Select performing laboratory to use
S LRX=$$SELPL^LRVERA($S($P(X,"^",5):$P(X,"^",5),1:DUZ(2)))
I LRX<1 S LREND=1 Q
I LRX,LRX'=DUZ(2) S LRDUZ(2)=LRX
;
D:$P(LRPARAM,U,14)&($P($G(^LRO(68,LRAA,0)),U,16)) AUTO^LRCAPV Q:LREND
I $P(^LRO(68,LRAA,0),U,2)="MI" D ^LRMIEDZ S LREND=1 Q
G STOP:$P(^LRO(68,LRAA,0),U,2)'="CH"
S LREND=0 D EXPAND G STOP:LREND!($O(LRVTS(0))<0)
F I=0:0 S I=$O(LRORD(I)) Q:I<1 S J=LRORD(I),X=$P(^LAB(60,J,0),U,5),LRORD(I)=$P(X,";",2)
S Y=^LRO(68,LRAA,0),LRTSE=-1
;
D CMTDSP^LRVERA
;
REV ;
K LRPER
D REV^LRVER
Q
LRVR ;DALOI/CJS/DALOI/FHS - LAB ROUTINE DATA VERIFICATION ;JUL 06, 2010 3:14 PM
+1 ;;5.2;LAB SERVICE;**42,153,263,286,1027**;NOV 01, 1997
+2 NEW LRDUZ,LRVBY
+3 DO INIT
IF $GET(LREND)
GOTO QUIT
+4 SET LRVBY=$$SELBY^LRWU4("Verify by")
+5 IF LRVBY=0
DO QUIT
QUIT
+6 IF LRVBY=2
DO ^LRVRA
DO QUIT
QUIT
DAT DO ADATE^LRWU
IF LRAD<1
GOTO QUIT
+1 IF $PIECE(^LRO(68,LRAA,0),U,3)="D"
FOR I=0:0
SET I=$ORDER(^LRO(68,LRAA,1,LRAD,1,I))
IF I<1
QUIT
IF $DATA(^LRO(68,LRAA,1,LRAD,1,I,3))
IF '$PIECE(^(3),U,4)
SET LRAN=I
QUIT
+2 IF $DATA(^LRO(68,LRAA,1,LRAD,2))&'LRAN
SET LRAN=$PIECE(^(2),U,4)
+3 Begin DoDot:1
+4 NEW X
+5 SET X=$SELECT(+$PIECE($GET(^LAB(69.9,1,0)),U,7):+$PIECE(^(0),U,7),1:1)
+6 SET LRTM60=9999999-$$FMADD^XLFDT(DT,-X)
End DoDot:1
L10 SET LRCFL=""
SET EAMODE=1
+1 KILL LRTEST,C5,LRSET,LRLDT,DIC,LRNM,LRNG,LRDL,LRDEL,T,LRFP,LRAB,LRVER,Y,Z
+2 DO WLN
IF LREND
GOTO QUIT
+3 DO ^LRVR1
DO NEXT
+4 GOTO L10
+5 ;
+6 ;
YN READ X:DTIME
IF X=""!(X["N")!(X["Y")
QUIT
WRITE !,"Answer 'Y' or 'N': "
GOTO YN
+1 ;
WLN ;
+1 SET LRNOP=0
+2 KILL DIR,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="NAO^1:999999:0"
+4 SET DIR("A")="Accession NUMBER: "
SET DIR("?")="^D LW^LRVR"
+5 IF LRAN'=""
SET DIR("B")=LRAN
+6 DO ^DIR
KILL DIR
+7 IF $DATA(DIRUT)
GOTO STOP
+8 SET LRAN=Y
+9 IF '$DATA(^LRO(68,LRAA,1,LRAD,1,LRAN,0))
WRITE !,"NOT ON FILE"
SET LRNOP=1
+10 IF '$GET(LRNOP)
Begin DoDot:1
+11 SET LRDFN=+^LRO(68,LRAA,1,LRAD,1,LRAN,0)
SET LRCEN=$SELECT($DATA(^(.1)):^(.1),1:0)
SET LRODT=$SELECT($PIECE(^(0),U,4):$PIECE(^(0),U,4),1:$PIECE(^(0),U,3))
SET LRSN=$PIECE(^(0),U,5)
+12 SET LRORU3=$GET(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
End DoDot:1
+13 IF '$GET(LRNOP)
IF $PIECE(LRORU3,U)=""
WRITE !?10,"No UID number for this accession",!
SET LRNOP=1
+14 ; I '$G(LRNOP) S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX W !,PNM,?30,SSN W:LRCEN !,"ORDER #: ",LRCEN
+15 ;----- BEGIN IHS/OIT/MKK MODIFICATIONS LR*5.2*1027
+16 IF '$GET(LRNOP)
SET LRDPF=$PIECE(^LR(LRDFN,0),U,2)
SET DFN=$PIECE(^(0),U,3)
DO PT^LRX
WRITE !,PNM,?30,HRCN
IF LRCEN
WRITE !,"ORDER #: ",LRCEN
+17 ;----- END IHS/OIT/MKK MODIFICATIONS LR*5.2*1027
+18 SET LRCDT=$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U)
+19 IF '$GET(LRNOP)
IF '$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",3)
Begin DoDot:1
+20 NEW %DT,LRA1,LRA2,LRA3
+21 SET %DT("B")=$$FMTE^XLFDT(LRCDT,"1")
+22 SET LRSTATUS="C"
SET LRA1=LRAA
SET LRA2=LRAD
SET LRA3=LRAN
+23 DO P15^LROE1
+24 SET LRAA=LRA1
SET LRAD=LRA2
SET LRAN=LRA3
+25 IF LRCDT<1
SET LRNOP=1
QUIT
+26 IF '$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,3)
SET $PIECE(^(3),U,3)=$$NOW^XLFDT
End DoDot:1
+27 ; If user did not update then go to next accession
+28 IF '$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,3)
SET LRNOP=1
+29 SET LRCDT=$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U)
+30 IF $GET(LRCDT)<1
SET (LRCDT,LRNOP)=1
+31 ;
+32 SET LRSS=$PIECE(^LRO(68,LRAA,0),U,2)
+33 IF '$GET(LRNOP)
IF LRSS'="CH"
SET LRNOP=1
+34 ; Check for valid pointer to file #63 and entry in file #63.
+35 SET LRIDT=$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,5)
+36 IF '$GET(LRNOP)
IF LRIDT<1
WRITE !,">>>>ERROR - NO POINTER TO FILE #63 - PLEASE NOTIFY SYSTEM MANAGER^ <<<<<",!
SET LRNOP=1
+37 IF '$GET(LRNOP)
IF '$DATA(^LR(LRDFN,LRSS,LRIDT,0))
WRITE !,">>>>ERROR - NO ENTRY IN FILE #63 - PLEASE NOTIFY SYSTEM MANAGER<<^ <<<",!
SET LRNOP=1
+38 ;
+39 IF '$GET(LRNOP)
IF $DATA(^LRO(69,LRODT,1,LRSN))
IF '$DATA(^(LRSN,1))
WRITE !,"This Order # has not been collected",$CHAR(7)
SET LRNOP=1
+40 IF '$GET(LRNOP)
IF $DATA(^LRO(69,LRODT,1,LRSN,1))
IF $PIECE(^LRO(69,LRODT,1,LRSN,1),U,4)'="C"
WRITE !,"You cannot verify an accession which has not been collected.",$CHAR(7)
SET LRNOP=1
+41 IF $GET(LRNOP)
DO NEXT
GOTO WLN
+42 QUIT
+43 ;
+44 ;
LW ;
+1 NEW S
+2 WRITE !,"Enter range of accession numbers which might apply."
+3 DO LRAN^LRWU3
IF LREND
QUIT
+4 SET LRDT=$$FMTE^XLFDT($$DT^XLFDT,"5F")
+5 SET S("LRAA")=LRAA
SET S("LRAD")=LRAD
SET S("LRAN")=LRAN
+6 DO W^LRWRKLST
+7 SET LREND=0
SET LRAA=S("LRAA")
SET LRAD=S("LRAD")
SET LRAN=S("LRAN")
+8 QUIT
+9 ;
+10 ;
QUIT IF $GET(LRAN)
IF $GET(LRAA)
IF $GET(LRAD)
SET LREND=1
IF $DATA(^LRO(68,LRAA,1,LRAD,0))
IF '$DATA(^(2))
SET ^(2)="^^"
SET ^(2)=$PIECE(^(2),U,1,3)_U_LRAN_U_$PIECE(^(2),U,5,99)
SET LREND=1
+1 ;
CLEAN ;
+1 IF $DATA(LRCSQ)
IF '$ORDER(^XTMP("LRCAP",LRCSQ,DUZ,0))
KILL ^XTMP("LRCAP",LRCSQ,DUZ)
+2 IF '$TEST
IF $DATA(LRAA)
IF $PIECE(LRPARAM,U,14)&($PIECE($GET(^LRO(68,+LRAA,0)),U,16))
DO STD^LRCAPV
KILL LRIDIV
+3 KILL DIR,LRCMTDSP,LRNOP,XP
+4 DO ^LRVRKIL
+5 SET ZTIO=""
SET ZTRTN="LRCAPV2"
SET ZTDTH=$HOROLOG
SET ZTDESC="LAB LRCAPV2 ROUTINE"
+6 DO ^%ZTLOAD
KILL ZTSK
+7 QUIT
+8 ;
+9 ;
NEXT SET LRAN=$ORDER(^LRO(68,LRAA,1,LRAD,1,LRAN))
IF LRAN'>0
WRITE !,"LAST IN WORK LIST"
SET LRAN="^"
+1 SET LREND=0
+2 QUIT
+3 ;
+4 ;
LIST WRITE " the following tests: "
FOR I=0:0
SET I=$ORDER(LRTST(I))
IF I<1
QUIT
WRITE !,?10,$PIECE(LRTST(I),"^",1)
+1 QUIT
+2 ;
+3 ;
EXPAND DO EXPLODE^LRGP2
SKPEX ; READY TO GO
IF $ORDER(LRVTS(0))
QUIT
STOP SET LREND=1
+1 QUIT
+2 ;
+3 ;
INIT ;from LRVRW
+1 NEW DIC,LRX
+2 DO ^LRPARAM
IF $GET(LREND)
QUIT
SET LREND=0
SET LRAN=0
KILL LRORD,LRDUZ
+3 SET DIC="^LRO(68.2,"
SET DIC(0)="AEMZ"
SET DIC("S")="S LRX=$P(^(0),U,12) Q:'$L(LRX) I $D(^XUSEC($P($G(^DIC(19.1,LRX,0)),U),DUZ))"
+4 DO ^DIC
KILL DIC("S")
IF Y<1
GOTO STOP
SET LRLL=+Y
SET LRTYPE=$PIECE(Y(0),U,3)
+5 SET LRPROF=$ORDER(^LRO(68.2,LRLL,10,0))
+6 IF LRPROF<1
SET LREND=1
WRITE !,"No profile defined."
QUIT
+7 SET B=$ORDER(^LRO(68.2,LRLL,10,LRPROF))
+8 IF B>0
SET DIC="^LRO(68.2,"_LRLL_",10,"
DO ^DIC
IF Y<1
GOTO STOP
SET LRPROF=+Y
+9 SET X=^LRO(68.2,LRLL,10,LRPROF,0)
SET LRAA=$PIECE(X,U,2)
SET LRPANEL=$PIECE(X,U)
IF '$DATA(^LRO(68,LRAA,0))#2
WRITE !?10,$CHAR(7),"Error in your DATABASE. There is not an accession area # ",LRAA,!!
QUIT
+10 ;
+11 ; Select performing laboratory to use
+12 SET LRX=$$SELPL^LRVERA($SELECT($PIECE(X,"^",5):$PIECE(X,"^",5),1:DUZ(2)))
+13 IF LRX<1
SET LREND=1
QUIT
+14 IF LRX
IF LRX'=DUZ(2)
SET LRDUZ(2)=LRX
+15 ;
+16 IF $PIECE(LRPARAM,U,14)&($PIECE($GET(^LRO(68,LRAA,0)),U,16))
DO AUTO^LRCAPV
IF LREND
QUIT
+17 IF $PIECE(^LRO(68,LRAA,0),U,2)="MI"
DO ^LRMIEDZ
SET LREND=1
QUIT
+18 IF $PIECE(^LRO(68,LRAA,0),U,2)'="CH"
GOTO STOP
+19 SET LREND=0
DO EXPAND
IF LREND!($ORDER(LRVTS(0))<0)
GOTO STOP
+20 FOR I=0:0
SET I=$ORDER(LRORD(I))
IF I<1
QUIT
SET J=LRORD(I)
SET X=$PIECE(^LAB(60,J,0),U,5)
SET LRORD(I)=$PIECE(X,";",2)
+21 SET Y=^LRO(68,LRAA,0)
SET LRTSE=-1
+22 ;
+23 DO CMTDSP^LRVERA
+24 ;
REV ;
+1 KILL LRPER
+2 DO REV^LRVER
+3 QUIT