GMRVXCH2 ;HIRMFO/YH,RM-GMRV VITAL QUALIFIER FILE CONVERSION ;8/1/96
;;4.0;Vitals/Measurements;;Apr 25, 1997
CONV52 ; Loop through 120.52 to convert
S GMRVDA=0 F S GMRVDA=$O(^GMRD(120.52,GMRVDA)) Q:GMRVDA'>0 D
. K GMRVVTYP S GMRVCHAR=$P($G(^GMRD(120.52,GMRVDA,0)),"^")
. I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR)) S ^TMP($J,"GMRVCHAR",GMRVCHAR)=""
. S GMRVCNV=$G(^TMP($J,"GMRVCHAR",GMRVCHAR))
. S GMRVCNV=$S(GMRVCNV]"":GMRVCNV,1:GMRVDA_";GMRD(120.52,")
. S $P(^GMRD(120.52,GMRVDA,"CONV"),"^")=GMRVCNV
. S GMRVTDA=0
. F S GMRVTDA=$O(^GMRD(120.52,GMRVDA,1,GMRVTDA)) Q:GMRVTDA'>0 D
. . S GMRVTYP=$P($G(^GMRD(120.52,GMRVDA,1,GMRVTDA,0)),"^")
. . Q:GMRVTYP'>0 S GMRVVTYP(GMRVTYP)=GMRVTDA
. . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) S ^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.52,GMRVCHAR)
. . Q
. S GMRVTYP=0
. F S GMRVTYP=$O(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) Q:GMRVTYP'>0 D
. . S GMRVTDA=$G(GMRVVTYP(GMRVTYP))
. . I GMRVTDA'>0 D Q:GMRVTDA'>0
. . . S X=GMRVTYP,DA(1)=GMRVDA,DIC="^GMRD(120.52,"_DA(1)_",1,"
. . . S DIC(0)="L",DLAYGO=120.52
. . . K DO,DINUM,DD D FILE^DICN S GMRVTDA=+Y
. . . Q
. . S GMRVCNV=$G(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP))
. . S GMRVCAT=$P(GMRVCNV,"^")
. . I GMRVCAT]"" S GMRVCAT=$G(^TMP($J,"GMRVCAT",GMRVCAT))
. . S $P(GMRVCNV,"^")=GMRVCAT
. . S $P(^GMRD(120.52,GMRVDA,1,GMRVTDA,0),"^",2,4)=GMRVCNV
. . Q
. Q
K DA,DIC,DLAYGO,GMRVCHAR,GMRVCNV,GMRVDA,GMRVTDA,GMRVTYP,GMRVVTYP,X
Q
MOVE53 ; Loop through 120.53 and move data from that
; file to the 120.52 file.
S GMRVD0=0 F S GMRVD0=$O(^GMRD(120.53,GMRVD0)) Q:GMRVD0'>0 D
. S GMRVCHAR=$P($G(^GMRD(120.53,GMRVD0,0)),"^") Q:GMRVCHAR=""
. K GMRVFDA,GMRVIEN S GMRVFDA(99,120.52,"+1,",.01)=GMRVCHAR
. D UPDATE^DIE("","GMRVFDA(99)","GMRVIEN") Q:GMRVIEN(1)'>0
. I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR)) S ^(GMRVCHAR)=GMRVD0_";GMRD(120.53,"
. S GMRVDA=GMRVIEN(1),GMRVD1=0
. F S GMRVD1=$O(^GMRD(120.53,GMRVD0,1,GMRVD1)) Q:GMRVD1'>0 D
. . S GMRVTYP=$P($G(^GMRD(120.53,GMRVD0,1,GMRVD1,0)),"^")
. . Q:$P($G(^GMRD(120.51,+GMRVTYP,0)),"^")'="BLOOD PRESSURE"
. . K GMRVFDA,GMRVIEN
. . S GMRVFDA(99,120.521,"+2,"_GMRVDA_",",.01)=GMRVTYP
. . D UPDATE^DIE("","GMRVFDA(99)","GMRVIEN")
. . I '$D(^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)) S ^TMP($J,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.53,GMRVCHAR)
. . Q
. Q
K GMRVCHAR,GMRVD0,GMRVD1,GMRVDA,GMRVFDA,GMRVTYP
Q
QUAL(TYPE,FILE,CHAR) ; Given a Qualifier (CHAR), the Vital Type (TYPE)
; ptr and the file from which this which the qualifier is from
; (FILE), this function will return the generic Category (CAT).
;
N CAT,GTYPE
S GTYPE=$P($G(^GMRD(120.51,TYPE,0)),"^",2)
I FILE=120.52 S CAT=$S(GTYPE="BP"!(GTYPE="P")!(GTYPE="T"):"LOCATION",GTYPE="R":"METHOD",GTYPE="WT":"QUALITY",1:"")
I FILE=120.53 S CAT=$S(GTYPE="BP":"POSITION",1:"")
Q CAT
;
TYP(TYPE) ; This function will return the external text for the Vital
; Type pointed to by TYPE.
Q $P($G(^GMRD(120.51,TYPE,0)),"^")
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVXCH2 3085 printed Nov 22, 2024@17:08:03 Page 2
GMRVXCH2 ;HIRMFO/YH,RM-GMRV VITAL QUALIFIER FILE CONVERSION ;8/1/96
+1 ;;4.0;Vitals/Measurements;;Apr 25, 1997
CONV52 ; Loop through 120.52 to convert
+1 SET GMRVDA=0
FOR
SET GMRVDA=$ORDER(^GMRD(120.52,GMRVDA))
if GMRVDA'>0
QUIT
Begin DoDot:1
+2 KILL GMRVVTYP
SET GMRVCHAR=$PIECE($GET(^GMRD(120.52,GMRVDA,0)),"^")
+3 IF '$DATA(^TMP($JOB,"GMRVCHAR",GMRVCHAR))
SET ^TMP($JOB,"GMRVCHAR",GMRVCHAR)=""
+4 SET GMRVCNV=$GET(^TMP($JOB,"GMRVCHAR",GMRVCHAR))
+5 SET GMRVCNV=$SELECT(GMRVCNV]"":GMRVCNV,1:GMRVDA_";GMRD(120.52,")
+6 SET $PIECE(^GMRD(120.52,GMRVDA,"CONV"),"^")=GMRVCNV
+7 SET GMRVTDA=0
+8 FOR
SET GMRVTDA=$ORDER(^GMRD(120.52,GMRVDA,1,GMRVTDA))
if GMRVTDA'>0
QUIT
Begin DoDot:2
+9 SET GMRVTYP=$PIECE($GET(^GMRD(120.52,GMRVDA,1,GMRVTDA,0)),"^")
+10 if GMRVTYP'>0
QUIT
SET GMRVVTYP(GMRVTYP)=GMRVTDA
+11 IF '$DATA(^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP))
SET ^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.52,GMRVCHAR)
+12 QUIT
End DoDot:2
+13 SET GMRVTYP=0
+14 FOR
SET GMRVTYP=$ORDER(^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP))
if GMRVTYP'>0
QUIT
Begin DoDot:2
+15 SET GMRVTDA=$GET(GMRVVTYP(GMRVTYP))
+16 IF GMRVTDA'>0
Begin DoDot:3
+17 SET X=GMRVTYP
SET DA(1)=GMRVDA
SET DIC="^GMRD(120.52,"_DA(1)_",1,"
+18 SET DIC(0)="L"
SET DLAYGO=120.52
+19 KILL DO,DINUM,DD
DO FILE^DICN
SET GMRVTDA=+Y
+20 QUIT
End DoDot:3
if GMRVTDA'>0
QUIT
+21 SET GMRVCNV=$GET(^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP))
+22 SET GMRVCAT=$PIECE(GMRVCNV,"^")
+23 IF GMRVCAT]""
SET GMRVCAT=$GET(^TMP($JOB,"GMRVCAT",GMRVCAT))
+24 SET $PIECE(GMRVCNV,"^")=GMRVCAT
+25 SET $PIECE(^GMRD(120.52,GMRVDA,1,GMRVTDA,0),"^",2,4)=GMRVCNV
+26 QUIT
End DoDot:2
+27 QUIT
End DoDot:1
+28 KILL DA,DIC,DLAYGO,GMRVCHAR,GMRVCNV,GMRVDA,GMRVTDA,GMRVTYP,GMRVVTYP,X
+29 QUIT
MOVE53 ; Loop through 120.53 and move data from that
+1 ; file to the 120.52 file.
+2 SET GMRVD0=0
FOR
SET GMRVD0=$ORDER(^GMRD(120.53,GMRVD0))
if GMRVD0'>0
QUIT
Begin DoDot:1
+3 SET GMRVCHAR=$PIECE($GET(^GMRD(120.53,GMRVD0,0)),"^")
if GMRVCHAR=""
QUIT
+4 KILL GMRVFDA,GMRVIEN
SET GMRVFDA(99,120.52,"+1,",.01)=GMRVCHAR
+5 DO UPDATE^DIE("","GMRVFDA(99)","GMRVIEN")
if GMRVIEN(1)'>0
QUIT
+6 IF '$DATA(^TMP($JOB,"GMRVCHAR",GMRVCHAR))
SET ^(GMRVCHAR)=GMRVD0_";GMRD(120.53,"
+7 SET GMRVDA=GMRVIEN(1)
SET GMRVD1=0
+8 FOR
SET GMRVD1=$ORDER(^GMRD(120.53,GMRVD0,1,GMRVD1))
if GMRVD1'>0
QUIT
Begin DoDot:2
+9 SET GMRVTYP=$PIECE($GET(^GMRD(120.53,GMRVD0,1,GMRVD1,0)),"^")
+10 if $PIECE($GET(^GMRD(120.51,+GMRVTYP,0)),"^")'="BLOOD PRESSURE"
QUIT
+11 KILL GMRVFDA,GMRVIEN
+12 SET GMRVFDA(99,120.521,"+2,"_GMRVDA_",",.01)=GMRVTYP
+13 DO UPDATE^DIE("","GMRVFDA(99)","GMRVIEN")
+14 IF '$DATA(^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP))
SET ^TMP($JOB,"GMRVCHAR",GMRVCHAR,GMRVTYP)=$$QUAL(GMRVTYP,120.53,GMRVCHAR)
+15 QUIT
End DoDot:2
+16 QUIT
End DoDot:1
+17 KILL GMRVCHAR,GMRVD0,GMRVD1,GMRVDA,GMRVFDA,GMRVTYP
+18 QUIT
QUAL(TYPE,FILE,CHAR) ; Given a Qualifier (CHAR), the Vital Type (TYPE)
+1 ; ptr and the file from which this which the qualifier is from
+2 ; (FILE), this function will return the generic Category (CAT).
+3 ;
+4 NEW CAT,GTYPE
+5 SET GTYPE=$PIECE($GET(^GMRD(120.51,TYPE,0)),"^",2)
+6 IF FILE=120.52
SET CAT=$SELECT(GTYPE="BP"!(GTYPE="P")!(GTYPE="T"):"LOCATION",GTYPE="R":"METHOD",GTYPE="WT":"QUALITY",1:"")
+7 IF FILE=120.53
SET CAT=$SELECT(GTYPE="BP":"POSITION",1:"")
+8 QUIT CAT
+9 ;
TYP(TYPE) ; This function will return the external text for the Vital
+1 ; Type pointed to by TYPE.
+2 QUIT $PIECE($GET(^GMRD(120.51,TYPE,0)),"^")