LRVERA ;VA/DALOI/JMC - READ ACCESSION/UID ;JUL 06, 2010 3:14 PM
;;5.2;LAB SERVICE;**153,271,286,1027**;NOV 01, 1997
;
;
ACC ; Prompt for accession selection
D EN^LRWU4
Q
;
;
UID ; Prompt for UID selection
;
N LRQUIT,LRX,LRY
;
W !
S (LRQUIT,LRY)=0
F D Q:LRQUIT
. S LRX=$$UID^LRWU4("Unique Identifier",$G(LRUID))
. I LRX=0 S LRUID="",(LRAA,LRAD,LRAN)=-1,LRQUIT=1 Q
. S LRY=$$CHECKUID^LRWU4(LRX)
. I LRY S LRQUIT=1 Q
. W !,"No accession on file for this UID."
. S LRUID=""
;
; If good UID then update variables if user selected a different UID
; Display accession.
I LRY D
. I $G(LRUID)'=LRX S LRUID=LRX,LRAA=$P(LRY,"^",2),LRAD=$P(LRY,"^",3),LRAN=$P(LRY,"^",4)
. W " (",$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.2)),"^"),")"
Q
;
;
SELPL(LR4) ; Select the performing laboratory to store with test results.
; Call with LR4 = default institution, usually value of DUZ(2)
;
; Returns LR4 = ien of file #4 institution selected
;
N DIC,DTOUT,DUOUT,X,Y
S DIC="^DIC(4,",DIC(0)="AEMOQ"
; S DIC("A")="Select Performing Laboratory: "
S DIC("A")="Select Referring Laboratory: " ; IHS/OIT/MKK - LR*5.2*1027
I $G(LR4)>0 S DIC("B")=$$GET1^DIQ(4,LR4_",",.01)
S DIC("S")="I $$SCRNPL^LRVERA"
D ^DIC
I Y<1 S LR4=0
E S LR4=$P(Y,"^")
;
Q LR4
;
;
SCRNPL() ; Screen performing laboratory
; Called by DIC("S") lookup above when selecting performing laboratory
N OK,LRX
S OK=0
I Y=DUZ(2) S OK=1
E I $D(^LAHM(62.9,"CH",DUZ(2),Y)) S OK=1
Q OK
;
;
PLOK(LRX,LRY,LRZ,LR60) ; Check if user is editing results that appear to have
; been performed by a lab different from the one they selected and.
; ask if changing performing lab is ok.
;
; Call with LRX = file #4 ien of performing lab on record
; LRY = file #4 ien of performing lab user selected
; LRZ = user's current division - DUZ(2)
; LR60 = file #60 ien of test selected
;
; Returns 1=YES, 0=NO
;
N DIR,DIRUT,DTOUT,DUOUT,OK,X,Y
S OK=1
I LRX D
. I LRY,LRX=LRY Q
. I LRX=LRZ Q
. S DIR("A",1)="The performing lab recorded for test "_$$GET1^DIQ(60,LR60_",",.01)_" is: "_$$GET1^DIQ(4,LRX_",",.01)
. S DIR("A",2)="You indicated the performing lab is: "_$$GET1^DIQ(4,$S(LRY:LRY,1:LRZ)_",",.01)
. S DIR("A")="Do you want to continue",DIR("B")="NO"
. S DIR(0)="YO",OK=0
. W ! D ^DIR
. I Y=1 S OK=1
Q OK
;
;
RFLAG(FLAG) ; Ask user for referral high/low/critical flag in case they
; don't have values to calculate.
; Call with FLAG = current abnormal flag if any
;
; Returns NULL=no selection 0=Calculate from entered values
; 1=Abnormal Low 2=Critical Low
; 3=Abnormal High 4=Critical High
;
N DIR,DIROUT,DIRUT,DTOUT,X,Y
S DIR(0)="SOA^0:Calculate from entered values;1:Abnormal Low;2:Critical Low;3:Abnormal High;4:Critical High"
S DIR("A")="Result's Abnormality: "
S DIR("B")="Calculate from entered values"
I $G(FLAG)'="" S DIR("B")=$S(FLAG="L":"Abnormal Low",FLAG="L*":"Critical Low",FLAG="H":"Abnormal High",FLAG="H*":"Critical High",1:DIR("B"))
S DIR("?")="Select the abnormality if it cannot be calculated from reference values."
D ^DIR
I $D(DIRUT) S Y=""
Q Y
;
;
DCOM ; From above and LRVR4 - display comments
;
; Quit if no current or previous comments
I '$O(^LR(LRDFN,LRSS,LRIDT,1,0)),'$O(^LR(LRDFN,LRSS,+$G(LRLDT),1,0)) Q
;
N DA
;
; Display previous comments.
I $G(LRCMTDSP),$G(LRLDT)>0,$O(^LR(LRDFN,LRSS,LRLDT,1,0)) D
. W !,"*** Comments for Previous Accession "_$P($G(Z2),"^",6)_" ***"
. S DA=LRLDT D DSPCMT
;
; Display current comments
I $O(^LR(LRDFN,LRSS,LRIDT,1,0)) D
. I $G(LRCMTDSP),$G(LRLDT)>0,$O(^LR(LRDFN,LRSS,LRLDT,1,0)) D
. . W !,"*** Comments for Current Accession "_$G(LRACC)_" ***"
. . S LRLCT=LRLCT+1
. S DA=LRIDT D DSPCMT
Q
;
;
CMTDSP ; Determine if display of previous results should include associated comments.
;
N ERR,I
;
; Get stored list of tests from parameter tool
K ^TMP("LRXPAR",$J),^TMP("LR",$J,"DCMT")
D GETLST^XPAR("^TMP(""LRXPAR"",$J)","USR","LR VER DISPLAY PREV COMMENT","Q",.ERR,1)
I '$G(^TMP("LRXPAR",$J)) Q
; Create list based in file #60 ien - makes checking easier
S I=0
F S I=$O(^TMP("LRXPAR",$J,I)) Q:'I I $P(^(I),"^",2) S ^TMP("LR",$J,"DCMT",+^TMP("LRXPAR",$J,I))=""
K ^TMP("LRXPAR",$J)
Q
;
;
CHKCDSP() ; Check if previous comment should display when test on user's list
; is present on test profile selected for this accession.
;
N I,OK
S OK=0
I $G(LRLDT)>0,$D(^TMP("LR",$J,"DCMT")) D
. S I=0
. F S I=$O(LRM(I)) Q:'I D Q:OK
. . I $D(^TMP("LR",$J,"DCMT",+LRM(I))) S OK=1 Q
. . I $G(LRM(I,"P")),$D(^TMP("LR",$J,"DCMT",+LRM(I,"P"))) S OK=1 Q
Q OK
;
;
DSPCMT ; Display comments stored in file #63
N DIR,DIRUT,DTOUT,DUOUT,I,X,Y
S I=0
F S I=$O(^LR(LRDFN,LRSS,DA,1,I)) Q:'I D Q:$D(DIRUT)
. S LRLCT=LRLCT+1
. W !,"COMMENTS: ",$P(^LR(LRDFN,LRSS,DA,1,I,0),"^")
. I LRLCT>21,$E(IOST,1,2)="C-" D Q:$D(DIRUT)
. . S DIR(0)="E" D ^DIR
. . S LRLCT=0
W ! S LRLCT=LRLCT+1
Q
LRVERA ;VA/DALOI/JMC - READ ACCESSION/UID ;JUL 06, 2010 3:14 PM
+1 ;;5.2;LAB SERVICE;**153,271,286,1027**;NOV 01, 1997
+2 ;
+3 ;
ACC ; Prompt for accession selection
+1 DO EN^LRWU4
+2 QUIT
+3 ;
+4 ;
UID ; Prompt for UID selection
+1 ;
+2 NEW LRQUIT,LRX,LRY
+3 ;
+4 WRITE !
+5 SET (LRQUIT,LRY)=0
+6 FOR
Begin DoDot:1
+7 SET LRX=$$UID^LRWU4("Unique Identifier",$GET(LRUID))
+8 IF LRX=0
SET LRUID=""
SET (LRAA,LRAD,LRAN)=-1
SET LRQUIT=1
QUIT
+9 SET LRY=$$CHECKUID^LRWU4(LRX)
+10 IF LRY
SET LRQUIT=1
QUIT
+11 WRITE !,"No accession on file for this UID."
+12 SET LRUID=""
End DoDot:1
IF LRQUIT
QUIT
+13 ;
+14 ; If good UID then update variables if user selected a different UID
+15 ; Display accession.
+16 IF LRY
Begin DoDot:1
+17 IF $GET(LRUID)'=LRX
SET LRUID=LRX
SET LRAA=$PIECE(LRY,"^",2)
SET LRAD=$PIECE(LRY,"^",3)
SET LRAN=$PIECE(LRY,"^",4)
+18 WRITE " (",$PIECE($GET(^LRO(68,LRAA,1,LRAD,1,LRAN,.2)),"^"),")"
End DoDot:1
+19 QUIT
+20 ;
+21 ;
SELPL(LR4) ; Select the performing laboratory to store with test results.
+1 ; Call with LR4 = default institution, usually value of DUZ(2)
+2 ;
+3 ; Returns LR4 = ien of file #4 institution selected
+4 ;
+5 NEW DIC,DTOUT,DUOUT,X,Y
+6 SET DIC="^DIC(4,"
SET DIC(0)="AEMOQ"
+7 ; S DIC("A")="Select Performing Laboratory: "
+8 ; IHS/OIT/MKK - LR*5.2*1027
SET DIC("A")="Select Referring Laboratory: "
+9 IF $GET(LR4)>0
SET DIC("B")=$$GET1^DIQ(4,LR4_",",.01)
+10 SET DIC("S")="I $$SCRNPL^LRVERA"
+11 DO ^DIC
+12 IF Y<1
SET LR4=0
+13 IF '$TEST
SET LR4=$PIECE(Y,"^")
+14 ;
+15 QUIT LR4
+16 ;
+17 ;
SCRNPL() ; Screen performing laboratory
+1 ; Called by DIC("S") lookup above when selecting performing laboratory
+2 NEW OK,LRX
+3 SET OK=0
+4 IF Y=DUZ(2)
SET OK=1
+5 IF '$TEST
IF $DATA(^LAHM(62.9,"CH",DUZ(2),Y))
SET OK=1
+6 QUIT OK
+7 ;
+8 ;
PLOK(LRX,LRY,LRZ,LR60) ; Check if user is editing results that appear to have
+1 ; been performed by a lab different from the one they selected and.
+2 ; ask if changing performing lab is ok.
+3 ;
+4 ; Call with LRX = file #4 ien of performing lab on record
+5 ; LRY = file #4 ien of performing lab user selected
+6 ; LRZ = user's current division - DUZ(2)
+7 ; LR60 = file #60 ien of test selected
+8 ;
+9 ; Returns 1=YES, 0=NO
+10 ;
+11 NEW DIR,DIRUT,DTOUT,DUOUT,OK,X,Y
+12 SET OK=1
+13 IF LRX
Begin DoDot:1
+14 IF LRY
IF LRX=LRY
QUIT
+15 IF LRX=LRZ
QUIT
+16 SET DIR("A",1)="The performing lab recorded for test "_$$GET1^DIQ(60,LR60_",",.01)_" is: "_$$GET1^DIQ(4,LRX_",",.01)
+17 SET DIR("A",2)="You indicated the performing lab is: "_$$GET1^DIQ(4,$SELECT(LRY:LRY,1:LRZ)_",",.01)
+18 SET DIR("A")="Do you want to continue"
SET DIR("B")="NO"
+19 SET DIR(0)="YO"
SET OK=0
+20 WRITE !
DO ^DIR
+21 IF Y=1
SET OK=1
End DoDot:1
+22 QUIT OK
+23 ;
+24 ;
RFLAG(FLAG) ; Ask user for referral high/low/critical flag in case they
+1 ; don't have values to calculate.
+2 ; Call with FLAG = current abnormal flag if any
+3 ;
+4 ; Returns NULL=no selection 0=Calculate from entered values
+5 ; 1=Abnormal Low 2=Critical Low
+6 ; 3=Abnormal High 4=Critical High
+7 ;
+8 NEW DIR,DIROUT,DIRUT,DTOUT,X,Y
+9 SET DIR(0)="SOA^0:Calculate from entered values;1:Abnormal Low;2:Critical Low;3:Abnormal High;4:Critical High"
+10 SET DIR("A")="Result's Abnormality: "
+11 SET DIR("B")="Calculate from entered values"
+12 IF $GET(FLAG)'=""
SET DIR("B")=$SELECT(FLAG="L":"Abnormal Low",FLAG="L*":"Critical Low",FLAG="H":"Abnormal High",FLAG="H*":"Critical High",1:DIR("B"))
+13 SET DIR("?")="Select the abnormality if it cannot be calculated from reference values."
+14 DO ^DIR
+15 IF $DATA(DIRUT)
SET Y=""
+16 QUIT Y
+17 ;
+18 ;
DCOM ; From above and LRVR4 - display comments
+1 ;
+2 ; Quit if no current or previous comments
+3 IF '$ORDER(^LR(LRDFN,LRSS,LRIDT,1,0))
IF '$ORDER(^LR(LRDFN,LRSS,+$GET(LRLDT),1,0))
QUIT
+4 ;
+5 NEW DA
+6 ;
+7 ; Display previous comments.
+8 IF $GET(LRCMTDSP)
IF $GET(LRLDT)>0
IF $ORDER(^LR(LRDFN,LRSS,LRLDT,1,0))
Begin DoDot:1
+9 WRITE !,"*** Comments for Previous Accession "_$PIECE($GET(Z2),"^",6)_" ***"
+10 SET DA=LRLDT
DO DSPCMT
End DoDot:1
+11 ;
+12 ; Display current comments
+13 IF $ORDER(^LR(LRDFN,LRSS,LRIDT,1,0))
Begin DoDot:1
+14 IF $GET(LRCMTDSP)
IF $GET(LRLDT)>0
IF $ORDER(^LR(LRDFN,LRSS,LRLDT,1,0))
Begin DoDot:2
+15 WRITE !,"*** Comments for Current Accession "_$GET(LRACC)_" ***"
+16 SET LRLCT=LRLCT+1
End DoDot:2
+17 SET DA=LRIDT
DO DSPCMT
End DoDot:1
+18 QUIT
+19 ;
+20 ;
CMTDSP ; Determine if display of previous results should include associated comments.
+1 ;
+2 NEW ERR,I
+3 ;
+4 ; Get stored list of tests from parameter tool
+5 KILL ^TMP("LRXPAR",$JOB),^TMP("LR",$JOB,"DCMT")
+6 DO GETLST^XPAR("^TMP(""LRXPAR"",$J)","USR","LR VER DISPLAY PREV COMMENT","Q",.ERR,1)
+7 IF '$GET(^TMP("LRXPAR",$JOB))
QUIT
+8 ; Create list based in file #60 ien - makes checking easier
+9 SET I=0
+10 FOR
SET I=$ORDER(^TMP("LRXPAR",$JOB,I))
IF 'I
QUIT
IF $PIECE(^(I),"^",2)
SET ^TMP("LR",$JOB,"DCMT",+^TMP("LRXPAR",$JOB,I))=""
+11 KILL ^TMP("LRXPAR",$JOB)
+12 QUIT
+13 ;
+14 ;
CHKCDSP() ; Check if previous comment should display when test on user's list
+1 ; is present on test profile selected for this accession.
+2 ;
+3 NEW I,OK
+4 SET OK=0
+5 IF $GET(LRLDT)>0
IF $DATA(^TMP("LR",$JOB,"DCMT"))
Begin DoDot:1
+6 SET I=0
+7 FOR
SET I=$ORDER(LRM(I))
IF 'I
QUIT
Begin DoDot:2
+8 IF $DATA(^TMP("LR",$JOB,"DCMT",+LRM(I)))
SET OK=1
QUIT
+9 IF $GET(LRM(I,"P"))
IF $DATA(^TMP("LR",$JOB,"DCMT",+LRM(I,"P")))
SET OK=1
QUIT
End DoDot:2
IF OK
QUIT
End DoDot:1
+10 QUIT OK
+11 ;
+12 ;
DSPCMT ; Display comments stored in file #63
+1 NEW DIR,DIRUT,DTOUT,DUOUT,I,X,Y
+2 SET I=0
+3 FOR
SET I=$ORDER(^LR(LRDFN,LRSS,DA,1,I))
IF 'I
QUIT
Begin DoDot:1
+4 SET LRLCT=LRLCT+1
+5 WRITE !,"COMMENTS: ",$PIECE(^LR(LRDFN,LRSS,DA,1,I,0),"^")
+6 IF LRLCT>21
IF $EXTRACT(IOST,1,2)="C-"
Begin DoDot:2
+7 SET DIR(0)="E"
DO ^DIR
+8 SET LRLCT=0
End DoDot:2
IF $DATA(DIRUT)
QUIT
End DoDot:1
IF $DATA(DIRUT)
QUIT
+9 WRITE !
SET LRLCT=LRLCT+1
+10 QUIT