Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMVGETVT

GMVGETVT.m

Go to the documentation of this file.
  1. GMVGETVT ;HOIFO/FT-GET VITAL TYPE INFORMATION ;2/26/07 15:35
  1. ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
  1. ;
  1. ; This routine uses the following IAs:
  1. ; #10104 - ^XLFSTR calls (supported)
  1. ;
  1. ; This routine supports the following IAs:
  1. ; #5047 - FIELD, GETIEN, LIST, TYPES entry points (supported)
  1. ;
  1. FIELD(GMVIEN,GMVFIELD,GMVFMT) ; Returns the vital type (FILE 120.51) values
  1. ; Input: GMVIEN = File 120.51 internal entry number (required)
  1. ; GMVFIELD = field you want (required)
  1. ; 1 = Name (.01)
  1. ; 2 = Abbreviation (1)
  1. ; 3 = PCE Abbreviation (7)
  1. ; 4 = VUID (99.99)
  1. ; 5 = Master Entry For VUID (99.98)
  1. ; GMVFMT = return internal or external value (optional)
  1. ; I for Internal, E for External
  1. ; default is E
  1. ; Output: field value or -1 if there is an error
  1. ;
  1. I $G(GMVIEN)="" Q -1
  1. I $G(GMVFIELD)="" Q -1
  1. S GMVFMT=$G(GMVFMT)
  1. S GMVFMT=$$UPPER(GMVFMT)
  1. S GMVFMT=$S(GMVFMT="I":"I",1:"E")
  1. I GMVFIELD=1 Q $$GET1^DIQ(120.51,+GMVIEN,.01,GMVFMT)
  1. I GMVFIELD=2 Q $$GET1^DIQ(120.51,+GMVIEN,1,GMVFMT)
  1. I GMVFIELD=3 Q $$GET1^DIQ(120.51,+GMVIEN,7,GMVFMT)
  1. I GMVFIELD=4 Q $$GET1^DIQ(120.51,+GMVIEN,99.99,GMVFMT)
  1. I GMVFIELD=5 Q $$GET1^DIQ(120.51,+GMVIEN,99.98,GMVFMT)
  1. Q -1
  1. ;
  1. GETIEN(GMVX,GMVY) ; Returns the vital type IEN
  1. ; Input: GMVX - File 120.51 look up value (required)
  1. ; GMVY - index type (required)
  1. ; 1 - Name (.01)
  1. ; 2 - Abbreviation (1)
  1. ; 3 - PCE Abbreviation (7)
  1. ; 4 - VUID (99.99)
  1. ; Output: File 120.51 internal entry number,
  1. ; or null if not found,
  1. ; or -1 if there is an error
  1. I $G(GMVX)="" Q -1
  1. I $G(GMVY)="" Q -1
  1. ;S GMVX=$$UP^XLFSTR(GMVX) ;make this an input parameter?
  1. I GMVY=1 Q $O(^GMRD(120.51,"B",GMVX,0))
  1. I GMVY=2 Q $O(^GMRD(120.51,"C",GMVX,0))
  1. I GMVY=3 Q $O(^GMRD(120.51,"APCE",GMVX,0))
  1. I GMVY=4 Q $O(^GMRD(120.51,"AVUID",GMVX,0))
  1. Q -1
  1. ;
  1. LIST(GMVARRAY,GMVFMT) ; Return list of supported vital types
  1. ; Input: GMVARRAY - Array name to return data in (required)
  1. ; GMVFMT - return internal or external value (optional)
  1. ; I for Internal or E for External
  1. ; default is I
  1. ; Output: GMVARRAY(0)=piece1
  1. ; GMVARRAY(n)=piece2^piece3^piece4^piece5^piece6^piece7
  1. ;
  1. ; where: piece1 = number of entries found
  1. ; piece2 = FILE 120.51 internal entry number (.001)
  1. ; piece3 = Name (.01)
  1. ; piece4 = Abbreviation (1)
  1. ; piece5 = PCE Abbreviation (7)
  1. ; piece6 = VUID (99.99)
  1. ; piece7 = Master Entry for VUID (99.98)
  1. ; n = a sequential number starting with 1
  1. ;
  1. N GMVCNT,GMVFLD,GMVIEN,GMVLOOP,GMVNAME,GMVNODE,GMVTYPES
  1. ; check if GMVARRAY is defined?
  1. S GMVFMT=$G(GMVFMT)
  1. S GMVFMT=$$UPPER(GMVFMT)
  1. S GMVFMT=$S(GMVFMT="I":"I",1:"E")
  1. S GMVCNT=0,GMVNAME=""
  1. S GMVTYPES=$$TYPES()
  1. F S GMVNAME=$O(^GMRD(120.51,"B",GMVNAME)) Q:GMVNAME="" D
  1. .S GMVIEN=0
  1. .F S GMVIEN=$O(^GMRD(120.51,"B",GMVNAME,GMVIEN)) Q:'GMVIEN D
  1. ..S GMVNODE=$G(^GMRD(120.51,GMVIEN,0))
  1. ..Q:GMVNODE=""
  1. ..Q:GMVTYPES'[$P(GMVNODE,U,2)
  1. ..F GMVLOOP=1:1:5 D
  1. ...S GMVFLD(GMVLOOP)=$$FIELD(GMVIEN,GMVLOOP,GMVFMT)
  1. ..S GMVCNT=GMVCNT+1
  1. ..;GMVARRAY(n)=ien^name^abbrev^pce abbrev^vuid^master entry for vuid
  1. ..S GMVARRAY(GMVCNT)=GMVIEN_U_GMVFLD(1)_U_GMVFLD(2)_U_GMVFLD(3)_U_GMVFLD(4)_U_GMVFLD(5)
  1. ..Q
  1. .Q
  1. S GMVARRAY(0)=GMVCNT
  1. Q
  1. TYPES() ; Returns list of abbreviations for the vitals types currently
  1. ; tracked
  1. ; Input: none
  1. ; Output: string of vital type abbreviations (File 120.51, Field 1
  1. ; values) separated by up-arrows
  1. ;
  1. Q "BP^CG^CVP^HT^P^PN^PO2^R^T^WT"
  1. ;
  1. UPPER(GMVX) ; Change text to uppercase
  1. ; Input: GMVX - string
  1. ; Output: string converted to uppercase
  1. S GMVX=$G(GMVX)
  1. Q $$UP^XLFSTR(GMVX)
  1. ;