GMTSPXTP ; SLC/SBW,KER - PCE Treatment Comp ; 08/27/2002
;;2.7;Health Summary;**8,10,28,56**;Oct 20, 1995
;
; External References
; DBIA 1242 TREAT^PXRHS06
; DBIA 10011 ^DIWP
;
TRTMT ; Treatments within a Date Range and Service Category
N SERCAT S SERCAT="AICTSORXHDE"
;
; SERCAT is a sting containing service categories:
; Ambulatory A
; Inpatient I
; Chart Review C
; Telecommunications T
; Day Surgery S
; Observation O
; Nursing Home R
; Ancillary X
; Hospitalization H
; Daily Hospitalization Ancillary D
; Historical event encounters E
;
K ^TMP("PXT",$J)
D TREAT^PXRHS06(DFN,GMTSEND,GMTSBEG,GMTSNDM,SERCAT) Q:'$D(^TMP("PXT",$J))
N GMDT,GMIFN,GMSITE,GMN0,GMN1,X,GMTSDAT,TREAT,NUM,PDT
N GMTXT,GMTSICL,DIWL,GMTAB,GMTSX,GMCKP,PNARR,GMPSITE,GMTR,PSITE
N GMTSLN,GMICL,GMTAB,COMMENT S GMTSICL=24,DIWL=0,GMTAB=2,GMDT=0
D CKP^GMTSUP Q:$D(GMTSQIT) D HDR
F S GMDT=$O(^TMP("PXT",$J,GMDT)) Q:GMDT'>0 D Q:$D(GMTSQIT)
. S GMTR=""
. F S GMTR=$O(^TMP("PXT",$J,GMDT,GMTR)) Q:GMTR']"" D Q:$D(GMTSQIT)
. . S GMIFN=0
. . F S GMIFN=$O(^TMP("PXT",$J,GMDT,GMTR,GMIFN)) Q:GMIFN'>0 D TREATDSP Q:$D(GMTSQIT)
K ^TMP("PXT",$J)
Q
HDR ; Display Header
W ?2,"Date",?10,"Facility",?22,"Treatment (Qty) ; Provider Narrative",!!
Q
TREATDSP ; Display Treatment Data
S GMN0=$G(^TMP("PXT",$J,GMDT,GMTR,GMIFN,0)) Q:GMN0']""
S GMN1=$G(^TMP("PXT",$J,GMDT,GMTR,GMIFN,1))
S GMSITE=$S($P(GMN1,U,3)]"":$E($P(GMN1,U,3),1,10),$P(GMN1,U,4)]"":$E($P(GMN1,U,4),1,10),1:"No Site")
S X=$P(GMN0,U,2)
D REGDT4^GMTSU S GMTSDAT=X
S TREAT=$P(GMN0,U),NUM=$P(GMN0,U,3)
S PNARR=$G(^TMP("PXT",$J,GMDT,GMTR,GMIFN,"P")) S:PNARR=TREAT PNARR=""
S GMTXT=TREAT_$S(NUM]"":" ("_NUM_")",1:"")_$S(PNARR]"":"; "_PNARR,1:"")
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HDR
I GMTSDAT'=$G(PDT)!GMTSNPG W GMTSDAT S PDT=GMTSDAT,PSITE=""
I GMSITE'=$G(PSITE) W ?12,GMSITE S PSITE=GMSITE
D TXTFMT^GMTSPXU1(GMTXT,"",GMTSICL,GMTAB,DIWL)
I '$D(^UTILITY($J,"W")) Q
S (GMTSX,GMCKP)=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:GMTSNPG HDR W:GMTSNPG GMTSDAT,?10,GMSITE
. S GMCKP=1
. W ?GMTSICL+$S(GMTSX>1:GMTAB,1:0),$G(^UTILITY($J,"W",DIWL,GMTSX,0)),!
S COMMENT=$P($G(^TMP("PXT",$J,GMDT,GMTR,GMIFN,"COM")),U)
I COMMENT]"" S GMICL=26,GMTAB=2 D FORMAT I $D(^UTILITY($J,"W")) D
. F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
Q
FORMAT ; Format Line
N DIWR,DIWF,X S DIWL=3,DIWR=80-(GMICL+GMTAB) K ^UTILITY($J,"W")
S X=COMMENT D ^DIWP
Q
LINE ; Write Line
D CKP^GMTSUP Q:$D(GMTSQIT) W ?26,^UTILITY($J,"W",DIWL,GMTSLN,0),!
Q
GMTSPXTP ; SLC/SBW,KER - PCE Treatment Comp ; 08/27/2002
+1 ;;2.7;Health Summary;**8,10,28,56**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 1242 TREAT^PXRHS06
+5 ; DBIA 10011 ^DIWP
+6 ;
TRTMT ; Treatments within a Date Range and Service Category
+1 NEW SERCAT
SET SERCAT="AICTSORXHDE"
+2 ;
+3 ; SERCAT is a sting containing service categories:
+4 ; Ambulatory A
+5 ; Inpatient I
+6 ; Chart Review C
+7 ; Telecommunications T
+8 ; Day Surgery S
+9 ; Observation O
+10 ; Nursing Home R
+11 ; Ancillary X
+12 ; Hospitalization H
+13 ; Daily Hospitalization Ancillary D
+14 ; Historical event encounters E
+15 ;
+16 KILL ^TMP("PXT",$JOB)
+17 DO TREAT^PXRHS06(DFN,GMTSEND,GMTSBEG,GMTSNDM,SERCAT)
IF '$DATA(^TMP("PXT",$JOB))
QUIT
+18 NEW GMDT,GMIFN,GMSITE,GMN0,GMN1,X,GMTSDAT,TREAT,NUM,PDT
+19 NEW GMTXT,GMTSICL,DIWL,GMTAB,GMTSX,GMCKP,PNARR,GMPSITE,GMTR,PSITE
+20 NEW GMTSLN,GMICL,GMTAB,COMMENT
SET GMTSICL=24
SET DIWL=0
SET GMTAB=2
SET GMDT=0
+21 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO HDR
+22 FOR
SET GMDT=$ORDER(^TMP("PXT",$JOB,GMDT))
IF GMDT'>0
QUIT
Begin DoDot:1
+23 SET GMTR=""
+24 FOR
SET GMTR=$ORDER(^TMP("PXT",$JOB,GMDT,GMTR))
IF GMTR']""
QUIT
Begin DoDot:2
+25 SET GMIFN=0
+26 FOR
SET GMIFN=$ORDER(^TMP("PXT",$JOB,GMDT,GMTR,GMIFN))
IF GMIFN'>0
QUIT
DO TREATDSP
IF $DATA(GMTSQIT)
QUIT
End DoDot:2
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+27 KILL ^TMP("PXT",$JOB)
+28 QUIT
HDR ; Display Header
+1 WRITE ?2,"Date",?10,"Facility",?22,"Treatment (Qty) ; Provider Narrative",!!
+2 QUIT
TREATDSP ; Display Treatment Data
+1 SET GMN0=$GET(^TMP("PXT",$JOB,GMDT,GMTR,GMIFN,0))
IF GMN0']""
QUIT
+2 SET GMN1=$GET(^TMP("PXT",$JOB,GMDT,GMTR,GMIFN,1))
+3 SET GMSITE=$SELECT($PIECE(GMN1,U,3)]"":$EXTRACT($PIECE(GMN1,U,3),1,10),$PIECE(GMN1,U,4)]"":$EXTRACT($PIECE(GMN1,U,4),1,10),1:"No Site")
+4 SET X=$PIECE(GMN0,U,2)
+5 DO REGDT4^GMTSU
SET GMTSDAT=X
+6 SET TREAT=$PIECE(GMN0,U)
SET NUM=$PIECE(GMN0,U,3)
+7 SET PNARR=$GET(^TMP("PXT",$JOB,GMDT,GMTR,GMIFN,"P"))
IF PNARR=TREAT
SET PNARR=""
+8 SET GMTXT=TREAT_$SELECT(NUM]"":" ("_NUM_")",1:"")_$SELECT(PNARR]"":"; "_PNARR,1:"")
+9 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HDR
+10 IF GMTSDAT'=$GET(PDT)!GMTSNPG
WRITE GMTSDAT
SET PDT=GMTSDAT
SET PSITE=""
+11 IF GMSITE'=$GET(PSITE)
WRITE ?12,GMSITE
SET PSITE=GMSITE
+12 DO TXTFMT^GMTSPXU1(GMTXT,"",GMTSICL,GMTAB,DIWL)
+13 IF '$DATA(^UTILITY($JOB,"W"))
QUIT
+14 SET (GMTSX,GMCKP)=0
+15 FOR
SET GMTSX=$ORDER(^UTILITY($JOB,"W",DIWL,GMTSX))
IF GMTSX'>0!$DATA(GMTSQIT)
QUIT
Begin DoDot:1
+16 IF GMCKP>0
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HDR
IF GMTSNPG
WRITE GMTSDAT,?10,GMSITE
+17 SET GMCKP=1
+18 WRITE ?GMTSICL+$SELECT(GMTSX>1:GMTAB,1:0),$GET(^UTILITY($JOB,"W",DIWL,GMTSX,0)),!
End DoDot:1
+19 SET COMMENT=$PIECE($GET(^TMP("PXT",$JOB,GMDT,GMTR,GMIFN,"COM")),U)
+20 IF COMMENT]""
SET GMICL=26
SET GMTAB=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:1
+21 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
+22 QUIT
FORMAT ; Format Line
+1 NEW DIWR,DIWF,X
SET DIWL=3
SET DIWR=80-(GMICL+GMTAB)
KILL ^UTILITY($JOB,"W")
+2 SET X=COMMENT
DO ^DIWP
+3 QUIT
LINE ; Write Line
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE ?26,^UTILITY($JOB,"W",DIWL,GMTSLN,0),!
+2 QUIT