PXCEAE1 ;ISL/dee,ISA/KWP - Builds the List Manager display of a visit and related v-files ;6/20/96
;;1.0;PCE PATIENT CARE ENCOUNTER;**22,73**;Aug 12, 1996
;; ;
Q
;
BUILD(VISITIEN,AEVIEW,ARRAY,ARRAYIX) ;
;AEVIEW is "B" for brief display and "D" for expanded display.
I '$D(^AUPNVSIT(VISITIEN)) S VALMBCK="Q" Q
N PXCECNT
D FULL^VALM1
D CLEAN^VALM10
K @ARRAYIX
S (VALMCNT,PXCECNT)=0
;
;
N IEN,FILE,VFILE,VROUTINE
F FILE="SIT","CSTP","PRV","POV","CPT","TRT","IMM","PED","SK","HF","XAM" D
. S VROUTINE="PXCE"_$S(FILE="IMM":"VIMM",1:FILE)
. S VFILE=$P($T(FORMAT^@VROUTINE),"~",5)
. I FILE="SIT" D
.. S IEN=VISITIEN
.. D AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,.PXCECNT,AEVIEW)
.. S VALMCNT=VALMCNT+1
.. S @ARRAY@(VALMCNT,0)=""
. E D
.. S IEN=""
.. F S IEN=$O(@VFILE@("AD",VISITIEN,IEN)) Q:'IEN D AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,.PXCECNT,AEVIEW)
S @ARRAYIX@(0)=PXCECNT
I VALMCNT=0 S VALMBCK="Q"
Q
;
AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,VALMCNT,PXCECNT,AEVIEW) ;
N ENTRY,NODE,NODES,NODECNT
S PXCECNT=PXCECNT+1
S NODES=$P($T(FORMAT^@VROUTINE),"~",3)
F NODECNT=1:1 S NODE=$P(NODES,",",NODECNT) Q:NODE']"" S ENTRY(NODE)=$G(@VFILE@(IEN,NODE))
D DISPLAY(.ENTRY,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,PXCECNT,AEVIEW)
I FILE="SIT" S @ARRAYIX@(PXCECNT)=VISITIEN_"^VST"
E S @ARRAYIX@(PXCECNT)=IEN_"^"_FILE
Q
;
DISPLAY(ENTRY,PXCECODE,ARRAY,ARRAYIX,LINE,COUNT,VIEW) ; -- display the data
N PXCEFILE,PXCELINE,PXCETEXT,PXCEINT,PXCEEXT
S PXCEFILE=$P($T(FORMAT^@PXCECODE),"~",2)
F PXCELINE=1:1 S PXCETEXT=$P($T(FORMAT+PXCELINE^@PXCECODE),";;",2) Q:PXCETEXT']"" D
. S (PXCEEXT,PXCEINT)=$P(ENTRY($P(PXCETEXT,"~",1)),"^",$P(PXCETEXT,"~",2))
. I PXCETEXT'["CPT Modifier",PXCEINT="" Q ;Q:PXCEINT=""
. Q:$P(PXCETEXT,"~",10)="N"
. I VIEW'="D",$P(PXCETEXT,"~",10)="D" Q
. I PXCECODE="PXCECSTP",$P(PXCETEXT,"~",3)=.01 Q
. I $P(PXCETEXT,"~",6)]"" D Q:PXCEEXT=""
.. ;I PXCECODE["CPT",$P(PXCETEXT,"~",6)["DNAR" B
.. S @("PXCEEXT="_$P(PXCETEXT,"~",6)_"("""_$S($P(PXCETEXT,"~",3)=.01:ENTRY($P(PXCETEXT,"~",1)),1:PXCEINT)_""")")
. E D
.. N PXCEDILF,DIERR,PXCEI
.. S PXCEEXT=$$EXTERNAL^DILFD(PXCEFILE,$P(PXCETEXT,"~",3),"",PXCEINT,"PXCEDILF")
.. S PXCEEXT=$S('$D(DIERR):PXCEEXT,1:PXCEINT)
. S TEMP=PXCEEXT
. F PXI=1:1 Q:$P(TEMP,"^",PXI)="" S PXCEEXT=$P(TEMP,"^",PXI) D ADDLINE
Q
ADDLINE ;
S LINE=LINE+1
I PXCELINE=1!(PXCECODE="PXCECSTP") S @ARRAY@(LINE,0)=$J(COUNT,3)_" "
E S @ARRAY@(LINE,0)=" "
S @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_$P(PXCETEXT,"~",5)
I ($L(@ARRAY@(LINE,0))+$L(PXCEEXT))'>80 D
. S @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_PXCEEXT
E D
. N PXCEWRAP,PXCECOUN,PXCEHEAD
. S PXCEHEAD=$L(@ARRAY@(LINE,0))
. D WRAP^PXCEVFI4(PXCEEXT,80-PXCEHEAD,.PXCEWRAP)
. S @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_$G(PXCEWRAP(1))
. S PXCECOUN=1
. F S PXCECOUN=$O(PXCEWRAP(PXCECOUN)) Q:PXCECOUN']"" D
.. S LINE=LINE+1
.. S @ARRAY@(LINE,0)=$J("",PXCEHEAD)_PXCEWRAP(PXCECOUN)
Q
;
PXCEAE1 ;ISL/dee,ISA/KWP - Builds the List Manager display of a visit and related v-files ;6/20/96
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**22,73**;Aug 12, 1996
+2 ;; ;
+3 QUIT
+4 ;
BUILD(VISITIEN,AEVIEW,ARRAY,ARRAYIX) ;
+1 ;AEVIEW is "B" for brief display and "D" for expanded display.
+2 IF '$DATA(^AUPNVSIT(VISITIEN))
SET VALMBCK="Q"
QUIT
+3 NEW PXCECNT
+4 DO FULL^VALM1
+5 DO CLEAN^VALM10
+6 KILL @ARRAYIX
+7 SET (VALMCNT,PXCECNT)=0
+8 ;
+9 ;
+10 NEW IEN,FILE,VFILE,VROUTINE
+11 FOR FILE="SIT","CSTP","PRV","POV","CPT","TRT","IMM","PED","SK","HF","XAM"
Begin DoDot:1
+12 SET VROUTINE="PXCE"_$SELECT(FILE="IMM":"VIMM",1:FILE)
+13 SET VFILE=$PIECE($TEXT(FORMAT^@VROUTINE),"~",5)
+14 IF FILE="SIT"
Begin DoDot:2
+15 SET IEN=VISITIEN
+16 DO AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,.PXCECNT,AEVIEW)
+17 SET VALMCNT=VALMCNT+1
+18 SET @ARRAY@(VALMCNT,0)=""
End DoDot:2
+19 IF '$TEST
Begin DoDot:2
+20 SET IEN=""
+21 FOR
SET IEN=$ORDER(@VFILE@("AD",VISITIEN,IEN))
IF 'IEN
QUIT
DO AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,.PXCECNT,AEVIEW)
End DoDot:2
End DoDot:1
+22 SET @ARRAYIX@(0)=PXCECNT
+23 IF VALMCNT=0
SET VALMBCK="Q"
+24 QUIT
+25 ;
AFILE(IEN,FILE,VFILE,VROUTINE,ARRAY,ARRAYIX,VALMCNT,PXCECNT,AEVIEW) ;
+1 NEW ENTRY,NODE,NODES,NODECNT
+2 SET PXCECNT=PXCECNT+1
+3 SET NODES=$PIECE($TEXT(FORMAT^@VROUTINE),"~",3)
+4 FOR NODECNT=1:1
SET NODE=$PIECE(NODES,",",NODECNT)
IF NODE']""
QUIT
SET ENTRY(NODE)=$GET(@VFILE@(IEN,NODE))
+5 DO DISPLAY(.ENTRY,VROUTINE,ARRAY,ARRAYIX,.VALMCNT,PXCECNT,AEVIEW)
+6 IF FILE="SIT"
SET @ARRAYIX@(PXCECNT)=VISITIEN_"^VST"
+7 IF '$TEST
SET @ARRAYIX@(PXCECNT)=IEN_"^"_FILE
+8 QUIT
+9 ;
DISPLAY(ENTRY,PXCECODE,ARRAY,ARRAYIX,LINE,COUNT,VIEW) ; -- display the data
+1 NEW PXCEFILE,PXCELINE,PXCETEXT,PXCEINT,PXCEEXT
+2 SET PXCEFILE=$PIECE($TEXT(FORMAT^@PXCECODE),"~",2)
+3 FOR PXCELINE=1:1
SET PXCETEXT=$PIECE($TEXT(FORMAT+PXCELINE^@PXCECODE),";;",2)
IF PXCETEXT']""
QUIT
Begin DoDot:1
+4 SET (PXCEEXT,PXCEINT)=$PIECE(ENTRY($PIECE(PXCETEXT,"~",1)),"^",$PIECE(PXCETEXT,"~",2))
+5 ;Q:PXCEINT=""
IF PXCETEXT'["CPT Modifier"
IF PXCEINT=""
QUIT
+6 IF $PIECE(PXCETEXT,"~",10)="N"
QUIT
+7 IF VIEW'="D"
IF $PIECE(PXCETEXT,"~",10)="D"
QUIT
+8 IF PXCECODE="PXCECSTP"
IF $PIECE(PXCETEXT,"~",3)=.01
QUIT
+9 IF $PIECE(PXCETEXT,"~",6)]""
Begin DoDot:2
+10 ;I PXCECODE["CPT",$P(PXCETEXT,"~",6)["DNAR" B
+11 SET @("PXCEEXT="_$PIECE(PXCETEXT,"~",6)_"("""_$SELECT($PIECE(PXCETEXT,"~",3)=.01:ENTRY($PIECE(PXCETEXT,"~",1)),1:PXCEINT)_""")")
End DoDot:2
IF PXCEEXT=""
QUIT
+12 IF '$TEST
Begin DoDot:2
+13 NEW PXCEDILF,DIERR,PXCEI
+14 SET PXCEEXT=$$EXTERNAL^DILFD(PXCEFILE,$PIECE(PXCETEXT,"~",3),"",PXCEINT,"PXCEDILF")
+15 SET PXCEEXT=$SELECT('$DATA(DIERR):PXCEEXT,1:PXCEINT)
End DoDot:2
+16 SET TEMP=PXCEEXT
+17 FOR PXI=1:1
IF $PIECE(TEMP,"^",PXI)=""
QUIT
SET PXCEEXT=$PIECE(TEMP,"^",PXI)
DO ADDLINE
End DoDot:1
+18 QUIT
ADDLINE ;
+1 SET LINE=LINE+1
+2 IF PXCELINE=1!(PXCECODE="PXCECSTP")
SET @ARRAY@(LINE,0)=$JUSTIFY(COUNT,3)_" "
+3 IF '$TEST
SET @ARRAY@(LINE,0)=" "
+4 SET @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_$PIECE(PXCETEXT,"~",5)
+5 IF ($LENGTH(@ARRAY@(LINE,0))+$LENGTH(PXCEEXT))'>80
Begin DoDot:1
+6 SET @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_PXCEEXT
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 NEW PXCEWRAP,PXCECOUN,PXCEHEAD
+9 SET PXCEHEAD=$LENGTH(@ARRAY@(LINE,0))
+10 DO WRAP^PXCEVFI4(PXCEEXT,80-PXCEHEAD,.PXCEWRAP)
+11 SET @ARRAY@(LINE,0)=@ARRAY@(LINE,0)_$GET(PXCEWRAP(1))
+12 SET PXCECOUN=1
+13 FOR
SET PXCECOUN=$ORDER(PXCEWRAP(PXCECOUN))
IF PXCECOUN']""
QUIT
Begin DoDot:2
+14 SET LINE=LINE+1
+15 SET @ARRAY@(LINE,0)=$JUSTIFY("",PXCEHEAD)_PXCEWRAP(PXCECOUN)
End DoDot:2
End DoDot:1
+16 QUIT
+17 ;