IBDFN11 ;ALB/CMR - ENCOUNTER FORM - (entry points for reprint of dynamic data) ;5/21/93
;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
;
REPRINT(IBPFID,LIST,ARY) ; -- returns dynamic lists previously printed on a form
; -- input IBPFID = ien of forms tracking file
; LIST = ien of selection list file
; ARY = name of array to return list in
;
; -- output The format of the returned array is as follows:
; @ARY(0) = count of array element (0 if nothing found)
; @ARY(1) = provider ien^provider
; or @ARY(1) = problem ien^problem text^ICD code
; or @ARY(1) = classification question
;
Q:'IBPFID!('LIST)
N FID,ITEM,IBDIEN,NODE,COUNT
; -- initialize counter
S COUNT=0
; -- clean out storage area
K @ARY
; -- get field ids associated with this list
S FID="S"_LIST
S XREF=$S($O(^IBD(357.96,IBPFID,"AD",FID))[LIST:"AD",$O(^IBD(357.96,IBPFID,"AC",FID))[LIST:"AC",1:"") Q:XREF']""
S FID=$O(^IBD(357.96,IBPFID,XREF,FID)) Q:FID'[LIST D
.; -- get all items for the field id
.S ITEM=0 F S ITEM=$O(^IBD(357.96,IBPFID,XREF,FID,ITEM)) Q:'ITEM D
..; -- get ien for dynamic data entry
..S IBDIEN=0 F S IBDIEN=$O(^IBD(357.96,IBPFID,XREF,FID,ITEM,IBDIEN)) Q:'IBDIEN S NODE=$S(XREF="AD":$G(^IBD(357.96,IBPFID,2,IBDIEN,0)),1:$G(^IBD(357.96,IBPFID,1,IBDIEN,0))) I NODE]"" D
...; -- set output array with dynamic data previously printed
...S COUNT=COUNT+1
...S @ARY@(COUNT)=$P(NODE,"^",4)_"^"_$P(NODE,"^",8)_"^"_$S(ARY["GMP SELECT PATIENT ACTIVE PROBLEMS":$P($G(^ICD9(+$G(^AUPNPROB(+$P(NODE,"^",4),0)),0)),"^"),1:"")
S @ARY@(0)=COUNT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBDFN11 1651 printed Dec 13, 2024@02:52:49 Page 2
IBDFN11 ;ALB/CMR - ENCOUNTER FORM - (entry points for reprint of dynamic data) ;5/21/93
+1 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
+2 ;
REPRINT(IBPFID,LIST,ARY) ; -- returns dynamic lists previously printed on a form
+1 ; -- input IBPFID = ien of forms tracking file
+2 ; LIST = ien of selection list file
+3 ; ARY = name of array to return list in
+4 ;
+5 ; -- output The format of the returned array is as follows:
+6 ; @ARY(0) = count of array element (0 if nothing found)
+7 ; @ARY(1) = provider ien^provider
+8 ; or @ARY(1) = problem ien^problem text^ICD code
+9 ; or @ARY(1) = classification question
+10 ;
+11 if 'IBPFID!('LIST)
QUIT
+12 NEW FID,ITEM,IBDIEN,NODE,COUNT
+13 ; -- initialize counter
+14 SET COUNT=0
+15 ; -- clean out storage area
+16 KILL @ARY
+17 ; -- get field ids associated with this list
+18 SET FID="S"_LIST
+19 SET XREF=$SELECT($ORDER(^IBD(357.96,IBPFID,"AD",FID))[LIST:"AD",$ORDER(^IBD(357.96,IBPFID,"AC",FID))[LIST:"AC",1:"")
if XREF']""
QUIT
+20 SET FID=$ORDER(^IBD(357.96,IBPFID,XREF,FID))
if FID'[LIST
QUIT
Begin DoDot:1
+21 ; -- get all items for the field id
+22 SET ITEM=0
FOR
SET ITEM=$ORDER(^IBD(357.96,IBPFID,XREF,FID,ITEM))
if 'ITEM
QUIT
Begin DoDot:2
+23 ; -- get ien for dynamic data entry
+24 SET IBDIEN=0
FOR
SET IBDIEN=$ORDER(^IBD(357.96,IBPFID,XREF,FID,ITEM,IBDIEN))
if 'IBDIEN
QUIT
SET NODE=$SELECT(XREF="AD":$GET(^IBD(357.96,IBPFID,2,IBDIEN,0)),1:$GET(^IBD(357.96,IBPFID,1,IBDIEN,0)))
IF NODE]""
Begin DoDot:3
+25 ; -- set output array with dynamic data previously printed
+26 SET COUNT=COUNT+1
+27 SET @ARY@(COUNT)=$PIECE(NODE,"^",4)_"^"_$PIECE(NODE,"^",8)_"^"_$SELECT(ARY["GMP SELECT PATIENT ACTIVE PROBLEMS":$PIECE($GET(^ICD9(+$GET(^AUPNPROB(+$PIECE(NODE,"^",4),0)),0)),"^"),1:"")
End DoDot:3
End DoDot:2
End DoDot:1
+28 SET @ARY@(0)=COUNT
+29 QUIT