GMTSPXOP ; SLC/SBW,KER - PCE Outpatient Encounter comp ; 02/27/2002
;;2.7;Health Summary;**8,10,28,37,47,49,76**;Oct 20, 1995
;
; External References
; DBIA 1238 VISIT^PXRHS01
; DBIA 1996 $$MOD^ICPTMOD
; DBIA 10103 $$DT^XLFDT
; DBIA 10011 ^DIWP
;
PURPOSE ; Encounters with ICD9 and providers
N DTYPE S DTYPE="DP" D MAIN Q
OUTPT ; Encounters with ICD9, CPT, and providers
N DTYPE S DTYPE="CDP" D MAIN Q
MAIN ; Entry for Purpose of Visit and Outpatient Encounters
N GMTSIVD,GMTSDAT,GMTSDTU,GMTSOVT,GMTSLOC,DIWL,GMTAB,GMTSN,GMCKP,GMTSX
N GMTSITE,GMTSINS,GMTSEVT,GMTSHIS,GMTSICL,GMTSLOC,GMTSELIG,X,GMTSVDF
N GMTSCPTM,GMICL
;
; GMTSCPTM Component uses CPT Modifiers 1 yes 0 no
S GMTSCPTM=+($$CPT^GMTSU(+($G(GMTSEGN)))) S:$G(GMPXCMOD)="N" GMTSCPTM=0
; GMTSICL # of blank left columns for support data of a visit
S GMTSICL=14
; DIWL Used in TXTFMT call & to print returned data
S DIWL=0
; GMTAB Used to offset data from TXTFMT call after 1st line
S GMTAB=2
; GMTSOVT This is the set of Service Categories for AICTSORE
;
; A Ambulatory
; I Inpatient
; C Chart Review
; T Telecommunications
; S Day Surgery
; O Observation
; R Nursing Home Encounters
; E Event (Historical)
;
; Note: Hospitalization and Ancillary
; encounters are not included
S GMTSOVT="AICTSORE"
;
D VISIT^PXRHS01(DFN,GMTSEND,GMTSBEG,GMTSNDM,GMTSOVT,DTYPE,1)
Q:'$D(^TMP("PXHSV",$J))
S GMTSIVD=0
F S GMTSIVD=$O(^TMP("PXHSV",$J,GMTSIVD)) Q:GMTSIVD']"" D Q:$D(GMTSQIT)
. S GMTSVDF=0
. F S GMTSVDF=$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF)) Q:GMTSVDF'>0 D Q:$D(GMTSQIT)
. . S GMTSN=$G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,0))
. . S GMTSEVT=$P(GMTSN,U,4),GMTSHIS=$S(GMTSEVT["HISTORICAL":1,1:0)
. . S X=$P(GMTSN,U,1) D REGDT4^GMTSU S GMTSDAT=X
. . S GMTSDTU=0,(GMTSITE,GMTSLOC)=""
. . S GMTSINS=$S($P(GMTSN,U,3)]"":$E($P(GMTSN,U,3),1,10),$P(GMTSN,U,8)]"":$E($P(GMTSN,U,8),1,10),1:""),GMTSITE=GMTSINS
. . I $G(GMPXHLOC)'="N" S GMTSLOC=$E($P(GMTSN,U,6),1,30)
. . I '$L(GMTSLOC) S GMTSLOC=$P(GMTSN,U,9)
. . S GMTSELIG=$E($P(GMTSN,U,12),1,17)
. . S:GMTSITE=""&('GMTSHIS) GMTSLOC=""
. . I GMTSHIS D
. . . S:GMTSLOC'=""&(GMTSITE'="") GMTSLOC=GMTSLOC_" (Historical Event)"
. . . S:GMTSLOC=""&(GMTSITE'="") GMTSITE=GMTSITE_" (Historical Event)"
. . . S:GMTSLOC'=""&(GMTSITE="") GMTSITE=GMTSLOC_" (Historical Event)",GMTSLOC=""
. . . S:GMTSLOC=""&(GMTSITE="") GMTSITE="Historical Event"
. . D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS,DSPPROV Q:$D(GMTSQIT)
. . D DSPPOV Q:$D(GMTSQIT) D DSPCPT W !
K ^TMP("PXHSV",$J)
Q
;
DSPPOV ; Display Purpose of visit
Q:$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"D",""))=""
Q:$G(GMPXICDF)="N"&($G(GMPXNARR)="N")
N GMTSN,GMTSMOD,GMTSICD,GMTSNARR,GMTSPDN,GMTS,GMTSQTY,GMTSPRI,COMMENT
D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS W ?3,"Diagnosis:"
S GMCKP=0,GMTSPDN="",GMTSQTY=""
F S GMTSPDN=$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"D",GMTSPDN)) Q:GMTSPDN'>0 D Q:$D(GMTSQIT)
. S GMTSN=$G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"D",GMTSPDN))
. S GMTSMOD=$P(GMTSN,U,2)
. S GMTSICD=$P(GMTSN,U) D GETICDDX^GMTSPXU1(.GMTSICD,$G(GMPXICDF),GMTSMOD)
. S GMTSNARR=""
. S:$G(GMPXNARR)'="N" GMTSNARR=$G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"D",GMTSPDN,"N"))
. I $P(GMTSICD,"-",2,10)=$G(GMTSNARR) S GMTSNARR=""
. S GMTSPRI="" I $P(GMTSN,U,5)]"",$E($P(GMTSN,U,5),1)="P" S GMTSPRI=" (P)"
. D TXTFMT^GMTSPXU1(GMTSICD,$G(GMTSNARR),GMTSICL,GMTAB,DIWL,GMTSQTY,GMTSPRI)
. I '$D(^UTILITY($J,"W")) Q
. S GMTSX=0
. F S GMTSX=$O(^UTILITY($J,"W",DIWL,GMTSX)) Q:GMTSX'>0!$D(GMTSQIT) D
. . I GMCKP>0 D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS
. . S GMCKP=1
. . W ?GMTSICL+$S(GMTSX>1:GMTAB,1:0),$G(^UTILITY($J,"W",DIWL,GMTSX,0)),!
. S COMMENT="",COMMENT=$P($G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"D",GMTSPDN,"COM")),U)
. I COMMENT]"" S GMICL=20,GMTAB=2 D FORMAT I $D(^UTILITY($J,"W")) D
. . F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
Q
DSPCPT ; Display Procedures performed during the visit
Q:$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"C",""))=""
N GMTSNARR,GMTSPDN,GMTSN,GMTSICD,GMTSNARR,GMTSCPT,GMTSQTY,GMTSPRIM,GMTSPRI,GMTSFLG
D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS W ?3,"Procedure:"
S GMCKP=0,GMTSPDN="",GMTSPRI=""
F S GMTSPDN=$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"C",GMTSPDN)) Q:GMTSPDN'>0 D Q:$D(GMTSQIT)
. S GMTSN=$G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"C",GMTSPDN))
. S GMTSNARR=$P(GMTSN,U,2),GMTSQTY=$P(GMTSN,U,3),GMTSPRIM=$P(GMTSN,U,4)
. S GMTSCPT=$$GETCPT^GMTSPXU1($P(GMTSN,U)) I $P(GMTSCPT,"-",2,10)=GMTSNARR S GMTSNARR=""
. S GMTSPRI="" S:$G(GMTSQTY)]"" GMTSQTY=" ("_GMTSQTY_")" S:$G(GMTSPRIM)="Y" GMTSPRI="(P)"
. S GMTSFLG=1
. D TXTFMT^GMTSPXU1(GMTSCPT,GMTSNARR,GMTSICL,GMTAB,DIWL,GMTSQTY,GMTSPRI)
. Q:'$D(^UTILITY($J,"W")) D DCPT
Q
DCPT ; Display CPT Comments
N GMTSLN,GMTSMOK,GMTSX S (GMTSMOK,GMTSX)=0
F S GMTSX=$O(^UTILITY($J,"W",DIWL,GMTSX)) Q:GMTSX'>0 D Q:$D(GMTSQIT)
. I GMCKP>0 D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS Q:$D(GMTSQIT)
. S (GMTSMOK,GMCKP)=1 W ?GMTSICL+$S(GMTSX>1:GMTAB,1:0)
. W $G(^UTILITY($J,"W",DIWL,GMTSX,0))
. D CKP^GMTSUP Q:$D(GMTSQIT) W !
Q:DTYPE="DP"
S COMMENT=$P($G(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"C",GMTSPDN,"COM")),U)
I COMMENT]"" S GMICL=20,GMTAB=2 D FORMAT I $D(^UTILITY($J,"W")) D
. F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D Q:$D(GMTSQIT)
. . I GMTSFLG=1 W !,?10,"Comments:" S GMTSFLG=0
. . D LINE
S:+($G(GMTSCPTM))=0 GMTSMOK=0 D:GMTSMOK DMOD
Q
DMOD ; Display CPT Modifier Comments
N GMTSM S GMTSM=""
W !
F S GMTSM=$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"C",GMTSPDN,GMTSM)) Q:GMTSM="" D Q:$D(GMTSQIT)
. I GMTSM="COM" Q
. N COMMENT S COMMENT=$$FCM(GMTSM) Q:'$L(COMMENT)
. S GMICL=26,GMTAB=2 D FORMAT I $D(^UTILITY($J,"W")) D
. . F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE2 Q:$D(GMTSQIT)
Q
DSPPROV ; Display Providers for visit
Q:$O(^TMP("PXHSV",$J,GMTSIVD,GMTSVDF,"P",""))=""
N GMCNT,GMPROV
D ORDERPRO^GMTSPXU1(.GMPROV,20)
D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS W ?3," Provider:"
S GMCNT=0
F S GMCNT=$O(GMPROV(GMCNT)) Q:GMCNT'>0 D Q:GMCNT'>0!$D(GMTSQIT)
. I GMCNT>1 D CKP^GMTSUP Q:$D(GMTSQIT) D DSPVIS
. W ?GMTSICL,GMPROV(GMCNT) S GMCNT=$O(GMPROV(GMCNT)) Q:GMCNT'>0
. W ?37,GMPROV(GMCNT) S GMCNT=$O(GMPROV(GMCNT)) Q:GMCNT'>0
. W ?60,GMPROV(GMCNT)
. D CKP^GMTSUP Q:$D(GMTSQIT) W:$O(GMPROV(GMCNT)) !
D CKP^GMTSUP Q:$D(GMTSQIT) W !
Q
DSPVIS ; Display outpatient visit data
Q:GMTSNPG'>0&(GMTSDTU>0) D:GMTSNPG HDR I GMTSNPG!(+GMTSDTU'>0) D
. W GMTSDAT,?14,GMTSITE,?29,GMTSLOC,?61,GMTSELIG
. D CKP^GMTSUP Q:$D(GMTSQIT) W !
. S GMTSDTU=1
Q
HDR ; Display header
W ?3,"Date",?14,"Facility",?29,"Hospital Location",?61,"Encounter Elig.",!!
Q
FORMAT ; Formats Diagnosis/Procedure line of text
N DIWR,DIWF,X S DIWL=3,DIWR=80-(GMICL+GMTAB) K ^UTILITY($J,"W") S X=COMMENT D ^DIWP
Q
FCM(X) ; Format CPT Modifier comment
N Y,%,%H,GMTSIEN,GMTSC,GMTSS,GMTST S GMTSIEN=$G(X) Q:GMTSIEN="" ""
S:'$D(DT)!(+($G(DT))=0) DT=$$DT^XLFDT
S X=$$MOD^ICPTMOD(GMTSIEN,"E",) Q:'$D(X)
S GMTSC=$P(X,"^",2),GMTSS=$P(X,"^",3)
S GMTST=$$EN2^GMTSUMX(GMTSS) S Y=""
S:$L(GMTST)&($L(GMTSC)) Y=GMTSC_"-"_GMTST
S:'$L(GMTST)&($L(GMTSS))&($L(GMTSC)) Y=GMTSC_"-"_GMTSS
S:'$L(GMTST)&('$L(GMTSS))&($L(GMTSC)) Y=GMTSC
S:Y["-" Y="Modifier "_Y S X=Y
Q X
LINE ; Writes formatted lines
D CKP^GMTSUP Q:$D(GMTSQIT) W ?20,^UTILITY($J,"W",DIWL,GMTSLN,0),! Q
LINE2 ; Writes indented formatted lines
D CKP^GMTSUP Q:$D(GMTSQIT) N GMTST S GMTST=20 S:+($G(GMTSLN))>1 GMTST=31 W ?GMTST,^UTILITY($J,"W",DIWL,GMTSLN,0),! Q
GMTSPXOP ; SLC/SBW,KER - PCE Outpatient Encounter comp ; 02/27/2002
+1 ;;2.7;Health Summary;**8,10,28,37,47,49,76**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 1238 VISIT^PXRHS01
+5 ; DBIA 1996 $$MOD^ICPTMOD
+6 ; DBIA 10103 $$DT^XLFDT
+7 ; DBIA 10011 ^DIWP
+8 ;
PURPOSE ; Encounters with ICD9 and providers
+1 NEW DTYPE
SET DTYPE="DP"
DO MAIN
QUIT
OUTPT ; Encounters with ICD9, CPT, and providers
+1 NEW DTYPE
SET DTYPE="CDP"
DO MAIN
QUIT
MAIN ; Entry for Purpose of Visit and Outpatient Encounters
+1 NEW GMTSIVD,GMTSDAT,GMTSDTU,GMTSOVT,GMTSLOC,DIWL,GMTAB,GMTSN,GMCKP,GMTSX
+2 NEW GMTSITE,GMTSINS,GMTSEVT,GMTSHIS,GMTSICL,GMTSLOC,GMTSELIG,X,GMTSVDF
+3 NEW GMTSCPTM,GMICL
+4 ;
+5 ; GMTSCPTM Component uses CPT Modifiers 1 yes 0 no
+6 SET GMTSCPTM=+($$CPT^GMTSU(+($GET(GMTSEGN))))
IF $GET(GMPXCMOD)="N"
SET GMTSCPTM=0
+7 ; GMTSICL # of blank left columns for support data of a visit
+8 SET GMTSICL=14
+9 ; DIWL Used in TXTFMT call & to print returned data
+10 SET DIWL=0
+11 ; GMTAB Used to offset data from TXTFMT call after 1st line
+12 SET GMTAB=2
+13 ; GMTSOVT This is the set of Service Categories for AICTSORE
+14 ;
+15 ; A Ambulatory
+16 ; I Inpatient
+17 ; C Chart Review
+18 ; T Telecommunications
+19 ; S Day Surgery
+20 ; O Observation
+21 ; R Nursing Home Encounters
+22 ; E Event (Historical)
+23 ;
+24 ; Note: Hospitalization and Ancillary
+25 ; encounters are not included
+26 SET GMTSOVT="AICTSORE"
+27 ;
+28 DO VISIT^PXRHS01(DFN,GMTSEND,GMTSBEG,GMTSNDM,GMTSOVT,DTYPE,1)
+29 IF '$DATA(^TMP("PXHSV",$JOB))
QUIT
+30 SET GMTSIVD=0
+31 FOR
SET GMTSIVD=$ORDER(^TMP("PXHSV",$JOB,GMTSIVD))
IF GMTSIVD']""
QUIT
Begin DoDot:1
+32 SET GMTSVDF=0
+33 FOR
SET GMTSVDF=$ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF))
IF GMTSVDF'>0
QUIT
Begin DoDot:2
+34 SET GMTSN=$GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,0))
+35 SET GMTSEVT=$PIECE(GMTSN,U,4)
SET GMTSHIS=$SELECT(GMTSEVT["HISTORICAL":1,1:0)
+36 SET X=$PIECE(GMTSN,U,1)
DO REGDT4^GMTSU
SET GMTSDAT=X
+37 SET GMTSDTU=0
SET (GMTSITE,GMTSLOC)=""
+38 SET GMTSINS=$SELECT($PIECE(GMTSN,U,3)]"":$EXTRACT($PIECE(GMTSN,U,3),1,10),$PIECE(GMTSN,U,8)]"":$EXTRACT($PIECE(GMTSN,U,8),1,10),1:"")
SET GMTSITE=GMTSINS
+39 IF $GET(GMPXHLOC)'="N"
SET GMTSLOC=$EXTRACT($PIECE(GMTSN,U,6),1,30)
+40 IF '$LENGTH(GMTSLOC)
SET GMTSLOC=$PIECE(GMTSN,U,9)
+41 SET GMTSELIG=$EXTRACT($PIECE(GMTSN,U,12),1,17)
+42 IF GMTSITE=""&('GMTSHIS)
SET GMTSLOC=""
+43 IF GMTSHIS
Begin DoDot:3
+44 IF GMTSLOC'=""&(GMTSITE'="")
SET GMTSLOC=GMTSLOC_" (Historical Event)"
+45 IF GMTSLOC=""&(GMTSITE'="")
SET GMTSITE=GMTSITE_" (Historical Event)"
+46 IF GMTSLOC'=""&(GMTSITE="")
SET GMTSITE=GMTSLOC_" (Historical Event)"
SET GMTSLOC=""
+47 IF GMTSLOC=""&(GMTSITE="")
SET GMTSITE="Historical Event"
End DoDot:3
+48 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
DO DSPPROV
IF $DATA(GMTSQIT)
QUIT
+49 DO DSPPOV
IF $DATA(GMTSQIT)
QUIT
DO DSPCPT
WRITE !
End DoDot:2
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+50 KILL ^TMP("PXHSV",$JOB)
+51 QUIT
+52 ;
DSPPOV ; Display Purpose of visit
+1 IF $ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"D",""))=""
QUIT
+2 IF $GET(GMPXICDF)="N"&($GET(GMPXNARR)="N")
QUIT
+3 NEW GMTSN,GMTSMOD,GMTSICD,GMTSNARR,GMTSPDN,GMTS,GMTSQTY,GMTSPRI,COMMENT
+4 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
WRITE ?3,"Diagnosis:"
+5 SET GMCKP=0
SET GMTSPDN=""
SET GMTSQTY=""
+6 FOR
SET GMTSPDN=$ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"D",GMTSPDN))
IF GMTSPDN'>0
QUIT
Begin DoDot:1
+7 SET GMTSN=$GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"D",GMTSPDN))
+8 SET GMTSMOD=$PIECE(GMTSN,U,2)
+9 SET GMTSICD=$PIECE(GMTSN,U)
DO GETICDDX^GMTSPXU1(.GMTSICD,$GET(GMPXICDF),GMTSMOD)
+10 SET GMTSNARR=""
+11 IF $GET(GMPXNARR)'="N"
SET GMTSNARR=$GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"D",GMTSPDN,"N"))
+12 IF $PIECE(GMTSICD,"-",2,10)=$GET(GMTSNARR)
SET GMTSNARR=""
+13 SET GMTSPRI=""
IF $PIECE(GMTSN,U,5)]""
IF $EXTRACT($PIECE(GMTSN,U,5),1)="P"
SET GMTSPRI=" (P)"
+14 DO TXTFMT^GMTSPXU1(GMTSICD,$GET(GMTSNARR),GMTSICL,GMTAB,DIWL,GMTSQTY,GMTSPRI)
+15 IF '$DATA(^UTILITY($JOB,"W"))
QUIT
+16 SET GMTSX=0
+17 FOR
SET GMTSX=$ORDER(^UTILITY($JOB,"W",DIWL,GMTSX))
IF GMTSX'>0!$DATA(GMTSQIT)
QUIT
Begin DoDot:2
+18 IF GMCKP>0
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
+19 SET GMCKP=1
+20 WRITE ?GMTSICL+$SELECT(GMTSX>1:GMTAB,1:0),$GET(^UTILITY($JOB,"W",DIWL,GMTSX,0)),!
End DoDot:2
+21 SET COMMENT=""
SET COMMENT=$PIECE($GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"D",GMTSPDN,"COM")),U)
+22 IF COMMENT]""
SET GMICL=20
SET GMTAB=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:2
+23 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE
IF $DATA(GMTSQIT)
QUIT
End DoDot:2
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+24 QUIT
DSPCPT ; Display Procedures performed during the visit
+1 IF $ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"C",""))=""
QUIT
+2 NEW GMTSNARR,GMTSPDN,GMTSN,GMTSICD,GMTSNARR,GMTSCPT,GMTSQTY,GMTSPRIM,GMTSPRI,GMTSFLG
+3 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
WRITE ?3,"Procedure:"
+4 SET GMCKP=0
SET GMTSPDN=""
SET GMTSPRI=""
+5 FOR
SET GMTSPDN=$ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"C",GMTSPDN))
IF GMTSPDN'>0
QUIT
Begin DoDot:1
+6 SET GMTSN=$GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"C",GMTSPDN))
+7 SET GMTSNARR=$PIECE(GMTSN,U,2)
SET GMTSQTY=$PIECE(GMTSN,U,3)
SET GMTSPRIM=$PIECE(GMTSN,U,4)
+8 SET GMTSCPT=$$GETCPT^GMTSPXU1($PIECE(GMTSN,U))
IF $PIECE(GMTSCPT,"-",2,10)=GMTSNARR
SET GMTSNARR=""
+9 SET GMTSPRI=""
IF $GET(GMTSQTY)]""
SET GMTSQTY=" ("_GMTSQTY_")"
IF $GET(GMTSPRIM)="Y"
SET GMTSPRI="(P)"
+10 SET GMTSFLG=1
+11 DO TXTFMT^GMTSPXU1(GMTSCPT,GMTSNARR,GMTSICL,GMTAB,DIWL,GMTSQTY,GMTSPRI)
+12 IF '$DATA(^UTILITY($JOB,"W"))
QUIT
DO DCPT
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+13 QUIT
DCPT ; Display CPT Comments
+1 NEW GMTSLN,GMTSMOK,GMTSX
SET (GMTSMOK,GMTSX)=0
+2 FOR
SET GMTSX=$ORDER(^UTILITY($JOB,"W",DIWL,GMTSX))
IF GMTSX'>0
QUIT
Begin DoDot:1
+3 IF GMCKP>0
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
IF $DATA(GMTSQIT)
QUIT
+4 SET (GMTSMOK,GMCKP)=1
WRITE ?GMTSICL+$SELECT(GMTSX>1:GMTAB,1:0)
+5 WRITE $GET(^UTILITY($JOB,"W",DIWL,GMTSX,0))
+6 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE !
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+7 IF DTYPE="DP"
QUIT
+8 SET COMMENT=$PIECE($GET(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"C",GMTSPDN,"COM")),U)
+9 IF COMMENT]""
SET GMICL=20
SET GMTAB=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:1
+10 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
Begin DoDot:2
+11 IF GMTSFLG=1
WRITE !,?10,"Comments:"
SET GMTSFLG=0
+12 DO LINE
End DoDot:2
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
+13 IF +($GET(GMTSCPTM))=0
SET GMTSMOK=0
IF GMTSMOK
DO DMOD
+14 QUIT
DMOD ; Display CPT Modifier Comments
+1 NEW GMTSM
SET GMTSM=""
+2 WRITE !
+3 FOR
SET GMTSM=$ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"C",GMTSPDN,GMTSM))
IF GMTSM=""
QUIT
Begin DoDot:1
+4 IF GMTSM="COM"
QUIT
+5 NEW COMMENT
SET COMMENT=$$FCM(GMTSM)
IF '$LENGTH(COMMENT)
QUIT
+6 SET GMICL=26
SET GMTAB=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:2
+7 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE2
IF $DATA(GMTSQIT)
QUIT
End DoDot:2
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+8 QUIT
DSPPROV ; Display Providers for visit
+1 IF $ORDER(^TMP("PXHSV",$JOB,GMTSIVD,GMTSVDF,"P",""))=""
QUIT
+2 NEW GMCNT,GMPROV
+3 DO ORDERPRO^GMTSPXU1(.GMPROV,20)
+4 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
WRITE ?3," Provider:"
+5 SET GMCNT=0
+6 FOR
SET GMCNT=$ORDER(GMPROV(GMCNT))
IF GMCNT'>0
QUIT
Begin DoDot:1
+7 IF GMCNT>1
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO DSPVIS
+8 WRITE ?GMTSICL,GMPROV(GMCNT)
SET GMCNT=$ORDER(GMPROV(GMCNT))
IF GMCNT'>0
QUIT
+9 WRITE ?37,GMPROV(GMCNT)
SET GMCNT=$ORDER(GMPROV(GMCNT))
IF GMCNT'>0
QUIT
+10 WRITE ?60,GMPROV(GMCNT)
+11 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF $ORDER(GMPROV(GMCNT))
WRITE !
End DoDot:1
IF GMCNT'>0!$DATA(GMTSQIT)
QUIT
+12 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE !
+13 QUIT
DSPVIS ; Display outpatient visit data
+1 IF GMTSNPG'>0&(GMTSDTU>0)
QUIT
IF GMTSNPG
DO HDR
IF GMTSNPG!(+GMTSDTU'>0)
Begin DoDot:1
+2 WRITE GMTSDAT,?14,GMTSITE,?29,GMTSLOC,?61,GMTSELIG
+3 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE !
+4 SET GMTSDTU=1
End DoDot:1
+5 QUIT
HDR ; Display header
+1 WRITE ?3,"Date",?14,"Facility",?29,"Hospital Location",?61,"Encounter Elig.",!!
+2 QUIT
FORMAT ; Formats Diagnosis/Procedure line of text
+1 NEW DIWR,DIWF,X
SET DIWL=3
SET DIWR=80-(GMICL+GMTAB)
KILL ^UTILITY($JOB,"W")
SET X=COMMENT
DO ^DIWP
+2 QUIT
FCM(X) ; Format CPT Modifier comment
+1 NEW Y,%,%H,GMTSIEN,GMTSC,GMTSS,GMTST
SET GMTSIEN=$GET(X)
IF GMTSIEN=""
QUIT ""
+2 IF '$DATA(DT)!(+($GET(DT))=0)
SET DT=$$DT^XLFDT
+3 SET X=$$MOD^ICPTMOD(GMTSIEN,"E",)
IF '$DATA(X)
QUIT
+4 SET GMTSC=$PIECE(X,"^",2)
SET GMTSS=$PIECE(X,"^",3)
+5 SET GMTST=$$EN2^GMTSUMX(GMTSS)
SET Y=""
+6 IF $LENGTH(GMTST)&($LENGTH(GMTSC))
SET Y=GMTSC_"-"_GMTST
+7 IF '$LENGTH(GMTST)&($LENGTH(GMTSS))&($LENGTH(GMTSC))
SET Y=GMTSC_"-"_GMTSS
+8 IF '$LENGTH(GMTST)&('$LENGTH(GMTSS))&($LENGTH(GMTSC))
SET Y=GMTSC
+9 IF Y["-"
SET Y="Modifier "_Y
SET X=Y
+10 QUIT X
LINE ; Writes formatted lines
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE ?20,^UTILITY($JOB,"W",DIWL,GMTSLN,0),!
QUIT
LINE2 ; Writes indented formatted lines
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
NEW GMTST
SET GMTST=20
IF +($GET(GMTSLN))>1
SET GMTST=31
WRITE ?GMTST,^UTILITY($JOB,"W",DIWL,GMTSLN,0),!
QUIT