GMTSPXEP ; SLC/SBW,KER,PKR - PCE Patient Education comp ; 04/15/2022
;;2.7;Health Summary;**8,10,28,35,56,122,115**;Oct 20, 1995;Build 190
;
; External References
; DBIA 3063 EDUC^PXRHS08
; DBIA 10011 ^DIWP
;
PTED ; Patient Education
N GMTSOVT K ^TMP("PXPE",$J) S GMTSOVT="AICTSORXHDE"
;
; GMTSOVT is a sting containing a set of Service
; Categories for:
;
; 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
; Event-Historical E
;
D EDUC^PXRHS08(DFN,GMTSBEG,GMTSEND,GMTSNDM,GMTSOVT)
Q:'$D(^TMP("PXPE",$J)) D CKP^GMTSUP Q:$D(GMTSQIT) D HDR,EDMAIN
Q
;
MRPTED ; Most recent patient education
N GMTSOVT K ^TMP("PXPE",$J) S GMTSOVT="AICTSORXHDE"
;
; Returns most recent Patient Education Topic Types
; for time period. GMTSOVT is a sting containing a
; set of Service Categories for:
;
; 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
; Event-Historical E
;
D EDUC^PXRHS08(DFN,GMTSBEG,GMTSEND,1,GMTSOVT)
Q:'$D(^TMP("PXPE",$J))
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HDR
D EDMAIN
Q
;
HDR ; Header
W "Event/Visit",?12,"Facility",?25,"Topic - Understanding Level"
W !,?3,"Date",!!
Q
;
EDMAIN ; Main Education Display
N COMMENT,ED,GMDT,GMED,GMICL,GMIFN,GMN0,GMN1,GMTSDATE,GMSITE
N GMTSLN,GMTAB,LEVEL,LTXT,PSITE,PDT,TEXT,X
S GMDT=0
F S GMDT=$O(^TMP("PXPE",$J,GMDT)) Q:GMDT'>0 D Q:$D(GMTSQIT)
. S GMED=""
. F S GMED=$O(^TMP("PXPE",$J,GMDT,GMED)) Q:GMED']"" D Q:$D(GMTSQIT)
. . S GMIFN=0
. . F S GMIFN=$O(^TMP("PXPE",$J,GMDT,GMED,GMIFN)) Q:GMIFN'>0 D Q:$D(GMTSQIT)
. . . S GMN0=$G(^TMP("PXPE",$J,GMDT,GMED,GMIFN,0))
. . . Q:GMN0']""
. . . S GMN1=$G(^TMP("PXPE",$J,GMDT,GMED,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 GMTSDATE=X
. . . S LTXT="",ED=$P(GMN0,U),LEVEL=$P(GMN0,U,3)
. . . I LEVEL]"" S LTXT=" - "_LEVEL
. . . D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HDR
. . . I GMTSDATE'=$G(PDT)!GMTSNPG W GMTSDATE S PDT=GMTSDATE,PSITE=""
. . . I GMSITE'=$G(PSITE) W ?12,GMSITE S PSITE=GMSITE
. . . S TEXT=ED_$G(LTXT)
. . . I $L(TEXT)<56 W ?25,TEXT,!
. . . E D LONGTEXT(TEXT)
. . . I $G(^TMP("PXPE",$J,GMDT,GMED,GMIFN,"MEASUREMENT"))'="" D
. . . . N MAGNITUDE,MEAS,UCUMDISPLAY,UCUMFIELD,UCUMIEN,UNITS
. . . . S MEAS=^TMP("PXPE",$J,GMDT,GMED,GMIFN,"MEASUREMENT")
. . . . S MAGNITUDE=$P(MEAS,U,1)
. . . . I MAGNITUDE="" Q
. . . . S UCUMIEN=$P(MEAS,U,2)
. . . . I UCUMIEN'="" D
. . . . . S UCUMDISPLAY=$P(MEAS,U,3)
. . . . . I UCUMDISPLAY="N" S UNITS="" Q
. . . . . S UCUMFIELD=$S(UCUMDISPLAY="C":"UCUM CODE",1:"DESCRIPTION")
. . . . . S UNITS=$$UCUMFIELDS^GMTSUCUM(UCUMIEN,UCUMFIELD)
. . . . E S UNITS=""
. . . . I UNITS="" S TEXT=" Magnitude: "
. . . . E S TEXT=" Measurement: "
. . . . S TEXT=TEXT_MAGNITUDE
. . . . I UNITS'="" S TEXT=TEXT_" "_UNITS
. . . . I $L(TEXT)<56 W ?25,TEXT,!
. . . . E D LONGTEXT(TEXT)
. . . S COMMENT=$P(^TMP("PXPE",$J,GMDT,GMED,GMIFN,"COM"),U,1)
. . . 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)
K ^TMP("PXPE",$J)
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
;
LONGTEXT(TEXT) ;
N BPT,IND
S BPT=55
F IND=55:-1 Q:(BPT<55)!(IND=1) I $E(TEXT,IND)=" " S BPT=IND
W ?25,$E(TEXT,1,BPT),!
W ?25,$E(TEXT,(BPT+1),$L(TEXT)),!
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPXEP 4524 printed Dec 13, 2024@01:59:47 Page 2
GMTSPXEP ; SLC/SBW,KER,PKR - PCE Patient Education comp ; 04/15/2022
+1 ;;2.7;Health Summary;**8,10,28,35,56,122,115**;Oct 20, 1995;Build 190
+2 ;
+3 ; External References
+4 ; DBIA 3063 EDUC^PXRHS08
+5 ; DBIA 10011 ^DIWP
+6 ;
PTED ; Patient Education
+1 NEW GMTSOVT
KILL ^TMP("PXPE",$JOB)
SET GMTSOVT="AICTSORXHDE"
+2 ;
+3 ; GMTSOVT is a sting containing a set of Service
+4 ; Categories for:
+5 ;
+6 ; Ambulatory A
+7 ; Inpatient I
+8 ; Chart Review C
+9 ; Telecommunications T
+10 ; Day Surgery S
+11 ; Observation O
+12 ; Nursing Home R
+13 ; Ancillary X
+14 ; Hospitalization H
+15 ; Daily Hospitalization Ancillary D
+16 ; Event-Historical E
+17 ;
+18 DO EDUC^PXRHS08(DFN,GMTSBEG,GMTSEND,GMTSNDM,GMTSOVT)
+19 if '$DATA(^TMP("PXPE",$JOB))
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
DO HDR
DO EDMAIN
+20 QUIT
+21 ;
MRPTED ; Most recent patient education
+1 NEW GMTSOVT
KILL ^TMP("PXPE",$JOB)
SET GMTSOVT="AICTSORXHDE"
+2 ;
+3 ; Returns most recent Patient Education Topic Types
+4 ; for time period. GMTSOVT is a sting containing a
+5 ; set of Service Categories for:
+6 ;
+7 ; Ambulatory A
+8 ; Inpatient I
+9 ; Chart Review C
+10 ; Telecommunications T
+11 ; Day Surgery S
+12 ; Observation O
+13 ; Nursing Home R
+14 ; Ancillary X
+15 ; Hospitalization H
+16 ; Daily Hospitalization Ancillary D
+17 ; Event-Historical E
+18 ;
+19 DO EDUC^PXRHS08(DFN,GMTSBEG,GMTSEND,1,GMTSOVT)
+20 if '$DATA(^TMP("PXPE",$JOB))
QUIT
+21 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HDR
+22 DO EDMAIN
+23 QUIT
+24 ;
HDR ; Header
+1 WRITE "Event/Visit",?12,"Facility",?25,"Topic - Understanding Level"
+2 WRITE !,?3,"Date",!!
+3 QUIT
+4 ;
EDMAIN ; Main Education Display
+1 NEW COMMENT,ED,GMDT,GMED,GMICL,GMIFN,GMN0,GMN1,GMTSDATE,GMSITE
+2 NEW GMTSLN,GMTAB,LEVEL,LTXT,PSITE,PDT,TEXT,X
+3 SET GMDT=0
+4 FOR
SET GMDT=$ORDER(^TMP("PXPE",$JOB,GMDT))
if GMDT'>0
QUIT
Begin DoDot:1
+5 SET GMED=""
+6 FOR
SET GMED=$ORDER(^TMP("PXPE",$JOB,GMDT,GMED))
if GMED']""
QUIT
Begin DoDot:2
+7 SET GMIFN=0
+8 FOR
SET GMIFN=$ORDER(^TMP("PXPE",$JOB,GMDT,GMED,GMIFN))
if GMIFN'>0
QUIT
Begin DoDot:3
+9 SET GMN0=$GET(^TMP("PXPE",$JOB,GMDT,GMED,GMIFN,0))
+10 if GMN0']""
QUIT
+11 SET GMN1=$GET(^TMP("PXPE",$JOB,GMDT,GMED,GMIFN,1))
+12 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")
+13 SET X=$PIECE(GMN0,U,2)
DO REGDT4^GMTSU
SET GMTSDATE=X
+14 SET LTXT=""
SET ED=$PIECE(GMN0,U)
SET LEVEL=$PIECE(GMN0,U,3)
+15 IF LEVEL]""
SET LTXT=" - "_LEVEL
+16 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HDR
+17 IF GMTSDATE'=$GET(PDT)!GMTSNPG
WRITE GMTSDATE
SET PDT=GMTSDATE
SET PSITE=""
+18 IF GMSITE'=$GET(PSITE)
WRITE ?12,GMSITE
SET PSITE=GMSITE
+19 SET TEXT=ED_$GET(LTXT)
+20 IF $LENGTH(TEXT)<56
WRITE ?25,TEXT,!
+21 IF '$TEST
DO LONGTEXT(TEXT)
+22 IF $GET(^TMP("PXPE",$JOB,GMDT,GMED,GMIFN,"MEASUREMENT"))'=""
Begin DoDot:4
+23 NEW MAGNITUDE,MEAS,UCUMDISPLAY,UCUMFIELD,UCUMIEN,UNITS
+24 SET MEAS=^TMP("PXPE",$JOB,GMDT,GMED,GMIFN,"MEASUREMENT")
+25 SET MAGNITUDE=$PIECE(MEAS,U,1)
+26 IF MAGNITUDE=""
QUIT
+27 SET UCUMIEN=$PIECE(MEAS,U,2)
+28 IF UCUMIEN'=""
Begin DoDot:5
+29 SET UCUMDISPLAY=$PIECE(MEAS,U,3)
+30 IF UCUMDISPLAY="N"
SET UNITS=""
QUIT
+31 SET UCUMFIELD=$SELECT(UCUMDISPLAY="C":"UCUM CODE",1:"DESCRIPTION")
+32 SET UNITS=$$UCUMFIELDS^GMTSUCUM(UCUMIEN,UCUMFIELD)
End DoDot:5
+33 IF '$TEST
SET UNITS=""
+34 IF UNITS=""
SET TEXT=" Magnitude: "
+35 IF '$TEST
SET TEXT=" Measurement: "
+36 SET TEXT=TEXT_MAGNITUDE
+37 IF UNITS'=""
SET TEXT=TEXT_" "_UNITS
+38 IF $LENGTH(TEXT)<56
WRITE ?25,TEXT,!
+39 IF '$TEST
DO LONGTEXT(TEXT)
End DoDot:4
+40 SET COMMENT=$PIECE(^TMP("PXPE",$JOB,GMDT,GMED,GMIFN,"COM"),U,1)
+41 IF COMMENT]""
SET GMICL=26
SET GMTAB=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:4
+42 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE
if $DATA(GMTSQIT)
QUIT
End DoDot:4
End DoDot:3
if $DATA(GMTSQIT)
QUIT
End DoDot:2
if $DATA(GMTSQIT)
QUIT
End DoDot:1
if $DATA(GMTSQIT)
QUIT
+43 KILL ^TMP("PXPE",$JOB)
+44 QUIT
+45 ;
FORMAT ; Format Line
+1 NEW DIWR,DIWF,X
SET DIWL=3
SET DIWR=80-(GMICL+GMTAB)
+2 KILL ^UTILITY($JOB,"W")
SET X=COMMENT
DO ^DIWP
+3 QUIT
+4 ;
LINE ; Write Line
+1 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE ?26,^UTILITY($JOB,"W",DIWL,GMTSLN,0),!
+2 QUIT
+3 ;
LONGTEXT(TEXT) ;
+1 NEW BPT,IND
+2 SET BPT=55
+3 FOR IND=55:-1
if (BPT<55)!(IND=1)
QUIT
IF $EXTRACT(TEXT,IND)=" "
SET BPT=IND
+4 WRITE ?25,$EXTRACT(TEXT,1,BPT),!
+5 WRITE ?25,$EXTRACT(TEXT,(BPT+1),$LENGTH(TEXT)),!
+6 QUIT
+7 ;