GMTSPXIM ; SLC/SBW,KER - PCE Immunization component ; 08/27/2002
;;2.7;Health Summary;**8,10,28,56**;Oct 20, 1995
;
; External References
; DBIA 1239 IMMUN^PXRHS03
; DBIA 10011 ^DIWP
;
IMMUN ; Main Entry Point
K ^TMP("PXI",$J) D IMMUN^PXRHS03(DFN) Q:'$D(^TMP("PXI",$J))
N GMIMM,GMDT,GMIFN,GMW,GMSITE,GMN0,GMN1,GMSIR,GMSIC,X,GMTSDAT,GML
N GMTSX,GMCKP,GMTAB,COMMENT,GMTSLN,GMICL
S GMIMM="" D CKP^GMTSUP Q:$D(GMTSQIT) D HDR
F S GMIMM=$O(^TMP("PXI",$J,GMIMM)) Q:GMIMM="" D Q:$D(GMTSQIT)
. S (GMDT,GMW)=0
. F S GMDT=$O(^TMP("PXI",$J,GMIMM,GMDT)) Q:GMDT'>0 D Q:$D(GMTSQIT)
. . S GMIFN=0
. . F S GMIFN=$O(^TMP("PXI",$J,GMIMM,GMDT,GMIFN)) Q:GMIFN'>0 D IMMDSP Q:$D(GMTSQIT)
K ^TMP("PXI",$J)
Q
IMMDSP ; Display Immunization data
S DIWL=0,CNT=0,COMMENT="",GMN0=$G(^TMP("PXI",$J,GMIMM,GMDT,GMIFN,0)) Q:GMN0']""
S GMN1=$G(^TMP("PXI",$J,GMIMM,GMDT,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,3) D REGDT4^GMTSU S GMTSDAT=X
S GMSIR=$P(GMN0,U,6),GMSIC=$S(+$P(GMN0,U,7):"DO NOT REPEAT",1:"")
I GMSIC]"",GMSIR]"" S GMSIR=GMSIR_"; "
S GMSIR=GMSIR_GMSIC
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HDR I GMW'>0!GMTSNPG W $P(GMN0,U,2) S GML=$L($P(GMN0,U,2))+1
W ?16,$P(GMN0,U,4),?23,GMTSDAT,?34,GMSITE
I GMSIR']"" W ! G COM
I GMSIR]"" S GMICL=47,GMTAB=2,CNT=1 D FORMAT I $D(^UTILITY($J,"W")) D
. F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
COM ; Comments
S COMMENT=$P(^TMP("PXI",$J,GMIMM,GMDT,GMIFN,"COM"),U)
I COMMENT]"" S GMICL=33,GMTAB=2,CNT=2 D FORMAT I $D(^UTILITY($J,"W")) D CKP^GMTSUP Q:$D(GMTSQIT) D
. F GMTSLN=1:1:^UTILITY($J,"W",DIWL) D LINE Q:$D(GMTSQIT)
S GMW=1
Q
HDR ; Header
W "Immunization",?14,"Series",?25,"Date",?33,"Facility",?47,"Reaction",!!
Q
FORMAT ; Format Line
N DIWR,DIWF,X S DIWL=3,DIWR=80-(GMICL+GMTAB) K ^UTILITY($J,"W")
S X=$S(CNT=1:GMSIR,CNT=2:COMMENT) D ^DIWP
Q
LINE ; Writes Line
D CKP^GMTSUP Q:$D(GMTSQIT)
W ?($S(CNT=1:47,CNT=2:33,1:0)),^UTILITY($J,"W",DIWL,GMTSLN,0),!
Q
GMTSPXIM ; SLC/SBW,KER - PCE Immunization component ; 08/27/2002
+1 ;;2.7;Health Summary;**8,10,28,56**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 1239 IMMUN^PXRHS03
+5 ; DBIA 10011 ^DIWP
+6 ;
IMMUN ; Main Entry Point
+1 KILL ^TMP("PXI",$JOB)
DO IMMUN^PXRHS03(DFN)
IF '$DATA(^TMP("PXI",$JOB))
QUIT
+2 NEW GMIMM,GMDT,GMIFN,GMW,GMSITE,GMN0,GMN1,GMSIR,GMSIC,X,GMTSDAT,GML
+3 NEW GMTSX,GMCKP,GMTAB,COMMENT,GMTSLN,GMICL
+4 SET GMIMM=""
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
DO HDR
+5 FOR
SET GMIMM=$ORDER(^TMP("PXI",$JOB,GMIMM))
IF GMIMM=""
QUIT
Begin DoDot:1
+6 SET (GMDT,GMW)=0
+7 FOR
SET GMDT=$ORDER(^TMP("PXI",$JOB,GMIMM,GMDT))
IF GMDT'>0
QUIT
Begin DoDot:2
+8 SET GMIFN=0
+9 FOR
SET GMIFN=$ORDER(^TMP("PXI",$JOB,GMIMM,GMDT,GMIFN))
IF GMIFN'>0
QUIT
DO IMMDSP
IF $DATA(GMTSQIT)
QUIT
End DoDot:2
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
IF $DATA(GMTSQIT)
QUIT
+10 KILL ^TMP("PXI",$JOB)
+11 QUIT
IMMDSP ; Display Immunization data
+1 SET DIWL=0
SET CNT=0
SET COMMENT=""
SET GMN0=$GET(^TMP("PXI",$JOB,GMIMM,GMDT,GMIFN,0))
IF GMN0']""
QUIT
+2 SET GMN1=$GET(^TMP("PXI",$JOB,GMIMM,GMDT,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,3)
DO REGDT4^GMTSU
SET GMTSDAT=X
+5 SET GMSIR=$PIECE(GMN0,U,6)
SET GMSIC=$SELECT(+$PIECE(GMN0,U,7):"DO NOT REPEAT",1:"")
+6 IF GMSIC]""
IF GMSIR]""
SET GMSIR=GMSIR_"; "
+7 SET GMSIR=GMSIR_GMSIC
+8 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HDR
IF GMW'>0!GMTSNPG
WRITE $PIECE(GMN0,U,2)
SET GML=$LENGTH($PIECE(GMN0,U,2))+1
+9 WRITE ?16,$PIECE(GMN0,U,4),?23,GMTSDAT,?34,GMSITE
+10 IF GMSIR']""
WRITE !
GOTO COM
+11 IF GMSIR]""
SET GMICL=47
SET GMTAB=2
SET CNT=1
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
Begin DoDot:1
+12 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
COM ; Comments
+1 SET COMMENT=$PIECE(^TMP("PXI",$JOB,GMIMM,GMDT,GMIFN,"COM"),U)
+2 IF COMMENT]""
SET GMICL=33
SET GMTAB=2
SET CNT=2
DO FORMAT
IF $DATA(^UTILITY($JOB,"W"))
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
Begin DoDot:1
+3 FOR GMTSLN=1:1:^UTILITY($JOB,"W",DIWL)
DO LINE
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
+4 SET GMW=1
+5 QUIT
HDR ; Header
+1 WRITE "Immunization",?14,"Series",?25,"Date",?33,"Facility",?47,"Reaction",!!
+2 QUIT
FORMAT ; Format Line
+1 NEW DIWR,DIWF,X
SET DIWL=3
SET DIWR=80-(GMICL+GMTAB)
KILL ^UTILITY($JOB,"W")
+2 SET X=$SELECT(CNT=1:GMSIR,CNT=2:COMMENT)
DO ^DIWP
+3 QUIT
LINE ; Writes Line
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+2 WRITE ?($SELECT(CNT=1:47,CNT=2:33,1:0)),^UTILITY($JOB,"W",DIWL,GMTSLN,0),!
+3 QUIT