- GMVUTL8 ;HIOFO/DS,FT-RPC API TO RETURN ALL VITALS/CATEGORIES/QUALIFIERS ;3/31/05 13:34
- ;;5.0;GEN. MED. REC. - VITALS;**1,3**;Oct 31, 2002
- ;
- ; This routine uses the following IAs:
- ; #2263 - ^XPAR calls (Supported)
- ; #3227 - ^NURAPI calls (private)
- ;
- ; This routine supports the following IAs:
- ; #4653 - QUALIFRS & SUPO2 entry points (private)
- ; #4420 - GMV DLL VERSION is called at DLL (private)
- ; #4354 - GMV GET CATEGORY IEN is called at CATEGORY (private)
- ; #4357 - GMV GET VITAL TYPE IEN is called at TYPE (private)
- ;
- APTLIST(ARRAY,LOC) ; Returns a list of active patients for a nursing
- ; location in the array specified. [RPC entry point]
- ; input: LOC - (Required) NURS LOCATION file (#211.4) ien
- ; input: ARRAY - (Required) Name of the array to return entries in
- ; output: ARRAY - Subscripted by sequential number with DFN in first
- ; piece and patient name in second piece.
- ; example: ARRAY(#)=DFN^patient name^SSN^DOB^SEX AND AGE
- ; ^ATTENDING^VETERAN^INTERNAL DATE/TIME DECEASED
- ; ^EXTERNAL DATE/TIME DECEASED
- ;
- I $G(LOC)="" S ARRAY(1)=-1
- N DFN,GMVARRAY,GMVCNT,GMVPAT,PATNAME
- D APTLIST^NURAPI(LOC,.GMVARRAY)
- I $G(GMVARRAY(1))'>0 S ARRAY(1)=-1 Q
- S GMVCNT=0
- F S GMVCNT=$O(GMVARRAY(GMVCNT)) Q:'GMVCNT D
- .S DFN=$P(GMVARRAY(GMVCNT),U,1)
- .Q:'DFN
- .S PATNAME=$P(GMVARRAY(GMVCNT),U,2)
- .D PTINFO^GMVUTL3(.GMVPAT,DFN)
- .S ARRAY(GMVCNT)=DFN_U_PATNAME_U_GMVPAT
- .Q
- Q
- TYPE(RESULT,GMVTYPE) ;GMV GET VITAL TYPE IEN [RPC entry point]
- ; Input:
- ; RESULT = variable name to hold result
- ; GMVTYPE = Name of Vital Type (from FILE 120.51) (e.g., WEIGHT)
- ; Output: Returns the IEN if GMVTYPE exists in FILE 120.51
- ; else returns -1
- ;
- I GMVTYPE="" S RESULT=-1 Q
- S RESULT=+$O(^GMRD(120.51,"B",GMVTYPE,0))
- Q
- CATEGORY(RESULT,GMVCAT) ;GMV GET CATEGORY IEN [RPC entry point]
- ; Input
- ; RESULT = variable name to hold result
- ; GMVCAT = Name of Category (from FILE 120.53) (e.g., METHOD)
- ; Output: Returns the IEN if GMVTYPE exists in FILE 120.53
- ; else returns -1
- I GMVCAT="" S RESULT=-1 Q
- S RESULT=+$O(^GMRD(120.53,"B",GMVCAT,0))
- Q
- QUALIFER(RESULT,GMVQUAL) ;Return IEN of Qualifier name
- ; Input:
- ; RESULT = variable name to hold result
- ; GMVQUAL = Name of Qualifier (from FILE 120.52) (e.g., ORAL)
- ; Output: Returns the IEN if GMVQUAL exists in FILE 120.52
- ; else returns -1
- ;
- I GMVQUAL="" S RESULT=-1 Q
- S RESULT=+$O(^GMRD(120.52,"B",GMVQUAL,0))
- Q
- VITALIEN() ;Returns the Vital Type IENS in a list separated by commas.
- ; ex: ",8,9,21,20,5,3,22,1,2,19,"
- ;
- N GMVABB,GMVIEN,GMVLIST
- S GMVLIST=""
- F GMVABB="BP","T","R","P","HT","WT","CVP","CG","PO2","PN" D
- .S GMVIEN=$O(^GMRD(120.51,"C",GMVABB,0))
- .Q:'GMVIEN
- .S GMVLIST=GMVLIST_","_GMVIEN
- .Q
- I $L(GMVLIST)'="," S GMVLIST=GMVLIST_","
- Q GMVLIST
- ;
- QUALIFRS(VIEN) ;Function to return vitals qualifiers text
- ; VIEN is the FILE 120.5 IEN
- ; Returns the qualifiers in a string of text
- ; e.g., Actual,Standing
- ;
- N QUALS,VQIEN,QNAME
- S QUALS=""
- I 'VIEN Q QUALS
- S VQIEN=0
- F S VQIEN=$O(^GMR(120.5,VIEN,5,"B",VQIEN)) Q:'VQIEN D
- .S QNAME=$P($G(^GMRD(120.52,+VQIEN,0)),U,1)
- .I QNAME]"" S QUALS=QUALS_QNAME_","
- .Q
- I $L(QUALS)>0 S QUALS=$E(QUALS,1,$L(QUALS)-1)
- Q QUALS
- SUPO2(VIEN) ;Function to return the Supplemental O2 value
- ; VIEN is the FILE 120.5 IEN
- ; Returns the Supplemental O2 value (#1.4)
- ; e.g., 2.0 l/min 90%
- ;
- S VIEN=+$G(VIEN)
- Q $P($G(^GMR(120.5,VIEN,0)),U,10)
- ;
- DLL(RESULT,GMVX) ; Entry for [GMV DLL VERSION] RPC. Returns DLL version check
- ; RESULT = variable name to return check
- ; GMVX = dll name and version date/time
- ; Returns yes or no
- S RESULT=$$GET^XPAR("SYS","GMV DLL VERSION",GMVX,"E")
- S:RESULT="" RESULT="NO"
- Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMVUTL8 3878 printed Mar 13, 2025@21:04:52 Page 2
- GMVUTL8 ;HIOFO/DS,FT-RPC API TO RETURN ALL VITALS/CATEGORIES/QUALIFIERS ;3/31/05 13:34
- +1 ;;5.0;GEN. MED. REC. - VITALS;**1,3**;Oct 31, 2002
- +2 ;
- +3 ; This routine uses the following IAs:
- +4 ; #2263 - ^XPAR calls (Supported)
- +5 ; #3227 - ^NURAPI calls (private)
- +6 ;
- +7 ; This routine supports the following IAs:
- +8 ; #4653 - QUALIFRS & SUPO2 entry points (private)
- +9 ; #4420 - GMV DLL VERSION is called at DLL (private)
- +10 ; #4354 - GMV GET CATEGORY IEN is called at CATEGORY (private)
- +11 ; #4357 - GMV GET VITAL TYPE IEN is called at TYPE (private)
- +12 ;
- APTLIST(ARRAY,LOC) ; Returns a list of active patients for a nursing
- +1 ; location in the array specified. [RPC entry point]
- +2 ; input: LOC - (Required) NURS LOCATION file (#211.4) ien
- +3 ; input: ARRAY - (Required) Name of the array to return entries in
- +4 ; output: ARRAY - Subscripted by sequential number with DFN in first
- +5 ; piece and patient name in second piece.
- +6 ; example: ARRAY(#)=DFN^patient name^SSN^DOB^SEX AND AGE
- +7 ; ^ATTENDING^VETERAN^INTERNAL DATE/TIME DECEASED
- +8 ; ^EXTERNAL DATE/TIME DECEASED
- +9 ;
- +10 IF $GET(LOC)=""
- SET ARRAY(1)=-1
- +11 NEW DFN,GMVARRAY,GMVCNT,GMVPAT,PATNAME
- +12 DO APTLIST^NURAPI(LOC,.GMVARRAY)
- +13 IF $GET(GMVARRAY(1))'>0
- SET ARRAY(1)=-1
- QUIT
- +14 SET GMVCNT=0
- +15 FOR
- SET GMVCNT=$ORDER(GMVARRAY(GMVCNT))
- if 'GMVCNT
- QUIT
- Begin DoDot:1
- +16 SET DFN=$PIECE(GMVARRAY(GMVCNT),U,1)
- +17 if 'DFN
- QUIT
- +18 SET PATNAME=$PIECE(GMVARRAY(GMVCNT),U,2)
- +19 DO PTINFO^GMVUTL3(.GMVPAT,DFN)
- +20 SET ARRAY(GMVCNT)=DFN_U_PATNAME_U_GMVPAT
- +21 QUIT
- End DoDot:1
- +22 QUIT
- TYPE(RESULT,GMVTYPE) ;GMV GET VITAL TYPE IEN [RPC entry point]
- +1 ; Input:
- +2 ; RESULT = variable name to hold result
- +3 ; GMVTYPE = Name of Vital Type (from FILE 120.51) (e.g., WEIGHT)
- +4 ; Output: Returns the IEN if GMVTYPE exists in FILE 120.51
- +5 ; else returns -1
- +6 ;
- +7 IF GMVTYPE=""
- SET RESULT=-1
- QUIT
- +8 SET RESULT=+$ORDER(^GMRD(120.51,"B",GMVTYPE,0))
- +9 QUIT
- CATEGORY(RESULT,GMVCAT) ;GMV GET CATEGORY IEN [RPC entry point]
- +1 ; Input
- +2 ; RESULT = variable name to hold result
- +3 ; GMVCAT = Name of Category (from FILE 120.53) (e.g., METHOD)
- +4 ; Output: Returns the IEN if GMVTYPE exists in FILE 120.53
- +5 ; else returns -1
- +6 IF GMVCAT=""
- SET RESULT=-1
- QUIT
- +7 SET RESULT=+$ORDER(^GMRD(120.53,"B",GMVCAT,0))
- +8 QUIT
- QUALIFER(RESULT,GMVQUAL) ;Return IEN of Qualifier name
- +1 ; Input:
- +2 ; RESULT = variable name to hold result
- +3 ; GMVQUAL = Name of Qualifier (from FILE 120.52) (e.g., ORAL)
- +4 ; Output: Returns the IEN if GMVQUAL exists in FILE 120.52
- +5 ; else returns -1
- +6 ;
- +7 IF GMVQUAL=""
- SET RESULT=-1
- QUIT
- +8 SET RESULT=+$ORDER(^GMRD(120.52,"B",GMVQUAL,0))
- +9 QUIT
- VITALIEN() ;Returns the Vital Type IENS in a list separated by commas.
- +1 ; ex: ",8,9,21,20,5,3,22,1,2,19,"
- +2 ;
- +3 NEW GMVABB,GMVIEN,GMVLIST
- +4 SET GMVLIST=""
- +5 FOR GMVABB="BP","T","R","P","HT","WT","CVP","CG","PO2","PN"
- Begin DoDot:1
- +6 SET GMVIEN=$ORDER(^GMRD(120.51,"C",GMVABB,0))
- +7 if 'GMVIEN
- QUIT
- +8 SET GMVLIST=GMVLIST_","_GMVIEN
- +9 QUIT
- End DoDot:1
- +10 IF $LENGTH(GMVLIST)'=","
- SET GMVLIST=GMVLIST_","
- +11 QUIT GMVLIST
- +12 ;
- QUALIFRS(VIEN) ;Function to return vitals qualifiers text
- +1 ; VIEN is the FILE 120.5 IEN
- +2 ; Returns the qualifiers in a string of text
- +3 ; e.g., Actual,Standing
- +4 ;
- +5 NEW QUALS,VQIEN,QNAME
- +6 SET QUALS=""
- +7 IF 'VIEN
- QUIT QUALS
- +8 SET VQIEN=0
- +9 FOR
- SET VQIEN=$ORDER(^GMR(120.5,VIEN,5,"B",VQIEN))
- if 'VQIEN
- QUIT
- Begin DoDot:1
- +10 SET QNAME=$PIECE($GET(^GMRD(120.52,+VQIEN,0)),U,1)
- +11 IF QNAME]""
- SET QUALS=QUALS_QNAME_","
- +12 QUIT
- End DoDot:1
- +13 IF $LENGTH(QUALS)>0
- SET QUALS=$EXTRACT(QUALS,1,$LENGTH(QUALS)-1)
- +14 QUIT QUALS
- SUPO2(VIEN) ;Function to return the Supplemental O2 value
- +1 ; VIEN is the FILE 120.5 IEN
- +2 ; Returns the Supplemental O2 value (#1.4)
- +3 ; e.g., 2.0 l/min 90%
- +4 ;
- +5 SET VIEN=+$GET(VIEN)
- +6 QUIT $PIECE($GET(^GMR(120.5,VIEN,0)),U,10)
- +7 ;
- DLL(RESULT,GMVX) ; Entry for [GMV DLL VERSION] RPC. Returns DLL version check
- +1 ; RESULT = variable name to return check
- +2 ; GMVX = dll name and version date/time
- +3 ; Returns yes or no
- +4 SET RESULT=$$GET^XPAR("SYS","GMV DLL VERSION",GMVX,"E")
- +5 if RESULT=""
- SET RESULT="NO"
- +6 QUIT
- +7 ;