GMRVXVM0 ;HIRMFO/YH,RM-GMRV VITAL MEASUREMENT CONVERSION ;8/1/96
;;4.0;Vitals/Measurements;;Apr 25, 1997
QUEUE ; Entry to queue/requeue GMRV Vital Measurement Conversion
D BMES^XPDUTL("Data conversion queued to run in the background")
S ZTDTH=$$HADD^XLFDT($H,"","","",60),ZTDESC="V/M V4.0 FILE 120.5 CONVERSION"
S ZTRTN="CONV5^GMRVXVM0",(ZTIO,ZTSAVE("DUZ"))=""
D ^%ZTLOAD
Q
ALERT ;Set up ALERT variables if conversion bombs out
S XQA(DUZ)="",XQAMSG="V/M VERSION 4 data conversion has aborted for file 120.5"
D SETUP^XQALERT K XQA,XQAMSQ
Q
;
; This job should be queued to run in the background.
Q
CONV5 ;Convert patient data in ^GMR(120.5)
N GMRV S XMSUB="V/M V4.0 FILE 120.5 CONVERSION",XMY(DUZ)="",XMTEXT="GMRV("
I +$G(^GMRD(120.57,1,"PHASEII"))=1 S GMRV(1)="Data conversion has completed." D ^XMD Q
S X="ALERT^GMRVXVM0",@^%ZOSF("TRAP")
S ^GMRD(120.57,1,"PHASEII")=$P($G(^GMRD(120.57,1,"PHASEII"))_"^^^","^",1,4)
N GMRVDA,GMRVLST,GMRVDATA,GMRV52,GMRV53
S GMRVDA=+$P(^GMRD(120.57,1,"PHASEII"),U,2),GMRVDA(1)=+$P(^GMR(120.5,0),"^",3)
F S GMRVDA=$O(^GMR(120.5,GMRVDA)) Q:GMRVDA'>0 S GMRVDATA=$G(^GMR(120.5,GMRVDA,0)),GMRV52=+$P(GMRVDATA,"^",7),GMRV53=+$P(GMRVDATA,"^",9) D:GMRV52>0!(GMRV53>0) S $P(^GMRD(120.57,1,"PHASEII"),"^",2)=GMRVDA
. S GMRVLST=0 I $D(^GMRD(120.52,GMRV52)) S GMRVLST=GMRVLST+1
. I $D(^GMRD(120.52,GMRV52)),'$D(^GMR(120.5,GMRVDA,5,"B",GMRV52)) S ^GMR(120.5,GMRVDA,5,GMRVLST,0)=GMRV52,^GMR(120.5,GMRVDA,5,"B",GMRV52,GMRVLST)=""
. I GMRV53>0 S GMRV53(1)=GMRV53_";GMRD(120.53," I $D(^GMRD(120.52,"AOLD",GMRV53(1))) S GMRV53(2)=$O(^GMRD(120.52,"AOLD",GMRV53(1),0)),GMRVLST=GMRVLST+1 D:GMRV53(2)>0
. . I '$D(^GMR(120.5,GMRVDA,5,"B",GMRV53(2))) S ^GMR(120.5,GMRVDA,5,GMRVLST,0)=GMRV53(2),^GMR(120.5,GMRVDA,5,"B",GMRV53(2),GMRVLST)=""
. S ^GMR(120.5,GMRVDA,5,0)="^120.505P^"_GMRVLST_"^"_GMRVLST
. Q
I $P(^GMRD(120.57,1,"PHASEII"),"^",2)<GMRVDA(1) S GMRV(1)="Conversion not completed, please check the record after the record # "_$P(^GMRD(120.57,1,"PHASEII"),"^",2)_" in the ^GMR(120.5) file" D ^XMD Q
S $P(^GMRD(120.57,1,"PHASEII"),"^")=1
S GMRV(1)="FILE 120.5 CONVERSION COMPLETED" D ^XMD
Q
GMRVXVM0 ;HIRMFO/YH,RM-GMRV VITAL MEASUREMENT CONVERSION ;8/1/96
+1 ;;4.0;Vitals/Measurements;;Apr 25, 1997
QUEUE ; Entry to queue/requeue GMRV Vital Measurement Conversion
+1 DO BMES^XPDUTL("Data conversion queued to run in the background")
+2 SET ZTDTH=$$HADD^XLFDT($HOROLOG,"","","",60)
SET ZTDESC="V/M V4.0 FILE 120.5 CONVERSION"
+3 SET ZTRTN="CONV5^GMRVXVM0"
SET (ZTIO,ZTSAVE("DUZ"))=""
+4 DO ^%ZTLOAD
+5 QUIT
ALERT ;Set up ALERT variables if conversion bombs out
+1 SET XQA(DUZ)=""
SET XQAMSG="V/M VERSION 4 data conversion has aborted for file 120.5"
+2 DO SETUP^XQALERT
KILL XQA,XQAMSQ
+3 QUIT
+4 ;
+5 ; This job should be queued to run in the background.
+6 QUIT
CONV5 ;Convert patient data in ^GMR(120.5)
+1 NEW GMRV
SET XMSUB="V/M V4.0 FILE 120.5 CONVERSION"
SET XMY(DUZ)=""
SET XMTEXT="GMRV("
+2 IF +$GET(^GMRD(120.57,1,"PHASEII"))=1
SET GMRV(1)="Data conversion has completed."
DO ^XMD
QUIT
+3 SET X="ALERT^GMRVXVM0"
SET @^%ZOSF("TRAP")
+4 SET ^GMRD(120.57,1,"PHASEII")=$PIECE($GET(^GMRD(120.57,1,"PHASEII"))_"^^^","^",1,4)
+5 NEW GMRVDA,GMRVLST,GMRVDATA,GMRV52,GMRV53
+6 SET GMRVDA=+$PIECE(^GMRD(120.57,1,"PHASEII"),U,2)
SET GMRVDA(1)=+$PIECE(^GMR(120.5,0),"^",3)
+7 FOR
SET GMRVDA=$ORDER(^GMR(120.5,GMRVDA))
IF GMRVDA'>0
QUIT
SET GMRVDATA=$GET(^GMR(120.5,GMRVDA,0))
SET GMRV52=+$PIECE(GMRVDATA,"^",7)
SET GMRV53=+$PIECE(GMRVDATA,"^",9)
IF GMRV52>0!(GMRV53>0)
Begin DoDot:1
+8 SET GMRVLST=0
IF $DATA(^GMRD(120.52,GMRV52))
SET GMRVLST=GMRVLST+1
+9 IF $DATA(^GMRD(120.52,GMRV52))
IF '$DATA(^GMR(120.5,GMRVDA,5,"B",GMRV52))
SET ^GMR(120.5,GMRVDA,5,GMRVLST,0)=GMRV52
SET ^GMR(120.5,GMRVDA,5,"B",GMRV52,GMRVLST)=""
+10 IF GMRV53>0
SET GMRV53(1)=GMRV53_";GMRD(120.53,"
IF $DATA(^GMRD(120.52,"AOLD",GMRV53(1)))
SET GMRV53(2)=$ORDER(^GMRD(120.52,"AOLD",GMRV53(1),0))
SET GMRVLST=GMRVLST+1
IF GMRV53(2)>0
Begin DoDot:2
+11 IF '$DATA(^GMR(120.5,GMRVDA,5,"B",GMRV53(2)))
SET ^GMR(120.5,GMRVDA,5,GMRVLST,0)=GMRV53(2)
SET ^GMR(120.5,GMRVDA,5,"B",GMRV53(2),GMRVLST)=""
End DoDot:2
+12 SET ^GMR(120.5,GMRVDA,5,0)="^120.505P^"_GMRVLST_"^"_GMRVLST
+13 QUIT
End DoDot:1
SET $PIECE(^GMRD(120.57,1,"PHASEII"),"^",2)=GMRVDA
+14 IF $PIECE(^GMRD(120.57,1,"PHASEII"),"^",2)<GMRVDA(1)
SET GMRV(1)="Conversion not completed, please check the record after the record # "_$PIECE(^GMRD(120.57,1,"PHASEII"),"^",2)_" in the ^GMR(120.5) file"
DO ^XMD
QUIT
+15 SET $PIECE(^GMRD(120.57,1,"PHASEII"),"^")=1
+16 SET GMRV(1)="FILE 120.5 CONVERSION COMPLETED"
DO ^XMD
+17 QUIT