GMVGETQ ;HOIFO/YH,FT-UTILITIES TO OBTAIN DATE/TIME, HOSPITAL, DUZ, VITAL CATEGORY AND EDIT V/M ;9/6/02 09:35
;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
;
; This routine uses the following IAs:
; #10103 - ^XLFDT calls (supported)
;
; This routine supports the following IAs:
; #4353 - GMV CONVERT DATE RPC is called at GETDT (private)
;
GETDT(RESULT,GMRDATE) ;GMV CONVERT DATE [RPC entry point]
;INPUT VARIABLE:
;GMRDATE - DATE/TIME FROM EDIT.TEXT ENTERED BY USER
;OUTPUT VARIABLE:
;RESULT - CONTAINS INTERNAL AND EXTERNAL DATE/TIME
N GDATE D DT^DILF("ETS",GMRDATE,.GDATE)
I $G(GDATE)'>0 S RESULT="" Q
I $G(GDATE)>$$NOW^XLFDT S RESULT="" Q
S RESULT=$G(GDATE)_"^"_$G(GDATE(0))
Q
;
ADDQUAL(RESULT,GMRVDATA) ; Add qualifiers to FILE 120.5 entry
; ADD QUALIFIER TO 120.505 SUBFILE
; Input:
; GMRVDATA=120.5 IEN^QUALIFIER (120.52) IEN
; Output:
; RESULT = "" or the IEN of the subfile entry
;
N GMVCNT,GMVERR,GMVFDA,GMVOKAY,GMRVIEN,GMRVQUAL
S GMRVIEN=+$P(GMRVDATA,"^",1) ;File 120.5 ien
S GMRVQUAL=+$P(GMRVDATA,"^",2) ;File 120.52 ien
; Does File 120.5 entry exist?
I '$D(^GMR(120.5,GMRVIEN,0)) D Q
.S RESULT=""
.;or S RESULT="-1^Vitals entry not found."
.Q
; Is the qualifier already stored?
I $O(^GMR(120.5,GMRVIEN,5,"B",GMRVQUAL,0))>0 D Q
.S RESULT=""
.;or S RESULT="-1^Qualifier already filed. No change made."
.Q
; Legitimate Qualifier?
I '$D(^GMRD(120.52,GMRVQUAL,0)) D Q
.S RESULT=""
.; or S RESULT="-1^"_$P(GMRVDATA,U,2)_" is not a legitimate qualifier"
.Q
S GMVCNT=0 ;counter for number of tries to lock an entry
B2 ; Lock the entry
I GMVCNT>3 D Q ;4 strikes and you're out
.S RESULT=""
.;or S RESULT="-1^Could not lock entry to file qualifiers."
.L -^GMR(120.5,GMRVIEN,0)
.Q
L +^GMR(120.5,GMRVIEN,0):1
S GMVCNT=GMVCNT+1
I '$T L -^GMR(120.5,GMRVIEN,0) G B2
; Store the qualifier
S GMVFDA(120.505,"+1,"_GMRVIEN_",",.01)=GMRVQUAL
D UPDATE^DIE("","GMVFDA","GMVOKAY","GMVERR")
L -^GMR(120.5,GMRVIEN,0)
I $D(GMVERR) S RESULT="" ; or S RESULT="-1^*fileman error message*"
E S RESULT=+$G(GMVOKAY(1))
Q
GMVGETQ ;HOIFO/YH,FT-UTILITIES TO OBTAIN DATE/TIME, HOSPITAL, DUZ, VITAL CATEGORY AND EDIT V/M ;9/6/02 09:35
+1 ;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #10103 - ^XLFDT calls (supported)
+5 ;
+6 ; This routine supports the following IAs:
+7 ; #4353 - GMV CONVERT DATE RPC is called at GETDT (private)
+8 ;
GETDT(RESULT,GMRDATE) ;GMV CONVERT DATE [RPC entry point]
+1 ;INPUT VARIABLE:
+2 ;GMRDATE - DATE/TIME FROM EDIT.TEXT ENTERED BY USER
+3 ;OUTPUT VARIABLE:
+4 ;RESULT - CONTAINS INTERNAL AND EXTERNAL DATE/TIME
+5 NEW GDATE
DO DT^DILF("ETS",GMRDATE,.GDATE)
+6 IF $GET(GDATE)'>0
SET RESULT=""
QUIT
+7 IF $GET(GDATE)>$$NOW^XLFDT
SET RESULT=""
QUIT
+8 SET RESULT=$GET(GDATE)_"^"_$GET(GDATE(0))
+9 QUIT
+10 ;
ADDQUAL(RESULT,GMRVDATA) ; Add qualifiers to FILE 120.5 entry
+1 ; ADD QUALIFIER TO 120.505 SUBFILE
+2 ; Input:
+3 ; GMRVDATA=120.5 IEN^QUALIFIER (120.52) IEN
+4 ; Output:
+5 ; RESULT = "" or the IEN of the subfile entry
+6 ;
+7 NEW GMVCNT,GMVERR,GMVFDA,GMVOKAY,GMRVIEN,GMRVQUAL
+8 ;File 120.5 ien
SET GMRVIEN=+$PIECE(GMRVDATA,"^",1)
+9 ;File 120.52 ien
SET GMRVQUAL=+$PIECE(GMRVDATA,"^",2)
+10 ; Does File 120.5 entry exist?
+11 IF '$DATA(^GMR(120.5,GMRVIEN,0))
Begin DoDot:1
+12 SET RESULT=""
+13 ;or S RESULT="-1^Vitals entry not found."
+14 QUIT
End DoDot:1
QUIT
+15 ; Is the qualifier already stored?
+16 IF $ORDER(^GMR(120.5,GMRVIEN,5,"B",GMRVQUAL,0))>0
Begin DoDot:1
+17 SET RESULT=""
+18 ;or S RESULT="-1^Qualifier already filed. No change made."
+19 QUIT
End DoDot:1
QUIT
+20 ; Legitimate Qualifier?
+21 IF '$DATA(^GMRD(120.52,GMRVQUAL,0))
Begin DoDot:1
+22 SET RESULT=""
+23 ; or S RESULT="-1^"_$P(GMRVDATA,U,2)_" is not a legitimate qualifier"
+24 QUIT
End DoDot:1
QUIT
+25 ;counter for number of tries to lock an entry
SET GMVCNT=0
B2 ; Lock the entry
+1 ;4 strikes and you're out
IF GMVCNT>3
Begin DoDot:1
+2 SET RESULT=""
+3 ;or S RESULT="-1^Could not lock entry to file qualifiers."
+4 LOCK -^GMR(120.5,GMRVIEN,0)
+5 QUIT
End DoDot:1
QUIT
+6 LOCK +^GMR(120.5,GMRVIEN,0):1
+7 SET GMVCNT=GMVCNT+1
+8 IF '$TEST
LOCK -^GMR(120.5,GMRVIEN,0)
GOTO B2
+9 ; Store the qualifier
+10 SET GMVFDA(120.505,"+1,"_GMRVIEN_",",.01)=GMRVQUAL
+11 DO UPDATE^DIE("","GMVFDA","GMVOKAY","GMVERR")
+12 LOCK -^GMR(120.5,GMRVIEN,0)
+13 ; or S RESULT="-1^*fileman error message*"
IF $DATA(GMVERR)
SET RESULT=""
+14 IF '$TEST
SET RESULT=+$GET(GMVOKAY(1))
+15 QUIT