GMVGETQL ;HOIFO/FT-GET QUALIFIER INFORMATION ;2/26/07 16:27
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; <None>
;
; This routine supports the following IAs:
; #5048 - FIELD, GETIEN, VT entry points (supported)
;
FIELD(GMVIEN,GMVFIELD,GMVFMT) ; Returns the qualifier values
; Input: GMVIEN - File 120.52 internal entry number (required)
; GMVFIELD - field you want (required)
; 1 = name(.01)
; 2 = Synonym (.02)
; 3 = VUID (99.99)
; 4 = Master Entry For VUID
; GMVFMT - return internal or external value (optional)
; I fo Internal, E for External
; default is E
; Output: field value or -1 if there is an error
;
I $G(GMVIEN)="" Q -1
I $G(GMVFIELD)="" Q -1
S GMVFMT=$E($G(GMVFMT,"E"))
S GMVFMT=$$UPPER^GMVGETVT(GMVFMT)
S GMVFMT=$S(GMVFMT="I":"I",1:"E")
I GMVFIELD=1 Q $$GET1^DIQ(120.52,+GMVIEN,.01,GMVFMT)
I GMVFIELD=2 Q $$GET1^DIQ(120.52,+GMVIEN,.02,GMVFMT)
I GMVFIELD=3 Q $$GET1^DIQ(120.52,+GMVIEN,99.99,GMVFMT)
I GMVFIELD=4 Q $$GET1^DIQ(120.52,+GMVIEN,99.96,GMVFMT)
Q -1
;
GETIEN(GMVX,GMVY) ; Returns the qualifier IEN
; Input: GMVX - File 120.52 look up value (required)
; GMVY - index type (required)
; 1 = name (.01)
; 2 = VUID (99.99)
; Output: File 120.52 internal entry number
; or null if not found
; or -1 if there is an error
;
I $G(GMVX)="" Q -1
I $G(GMVY)="" Q -1
I GMVY=1 Q $O(^GMRD(120.52,"B",GMVX,0))
I GMVY=2 Q $O(^GMRD(120.52,"AVUID",GMVX,0))
Q -1
;
VT(RESULT,GMVIEN) ; Returns the vital types and category values for a qualifier
; Input: RESULT = Array name to return data in (required)
; GMVIEN = File 120.52 internal entry number (required)
; Output: RESULT(0)=piece1
; RESULT(n)=piece2^piece3^piece4^piece5
; where piece1 = number of entries found or -1 if an error
; piece2 = File 120.51 entry number
; piece3 = File 120.51 .01 field value
; piece4 = File 120.53 entry number
; piece5 = File 120.53 .01 field value
; n = sequential number starting with 1
;
N GMVCATE,GMVCATI,GMVCNT,GMVLOOP,GMVNODE,GMVTE,GMVTI
S (GMVCNT,GMVLOOP)=0
I $G(GMVIEN)="" Q
; check if RESULT is defined?
F S GMVLOOP=$O(^GMRD(120.52,GMVIEN,1,GMVLOOP)) Q:'GMVLOOP D
.S GMVNODE=$G(^GMRD(120.52,GMVIEN,1,GMVLOOP,0))
.Q:GMVNODE=""
.S GMVTI=$P(GMVNODE,U,1)
.Q:'GMVTI
.S GMVTE=$$FIELD^GMVGETVT(GMVTI,1,"E")
.Q:GMVTE=""
.S GMVCATI=$P(GMVNODE,U,2)
.S GMVCATE=""
.I GMVCATI S GMVCATE=$$FIELD^GMVGETC(GMVCATI,1,"E")
.S GMVCNT=GMVCNT+1
.S RESULT(GMVCNT)=GMVTI_U_GMVTE_U_GMVCATI_U_GMVCATE
.Q
S RESULT(0)=GMVCNT
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMVGETQL 2910 printed Dec 13, 2024@01:58:52 Page 2
GMVGETQL ;HOIFO/FT-GET QUALIFIER INFORMATION ;2/26/07 16:27
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; <None>
+5 ;
+6 ; This routine supports the following IAs:
+7 ; #5048 - FIELD, GETIEN, VT entry points (supported)
+8 ;
FIELD(GMVIEN,GMVFIELD,GMVFMT) ; Returns the qualifier values
+1 ; Input: GMVIEN - File 120.52 internal entry number (required)
+2 ; GMVFIELD - field you want (required)
+3 ; 1 = name(.01)
+4 ; 2 = Synonym (.02)
+5 ; 3 = VUID (99.99)
+6 ; 4 = Master Entry For VUID
+7 ; GMVFMT - return internal or external value (optional)
+8 ; I fo Internal, E for External
+9 ; default is E
+10 ; Output: field value or -1 if there is an error
+11 ;
+12 IF $GET(GMVIEN)=""
QUIT -1
+13 IF $GET(GMVFIELD)=""
QUIT -1
+14 SET GMVFMT=$EXTRACT($GET(GMVFMT,"E"))
+15 SET GMVFMT=$$UPPER^GMVGETVT(GMVFMT)
+16 SET GMVFMT=$SELECT(GMVFMT="I":"I",1:"E")
+17 IF GMVFIELD=1
QUIT $$GET1^DIQ(120.52,+GMVIEN,.01,GMVFMT)
+18 IF GMVFIELD=2
QUIT $$GET1^DIQ(120.52,+GMVIEN,.02,GMVFMT)
+19 IF GMVFIELD=3
QUIT $$GET1^DIQ(120.52,+GMVIEN,99.99,GMVFMT)
+20 IF GMVFIELD=4
QUIT $$GET1^DIQ(120.52,+GMVIEN,99.96,GMVFMT)
+21 QUIT -1
+22 ;
GETIEN(GMVX,GMVY) ; Returns the qualifier IEN
+1 ; Input: GMVX - File 120.52 look up value (required)
+2 ; GMVY - index type (required)
+3 ; 1 = name (.01)
+4 ; 2 = VUID (99.99)
+5 ; Output: File 120.52 internal entry number
+6 ; or null if not found
+7 ; or -1 if there is an error
+8 ;
+9 IF $GET(GMVX)=""
QUIT -1
+10 IF $GET(GMVY)=""
QUIT -1
+11 IF GMVY=1
QUIT $ORDER(^GMRD(120.52,"B",GMVX,0))
+12 IF GMVY=2
QUIT $ORDER(^GMRD(120.52,"AVUID",GMVX,0))
+13 QUIT -1
+14 ;
VT(RESULT,GMVIEN) ; Returns the vital types and category values for a qualifier
+1 ; Input: RESULT = Array name to return data in (required)
+2 ; GMVIEN = File 120.52 internal entry number (required)
+3 ; Output: RESULT(0)=piece1
+4 ; RESULT(n)=piece2^piece3^piece4^piece5
+5 ; where piece1 = number of entries found or -1 if an error
+6 ; piece2 = File 120.51 entry number
+7 ; piece3 = File 120.51 .01 field value
+8 ; piece4 = File 120.53 entry number
+9 ; piece5 = File 120.53 .01 field value
+10 ; n = sequential number starting with 1
+11 ;
+12 NEW GMVCATE,GMVCATI,GMVCNT,GMVLOOP,GMVNODE,GMVTE,GMVTI
+13 SET (GMVCNT,GMVLOOP)=0
+14 IF $GET(GMVIEN)=""
QUIT
+15 ; check if RESULT is defined?
+16 FOR
SET GMVLOOP=$ORDER(^GMRD(120.52,GMVIEN,1,GMVLOOP))
if 'GMVLOOP
QUIT
Begin DoDot:1
+17 SET GMVNODE=$GET(^GMRD(120.52,GMVIEN,1,GMVLOOP,0))
+18 if GMVNODE=""
QUIT
+19 SET GMVTI=$PIECE(GMVNODE,U,1)
+20 if 'GMVTI
QUIT
+21 SET GMVTE=$$FIELD^GMVGETVT(GMVTI,1,"E")
+22 if GMVTE=""
QUIT
+23 SET GMVCATI=$PIECE(GMVNODE,U,2)
+24 SET GMVCATE=""
+25 IF GMVCATI
SET GMVCATE=$$FIELD^GMVGETC(GMVCATI,1,"E")
+26 SET GMVCNT=GMVCNT+1
+27 SET RESULT(GMVCNT)=GMVTI_U_GMVTE_U_GMVCATI_U_GMVCATE
+28 QUIT
End DoDot:1
+29 SET RESULT(0)=GMVCNT
+30 QUIT
+31 ;