GMVCAQU ;HOIFO/YH,FT-DISPLAY CATEGORY/QUALIFIER/SYNONYM TABLE FOR VITAL TYPE ;10/25/02 10:04
;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
;
; This routine uses the following IAs:
; #10103 - ^XLFDT calls (supported)
; #10104 - ^XLFSTR calls (supported)
;
EN1(RESULTS,GMVDATA) ; GMV QUALIFIER TABLE [RPC entry point]
; Display Vitals Category/Qualifier/Synonym Table
; GMVDEV - device name (File 3.5)
; GMVIEN - device internal entry number
; GMVPDT - date/time to print report
;
N GMVDEV,GMVIEN,GMVPDT
S RESULTS=$NA(^TMP($J)) K @RESULTS
S GMVDEV=$P(GMVDATA,U,5),GMVIEN=+$P(GMVDATA,U,6),GMVPDT=$P(GMVDATA,U,7)
S ZTIO=GMVDEV ;device
S ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
S ZTDESC="Vitals Category/Qualifier/Synonym Table"
S ZTRTN="START^GMVCAQU"
D ^%ZTLOAD
I $G(ZTSK)>0 S @RESULTS@(0)="1^Report Queued. Task #:"_ZTSK
E S @RESULTS@(0)="-1^Unable to queue report."
K ZTSK,ZTIO,ZTDTH,ZTSAVE,ZTDESC,ZTRTN
Q
START ; Start the report
U IO
S:$D(ZTQUEUED) ZTREQ="@"
S (GMROUT,GMRPG)=0
S GMVNOW=$$NOW^XLFDT() ;get current date/time
S GMVNOW=$$FMTE^XLFDT(GMVNOW) ;format current date/time
D HDR
F GMRVIT(1)="BLOOD PRESSURE","PULSE","RESPIRATION","TEMPERATURE","WEIGHT","CIRCUMFERENCE/GIRTH","HEIGHT","PULSE OXIMETRY" Q:GMROUT D
.S GMRVIT=$O(^GMRD(120.51,"B",GMRVIT(1),0)) Q:GMRVIT'>0!GMROUT D
..S GMRVITY=$P(^GMRD(120.51,GMRVIT,0),"^",2) Q:GMRVITY=""!GMROUT S GLVL=8 D LISTQ^GMVQUAL Q:GMROUT D OTHERQ D CLEAR
..Q
.Q
Q1 ; Kill variables and quit
K GMRVIT,GMRVITY,GLVL,GMROUT,GMRPG,GSYNO,I,J,POP
D CLEAR
D ^%ZISC
Q
HDR ; Header
W:$Y>0 @IOF
S GMRPG=GMRPG+1
W !,"Vitals/Measurements Category/Qualifier/Synonym Table",?65,"Page ",GMRPG
W !,"Run Date: ",GMVNOW
W !,$$RJ^XLFSTR(" ",75,"-")
W:GMRPG>1 !,GLABEL,!,GLABEL(1)
Q
CLEAR ; Clean up variables
K GCHART,GCHART1,GQUAL,GMRVDFLT,GORDER,GLABEL,GFLAG,GMAX,GMIN,GMRLAST,GMRINF,GCAT,GCHA,GCOL,GDA,GENTR,GTXT,GBLNK,GCOUNT,GLN,GMRENTR,GMRVODR,GSIDE,GTYPE,GDASH
Q
OTHERQ ;
Q:'$D(GCHART)&('$D(GCHART1))
S GCOL=1,GFLAG=0,$P(GLABEL," ",80)="",$P(GBLNK," ",80)="",$P(GLABEL(1)," ",80)="",$P(GDASH,"-",20)=""
S (GMAX,GMAX(1))=0
F S GMAX(1)=$O(GCOUNT(GMAX(1))) Q:GMAX(1)'>0 S GMAX(2)="" F S GMAX(2)=$O(GCOUNT(GMAX(1),GMAX(2))) Q:GMAX(2)="" I GCOUNT(GMAX(1),GMAX(2))>GMAX S GMAX=GCOUNT(GMAX(1),GMAX(2))
Q:+$G(GMAX)=0
F I=1:1:GMAX S $P(GTXT(I)," ",80)=""
S GMRVODR=0
F S GMRVODR=$O(GCOUNT(GMRVODR)) Q:GMRVODR'>0 S GCAT=$O(GCOUNT(GMRVODR,"")) Q:GCAT="" D
. S GCOL=$S(GMRVODR=1:1,GMRVODR=2:18,GMRVODR=3:39,GMRVODR=4:58,1:70)
. I GMRVODR=2,GMRVIT(1)="PULSE" S GCOL=28
. I GMRVODR=2,GMRVIT(1)="RESPIRATION" S GCOL=32
. S GLABEL=$S(GMRVODR=1:$E(GCAT_GBLNK,1,80),1:$E($E(GLABEL,1,GCOL)_GCAT_GBLNK,1,80))
. S GCAT(1)=$E(GDASH,1,$L(GCAT))
. S GLABEL(1)=$S(GMRVODR=1:$E(GCAT(1)_GBLNK,1,80),1:$E($E(GLABEL(1),1,GCOL)_GCAT(1)_GBLNK,1,80))
. S I=0,GCHA="" F S GCHA=$O(GQUAL(GMRVODR,GCHA)) Q:GCHA="" D
. . S GSYNO(1)=$O(^GMRD(120.52,"B",GCHA,0)) Q:GSYNO(1)'>0 S GSYNO=$P($G(^GMRD(120.52,GSYNO(1),0)),"^",2)
. . S I=I+1,GTXT(I)=$S(GMRVODR=1:$E(GCHA_": "_GSYNO_GBLNK,1,80),1:$E($E(GTXT(I),1,GCOL)_GCHA_": "_GSYNO_GBLNK,1,80))
. . Q
. Q
W !!,"Qualifiers for "_GMRVIT(1)_": ",!!,GLABEL,!,GLABEL(1)
F I=1:1:GMAX D:IOSL<($Y+6) HDR Q:GMROUT W !,GTXT(I)
Q
GMVCAQU ;HOIFO/YH,FT-DISPLAY CATEGORY/QUALIFIER/SYNONYM TABLE FOR VITAL TYPE ;10/25/02 10:04
+1 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #10103 - ^XLFDT calls (supported)
+5 ; #10104 - ^XLFSTR calls (supported)
+6 ;
EN1(RESULTS,GMVDATA) ; GMV QUALIFIER TABLE [RPC entry point]
+1 ; Display Vitals Category/Qualifier/Synonym Table
+2 ; GMVDEV - device name (File 3.5)
+3 ; GMVIEN - device internal entry number
+4 ; GMVPDT - date/time to print report
+5 ;
+6 NEW GMVDEV,GMVIEN,GMVPDT
+7 SET RESULTS=$NAME(^TMP($JOB))
KILL @RESULTS
+8 SET GMVDEV=$PIECE(GMVDATA,U,5)
SET GMVIEN=+$PIECE(GMVDATA,U,6)
SET GMVPDT=$PIECE(GMVDATA,U,7)
+9 ;device
SET ZTIO=GMVDEV
+10 ;date/time to print
SET ZTDTH=$SELECT($GET(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT())
+11 SET ZTDESC="Vitals Category/Qualifier/Synonym Table"
+12 SET ZTRTN="START^GMVCAQU"
+13 DO ^%ZTLOAD
+14 IF $GET(ZTSK)>0
SET @RESULTS@(0)="1^Report Queued. Task #:"_ZTSK
+15 IF '$TEST
SET @RESULTS@(0)="-1^Unable to queue report."
+16 KILL ZTSK,ZTIO,ZTDTH,ZTSAVE,ZTDESC,ZTRTN
+17 QUIT
START ; Start the report
+1 USE IO
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 SET (GMROUT,GMRPG)=0
+4 ;get current date/time
SET GMVNOW=$$NOW^XLFDT()
+5 ;format current date/time
SET GMVNOW=$$FMTE^XLFDT(GMVNOW)
+6 DO HDR
+7 FOR GMRVIT(1)="BLOOD PRESSURE","PULSE","RESPIRATION","TEMPERATURE","WEIGHT","CIRCUMFERENCE/GIRTH","HEIGHT","PULSE OXIMETRY"
IF GMROUT
QUIT
Begin DoDot:1
+8 SET GMRVIT=$ORDER(^GMRD(120.51,"B",GMRVIT(1),0))
IF GMRVIT'>0!GMROUT
QUIT
Begin DoDot:2
+9 SET GMRVITY=$PIECE(^GMRD(120.51,GMRVIT,0),"^",2)
IF GMRVITY=""!GMROUT
QUIT
SET GLVL=8
DO LISTQ^GMVQUAL
IF GMROUT
QUIT
DO OTHERQ
DO CLEAR
+10 QUIT
End DoDot:2
+11 QUIT
End DoDot:1
Q1 ; Kill variables and quit
+1 KILL GMRVIT,GMRVITY,GLVL,GMROUT,GMRPG,GSYNO,I,J,POP
+2 DO CLEAR
+3 DO ^%ZISC
+4 QUIT
HDR ; Header
+1 IF $Y>0
WRITE @IOF
+2 SET GMRPG=GMRPG+1
+3 WRITE !,"Vitals/Measurements Category/Qualifier/Synonym Table",?65,"Page ",GMRPG
+4 WRITE !,"Run Date: ",GMVNOW
+5 WRITE !,$$RJ^XLFSTR(" ",75,"-")
+6 IF GMRPG>1
WRITE !,GLABEL,!,GLABEL(1)
+7 QUIT
CLEAR ; Clean up variables
+1 KILL GCHART,GCHART1,GQUAL,GMRVDFLT,GORDER,GLABEL,GFLAG,GMAX,GMIN,GMRLAST,GMRINF,GCAT,GCHA,GCOL,GDA,GENTR,GTXT,GBLNK,GCOUNT,GLN,GMRENTR,GMRVODR,GSIDE,GTYPE,GDASH
+2 QUIT
OTHERQ ;
+1 IF '$DATA(GCHART)&('$DATA(GCHART1))
QUIT
+2 SET GCOL=1
SET GFLAG=0
SET $PIECE(GLABEL," ",80)=""
SET $PIECE(GBLNK," ",80)=""
SET $PIECE(GLABEL(1)," ",80)=""
SET $PIECE(GDASH,"-",20)=""
+3 SET (GMAX,GMAX(1))=0
+4 FOR
SET GMAX(1)=$ORDER(GCOUNT(GMAX(1)))
IF GMAX(1)'>0
QUIT
SET GMAX(2)=""
FOR
SET GMAX(2)=$ORDER(GCOUNT(GMAX(1),GMAX(2)))
IF GMAX(2)=""
QUIT
IF GCOUNT(GMAX(1),GMAX(2))>GMAX
SET GMAX=GCOUNT(GMAX(1),GMAX(2))
+5 IF +$GET(GMAX)=0
QUIT
+6 FOR I=1:1:GMAX
SET $PIECE(GTXT(I)," ",80)=""
+7 SET GMRVODR=0
+8 FOR
SET GMRVODR=$ORDER(GCOUNT(GMRVODR))
IF GMRVODR'>0
QUIT
SET GCAT=$ORDER(GCOUNT(GMRVODR,""))
IF GCAT=""
QUIT
Begin DoDot:1
+9 SET GCOL=$SELECT(GMRVODR=1:1,GMRVODR=2:18,GMRVODR=3:39,GMRVODR=4:58,1:70)
+10 IF GMRVODR=2
IF GMRVIT(1)="PULSE"
SET GCOL=28
+11 IF GMRVODR=2
IF GMRVIT(1)="RESPIRATION"
SET GCOL=32
+12 SET GLABEL=$SELECT(GMRVODR=1:$EXTRACT(GCAT_GBLNK,1,80),1:$EXTRACT($EXTRACT(GLABEL,1,GCOL)_GCAT_GBLNK,1,80))
+13 SET GCAT(1)=$EXTRACT(GDASH,1,$LENGTH(GCAT))
+14 SET GLABEL(1)=$SELECT(GMRVODR=1:$EXTRACT(GCAT(1)_GBLNK,1,80),1:$EXTRACT($EXTRACT(GLABEL(1),1,GCOL)_GCAT(1)_GBLNK,1,80))
+15 SET I=0
SET GCHA=""
FOR
SET GCHA=$ORDER(GQUAL(GMRVODR,GCHA))
IF GCHA=""
QUIT
Begin DoDot:2
+16 SET GSYNO(1)=$ORDER(^GMRD(120.52,"B",GCHA,0))
IF GSYNO(1)'>0
QUIT
SET GSYNO=$PIECE($GET(^GMRD(120.52,GSYNO(1),0)),"^",2)
+17 SET I=I+1
SET GTXT(I)=$SELECT(GMRVODR=1:$EXTRACT(GCHA_": "_GSYNO_GBLNK,1,80),1:$EXTRACT($EXTRACT(GTXT(I),1,GCOL)_GCHA_": "_GSYNO_GBLNK,1,80))
+18 QUIT
End DoDot:2
+19 QUIT
End DoDot:1
+20 WRITE !!,"Qualifiers for "_GMRVIT(1)_": ",!!,GLABEL,!,GLABEL(1)
+21 FOR I=1:1:GMAX
IF IOSL<($Y+6)
DO HDR
IF GMROUT
QUIT
WRITE !,GTXT(I)
+22 QUIT