GMVUTL ;HOIFO/RM,MD,FT-CALLABLE ENTRY POINTS FOR PROGRAMMER UTILITIES ;08/12/09 17:15
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #5076 - MDCLIO1 calls (private)
; #5269 - MDTERM calls (private)
; #10103 - XLFDT calls (supported)
;
; This routine supports the following IAs:
; #5046 - CLIO, F1250 entry points (supported)
;
EN1 ; CALL TO CONVERT TEMPERATURE (F) IN VARIABLE X TO TEMPERATURE (C)
; IN VARIABLE Y
S Y=$J(X-32*5/9,0,1)
Q
EN2 ; CALL TO CONVERT AN INCHES MEASUREMENT IN X TO A CENTIMETER
; MEASUREMENT IN Y
S Y=$J(2.54*X,0,2)
Q
EN3 ; CALL TO CONVERT A WEIGHT (LBS) IN VARIABLE X TO A WEIGHT (KG)
; IN VARIABLE Y
S Y=$J(X/2.2,0,2)
Q
CLIO(GMVCLIO,GMVGUID) ; Calls Clinical Observations to get a single record
; Input:
; GMVCLIO = array name (required)
; GMVGUID = Global Unique ID (required)
; Output:
; GMVCLIO(0) =
;
I $G(GMVGUID)="" S GMVCLIO(0)="" Q
N GMVARRAY,GMVCNT,GMVCS,GMVDATE,GMVDY,GMVFLAG,GMVFLD,GMVFR,GMVHR,GMVL,GMVLOOP,GMVM,GMVMI,GMVMO
N GMVO2,GMVP,GMVPAIN,GMVPO2,GMVQ,GMVQFLAG,GMVQLOOP,GMVS,GMVSC,GMVSUP,GMVTIME,GMVU,GMVX,GMVY,GMVYR,X,Y
I $T(QRYOBS^MDCLIO1)="" S GMVCLIO(0)="",GMVCLIO(5)="" Q
D QRYOBS^MDCLIO1("GMVARRAY",GMVGUID)
I '$D(GMVARRAY("OBSERVED_DATE_TIME")) S GMVCLIO(0)="",GMVCLIO(5)="" Q
S GMVPAIN=$$GETIEN^GMVGETVT("PN",2),GMVCNT=0
S GMVPO2=$$GETIEN^GMVGETVT("PO2",2),(GMVFR,GMVO2,GMVSUP)=""
S $P(GMVCLIO(0),U,1)=$G(GMVARRAY("OBSERVED_DATE_TIME","I"))
S $P(GMVCLIO(0),U,2)=$G(GMVARRAY("PATIENT_ID","I"))
S $P(GMVCLIO(0),U,4)=$G(GMVARRAY("ENTERED_DATE_TIME","I"))
S $P(GMVCLIO(0),U,5)=$G(GMVARRAY("HOSPITAL_LOCATION_ID","I"))
S $P(GMVCLIO(0),U,6)=$G(GMVARRAY("ENTERED_BY_ID","I"))
S $P(GMVCLIO(0),U,8)=$G(GMVARRAY("SVALUE","I"))
S GMVX=$G(GMVARRAY("TERM_ID","I"))
I GMVX]"" D
.S GMVX=$$GETIEN^GMVGETVT(GMVX,4)
.S $P(GMVCLIO(0),U,3)=GMVX
.Q
; NOTE: PAIN needs external value from CLIO
I $P(GMVCLIO(0),U,3)=GMVPAIN D
.S $P(GMVCLIO(0),U,8)=$G(GMVARRAY("SVALUE","E"))
.Q
S GMVFLAG=0
F GMVLOOP=1,2,3,8 D Q:GMVFLAG
.S:$P(GMVCLIO(0),U,GMVLOOP)="" GMVFLAG=1
.Q
I GMVFLAG S GMVCLIO(0)="",GMVCLIO(5)="" Q
;check unit of measurement and convert value if needed
I $G(GMVARRAY("UNIT_ID","E"))="DEGREES C" D
.S $P(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($P(GMVCLIO(0),U,8),"DEGREES C","DEGREES F",1)
I $G(GMVARRAY("UNIT_ID","E"))="CENTIMETER" D
.S $P(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($P(GMVCLIO(0),U,8),"CENTIMETER","INCH",2)
I $G(GMVARRAY("UNIT_ID","E"))="KILOGRAM" D
.S $P(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($P(GMVCLIO(0),U,8),"KILOGRAM","POUND",2)
I $G(GMVARRAY("UNIT_ID","E"))="MILLIMETERS OF MERCURY" D
.S $P(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($P(GMVCLIO(0),U,8),"MILLIMETERS OF MERCURY","CENTIMETERS H2O",1)
; entered-in-error - won't get errors from clio
S $P(GMVCLIO(2),U,1)="" ;error flag
S $P(GMVCLIO(2),U,2)="" ;error entered by
S $P(GMVCLIO(2),U,3)="" ;reason entered in error
;
S GMVCLIO(5)="",GMVCNT=0
S GMVCS=$G(GMVARRAY("CUFF_SIZE_ID","I"))
I GMVCS]"" D
.S GMVCS=$$GETIEN^GMVGETQL(GMVCS,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVCS
.Q
S GMVL=$G(GMVARRAY("LOCATION_ID","I"))
I GMVL]"" D
.S GMVL=$$GETIEN^GMVGETQL(GMVL,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVL
.Q
S GMVM=$G(GMVARRAY("METHOD_ID","I"))
I GMVM]"" D
.S GMVM=$$GETIEN^GMVGETQL(GMVM,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVM
.Q
S GMVP=$G(GMVARRAY("POSITION_ID","I"))
I GMVP]"" D
.S GMVP=$$GETIEN^GMVGETQL(GMVP,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVP
.Q
S GMVS=$G(GMVARRAY("SITE_ID","I"))
I GMVS]"" D
.S GMVS=$$GETIEN^GMVGETQL(GMVS,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVS
.Q
S GMVQ=$G(GMVARRAY("QUALITY_ID","I"))
I GMVQ]"" D
.S GMVQ=$$GETIEN^GMVGETQL(GMVQ,2)
.S GMVCNT=GMVCNT+1
.S $P(GMVCLIO(5),U,GMVCNT)=GMVQ
.Q
I $P(GMVCLIO(0),U,3)=GMVPO2 D
.S GMVLOOP=0
.F S GMVLOOP=$O(GMVARRAY("CONTEXT",GMVLOOP)) Q:'GMVLOOP D
..I $G(GMVARRAY("CONTEXT",GMVLOOP,"TERM_ID","E"))="SUPPLEMENTAL OXYGEN CONCENTRATION" D
...S GMVO2=$G(GMVARRAY("CONTEXT",GMVLOOP,"SVALUE","E"))
..I $G(GMVARRAY("CONTEXT",GMVLOOP,"TERM_ID","E"))="SUPPLEMENTAL OXYGEN FLOW RATE" D
...S GMVFR=$G(GMVARRAY("CONTEXT",GMVLOOP,"SVALUE","E"))
..S GMVM=$G(GMVARRAY("CONTEXT",GMVLOOP,"METHOD_ID","I"))
..I GMVM]"" D
...S GMVM=$$GETIEN^GMVGETQL(GMVM,2)
...Q:'GMVM
...S GMVQFLAG=0
...F GMVQLOOP=1:1 Q:$P($G(GMVCLIO(5)),U,GMVQLOOP)="" I $P($G(GMVCLIO(5)),U,GMVQLOOP)=GMVM S GMVQFLAG=1 Q
...I GMVQFLAG=0 S GMVCNT=GMVCNT+1,$P(GMVCLIO(5),U,GMVCNT)=GMVM
S:GMVO2]"" GMVO2=GMVO2_"%"
S:GMVFR]"" GMVFR=GMVFR_" l/min"
I GMVFR="",GMVO2="" S GMVSUP=""
I GMVFR'="",GMVO2="" S GMVSUP=GMVFR
I GMVFR="",GMVO2'="" S GMVSUP=GMVO2
I GMVFR'="",GMVO2'="" S GMVSUP=GMVFR_" "_GMVO2
S $P(GMVCLIO(0),U,10)=GMVSUP
Q
;
F1205(GMV1205,GMVX,GMVY) ; Return file 120.5 record as nodes
; Input: GMV1205 = array name to hold nodes (required)
; GMVX = File 120.5 IEN or CliO GUID (required)
; GMVY = Return records marked as errors? (optional)
; 0 = don't return, 1 = return error records
; (default = 0)
; Output:GMV1205(0) = file 120.5 zero node
; (2) = 120.5,#2 ^ 120.5, #3 ^ 120.5, #4 delimited by
; tilde (~)
; (3) = qualifier IENS delimited by caret (^)
;
N GMVCNT,GMVFLAG,GMVLIST,GMVLOOP,GMVNODE,GMVNODE2,GMVIEN1
S GMVX=$G(GMVX),GMVY=$G(GMVY,0)
S (GMV1205(0),GMV1205(2),GMV1205(5))=""
I GMVX'=+GMVX Q
S GMVY=$S(GMVY=1:1,1:0)
S GMVNODE2=$G(^GMR(120.5,+GMVX,2))
I GMVY=0,$P(GMVNODE2,U,1)=1 Q
S GMV1205(0)=$G(^GMR(120.5,GMVX,0))
S GMVFLAG=0
F GMVLOOP=1,2,3,8 D Q:GMVFLAG
.S:$P(GMV1205(0),U,GMVLOOP)="" GMVFLAG=1
.Q
I GMVFLAG S (GMV1205(0),GMV1205(2),GMV1205(5))="" Q
S GMV1205(2)=GMVNODE2
S (GMVCNT,GMVIEN1)=0,GMVLIST=""
F S GMVIEN1=$O(^GMR(120.5,GMVX,2.1,GMVIEN1)) Q:'GMVIEN1 D
.S GMVCNT=GMVCNT+1
.S $P(GMVLIST,"~",GMVCNT)=+$P($G(^GMR(120.5,GMVX,2.1,GMVIEN1,0)),U,1)
.Q
S $P(GMV1205(2),U,3)=GMVLIST
S (GMVCNT,GMVIEN1)=0
F S GMVIEN1=$O(^GMR(120.5,GMVX,5,"B",GMVIEN1)) Q:'GMVIEN1 D
.S GMVCNT=GMVCNT+1
.S $P(GMV1205(5),U,GMVCNT)=GMVIEN1
.Q
Q
;
GETREC(GMVARRAY,GMVID,GMVERR) ; Checks CLIO and Vitals databases. Returns
; record as nodes with internal values.
; Input: GMVARRAY = array name passed by reference (required)
; GMVID = File 120.5 IEN or CliO GUID (required)
; GMVERR = Return records marked as errors? (optional)
; 0 = don't return, 1 = return error records
; (default = 0)
; Output:GMVARRAY(0) = same as File 120.5 zero node
; (2) = 120.5, #2 ^ 120.5, #3 ^ 120.5, #4 delimited by
; tilde (~)
; (3) = qualifier IENS (File 120.52) delimited by caret (^)
;
; example:
; >D GETREC^GMVUTL(.RESULT,12196,0) ZW RESULT
; RESULT(0)="3080108.093626^217^21^3080108.0937^67^4658^^4^^1.0 l/min 22%"
; RESULT(2)="^^"
; RESULT(5)=134
;
S GMVID=$G(GMVID),GMVERR=$G(GMVERR)
I GMVID="" Q
S GMVERR=$S(GMVERR=1:1,1:0)
I GMVID=+GMVID D Q
.D F1205(.GMVARRAY,GMVID,GMVERR)
.Q
I GMVID'=+GMVID D Q
.D CLIO(.GMVARRAY,GMVID)
.Q
Q
QRYDATE(RESULT,SDATE,EDATE) ; Returns a list of GUIDs found in the
; Clinical Observations package for the date range specified
; Input: RESULT = array name surrounded by quotes (required)
; ex: "ARRAY", "^TMP($J)"
; SDATE = start date of search range in FileMan internal
; format (optional)
; default is T-24 hours
; EDATE = end date in FileMan internal format (optional)
; default is current date/time
; Output: RESULT(0)=number of entries returned
; or "-1^error message"
; RESULT(n)=Global Unique ID (aka GUID)
; where n is a sequential number starting with 1
;
; example:
; >D QRYDATE^GMVUTL("ARRAY",3070301,3070401)
; >ZW ARRAY
; ARRAY(0)=3
; ARRAY(1)="{FD0FEBBC-8EC1-42E4-9483-4BDBE6370728}"
; ARRAY(2)="{A7C7FFEB-0CD5-4D55-BB34-35B9620F4ECC}"
; ARRAY(3)="{D0CEA9D2-A519-41C2-A4AE-9C24C7498E56}"
;
I $T(QRYDATE^MDCLIO1)="" D Q
.S @RESULT@(0)="-1^QRYDATE entry point not found in MDCLIO1"
.Q
K ^TMP($J),@RESULT
S SDATE=$G(SDATE,$$FMADD^XLFDT($$NOW^XLFDT(),,-24))
S EDATE=$G(EDATE,$$NOW^XLFDT())
I SDATE>EDATE D Q
.S @RESULT@(0)="-1^Start Date is after end date"
.Q
D QRYDATE^MDCLIO1(RESULT,SDATE,EDATE)
Q
GMVUTL ;HOIFO/RM,MD,FT-CALLABLE ENTRY POINTS FOR PROGRAMMER UTILITIES ;08/12/09 17:15
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #5076 - MDCLIO1 calls (private)
+5 ; #5269 - MDTERM calls (private)
+6 ; #10103 - XLFDT calls (supported)
+7 ;
+8 ; This routine supports the following IAs:
+9 ; #5046 - CLIO, F1250 entry points (supported)
+10 ;
EN1 ; CALL TO CONVERT TEMPERATURE (F) IN VARIABLE X TO TEMPERATURE (C)
+1 ; IN VARIABLE Y
+2 SET Y=$JUSTIFY(X-32*5/9,0,1)
+3 QUIT
EN2 ; CALL TO CONVERT AN INCHES MEASUREMENT IN X TO A CENTIMETER
+1 ; MEASUREMENT IN Y
+2 SET Y=$JUSTIFY(2.54*X,0,2)
+3 QUIT
EN3 ; CALL TO CONVERT A WEIGHT (LBS) IN VARIABLE X TO A WEIGHT (KG)
+1 ; IN VARIABLE Y
+2 SET Y=$JUSTIFY(X/2.2,0,2)
+3 QUIT
CLIO(GMVCLIO,GMVGUID) ; Calls Clinical Observations to get a single record
+1 ; Input:
+2 ; GMVCLIO = array name (required)
+3 ; GMVGUID = Global Unique ID (required)
+4 ; Output:
+5 ; GMVCLIO(0) =
+6 ;
+7 IF $GET(GMVGUID)=""
SET GMVCLIO(0)=""
QUIT
+8 NEW GMVARRAY,GMVCNT,GMVCS,GMVDATE,GMVDY,GMVFLAG,GMVFLD,GMVFR,GMVHR,GMVL,GMVLOOP,GMVM,GMVMI,GMVMO
+9 NEW GMVO2,GMVP,GMVPAIN,GMVPO2,GMVQ,GMVQFLAG,GMVQLOOP,GMVS,GMVSC,GMVSUP,GMVTIME,GMVU,GMVX,GMVY,GMVYR,X,Y
+10 IF $TEXT(QRYOBS^MDCLIO1)=""
SET GMVCLIO(0)=""
SET GMVCLIO(5)=""
QUIT
+11 DO QRYOBS^MDCLIO1("GMVARRAY",GMVGUID)
+12 IF '$DATA(GMVARRAY("OBSERVED_DATE_TIME"))
SET GMVCLIO(0)=""
SET GMVCLIO(5)=""
QUIT
+13 SET GMVPAIN=$$GETIEN^GMVGETVT("PN",2)
SET GMVCNT=0
+14 SET GMVPO2=$$GETIEN^GMVGETVT("PO2",2)
SET (GMVFR,GMVO2,GMVSUP)=""
+15 SET $PIECE(GMVCLIO(0),U,1)=$GET(GMVARRAY("OBSERVED_DATE_TIME","I"))
+16 SET $PIECE(GMVCLIO(0),U,2)=$GET(GMVARRAY("PATIENT_ID","I"))
+17 SET $PIECE(GMVCLIO(0),U,4)=$GET(GMVARRAY("ENTERED_DATE_TIME","I"))
+18 SET $PIECE(GMVCLIO(0),U,5)=$GET(GMVARRAY("HOSPITAL_LOCATION_ID","I"))
+19 SET $PIECE(GMVCLIO(0),U,6)=$GET(GMVARRAY("ENTERED_BY_ID","I"))
+20 SET $PIECE(GMVCLIO(0),U,8)=$GET(GMVARRAY("SVALUE","I"))
+21 SET GMVX=$GET(GMVARRAY("TERM_ID","I"))
+22 IF GMVX]""
Begin DoDot:1
+23 SET GMVX=$$GETIEN^GMVGETVT(GMVX,4)
+24 SET $PIECE(GMVCLIO(0),U,3)=GMVX
+25 QUIT
End DoDot:1
+26 ; NOTE: PAIN needs external value from CLIO
+27 IF $PIECE(GMVCLIO(0),U,3)=GMVPAIN
Begin DoDot:1
+28 SET $PIECE(GMVCLIO(0),U,8)=$GET(GMVARRAY("SVALUE","E"))
+29 QUIT
End DoDot:1
+30 SET GMVFLAG=0
+31 FOR GMVLOOP=1,2,3,8
Begin DoDot:1
+32 IF $PIECE(GMVCLIO(0),U,GMVLOOP)=""
SET GMVFLAG=1
+33 QUIT
End DoDot:1
IF GMVFLAG
QUIT
+34 IF GMVFLAG
SET GMVCLIO(0)=""
SET GMVCLIO(5)=""
QUIT
+35 ;check unit of measurement and convert value if needed
+36 IF $GET(GMVARRAY("UNIT_ID","E"))="DEGREES C"
Begin DoDot:1
+37 SET $PIECE(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($PIECE(GMVCLIO(0),U,8),"DEGREES C","DEGREES F",1)
End DoDot:1
+38 IF $GET(GMVARRAY("UNIT_ID","E"))="CENTIMETER"
Begin DoDot:1
+39 SET $PIECE(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($PIECE(GMVCLIO(0),U,8),"CENTIMETER","INCH",2)
End DoDot:1
+40 IF $GET(GMVARRAY("UNIT_ID","E"))="KILOGRAM"
Begin DoDot:1
+41 SET $PIECE(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($PIECE(GMVCLIO(0),U,8),"KILOGRAM","POUND",2)
End DoDot:1
+42 IF $GET(GMVARRAY("UNIT_ID","E"))="MILLIMETERS OF MERCURY"
Begin DoDot:1
+43 SET $PIECE(GMVCLIO(0),U,8)=+$$CVTVAL^MDTERM($PIECE(GMVCLIO(0),U,8),"MILLIMETERS OF MERCURY","CENTIMETERS H2O",1)
End DoDot:1
+44 ; entered-in-error - won't get errors from clio
+45 ;error flag
SET $PIECE(GMVCLIO(2),U,1)=""
+46 ;error entered by
SET $PIECE(GMVCLIO(2),U,2)=""
+47 ;reason entered in error
SET $PIECE(GMVCLIO(2),U,3)=""
+48 ;
+49 SET GMVCLIO(5)=""
SET GMVCNT=0
+50 SET GMVCS=$GET(GMVARRAY("CUFF_SIZE_ID","I"))
+51 IF GMVCS]""
Begin DoDot:1
+52 SET GMVCS=$$GETIEN^GMVGETQL(GMVCS,2)
+53 SET GMVCNT=GMVCNT+1
+54 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVCS
+55 QUIT
End DoDot:1
+56 SET GMVL=$GET(GMVARRAY("LOCATION_ID","I"))
+57 IF GMVL]""
Begin DoDot:1
+58 SET GMVL=$$GETIEN^GMVGETQL(GMVL,2)
+59 SET GMVCNT=GMVCNT+1
+60 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVL
+61 QUIT
End DoDot:1
+62 SET GMVM=$GET(GMVARRAY("METHOD_ID","I"))
+63 IF GMVM]""
Begin DoDot:1
+64 SET GMVM=$$GETIEN^GMVGETQL(GMVM,2)
+65 SET GMVCNT=GMVCNT+1
+66 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVM
+67 QUIT
End DoDot:1
+68 SET GMVP=$GET(GMVARRAY("POSITION_ID","I"))
+69 IF GMVP]""
Begin DoDot:1
+70 SET GMVP=$$GETIEN^GMVGETQL(GMVP,2)
+71 SET GMVCNT=GMVCNT+1
+72 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVP
+73 QUIT
End DoDot:1
+74 SET GMVS=$GET(GMVARRAY("SITE_ID","I"))
+75 IF GMVS]""
Begin DoDot:1
+76 SET GMVS=$$GETIEN^GMVGETQL(GMVS,2)
+77 SET GMVCNT=GMVCNT+1
+78 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVS
+79 QUIT
End DoDot:1
+80 SET GMVQ=$GET(GMVARRAY("QUALITY_ID","I"))
+81 IF GMVQ]""
Begin DoDot:1
+82 SET GMVQ=$$GETIEN^GMVGETQL(GMVQ,2)
+83 SET GMVCNT=GMVCNT+1
+84 SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVQ
+85 QUIT
End DoDot:1
+86 IF $PIECE(GMVCLIO(0),U,3)=GMVPO2
Begin DoDot:1
+87 SET GMVLOOP=0
+88 FOR
SET GMVLOOP=$ORDER(GMVARRAY("CONTEXT",GMVLOOP))
IF 'GMVLOOP
QUIT
Begin DoDot:2
+89 IF $GET(GMVARRAY("CONTEXT",GMVLOOP,"TERM_ID","E"))="SUPPLEMENTAL OXYGEN CONCENTRATION"
Begin DoDot:3
+90 SET GMVO2=$GET(GMVARRAY("CONTEXT",GMVLOOP,"SVALUE","E"))
End DoDot:3
+91 IF $GET(GMVARRAY("CONTEXT",GMVLOOP,"TERM_ID","E"))="SUPPLEMENTAL OXYGEN FLOW RATE"
Begin DoDot:3
+92 SET GMVFR=$GET(GMVARRAY("CONTEXT",GMVLOOP,"SVALUE","E"))
End DoDot:3
+93 SET GMVM=$GET(GMVARRAY("CONTEXT",GMVLOOP,"METHOD_ID","I"))
+94 IF GMVM]""
Begin DoDot:3
+95 SET GMVM=$$GETIEN^GMVGETQL(GMVM,2)
+96 IF 'GMVM
QUIT
+97 SET GMVQFLAG=0
+98 FOR GMVQLOOP=1:1
IF $PIECE($GET(GMVCLIO(5)),U,GMVQLOOP)=""
QUIT
IF $PIECE($GET(GMVCLIO(5)),U,GMVQLOOP)=GMVM
SET GMVQFLAG=1
QUIT
+99 IF GMVQFLAG=0
SET GMVCNT=GMVCNT+1
SET $PIECE(GMVCLIO(5),U,GMVCNT)=GMVM
End DoDot:3
End DoDot:2
End DoDot:1
+100 IF GMVO2]""
SET GMVO2=GMVO2_"%"
+101 IF GMVFR]""
SET GMVFR=GMVFR_" l/min"
+102 IF GMVFR=""
IF GMVO2=""
SET GMVSUP=""
+103 IF GMVFR'=""
IF GMVO2=""
SET GMVSUP=GMVFR
+104 IF GMVFR=""
IF GMVO2'=""
SET GMVSUP=GMVO2
+105 IF GMVFR'=""
IF GMVO2'=""
SET GMVSUP=GMVFR_" "_GMVO2
+106 SET $PIECE(GMVCLIO(0),U,10)=GMVSUP
+107 QUIT
+108 ;
F1205(GMV1205,GMVX,GMVY) ; Return file 120.5 record as nodes
+1 ; Input: GMV1205 = array name to hold nodes (required)
+2 ; GMVX = File 120.5 IEN or CliO GUID (required)
+3 ; GMVY = Return records marked as errors? (optional)
+4 ; 0 = don't return, 1 = return error records
+5 ; (default = 0)
+6 ; Output:GMV1205(0) = file 120.5 zero node
+7 ; (2) = 120.5,#2 ^ 120.5, #3 ^ 120.5, #4 delimited by
+8 ; tilde (~)
+9 ; (3) = qualifier IENS delimited by caret (^)
+10 ;
+11 NEW GMVCNT,GMVFLAG,GMVLIST,GMVLOOP,GMVNODE,GMVNODE2,GMVIEN1
+12 SET GMVX=$GET(GMVX)
SET GMVY=$GET(GMVY,0)
+13 SET (GMV1205(0),GMV1205(2),GMV1205(5))=""
+14 IF GMVX'=+GMVX
QUIT
+15 SET GMVY=$SELECT(GMVY=1:1,1:0)
+16 SET GMVNODE2=$GET(^GMR(120.5,+GMVX,2))
+17 IF GMVY=0
IF $PIECE(GMVNODE2,U,1)=1
QUIT
+18 SET GMV1205(0)=$GET(^GMR(120.5,GMVX,0))
+19 SET GMVFLAG=0
+20 FOR GMVLOOP=1,2,3,8
Begin DoDot:1
+21 IF $PIECE(GMV1205(0),U,GMVLOOP)=""
SET GMVFLAG=1
+22 QUIT
End DoDot:1
IF GMVFLAG
QUIT
+23 IF GMVFLAG
SET (GMV1205(0),GMV1205(2),GMV1205(5))=""
QUIT
+24 SET GMV1205(2)=GMVNODE2
+25 SET (GMVCNT,GMVIEN1)=0
SET GMVLIST=""
+26 FOR
SET GMVIEN1=$ORDER(^GMR(120.5,GMVX,2.1,GMVIEN1))
IF 'GMVIEN1
QUIT
Begin DoDot:1
+27 SET GMVCNT=GMVCNT+1
+28 SET $PIECE(GMVLIST,"~",GMVCNT)=+$PIECE($GET(^GMR(120.5,GMVX,2.1,GMVIEN1,0)),U,1)
+29 QUIT
End DoDot:1
+30 SET $PIECE(GMV1205(2),U,3)=GMVLIST
+31 SET (GMVCNT,GMVIEN1)=0
+32 FOR
SET GMVIEN1=$ORDER(^GMR(120.5,GMVX,5,"B",GMVIEN1))
IF 'GMVIEN1
QUIT
Begin DoDot:1
+33 SET GMVCNT=GMVCNT+1
+34 SET $PIECE(GMV1205(5),U,GMVCNT)=GMVIEN1
+35 QUIT
End DoDot:1
+36 QUIT
+37 ;
GETREC(GMVARRAY,GMVID,GMVERR) ; Checks CLIO and Vitals databases. Returns
+1 ; record as nodes with internal values.
+2 ; Input: GMVARRAY = array name passed by reference (required)
+3 ; GMVID = File 120.5 IEN or CliO GUID (required)
+4 ; GMVERR = Return records marked as errors? (optional)
+5 ; 0 = don't return, 1 = return error records
+6 ; (default = 0)
+7 ; Output:GMVARRAY(0) = same as File 120.5 zero node
+8 ; (2) = 120.5, #2 ^ 120.5, #3 ^ 120.5, #4 delimited by
+9 ; tilde (~)
+10 ; (3) = qualifier IENS (File 120.52) delimited by caret (^)
+11 ;
+12 ; example:
+13 ; >D GETREC^GMVUTL(.RESULT,12196,0) ZW RESULT
+14 ; RESULT(0)="3080108.093626^217^21^3080108.0937^67^4658^^4^^1.0 l/min 22%"
+15 ; RESULT(2)="^^"
+16 ; RESULT(5)=134
+17 ;
+18 SET GMVID=$GET(GMVID)
SET GMVERR=$GET(GMVERR)
+19 IF GMVID=""
QUIT
+20 SET GMVERR=$SELECT(GMVERR=1:1,1:0)
+21 IF GMVID=+GMVID
Begin DoDot:1
+22 DO F1205(.GMVARRAY,GMVID,GMVERR)
+23 QUIT
End DoDot:1
QUIT
+24 IF GMVID'=+GMVID
Begin DoDot:1
+25 DO CLIO(.GMVARRAY,GMVID)
+26 QUIT
End DoDot:1
QUIT
+27 QUIT
QRYDATE(RESULT,SDATE,EDATE) ; Returns a list of GUIDs found in the
+1 ; Clinical Observations package for the date range specified
+2 ; Input: RESULT = array name surrounded by quotes (required)
+3 ; ex: "ARRAY", "^TMP($J)"
+4 ; SDATE = start date of search range in FileMan internal
+5 ; format (optional)
+6 ; default is T-24 hours
+7 ; EDATE = end date in FileMan internal format (optional)
+8 ; default is current date/time
+9 ; Output: RESULT(0)=number of entries returned
+10 ; or "-1^error message"
+11 ; RESULT(n)=Global Unique ID (aka GUID)
+12 ; where n is a sequential number starting with 1
+13 ;
+14 ; example:
+15 ; >D QRYDATE^GMVUTL("ARRAY",3070301,3070401)
+16 ; >ZW ARRAY
+17 ; ARRAY(0)=3
+18 ; ARRAY(1)="{FD0FEBBC-8EC1-42E4-9483-4BDBE6370728}"
+19 ; ARRAY(2)="{A7C7FFEB-0CD5-4D55-BB34-35B9620F4ECC}"
+20 ; ARRAY(3)="{D0CEA9D2-A519-41C2-A4AE-9C24C7498E56}"
+21 ;
+22 IF $TEXT(QRYDATE^MDCLIO1)=""
Begin DoDot:1
+23 SET @RESULT@(0)="-1^QRYDATE entry point not found in MDCLIO1"
+24 QUIT
End DoDot:1
QUIT
+25 KILL ^TMP($JOB),@RESULT
+26 SET SDATE=$GET(SDATE,$$FMADD^XLFDT($$NOW^XLFDT(),,-24))
+27 SET EDATE=$GET(EDATE,$$NOW^XLFDT())
+28 IF SDATE>EDATE
Begin DoDot:1
+29 SET @RESULT@(0)="-1^Start Date is after end date"
+30 QUIT
End DoDot:1
QUIT
+31 DO QRYDATE^MDCLIO1(RESULT,SDATE,EDATE)
+32 QUIT