GMVGETC ;HOIFO/FT-GET CATEGORY INFORMATION ;2/26/07 15:32
;;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:
; #5050 - FIELD, GETIEN, VT entry points (supported)
;
FIELD(GMVIEN,GMVFIELD,GMVFMT) ; Returns the FILE 120.53 value
; Input: GMVIEN = File 120.53 internal entry number (required)
; GMVFIELD = field you want (required)
; 1 = Name (.01)
; 2 = VUID (99.99)
; 3 = Master Entry For VUID (99.98)
; GMVFMT = return internal or external value (optional)
; I for 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=$G(GMVFMT)
S GMVFMT=$$UPPER^GMVGETVT(GMVFMT)
S GMVFMT=$S(GMVFMT="I":"I",1:"E")
I GMVFIELD=1 Q $$GET1^DIQ(120.53,+GMVIEN,.01,GMVFMT)
I GMVFIELD=2 Q $$GET1^DIQ(120.53,+GMVIEN,99.99,GMVFMT)
I GMVFIELD=3 Q $$GET1^DIQ(120.53,+GMVIEN,99.98,GMVFMT)
Q -1
;
GETIEN(GMVX,GMVY) ; Returns the qualifier IEN
; Input: GMVX - File 120.53 look up value (required)
; GMVY - index type (required)
; 1 - Name (.01)
; 2 - VUID (99.99)
; Output: File 120.53 internal entry number,
; or null if not found,
; or -1 if there is an error
N GMVIEN
I $G(GMVX)="" Q -1
I $G(GMVY)="" Q -1
I GMVY=1 Q $O(^GMRD(120.53,"B",GMVX,0))
I GMVY=2 Q $O(^GMRD(120.53,"AVUID",GMVX,0))
Q -1
;
VT(RESULT,GMVIEN) ; Returns the vital types (field #1) values
; Input: RESULT = Array name to return data in (required)
; GMVIEN = File 120.53 internal entry number (required)
; Output: RESULT(0)=piece1
; RESULT(n)=piece2^piece3
;
; where piece1 = number of entries found or -1 if an error
; piece2 = FILE 120.51 entry number
; piece3 = FILE 120.51, Field .01 external value
; n = a sequential number starting with 1
;
N GMVCNT,GMVLOOP,GMVNODE,GMVVTE,GMVVTI
; What if RESULT is not defined?
S (GMVCNT,GMVLOOP,RESULT(0))=0
I $G(GMVIEN)="" Q
F S GMVLOOP=$O(^GMRD(120.53,GMVIEN,1,GMVLOOP)) Q:'GMVLOOP D
.S GMVNODE=$G(^GMRD(120.53,GMVIEN,1,GMVLOOP,0))
.Q:GMVNODE=""
.S GMVVTI=$P(GMVNODE,U,1)
.Q:'GMVVTI
.S GMVVTE=$$FIELD^GMVGETVT(GMVVTI,1,"E")
.Q:GMVVTE=-1
.S GMVCNT=GMVCNT+1
.S RESULT(GMVCNT)=GMVVTI_U_GMVVTE
.Q
S RESULT(0)=GMVCNT
Q
;
GMVGETC ;HOIFO/FT-GET CATEGORY INFORMATION ;2/26/07 15:32
+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 ; #5050 - FIELD, GETIEN, VT entry points (supported)
+8 ;
FIELD(GMVIEN,GMVFIELD,GMVFMT) ; Returns the FILE 120.53 value
+1 ; Input: GMVIEN = File 120.53 internal entry number (required)
+2 ; GMVFIELD = field you want (required)
+3 ; 1 = Name (.01)
+4 ; 2 = VUID (99.99)
+5 ; 3 = Master Entry For VUID (99.98)
+6 ; GMVFMT = return internal or external value (optional)
+7 ; I for Internal, E for External
+8 ; default is E
+9 ; Output: field value or -1 if there is an error
+10 ;
+11 IF $GET(GMVIEN)=""
QUIT -1
+12 IF $GET(GMVFIELD)=""
QUIT -1
+13 SET GMVFMT=$GET(GMVFMT)
+14 SET GMVFMT=$$UPPER^GMVGETVT(GMVFMT)
+15 SET GMVFMT=$SELECT(GMVFMT="I":"I",1:"E")
+16 IF GMVFIELD=1
QUIT $$GET1^DIQ(120.53,+GMVIEN,.01,GMVFMT)
+17 IF GMVFIELD=2
QUIT $$GET1^DIQ(120.53,+GMVIEN,99.99,GMVFMT)
+18 IF GMVFIELD=3
QUIT $$GET1^DIQ(120.53,+GMVIEN,99.98,GMVFMT)
+19 QUIT -1
+20 ;
GETIEN(GMVX,GMVY) ; Returns the qualifier IEN
+1 ; Input: GMVX - File 120.53 look up value (required)
+2 ; GMVY - index type (required)
+3 ; 1 - Name (.01)
+4 ; 2 - VUID (99.99)
+5 ; Output: File 120.53 internal entry number,
+6 ; or null if not found,
+7 ; or -1 if there is an error
+8 NEW GMVIEN
+9 IF $GET(GMVX)=""
QUIT -1
+10 IF $GET(GMVY)=""
QUIT -1
+11 IF GMVY=1
QUIT $ORDER(^GMRD(120.53,"B",GMVX,0))
+12 IF GMVY=2
QUIT $ORDER(^GMRD(120.53,"AVUID",GMVX,0))
+13 QUIT -1
+14 ;
VT(RESULT,GMVIEN) ; Returns the vital types (field #1) values
+1 ; Input: RESULT = Array name to return data in (required)
+2 ; GMVIEN = File 120.53 internal entry number (required)
+3 ; Output: RESULT(0)=piece1
+4 ; RESULT(n)=piece2^piece3
+5 ;
+6 ; where piece1 = number of entries found or -1 if an error
+7 ; piece2 = FILE 120.51 entry number
+8 ; piece3 = FILE 120.51, Field .01 external value
+9 ; n = a sequential number starting with 1
+10 ;
+11 NEW GMVCNT,GMVLOOP,GMVNODE,GMVVTE,GMVVTI
+12 ; What if RESULT is not defined?
+13 SET (GMVCNT,GMVLOOP,RESULT(0))=0
+14 IF $GET(GMVIEN)=""
QUIT
+15 FOR
SET GMVLOOP=$ORDER(^GMRD(120.53,GMVIEN,1,GMVLOOP))
IF 'GMVLOOP
QUIT
Begin DoDot:1
+16 SET GMVNODE=$GET(^GMRD(120.53,GMVIEN,1,GMVLOOP,0))
+17 IF GMVNODE=""
QUIT
+18 SET GMVVTI=$PIECE(GMVNODE,U,1)
+19 IF 'GMVVTI
QUIT
+20 SET GMVVTE=$$FIELD^GMVGETVT(GMVVTI,1,"E")
+21 IF GMVVTE=-1
QUIT
+22 SET GMVCNT=GMVCNT+1
+23 SET RESULT(GMVCNT)=GMVVTI_U_GMVVTE
+24 QUIT
End DoDot:1
+25 SET RESULT(0)=GMVCNT
+26 QUIT
+27 ;