BQIDCABA ;GDIT/HS/ALA-Abnormal Lab Results ; 12 Dec 2005 1:07 PM
;;2.4;ICARE MANAGEMENT SYSTEM;**2**;Apr 01, 2015;Build 10
;
Q
;
VIS(DATA,PARMS,MPARMS) ;EP
;
;Description
; Executable that determines abnormal lab flags for the specified parameters
;Input
; PARMS = Array of parameters and their values
; MPARMS = Multiple array of a parameter
;Parameters
; TMFRAME = Relative time frame
; FDT = Starting date for the time frame
; TDT = Ending date for the time frame
; IEN = Lab record internal entry number
; VIEN = Visit record internal entry number
; ABNFL = Abnormal lab result
;Output
; All records found will be put into ^TMP by patient and visit internal entry
; numbers. The patient will be checked against the patients found in all the
; panels and added to the ICARE PATIENT INDEX file.
;
NEW UID
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP(UID,"BQIDCABA"))
K @DATA
;
NEW IEN,NM,FDT,TDT,VTYP,X,DIC,Y,RSTM,VIEN,DFN,%DT,TMFRAME,ABNFL,STAT
S NM=""
F S NM=$O(PARMS(NM)) Q:NM="" S @NM=PARMS(NM)
;
I $G(TMFRAME)="" S TMFRAME="T-6M"
I TMFRAME["T-" D
. S %DT="",X=TMFRAME D ^%DT S FDT=Y
I $G(DT)="" D DT^DICRW
S TDT=DT
;
; Go through the V LAB file for the designated time frame to find any
; abnormal lab results
S RSTM=FDT
F S RSTM=$O(^AUPNVLAB("ARDT",RSTM)) Q:RSTM=""!(RSTM\1>TDT) D
. S IEN=""
. F S IEN=$O(^AUPNVLAB("ARDT",RSTM,IEN)) Q:IEN="" D
.. ;S DFN=$$GET1^DIQ(9000010.09,IEN_",",.02,"I") I DFN="" Q
.. S DFN=$P($G(^AUPNVLAB(IEN,0)),"^",2) I DFN="" Q
.. ;S STAT=$$GET1^DIQ(9000010.09,IEN_",",1109,"I")
.. S STAT=$P($G(^AUPNVLAB(IEN,11)),"^",9)
.. I STAT'="R",STAT'="M" Q
.. ;S ABNFL=$$GET1^DIQ(9000010.09,IEN_",",.05,"E")
.. S ABNFL=$P($G(^AUPNVLAB(IEN,0)),"^",5)
.. ;Q:ABNFL=""
.. I ABNFL="" Q
.. ;S VIEN=$$GET1^DIQ(9000010.09,IEN_",",.03,"I") Q:VIEN=""
.. S VIEN=$P($G(^AUPNVLAB(IEN,0)),"^",3) I VIEN="" Q
.. ;I $$GET1^DIQ(9000010,VIEN_",",.11,"I")=1 Q
.. I $P($G(^AUPNVSIT(VIEN,0)),"^",11)=1 Q
.. I ABNFL="L"!(ABNFL="L*")!(ABNFL="H")!(ABNFL="H*") S @DATA@(DFN,IEN)=VIEN_U_$P($G(^AUPNVSIT(VIEN,0)),"^",1)
Q
BQIDCABA ;GDIT/HS/ALA-Abnormal Lab Results ; 12 Dec 2005 1:07 PM
+1 ;;2.4;ICARE MANAGEMENT SYSTEM;**2**;Apr 01, 2015;Build 10
+2 ;
+3 QUIT
+4 ;
VIS(DATA,PARMS,MPARMS) ;EP
+1 ;
+2 ;Description
+3 ; Executable that determines abnormal lab flags for the specified parameters
+4 ;Input
+5 ; PARMS = Array of parameters and their values
+6 ; MPARMS = Multiple array of a parameter
+7 ;Parameters
+8 ; TMFRAME = Relative time frame
+9 ; FDT = Starting date for the time frame
+10 ; TDT = Ending date for the time frame
+11 ; IEN = Lab record internal entry number
+12 ; VIEN = Visit record internal entry number
+13 ; ABNFL = Abnormal lab result
+14 ;Output
+15 ; All records found will be put into ^TMP by patient and visit internal entry
+16 ; numbers. The patient will be checked against the patients found in all the
+17 ; panels and added to the ICARE PATIENT INDEX file.
+18 ;
+19 NEW UID
+20 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+21 SET DATA=$NAME(^TMP(UID,"BQIDCABA"))
+22 KILL @DATA
+23 ;
+24 NEW IEN,NM,FDT,TDT,VTYP,X,DIC,Y,RSTM,VIEN,DFN,%DT,TMFRAME,ABNFL,STAT
+25 SET NM=""
+26 FOR
SET NM=$ORDER(PARMS(NM))
IF NM=""
QUIT
SET @NM=PARMS(NM)
+27 ;
+28 IF $GET(TMFRAME)=""
SET TMFRAME="T-6M"
+29 IF TMFRAME["T-"
Begin DoDot:1
+30 SET %DT=""
SET X=TMFRAME
DO ^%DT
SET FDT=Y
End DoDot:1
+31 IF $GET(DT)=""
DO DT^DICRW
+32 SET TDT=DT
+33 ;
+34 ; Go through the V LAB file for the designated time frame to find any
+35 ; abnormal lab results
+36 SET RSTM=FDT
+37 FOR
SET RSTM=$ORDER(^AUPNVLAB("ARDT",RSTM))
IF RSTM=""!(RSTM\1>TDT)
QUIT
Begin DoDot:1
+38 SET IEN=""
+39 FOR
SET IEN=$ORDER(^AUPNVLAB("ARDT",RSTM,IEN))
IF IEN=""
QUIT
Begin DoDot:2
+40 ;S DFN=$$GET1^DIQ(9000010.09,IEN_",",.02,"I") I DFN="" Q
+41 SET DFN=$PIECE($GET(^AUPNVLAB(IEN,0)),"^",2)
IF DFN=""
QUIT
+42 ;S STAT=$$GET1^DIQ(9000010.09,IEN_",",1109,"I")
+43 SET STAT=$PIECE($GET(^AUPNVLAB(IEN,11)),"^",9)
+44 IF STAT'="R"
IF STAT'="M"
QUIT
+45 ;S ABNFL=$$GET1^DIQ(9000010.09,IEN_",",.05,"E")
+46 SET ABNFL=$PIECE($GET(^AUPNVLAB(IEN,0)),"^",5)
+47 ;Q:ABNFL=""
+48 IF ABNFL=""
QUIT
+49 ;S VIEN=$$GET1^DIQ(9000010.09,IEN_",",.03,"I") Q:VIEN=""
+50 SET VIEN=$PIECE($GET(^AUPNVLAB(IEN,0)),"^",3)
IF VIEN=""
QUIT
+51 ;I $$GET1^DIQ(9000010,VIEN_",",.11,"I")=1 Q
+52 IF $PIECE($GET(^AUPNVSIT(VIEN,0)),"^",11)=1
QUIT
+53 IF ABNFL="L"!(ABNFL="L*")!(ABNFL="H")!(ABNFL="H*")
SET @DATA@(DFN,IEN)=VIEN_U_$PIECE($GET(^AUPNVSIT(VIEN,0)),"^",1)
End DoDot:2
End DoDot:1
+54 QUIT