GMVHPN0 ;HIOFO/YH,FT-HP LASER PAIN CHART - DATA ARRAY ;11/6/01 15:14
;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
;
; This routine uses the following IAs:
; #10061 - ^VADPT calls (supported)
; #10104 - ^XLFSTR calls (supported)
;
EN1 ;ENTRY POINT FROM GMVSR0 TO PRINT CHART FOR HP LASER PRINTER
S GMROUT=0 K ^TMP($J,"GMR"),^TMP($J,"GMRK"),^TMP($J,"GDT"),^TMP($J,"GMRVG"),^TMP($J,"GTNM") F GI=1:1:200 S ^TMP($J,"GMRK","G"_GI)=""
S GMROUT=0
S GSTART1=(9999999-GMRFIN)-.0001,GEND1=9999999-GMRSTRT
F GTYPE="PN" D SETT
U IO D GRAPH
Q1 K GSOL,GIVDT,GMRHLOC,GMRVJ,GDATA,GDT,GEN,GEND1,GI,GJ,GK,GMRVX,GSTART1,GTNM,GTYP,GTYPE,GX,I D KVAR^VADPT K VA,VAROOT
K GMRRMBD,GAGE,GCNT,GDOB,GCNTB,GCNTD,GCNTP,GCNTR,GCNTT,GCNTT1,GCNTI,GCNTO,GDT1,GCNTPD,GCNTTD,GCNTW,GPG,GPGS,GTYPE1,GCNTB3,GDTA,XDT,XIO,XX,^TMP($J,"GMRK"),^TMP($J,"GMR"),^TMP($J,"GDT"),^TMP($J,"GMRVG")
K ^TMP($J,"GTNM") Q
GRAPH D DEM^VADPT,INP^VADPT,SETV^GMVGR1
S GK="PN",^TMP($J,"GTNM",GK)=0 F GI=0:0 S GI=$O(^TMP($J,"GMRVG",GK,GI)) Q:GI'>0 S GJ="" F X=0:0 S GJ=$O(^TMP($J,"GMRVG",GK,GI,GJ)) Q:GJ="" S ^TMP($J,"GTNM",GK)=^TMP($J,"GTNM",GK)+1,^TMP($J,"GDT",GI)=""
S GTNM=0 F X=0:0 S X=$O(^TMP($J,"GDT",X)) Q:X'>0 S GTNM=GTNM+1
S GPG=$S(GTNM=0:1,1:GTNM\10+''(GTNM#10)),GDT1=0
F GPGS=1:1:GPG D
. S ^TMP($J,"GMRK","G199")="Page "_GPGS D SETP,DATE S ^TMP($J,"GMRK","G200")=GMRRMBD D PAGE D EN2^GMVHPN1
D KVAR^VADPT K VA,GRAPHR,GRAPHS,GRAPHD,GPA Q
PAGE ;SET GRAPH DATA
;DATA FOR PAIN CHART
K GRAPHR S GRAPHR=0,I=1,J=411,GPA=0 F GI=312:1:321 S GRAPHR=0.4+(1.6*(I-1)) S GK=^TMP($J,"GMRK","G"_GI) D:(GK'="")&(GK'=99)&("PASSREFUSEDUNAVAL"'[$$UP^XLFSTR(GK)) S I=I+1,J=J+1
.S GRAPHR(I)=$S(GPA=0:"PA",1:"PD")_GRAPHR_","_GK_";LB"_^TMP($J,"GMRK","G"_J)_"#;",GPA=1
K GG,GI,GMRVJ,GSYNO Q
DATE F GCNTD=1:1:10 S:$L(GDT1) GDT1=$O(^TMP($J,"GDT",GDT1)) S ^TMP($J,"GMRK","G"_GCNTD)=$S($L(GDT1):$E(GDT1,4,5)_"-"_$E(GDT1,6,7)_"-"_$E(GDT1,2,3),1:"") D DATE1
Q
DATE1 S Y=$E($P(GDT1,".",2)_"0000",1,4),^TMP($J,"GMRK","G"_(GCNTD+16))=$S($L(GDT1):$E(Y,1,2)_":"_$E(Y,3,4),1:"") D SETD
Q
SETD S GI="PN",GJ=310,GK=$S($L(GDT1):$O(^TMP($J,"GMRVG",GI,GDT1,"")),1:"") D SETA^GMVHPN2
Q
SETP ;INITIALIZE ^TMP FOR QUALIFIERS
; 410 - STORE PN*
F I=1:1:10 S (^TMP($J,"GMRK","G"_(410+I)),^("G"_(311+I)),^("G"_(331+I)))=""
Q
SETT S GTYP=$O(^GMRD(120.51,"B","PAIN",0))
I GTYP>0 F GX=GSTART1:0 S GX=$O(^GMR(120.5,"AA",DFN,GTYP,GX)) Q:GX>GEND1!(GX'>0) F GEN=0:0 S GEN=$O(^GMR(120.5,"AA",DFN,GTYP,GX,GEN)) Q:GEN'>0 I '$D(^GMR(120.5,GEN,2)) D BLDARR^GMVGR0
Q
GMVHPN0 ;HIOFO/YH,FT-HP LASER PAIN CHART - DATA ARRAY ;11/6/01 15:14
+1 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #10061 - ^VADPT calls (supported)
+5 ; #10104 - ^XLFSTR calls (supported)
+6 ;
EN1 ;ENTRY POINT FROM GMVSR0 TO PRINT CHART FOR HP LASER PRINTER
+1 SET GMROUT=0
KILL ^TMP($JOB,"GMR"),^TMP($JOB,"GMRK"),^TMP($JOB,"GDT"),^TMP($JOB,"GMRVG"),^TMP($JOB,"GTNM")
FOR GI=1:1:200
SET ^TMP($JOB,"GMRK","G"_GI)=""
+2 SET GMROUT=0
+3 SET GSTART1=(9999999-GMRFIN)-.0001
SET GEND1=9999999-GMRSTRT
+4 FOR GTYPE="PN"
DO SETT
+5 USE IO
DO GRAPH
Q1 KILL GSOL,GIVDT,GMRHLOC,GMRVJ,GDATA,GDT,GEN,GEND1,GI,GJ,GK,GMRVX,GSTART1,GTNM,GTYP,GTYPE,GX,I
DO KVAR^VADPT
KILL VA,VAROOT
+1 KILL GMRRMBD,GAGE,GCNT,GDOB,GCNTB,GCNTD,GCNTP,GCNTR,GCNTT,GCNTT1,GCNTI,GCNTO,GDT1,GCNTPD,GCNTTD,GCNTW,GPG,GPGS,GTYPE1,GCNTB3,GDTA,XDT,XIO,XX,^TMP($JOB,"GMRK"),^TMP($JOB,"GMR"),^TMP($JOB,"GDT"),^TMP($JOB,"GMRVG")
+2 KILL ^TMP($JOB,"GTNM")
QUIT
GRAPH DO DEM^VADPT
DO INP^VADPT
DO SETV^GMVGR1
+1 SET GK="PN"
SET ^TMP($JOB,"GTNM",GK)=0
FOR GI=0:0
SET GI=$ORDER(^TMP($JOB,"GMRVG",GK,GI))
IF GI'>0
QUIT
SET GJ=""
FOR X=0:0
SET GJ=$ORDER(^TMP($JOB,"GMRVG",GK,GI,GJ))
IF GJ=""
QUIT
SET ^TMP($JOB,"GTNM",GK)=^TMP($JOB,"GTNM",GK)+1
SET ^TMP($JOB,"GDT",GI)=""
+2 SET GTNM=0
FOR X=0:0
SET X=$ORDER(^TMP($JOB,"GDT",X))
IF X'>0
QUIT
SET GTNM=GTNM+1
+3 SET GPG=$SELECT(GTNM=0:1,1:GTNM\10+''(GTNM#10))
SET GDT1=0
+4 FOR GPGS=1:1:GPG
Begin DoDot:1
+5 SET ^TMP($JOB,"GMRK","G199")="Page "_GPGS
DO SETP
DO DATE
SET ^TMP($JOB,"GMRK","G200")=GMRRMBD
DO PAGE
DO EN2^GMVHPN1
End DoDot:1
+6 DO KVAR^VADPT
KILL VA,GRAPHR,GRAPHS,GRAPHD,GPA
QUIT
PAGE ;SET GRAPH DATA
+1 ;DATA FOR PAIN CHART
+2 KILL GRAPHR
SET GRAPHR=0
SET I=1
SET J=411
SET GPA=0
FOR GI=312:1:321
SET GRAPHR=0.4+(1.6*(I-1))
SET GK=^TMP($JOB,"GMRK","G"_GI)
IF (GK'="")&(GK'=99)&("PASSREFUSEDUNAVAL"'[$$UP^XLFSTR(GK))
Begin DoDot:1
+3 SET GRAPHR(I)=$SELECT(GPA=0:"PA",1:"PD")_GRAPHR_","_GK_";LB"_^TMP($JOB,"GMRK","G"_J)_"#;"
SET GPA=1
End DoDot:1
SET I=I+1
SET J=J+1
+4 KILL GG,GI,GMRVJ,GSYNO
QUIT
DATE FOR GCNTD=1:1:10
IF $LENGTH(GDT1)
SET GDT1=$ORDER(^TMP($JOB,"GDT",GDT1))
SET ^TMP($JOB,"GMRK","G"_GCNTD)=$SELECT($LENGTH(GDT1):$EXTRACT(GDT1,4,5)_"-"_$EXTRACT(GDT1,6,7)_"-"_$EXTRACT(GDT1,2,3),1:"")
DO DATE1
+1 QUIT
DATE1 SET Y=$EXTRACT($PIECE(GDT1,".",2)_"0000",1,4)
SET ^TMP($JOB,"GMRK","G"_(GCNTD+16))=$SELECT($LENGTH(GDT1):$EXTRACT(Y,1,2)_":"_$EXTRACT(Y,3,4),1:"")
DO SETD
+1 QUIT
SETD SET GI="PN"
SET GJ=310
SET GK=$SELECT($LENGTH(GDT1):$ORDER(^TMP($JOB,"GMRVG",GI,GDT1,"")),1:"")
DO SETA^GMVHPN2
+1 QUIT
SETP ;INITIALIZE ^TMP FOR QUALIFIERS
+1 ; 410 - STORE PN*
+2 FOR I=1:1:10
SET (^TMP($JOB,"GMRK","G"_(410+I)),^("G"_(311+I)),^("G"_(331+I)))=""
+3 QUIT
SETT SET GTYP=$ORDER(^GMRD(120.51,"B","PAIN",0))
+1 IF GTYP>0
FOR GX=GSTART1:0
SET GX=$ORDER(^GMR(120.5,"AA",DFN,GTYP,GX))
IF GX>GEND1!(GX'>0)
QUIT
FOR GEN=0:0
SET GEN=$ORDER(^GMR(120.5,"AA",DFN,GTYP,GX,GEN))
IF GEN'>0
QUIT
IF '$DATA(^GMR(120.5,GEN,2))
DO BLDARR^GMVGR0
+2 QUIT