GMVPXRM ;HIOFO/FT-API to return FILE 120.5 data ;01/20/09 13:11
;;5.0;GEN. MED. REC. - VITALS;**6,23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #4113 - ^PXRMSXRM routine (controlled)
; #4114 - ^PXRMINDX global (controlled)
; #5076 - ^MDCLIO1 calls (private)
; #10103 - ^XLFDT calls (supported)
; #10040 - FILE 44 references (supported)
; #10141 - ^XPDUTL calls (supported)
;
; Entry point(s) available for use by other packages:
; EN is documented in IA #3647
; VITALS is documented in IA #3647
;
EN(GMVDATA,GMVIEN,GMVIB) ; Returns data for a single FILE 120.5 entry.
; Input:
; GMVDATA = Array name passed by reference (required)
; GMVIEN = IEN for FILE 120.5 or GUID for FILE 704.117 (required)
; GMVIB = "I" for Internal value only
; "B" for Internal and External values (default = B)
;
; If GMVIB = "I", then
; Output = GMVDATA(n)=internal value
;
; If GMVIB = "B", then
; Output: GMVDATA(n)=internal value^external value
;
; where:
; GMVDATA(1)=.01 (DATE/TIME VITALS TAKEN)
; GMVDATA(2)=.02 (PATIENT)
; GMVDATA(3)=.03 (VITAL TYPE)
; GMVDATA(4)=.04 (DATE/TIME VITALS ENTERED)
; GMVDATA(5)=.05 (HOSPITAL LOCATION)
; GMVDATA(6)=.06 (ENTERED BY)
; GMVDATA(7)=1.2 (RATE)
; GMVDATA(8)=1.4 (SUPPLEMENTAL O2)
; GMVDATA(9)=2 (ENTERED IN ERROR)
; GMVDATA(10)=3 (ERROR ENTERED BY)
; GMVDATA(11,n)=4 (REASON ENTERED IN ERROR) <--multiple
; GMVDATA(12,n)=5 (QUALIFIER) <--multiple
;
; If the lookup failed then: GMVDATA(1)=-1^error text
;
N GMVCNT,GMVIEN1,GMVLIST,GMVLEN,GMVLOOP,GMVTEMP,TEMP,TEMP2,TEMP5,TP,EM
I $G(GMVIB)'="I",$G(GMVIB)'="B" S GMVIB="B"
I $G(GMVIEN)="" S GMVDATA(1)="-1^Record Number is Null" Q
I GMVIEN=+GMVIEN D
.D F1205^GMVUTL(.GMVTEMP,GMVIEN,1)
.S TEMP=$G(GMVTEMP(0))
.S TEMP2=$G(GMVTEMP(2))
.S TEMP5=$G(GMVTEMP(5))
.Q
I GMVIEN'=+GMVIEN D
.D CLIO^GMVUTL(.GMVTEMP,GMVIEN)
.S TEMP=$G(GMVTEMP(0))
.S TEMP2=$G(GMVTEMP(2))
.S TEMP5=$G(GMVTEMP(5))
.Q
I TEMP="" D Q
.S GMVDATA(1)="-1^The entry does not exist"
.Q
;
S GMVDATA(1)=$P(TEMP,U,1)
S GMVDATA(2)=$P(TEMP,U,2)
S GMVDATA(3)=$P(TEMP,U,3)
S GMVDATA(4)=$P(TEMP,U,4)
S GMVDATA(5)=$P(TEMP,U,5)
I '$D(^SC(+GMVDATA(5),0)) S GMVDATA(5)=0
S GMVDATA(6)=$P(TEMP,U,6)
S GMVDATA(7)=$P(TEMP,U,8)
S GMVDATA(8)=$P(TEMP,U,10)
S GMVDATA(9)=$P(TEMP2,U,1)
S GMVDATA(10)=$P(TEMP2,U,2)
S GMVCNT=0
S GMVLIST=$P(TEMP2,U,3)
S GMVLEN=$L(GMVLIST,"~")
F GMVCNT=1:1:GMVLEN D
.S GMVDATA(11,GMVCNT)=$P(GMVLIST,"~",GMVCNT)
.Q
I GMVCNT=0 S GMVDATA(11,1)=""
S GMVLIST=$G(TEMP5),GMVCNT=0
F GMVLOOP=1:1 Q:$P(GMVLIST,U,GMVLOOP)="" D
.S GMVCNT=GMVCNT+1
.S GMVDATA(12,GMVCNT)=$P(GMVLIST,U,GMVLOOP)
.Q
I GMVCNT=0 S GMVDATA(12,1)=""
;
Q:GMVIB="I"
;
S GMVDATA(1)=$P(GMVDATA(1),U,1)_U_$$EXTERNAL^DILFD(120.5,.01,"",$P(GMVDATA(1),U,1),.EM)
S GMVDATA(2)=$P(GMVDATA(2),U,1)_U_$$EXTERNAL^DILFD(120.5,.02,"",$P(GMVDATA(2),U,1),.EM)
S GMVDATA(3)=$P(GMVDATA(3),U,1)_U_$$EXTERNAL^DILFD(120.5,.03,"",$P(GMVDATA(3),U,1),.EM)
S GMVDATA(4)=$P(GMVDATA(4),U,1)_U_$$EXTERNAL^DILFD(120.5,.04,"",$P(GMVDATA(4),U,1),.EM)
S GMVDATA(5)=$P(GMVDATA(5),U,1)_U_$$EXTERNAL^DILFD(120.5,.05,"",$P(GMVDATA(5),U,1),.EM)
S GMVDATA(6)=$P(GMVDATA(6),U,1)_U_$$EXTERNAL^DILFD(120.5,.06,"",$P(GMVDATA(6),U,1),.EM)
S GMVDATA(7)=$P(GMVDATA(7),U,1)_U_$P(GMVDATA(7),U,1) ;same
S GMVDATA(8)=$P(GMVDATA(8),U,1)_U_$P(GMVDATA(8),U,1) ;same
S GMVDATA(9)=$P(GMVDATA(9),U,1)_U_$$EXTERNAL^DILFD(120.5,2,"",$P(GMVDATA(9),U,1),.EM)
S GMVDATA(10)=$P(GMVDATA(10),U,1)_U_$$EXTERNAL^DILFD(120.5,3,"",$P(GMVDATA(10),U,1),.EM)
;
;loop through entered-in-error reason multiple
S (GMVCNT,GMVIEN1)=0
F S GMVIEN1=$O(GMVDATA(11,GMVIEN1)) Q:'GMVIEN1 D
.S TP=+$P(GMVDATA(11,GMVIEN1),U,1)
.Q:'TP
.S GMVDATA(11,GMVIEN1)=TP_U_$$EXTERNAL^DILFD(120.506,.01,"",TP,.EM)
.S GMVCNT=1
.Q
I GMVCNT=0 S GMVDATA(11,1)="^"
;loop through qualifier multiple
S (GMVCNT,GMVIEN1)=0
F S GMVIEN1=$O(GMVDATA(12,GMVIEN1)) Q:'GMVIEN1 D
.S TP=+$P(GMVDATA(12,GMVIEN1),U,1)
.Q:'TP
.S GMVDATA(12,GMVIEN1)=TP_U_$P($G(^GMRD(120.52,+TP,0)),U,1)
.S GMVCNT=1
.Q
I GMVCNT=0 S GMVDATA(12,1)="^"
Q
;
VITALS ; This entry point is for use by the Clinical Reminders package
; to re-index the ACR cross-reference nodes for FILE 120.5.
;
; a) This entry point kills the ACR cross-reference nodes for ^PXRMINDX(120.5).
; b) Re-builds the ACR cross-reference nodes.
; c) Calls the Clinical Reminders package to generate a mail message
; summarizing the rebuilding of the ACR cross-reference.
;
N DAS,DATE,DFN,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NE1,NE2,NERROR
N START,TEMP,TENP,TEXT,VT,GMVCLIO,GMVTYPE,GMVLOOP,GMVIEN
S GLOBAL=$$GET1^DID(120.5,"","","GLOBAL NAME")
; Don't leave any old cross-reference nodes around.
K ^PXRMINDX(120.5)
S ENTRIES=$P(^GMR(120.5,0),U,4)
S TENP=ENTRIES/10
S TENP=+$P(TENP,".",1)
D BMES^XPDUTL("Building index for VITALS DATA.")
;S TEXT="There are "_ENTRIES_" entries to process."
;D MES^XPDUTL(TEXT)
S START=$H
S (DAS,IND,NE,NE1,NE2,NERROR)=0
F S DAS=+$O(^GMR(120.5,DAS)) Q:DAS=0 D
. S IND=IND+1
. I IND#TENP=0 D
.. S TEXT="Processing entry "_IND
.. D MES^XPDUTL(TEXT)
. I IND#10000=0 W "."
. S TEMP=^GMR(120.5,DAS,0)
. I $P(TEMP,U,1)'?7N1"."1.6N S NE1=NE1+1 Q
. I $P(TEMP,U,2)'>0 S NE1=NE1+1 Q
. I $P(TEMP,U,3)'>0 S NE1=NE1+1 Q
. S DATE=$P(TEMP,U,1),DFN=$P(TEMP,U,2),VT=$P(TEMP,U,3)
.;If this entry is marked as entered-in-error do not index it.
. I $P($G(^GMR(120.5,DAS,2)),U,1) S NE2=NE2+1 Q
. S ^PXRMINDX(120.5,"IP",VT,DFN,DATE,DAS)=""
. S ^PXRMINDX(120.5,"PI",DFN,VT,DATE,DAS)=""
. S NE=NE+1
. Q
; Get vital type iens
F GMVLOOP="BP","CG","CVP","HT","P","PN","PO2","R","T","WT" D
.S GMVIEN=$O(^GMRD(120.51,"C",GMVLOOP,0))
.Q:'GMVIEN
.S GMVTYPE(GMVIEN)=""
.Q
K ^TMP($J)
; get records from Clinical Observations
I $T(QRYDATE^MDCLIO1)]"" D
.D QRYDATE^MDCLIO1("^TMP($J)",3070101,$$FMADD^XLFDT($$NOW^XLFDT(),,24))
.S GMVLOOP=0
.F S GMVLOOP=$O(^TMP($J,GMVLOOP)) Q:'GMVLOOP D
..S DAS=^TMP($J,GMVLOOP)
..Q:DAS=""
..D CLIO^GMVUTL(.GMVCLIO,DAS)
..S GMVCLIO(0)=$G(GMVCLIO(0))
..I GMVCLIO(0)="" S NE1=NE1+1 Q
..I $P(GMVCLIO(0),U,1)'?7N1"."1.6N S NE1=NE1+1 Q
..I $P(GMVCLIO(0),U,2)'>0 S NE1=NE1+1 Q
..I $P(GMVCLIO(0),U,3)'>0 S NE1=NE1+1 Q
..I '$D(GMVTYPE($P(GMVCLIO(0),U,3))) Q ;not a vitals entry
..S DATE=$P(GMVCLIO(0),U,1),DFN=$P(GMVCLIO(0),U,2),VT=$P(GMVCLIO(0),U,3)
..S ^PXRMINDX(120.5,"IP",VT,DFN,DATE,DAS)=""
..S ^PXRMINDX(120.5,"PI",DFN,VT,DATE,DAS)=""
..S NE=NE+1
..Q
.Q
S END=$H
S TEXT=" VITAL MEASUREMENTS entries indexed: "_NE
D BMES^XPDUTL(TEXT)
S TEXT=" Bad entries not indexed: "_NE1
D MES^XPDUTL(TEXT)
S TEXT="Entered-in-Error entries not indexed: "_NE2
D MES^XPDUTL(TEXT)
S TEXT=" "
D MES^XPDUTL(TEXT)
D DETIME^PXRMSXRM(START,END)
;Send a MailMan message with the results.
D COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
S ^PXRMINDX(120.5,"GLOBAL NAME")=$$GET1^DID(120.5,"","","GLOBAL NAME")
S ^PXRMINDX(120.5,"BUILT BY")=DUZ
S ^PXRMINDX(120.5,"DATE BUILT")=$$NOW^XLFDT
Q
;
SVITAL(X,DA) ; Set ACR index entry
; X(1)=DATE/TIME, X(2)=DFN, X(3)=VITAL TYPE, X(4)=ENTERED IN ERROR
; Do not index entries that are marked as entered-in-error.
I $G(X(4)) Q
S ^PXRMINDX(120.5,"IP",X(3),X(2),X(1),DA)=""
S ^PXRMINDX(120.5,"PI",X(2),X(3),X(1),DA)=""
Q
;
KVITAL(X,DA) ; Delete ACR index entry
K ^PXRMINDX(120.5,"IP",X(3),X(2),X(1),DA)
K ^PXRMINDX(120.5,"PI",X(2),X(3),X(1),DA)
Q
GMVPXRM ;HIOFO/FT-API to return FILE 120.5 data ;01/20/09 13:11
+1 ;;5.0;GEN. MED. REC. - VITALS;**6,23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #4113 - ^PXRMSXRM routine (controlled)
+5 ; #4114 - ^PXRMINDX global (controlled)
+6 ; #5076 - ^MDCLIO1 calls (private)
+7 ; #10103 - ^XLFDT calls (supported)
+8 ; #10040 - FILE 44 references (supported)
+9 ; #10141 - ^XPDUTL calls (supported)
+10 ;
+11 ; Entry point(s) available for use by other packages:
+12 ; EN is documented in IA #3647
+13 ; VITALS is documented in IA #3647
+14 ;
EN(GMVDATA,GMVIEN,GMVIB) ; Returns data for a single FILE 120.5 entry.
+1 ; Input:
+2 ; GMVDATA = Array name passed by reference (required)
+3 ; GMVIEN = IEN for FILE 120.5 or GUID for FILE 704.117 (required)
+4 ; GMVIB = "I" for Internal value only
+5 ; "B" for Internal and External values (default = B)
+6 ;
+7 ; If GMVIB = "I", then
+8 ; Output = GMVDATA(n)=internal value
+9 ;
+10 ; If GMVIB = "B", then
+11 ; Output: GMVDATA(n)=internal value^external value
+12 ;
+13 ; where:
+14 ; GMVDATA(1)=.01 (DATE/TIME VITALS TAKEN)
+15 ; GMVDATA(2)=.02 (PATIENT)
+16 ; GMVDATA(3)=.03 (VITAL TYPE)
+17 ; GMVDATA(4)=.04 (DATE/TIME VITALS ENTERED)
+18 ; GMVDATA(5)=.05 (HOSPITAL LOCATION)
+19 ; GMVDATA(6)=.06 (ENTERED BY)
+20 ; GMVDATA(7)=1.2 (RATE)
+21 ; GMVDATA(8)=1.4 (SUPPLEMENTAL O2)
+22 ; GMVDATA(9)=2 (ENTERED IN ERROR)
+23 ; GMVDATA(10)=3 (ERROR ENTERED BY)
+24 ; GMVDATA(11,n)=4 (REASON ENTERED IN ERROR) <--multiple
+25 ; GMVDATA(12,n)=5 (QUALIFIER) <--multiple
+26 ;
+27 ; If the lookup failed then: GMVDATA(1)=-1^error text
+28 ;
+29 NEW GMVCNT,GMVIEN1,GMVLIST,GMVLEN,GMVLOOP,GMVTEMP,TEMP,TEMP2,TEMP5,TP,EM
+30 IF $GET(GMVIB)'="I"
IF $GET(GMVIB)'="B"
SET GMVIB="B"
+31 IF $GET(GMVIEN)=""
SET GMVDATA(1)="-1^Record Number is Null"
QUIT
+32 IF GMVIEN=+GMVIEN
Begin DoDot:1
+33 DO F1205^GMVUTL(.GMVTEMP,GMVIEN,1)
+34 SET TEMP=$GET(GMVTEMP(0))
+35 SET TEMP2=$GET(GMVTEMP(2))
+36 SET TEMP5=$GET(GMVTEMP(5))
+37 QUIT
End DoDot:1
+38 IF GMVIEN'=+GMVIEN
Begin DoDot:1
+39 DO CLIO^GMVUTL(.GMVTEMP,GMVIEN)
+40 SET TEMP=$GET(GMVTEMP(0))
+41 SET TEMP2=$GET(GMVTEMP(2))
+42 SET TEMP5=$GET(GMVTEMP(5))
+43 QUIT
End DoDot:1
+44 IF TEMP=""
Begin DoDot:1
+45 SET GMVDATA(1)="-1^The entry does not exist"
+46 QUIT
End DoDot:1
QUIT
+47 ;
+48 SET GMVDATA(1)=$PIECE(TEMP,U,1)
+49 SET GMVDATA(2)=$PIECE(TEMP,U,2)
+50 SET GMVDATA(3)=$PIECE(TEMP,U,3)
+51 SET GMVDATA(4)=$PIECE(TEMP,U,4)
+52 SET GMVDATA(5)=$PIECE(TEMP,U,5)
+53 IF '$DATA(^SC(+GMVDATA(5),0))
SET GMVDATA(5)=0
+54 SET GMVDATA(6)=$PIECE(TEMP,U,6)
+55 SET GMVDATA(7)=$PIECE(TEMP,U,8)
+56 SET GMVDATA(8)=$PIECE(TEMP,U,10)
+57 SET GMVDATA(9)=$PIECE(TEMP2,U,1)
+58 SET GMVDATA(10)=$PIECE(TEMP2,U,2)
+59 SET GMVCNT=0
+60 SET GMVLIST=$PIECE(TEMP2,U,3)
+61 SET GMVLEN=$LENGTH(GMVLIST,"~")
+62 FOR GMVCNT=1:1:GMVLEN
Begin DoDot:1
+63 SET GMVDATA(11,GMVCNT)=$PIECE(GMVLIST,"~",GMVCNT)
+64 QUIT
End DoDot:1
+65 IF GMVCNT=0
SET GMVDATA(11,1)=""
+66 SET GMVLIST=$GET(TEMP5)
SET GMVCNT=0
+67 FOR GMVLOOP=1:1
IF $PIECE(GMVLIST,U,GMVLOOP)=""
QUIT
Begin DoDot:1
+68 SET GMVCNT=GMVCNT+1
+69 SET GMVDATA(12,GMVCNT)=$PIECE(GMVLIST,U,GMVLOOP)
+70 QUIT
End DoDot:1
+71 IF GMVCNT=0
SET GMVDATA(12,1)=""
+72 ;
+73 IF GMVIB="I"
QUIT
+74 ;
+75 SET GMVDATA(1)=$PIECE(GMVDATA(1),U,1)_U_$$EXTERNAL^DILFD(120.5,.01,"",$PIECE(GMVDATA(1),U,1),.EM)
+76 SET GMVDATA(2)=$PIECE(GMVDATA(2),U,1)_U_$$EXTERNAL^DILFD(120.5,.02,"",$PIECE(GMVDATA(2),U,1),.EM)
+77 SET GMVDATA(3)=$PIECE(GMVDATA(3),U,1)_U_$$EXTERNAL^DILFD(120.5,.03,"",$PIECE(GMVDATA(3),U,1),.EM)
+78 SET GMVDATA(4)=$PIECE(GMVDATA(4),U,1)_U_$$EXTERNAL^DILFD(120.5,.04,"",$PIECE(GMVDATA(4),U,1),.EM)
+79 SET GMVDATA(5)=$PIECE(GMVDATA(5),U,1)_U_$$EXTERNAL^DILFD(120.5,.05,"",$PIECE(GMVDATA(5),U,1),.EM)
+80 SET GMVDATA(6)=$PIECE(GMVDATA(6),U,1)_U_$$EXTERNAL^DILFD(120.5,.06,"",$PIECE(GMVDATA(6),U,1),.EM)
+81 ;same
SET GMVDATA(7)=$PIECE(GMVDATA(7),U,1)_U_$PIECE(GMVDATA(7),U,1)
+82 ;same
SET GMVDATA(8)=$PIECE(GMVDATA(8),U,1)_U_$PIECE(GMVDATA(8),U,1)
+83 SET GMVDATA(9)=$PIECE(GMVDATA(9),U,1)_U_$$EXTERNAL^DILFD(120.5,2,"",$PIECE(GMVDATA(9),U,1),.EM)
+84 SET GMVDATA(10)=$PIECE(GMVDATA(10),U,1)_U_$$EXTERNAL^DILFD(120.5,3,"",$PIECE(GMVDATA(10),U,1),.EM)
+85 ;
+86 ;loop through entered-in-error reason multiple
+87 SET (GMVCNT,GMVIEN1)=0
+88 FOR
SET GMVIEN1=$ORDER(GMVDATA(11,GMVIEN1))
IF 'GMVIEN1
QUIT
Begin DoDot:1
+89 SET TP=+$PIECE(GMVDATA(11,GMVIEN1),U,1)
+90 IF 'TP
QUIT
+91 SET GMVDATA(11,GMVIEN1)=TP_U_$$EXTERNAL^DILFD(120.506,.01,"",TP,.EM)
+92 SET GMVCNT=1
+93 QUIT
End DoDot:1
+94 IF GMVCNT=0
SET GMVDATA(11,1)="^"
+95 ;loop through qualifier multiple
+96 SET (GMVCNT,GMVIEN1)=0
+97 FOR
SET GMVIEN1=$ORDER(GMVDATA(12,GMVIEN1))
IF 'GMVIEN1
QUIT
Begin DoDot:1
+98 SET TP=+$PIECE(GMVDATA(12,GMVIEN1),U,1)
+99 IF 'TP
QUIT
+100 SET GMVDATA(12,GMVIEN1)=TP_U_$PIECE($GET(^GMRD(120.52,+TP,0)),U,1)
+101 SET GMVCNT=1
+102 QUIT
End DoDot:1
+103 IF GMVCNT=0
SET GMVDATA(12,1)="^"
+104 QUIT
+105 ;
VITALS ; This entry point is for use by the Clinical Reminders package
+1 ; to re-index the ACR cross-reference nodes for FILE 120.5.
+2 ;
+3 ; a) This entry point kills the ACR cross-reference nodes for ^PXRMINDX(120.5).
+4 ; b) Re-builds the ACR cross-reference nodes.
+5 ; c) Calls the Clinical Reminders package to generate a mail message
+6 ; summarizing the rebuilding of the ACR cross-reference.
+7 ;
+8 NEW DAS,DATE,DFN,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NE1,NE2,NERROR
+9 NEW START,TEMP,TENP,TEXT,VT,GMVCLIO,GMVTYPE,GMVLOOP,GMVIEN
+10 SET GLOBAL=$$GET1^DID(120.5,"","","GLOBAL NAME")
+11 ; Don't leave any old cross-reference nodes around.
+12 KILL ^PXRMINDX(120.5)
+13 SET ENTRIES=$PIECE(^GMR(120.5,0),U,4)
+14 SET TENP=ENTRIES/10
+15 SET TENP=+$PIECE(TENP,".",1)
+16 DO BMES^XPDUTL("Building index for VITALS DATA.")
+17 ;S TEXT="There are "_ENTRIES_" entries to process."
+18 ;D MES^XPDUTL(TEXT)
+19 SET START=$HOROLOG
+20 SET (DAS,IND,NE,NE1,NE2,NERROR)=0
+21 FOR
SET DAS=+$ORDER(^GMR(120.5,DAS))
IF DAS=0
QUIT
Begin DoDot:1
+22 SET IND=IND+1
+23 IF IND#TENP=0
Begin DoDot:2
+24 SET TEXT="Processing entry "_IND
+25 DO MES^XPDUTL(TEXT)
End DoDot:2
+26 IF IND#10000=0
WRITE "."
+27 SET TEMP=^GMR(120.5,DAS,0)
+28 IF $PIECE(TEMP,U,1)'?7N1"."1.6N
SET NE1=NE1+1
QUIT
+29 IF $PIECE(TEMP,U,2)'>0
SET NE1=NE1+1
QUIT
+30 IF $PIECE(TEMP,U,3)'>0
SET NE1=NE1+1
QUIT
+31 SET DATE=$PIECE(TEMP,U,1)
SET DFN=$PIECE(TEMP,U,2)
SET VT=$PIECE(TEMP,U,3)
+32 ;If this entry is marked as entered-in-error do not index it.
+33 IF $PIECE($GET(^GMR(120.5,DAS,2)),U,1)
SET NE2=NE2+1
QUIT
+34 SET ^PXRMINDX(120.5,"IP",VT,DFN,DATE,DAS)=""
+35 SET ^PXRMINDX(120.5,"PI",DFN,VT,DATE,DAS)=""
+36 SET NE=NE+1
+37 QUIT
End DoDot:1
+38 ; Get vital type iens
+39 FOR GMVLOOP="BP","CG","CVP","HT","P","PN","PO2","R","T","WT"
Begin DoDot:1
+40 SET GMVIEN=$ORDER(^GMRD(120.51,"C",GMVLOOP,0))
+41 IF 'GMVIEN
QUIT
+42 SET GMVTYPE(GMVIEN)=""
+43 QUIT
End DoDot:1
+44 KILL ^TMP($JOB)
+45 ; get records from Clinical Observations
+46 IF $TEXT(QRYDATE^MDCLIO1)]""
Begin DoDot:1
+47 DO QRYDATE^MDCLIO1("^TMP($J)",3070101,$$FMADD^XLFDT($$NOW^XLFDT(),,24))
+48 SET GMVLOOP=0
+49 FOR
SET GMVLOOP=$ORDER(^TMP($JOB,GMVLOOP))
IF 'GMVLOOP
QUIT
Begin DoDot:2
+50 SET DAS=^TMP($JOB,GMVLOOP)
+51 IF DAS=""
QUIT
+52 DO CLIO^GMVUTL(.GMVCLIO,DAS)
+53 SET GMVCLIO(0)=$GET(GMVCLIO(0))
+54 IF GMVCLIO(0)=""
SET NE1=NE1+1
QUIT
+55 IF $PIECE(GMVCLIO(0),U,1)'?7N1"."1.6N
SET NE1=NE1+1
QUIT
+56 IF $PIECE(GMVCLIO(0),U,2)'>0
SET NE1=NE1+1
QUIT
+57 IF $PIECE(GMVCLIO(0),U,3)'>0
SET NE1=NE1+1
QUIT
+58 ;not a vitals entry
IF '$DATA(GMVTYPE($PIECE(GMVCLIO(0),U,3)))
QUIT
+59 SET DATE=$PIECE(GMVCLIO(0),U,1)
SET DFN=$PIECE(GMVCLIO(0),U,2)
SET VT=$PIECE(GMVCLIO(0),U,3)
+60 SET ^PXRMINDX(120.5,"IP",VT,DFN,DATE,DAS)=""
+61 SET ^PXRMINDX(120.5,"PI",DFN,VT,DATE,DAS)=""
+62 SET NE=NE+1
+63 QUIT
End DoDot:2
+64 QUIT
End DoDot:1
+65 SET END=$HOROLOG
+66 SET TEXT=" VITAL MEASUREMENTS entries indexed: "_NE
+67 DO BMES^XPDUTL(TEXT)
+68 SET TEXT=" Bad entries not indexed: "_NE1
+69 DO MES^XPDUTL(TEXT)
+70 SET TEXT="Entered-in-Error entries not indexed: "_NE2
+71 DO MES^XPDUTL(TEXT)
+72 SET TEXT=" "
+73 DO MES^XPDUTL(TEXT)
+74 DO DETIME^PXRMSXRM(START,END)
+75 ;Send a MailMan message with the results.
+76 DO COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
+77 SET ^PXRMINDX(120.5,"GLOBAL NAME")=$$GET1^DID(120.5,"","","GLOBAL NAME")
+78 SET ^PXRMINDX(120.5,"BUILT BY")=DUZ
+79 SET ^PXRMINDX(120.5,"DATE BUILT")=$$NOW^XLFDT
+80 QUIT
+81 ;
SVITAL(X,DA) ; Set ACR index entry
+1 ; X(1)=DATE/TIME, X(2)=DFN, X(3)=VITAL TYPE, X(4)=ENTERED IN ERROR
+2 ; Do not index entries that are marked as entered-in-error.
+3 IF $GET(X(4))
QUIT
+4 SET ^PXRMINDX(120.5,"IP",X(3),X(2),X(1),DA)=""
+5 SET ^PXRMINDX(120.5,"PI",X(2),X(3),X(1),DA)=""
+6 QUIT
+7 ;
KVITAL(X,DA) ; Delete ACR index entry
+1 KILL ^PXRMINDX(120.5,"IP",X(3),X(2),X(1),DA)
+2 KILL ^PXRMINDX(120.5,"PI",X(2),X(3),X(1),DA)
+3 QUIT