PXPXRMI2 ; SLC/PKR - Build indexes for the V files (continued). ;28-Apr-2015 14:34;DU
;;1.0;PCE PATIENT CARE ENCOUNTER;**119,1009**;Aug 12, 1996;Build 3
;DBIA 4113 supports PXRMSXRM entry points.
;DBIA 4114 supports setting and killing ^PXRMINDX
;===============================================================
VPED ;Build the indexes for V PATIENT ED.
N DAS,DATE,DFN,DIFF,DONE,EDU,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NERROR
N START,TEMP,TENP,TEXT,VISIT
;Don't leave any old stuff around.
K ^PXRMINDX(9000010.16)
S GLOBAL=$$GET1^DID(9000010.16,"","","GLOBAL NAME")
S ENTRIES=$P(^AUPNVPED(0),U,4)
S TENP=ENTRIES/10
S TENP=+$P(TENP,".",1)
I TENP<1 S TENP=1
D BMES^XPDUTL("Building indexes for V PATIENT ED")
S TEXT="There are "_ENTRIES_" entries to process."
D MES^XPDUTL(TEXT)
S START=$H
S (DAS,DONE,IND,NE,NERROR)=0
F S DAS=$O(^AUPNVPED(DAS)) Q:DONE D
. I +DAS=0 S DONE=1 Q
. I +DAS'=DAS D Q
.. S DONE=1
.. S ETEXT="Bad ien: "_DAS_", cannot continue."
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S IND=IND+1
. I IND#TENP=0 D
.. S TEXT="Processing entry "_IND
.. D MES^XPDUTL(TEXT)
. I IND#10000=0 W "."
. ;IHS/MSC/MGH Put a $G around it p1003
. S TEMP=$G(^AUPNVPED(DAS,0))
. S EDU=$P(TEMP,U,1)
. I EDU="" D Q
.. S ETEXT=DAS_" missing education topic"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUTTEDT(EDU)) D Q
.. S ETEXT=DAS_" invalid education topic"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S DFN=$P(TEMP,U,2)
. I DFN="" D Q
.. S ETEXT=DAS_" missing DFN"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S VISIT=$P(TEMP,U,3)
. I VISIT="" D Q
.. S ETEXT=DAS_" missing visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUPNVSIT(VISIT)) D Q
.. S ETEXT=DAS_" invalid visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. ;IHS/MSC/MGH wrap it
. S DATE=$P($G(^AUPNVSIT(VISIT,0)),U,1)
. I DATE="" D Q
.. S ETEXT=DAS_" missing visit date"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S NE=NE+1
. S ^PXRMINDX(9000010.16,"IP",EDU,DFN,DATE,DAS)=""
. S ^PXRMINDX(9000010.16,"PI",DFN,EDU,DATE,DAS)=""
S END=$H
S TEXT=NE_" V PATIENT ED results indexed."
D MES^XPDUTL(TEXT)
D DETIME^PXRMSXRM(START,END)
;If there were errors send a message.
I NERROR>0 D ERRMSG^PXRMSXRM(NERROR,GLOBAL)
;Send a MailMan message with the results.
D COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
S ^PXRMINDX(9000010.16,"GLOBAL NAME")=GLOBAL
S ^PXRMINDX(9000010.16,"BUILT BY")=DUZ
S ^PXRMINDX(9000010.16,"DATE BUILT")=$$NOW^XLFDT
Q
;
;===============================================================
VPOV ;Build the indexes for V POV.
N DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NERROR,POV,PS
N START,TEMP,TENP,TEXT,VISIT
;Don't leave any old stuff around.
K ^PXRMINDX(9000010.07)
S GLOBAL=$$GET1^DID(9000010.07,"","","GLOBAL NAME")
S ENTRIES=$P(^AUPNVPOV(0),U,4)
S TENP=ENTRIES/10
S TENP=+$P(TENP,".",1)
I TENP<1 S TENP=1
D BMES^XPDUTL("Building indexes for V POV")
S TEXT="There are "_ENTRIES_" entries to process."
D MES^XPDUTL(TEXT)
S START=$H
S (DAS,DONE,IND,NE,NERROR)=0
F S DAS=$O(^AUPNVPOV(DAS)) Q:DONE D
. I +DAS=0 S DONE=1 Q
. I +DAS'=DAS D Q
.. S DONE=1
.. S ETEXT="Bad ien: "_DAS_", cannot continue."
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S IND=IND+1
. I IND#TENP=0 D
.. S TEXT="Processing entry "_IND
.. D MES^XPDUTL(TEXT)
. I IND#10000=0 W "."
. ;IHS/MSC/MGH Put a $G around it p1003
. S TEMP=$G(^AUPNVPOV(DAS,0))
. S POV=$P(TEMP,U,1)
. I POV="" D Q
.. S ETEXT=DAS_" missing POV (ICD9)"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^ICD9(POV)) D Q
.. S ETEXT=DAS_" invalid ICD9"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S DFN=$P(TEMP,U,2)
. I DFN="" D Q
.. S ETEXT=DAS_" missing DFN"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S VISIT=$P(TEMP,U,3)
. I VISIT="" D Q
.. S ETEXT=DAS_" missing visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUPNVSIT(VISIT)) D Q
.. S ETEXT=DAS_" invalid visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S PS=$P(TEMP,U,12)
. I PS="" S PS="U"
. ;IHS/MSC/MGH wrap it
. S DATE=$P($G(^AUPNVSIT(VISIT,0)),U,1)
. I DATE="" D Q
.. S ETEXT=DAS_" missing visit date"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S NE=NE+1
. S ^PXRMINDX(9000010.07,"IPP",POV,PS,DFN,DATE,DAS)=""
. S ^PXRMINDX(9000010.07,"PPI",DFN,PS,POV,DATE,DAS)=""
S END=$H
S TEXT=NE_" V POV results indexed."
D MES^XPDUTL(TEXT)
D DETIME^PXRMSXRM(START,END)
;If there were errors send a message.
I NERROR>0 D ERRMSG^PXRMSXRM(NERROR,GLOBAL)
;Send a MailMan message with the results.
D COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
S ^PXRMINDX(9000010.07,"GLOBAL NAME")=GLOBAL
S ^PXRMINDX(9000010.07,"BUILT BY")=DUZ
S ^PXRMINDX(9000010.07,"DATE BUILT")=$$NOW^XLFDT
Q
;
;===============================================================
VSK ;Build the indexes for V SKIN TEST.
N DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,GLOBAL,IND,NE,NERROR
N SK,START,TEMP,TENP,TEXT,VISIT
;Don't leave any old stuff around.
K ^PXRMINDX(9000010.12)
S GLOBAL=$$GET1^DID(9000010.12,"","","GLOBAL NAME")
S ENTRIES=$P(^AUPNVSK(0),U,4)
S TENP=ENTRIES/10
S TENP=+$P(TENP,".",1)
I TENP<1 S TENP=1
D BMES^XPDUTL("Building indexes for V SKIN TEST")
S TEXT="There are "_ENTRIES_" entries to process."
D MES^XPDUTL(TEXT)
S START=$H
S (DAS,DONE,IND,NE,NERROR)=0
F S DAS=$O(^AUPNVSK(DAS)) Q:DONE D
. I +DAS=0 S DONE=1 Q
. I +DAS'=DAS D Q
.. S DONE=1
.. S ETEXT="Bad ien: "_DAS_", cannot continue."
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S IND=IND+1
. I IND#TENP=0 D
.. S TEXT="Processing entry "_IND
.. D MES^XPDUTL(TEXT)
. I IND#10000=0 W "."
. ;IHS/MSC/MGH Put a $G around it p1003
. S TEMP=$G(^AUPNVSK(DAS,0))
. S SK=$P(TEMP,U,1)
. I SK="" D Q
.. S ETEXT=DAS_" missing skin test"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUTTSK(SK)) D Q
.. S ETEXT=DAS_" invalid skin test"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S DFN=$P(TEMP,U,2)
. I DFN="" D Q
.. S ETEXT=DAS_" missing DFN"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S VISIT=$P(TEMP,U,3)
. I VISIT="" D Q
.. S ETEXT=DAS_" missing visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUPNVSIT(VISIT)) D Q
.. S ETEXT=DAS_" invalid visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. ;IHS/MSC/MGH wrap it
. S DATE=$P($G(^AUPNVSIT(VISIT,0)),U,1)
. I DATE="" D Q
.. S ETEXT=DAS_" missing visit date"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S NE=NE+1
. S ^PXRMINDX(9000010.12,"IP",SK,DFN,DATE,DAS)=""
. S ^PXRMINDX(9000010.12,"PI",DFN,SK,DATE,DAS)=""
S END=$H
S TEXT=NE_" V SKIN TEST results indexed."
D MES^XPDUTL(TEXT)
D DETIME^PXRMSXRM(START,END)
;If there were errors send a message.
I NERROR>0 D ERRMSG^PXRMSXRM(NERROR,GLOBAL)
;Send a MailMan message with the results.
D COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
S ^PXRMINDX(9000010.12,"GLOBAL NAME")=GLOBAL
S ^PXRMINDX(9000010.12,"BUILT BY")=DUZ
S ^PXRMINDX(9000010.12,"DATE BUILT")=$$NOW^XLFDT
Q
;
;===============================================================
VXAM ;Build the indexes for V EXAM.
N DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,ETEXT,EXAM,GLOBAL,IND,NE,NERROR
N START,TEMP,TENP,TEXT,VISIT
;Don't leave any old stuff around.
K ^PXRMINDX(9000010.13)
S GLOBAL=$$GET1^DID(9000010.13,"","","GLOBAL NAME")
S ENTRIES=$P(^AUPNVXAM(0),U,4)
S TENP=ENTRIES/10
S TENP=+$P(TENP,".",1)
I TENP<1 S TENP=1
D BMES^XPDUTL("Building indexes for V EXAM")
S TEXT="There are "_ENTRIES_" entries to process."
D MES^XPDUTL(TEXT)
S START=$H
S (DAS,DONE,IND,NE,NERROR)=0
F S DAS=$O(^AUPNVXAM(DAS)) Q:DONE D
. I +DAS=0 S DONE=1 Q
. I +DAS'=DAS D Q
.. S DONE=1
.. S ETEXT="Bad ien: "_DAS_", cannot continue."
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S IND=IND+1
. I IND#TENP=0 D
.. S TEXT="Processing entry "_IND
.. D MES^XPDUTL(TEXT)
. I IND#10000=0 W "."
. ;IHS/MSC/MGH Put a $G around it p1003
. S TEMP=$G(^AUPNVXAM(DAS,0))
. S EXAM=$P(TEMP,U,1)
. I EXAM="" D Q
.. S ETEXT=DAS_" missing exam"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUTTEXAM(EXAM)) D Q
.. S ETEXT=DAS_" invalid exam"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S DFN=$P(TEMP,U,2)
. I DFN="" D Q
.. S ETEXT=DAS_" missing DFN"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S VISIT=$P(TEMP,U,3)
. I VISIT="" D Q
.. S ETEXT=DAS_" missing visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. I '$D(^AUPNVSIT(VISIT)) D Q
.. S ETEXT=DAS_" invalid visit"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. ;IHS/MSC/MGH wrap it
. S DATE=$P($G(^AUPNVSIT(VISIT,0)),U,1)
. I DATE="" D Q
.. S ETEXT=DAS_" missing visit date"
.. D ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
. S NE=NE+1
. S ^PXRMINDX(9000010.13,"IP",EXAM,DFN,DATE,DAS)=""
. S ^PXRMINDX(9000010.13,"PI",DFN,EXAM,DATE,DAS)=""
S END=$H
S TEXT=NE_" V EXAM results indexed."
D MES^XPDUTL(TEXT)
D DETIME^PXRMSXRM(START,END)
;If there were errors send a message.
I NERROR>0 D ERRMSG^PXRMSXRM(NERROR,GLOBAL)
;Send a MailMan message with the results.
D COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
S ^PXRMINDX(9000010.13,"GLOBAL NAME")=GLOBAL
S ^PXRMINDX(9000010.13,"BUILT BY")=DUZ
S ^PXRMINDX(9000010.13,"DATE BUILT")=$$NOW^XLFDT
Q
;
PXPXRMI2 ; SLC/PKR - Build indexes for the V files (continued). ;28-Apr-2015 14:34;DU
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**119,1009**;Aug 12, 1996;Build 3
+2 ;DBIA 4113 supports PXRMSXRM entry points.
+3 ;DBIA 4114 supports setting and killing ^PXRMINDX
+4 ;===============================================================
VPED ;Build the indexes for V PATIENT ED.
+1 NEW DAS,DATE,DFN,DIFF,DONE,EDU,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NERROR
+2 NEW START,TEMP,TENP,TEXT,VISIT
+3 ;Don't leave any old stuff around.
+4 KILL ^PXRMINDX(9000010.16)
+5 SET GLOBAL=$$GET1^DID(9000010.16,"","","GLOBAL NAME")
+6 SET ENTRIES=$PIECE(^AUPNVPED(0),U,4)
+7 SET TENP=ENTRIES/10
+8 SET TENP=+$PIECE(TENP,".",1)
+9 IF TENP<1
SET TENP=1
+10 DO BMES^XPDUTL("Building indexes for V PATIENT ED")
+11 SET TEXT="There are "_ENTRIES_" entries to process."
+12 DO MES^XPDUTL(TEXT)
+13 SET START=$HOROLOG
+14 SET (DAS,DONE,IND,NE,NERROR)=0
+15 FOR
SET DAS=$ORDER(^AUPNVPED(DAS))
IF DONE
QUIT
Begin DoDot:1
+16 IF +DAS=0
SET DONE=1
QUIT
+17 IF +DAS'=DAS
Begin DoDot:2
+18 SET DONE=1
+19 SET ETEXT="Bad ien: "_DAS_", cannot continue."
+20 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+21 SET IND=IND+1
+22 IF IND#TENP=0
Begin DoDot:2
+23 SET TEXT="Processing entry "_IND
+24 DO MES^XPDUTL(TEXT)
End DoDot:2
+25 IF IND#10000=0
WRITE "."
+26 ;IHS/MSC/MGH Put a $G around it p1003
+27 SET TEMP=$GET(^AUPNVPED(DAS,0))
+28 SET EDU=$PIECE(TEMP,U,1)
+29 IF EDU=""
Begin DoDot:2
+30 SET ETEXT=DAS_" missing education topic"
+31 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+32 IF '$DATA(^AUTTEDT(EDU))
Begin DoDot:2
+33 SET ETEXT=DAS_" invalid education topic"
+34 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+35 SET DFN=$PIECE(TEMP,U,2)
+36 IF DFN=""
Begin DoDot:2
+37 SET ETEXT=DAS_" missing DFN"
+38 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+39 SET VISIT=$PIECE(TEMP,U,3)
+40 IF VISIT=""
Begin DoDot:2
+41 SET ETEXT=DAS_" missing visit"
+42 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+43 IF '$DATA(^AUPNVSIT(VISIT))
Begin DoDot:2
+44 SET ETEXT=DAS_" invalid visit"
+45 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+46 ;IHS/MSC/MGH wrap it
+47 SET DATE=$PIECE($GET(^AUPNVSIT(VISIT,0)),U,1)
+48 IF DATE=""
Begin DoDot:2
+49 SET ETEXT=DAS_" missing visit date"
+50 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+51 SET NE=NE+1
+52 SET ^PXRMINDX(9000010.16,"IP",EDU,DFN,DATE,DAS)=""
+53 SET ^PXRMINDX(9000010.16,"PI",DFN,EDU,DATE,DAS)=""
End DoDot:1
+54 SET END=$HOROLOG
+55 SET TEXT=NE_" V PATIENT ED results indexed."
+56 DO MES^XPDUTL(TEXT)
+57 DO DETIME^PXRMSXRM(START,END)
+58 ;If there were errors send a message.
+59 IF NERROR>0
DO ERRMSG^PXRMSXRM(NERROR,GLOBAL)
+60 ;Send a MailMan message with the results.
+61 DO COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
+62 SET ^PXRMINDX(9000010.16,"GLOBAL NAME")=GLOBAL
+63 SET ^PXRMINDX(9000010.16,"BUILT BY")=DUZ
+64 SET ^PXRMINDX(9000010.16,"DATE BUILT")=$$NOW^XLFDT
+65 QUIT
+66 ;
+67 ;===============================================================
VPOV ;Build the indexes for V POV.
+1 NEW DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,ETEXT,GLOBAL,IND,NE,NERROR,POV,PS
+2 NEW START,TEMP,TENP,TEXT,VISIT
+3 ;Don't leave any old stuff around.
+4 KILL ^PXRMINDX(9000010.07)
+5 SET GLOBAL=$$GET1^DID(9000010.07,"","","GLOBAL NAME")
+6 SET ENTRIES=$PIECE(^AUPNVPOV(0),U,4)
+7 SET TENP=ENTRIES/10
+8 SET TENP=+$PIECE(TENP,".",1)
+9 IF TENP<1
SET TENP=1
+10 DO BMES^XPDUTL("Building indexes for V POV")
+11 SET TEXT="There are "_ENTRIES_" entries to process."
+12 DO MES^XPDUTL(TEXT)
+13 SET START=$HOROLOG
+14 SET (DAS,DONE,IND,NE,NERROR)=0
+15 FOR
SET DAS=$ORDER(^AUPNVPOV(DAS))
IF DONE
QUIT
Begin DoDot:1
+16 IF +DAS=0
SET DONE=1
QUIT
+17 IF +DAS'=DAS
Begin DoDot:2
+18 SET DONE=1
+19 SET ETEXT="Bad ien: "_DAS_", cannot continue."
+20 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+21 SET IND=IND+1
+22 IF IND#TENP=0
Begin DoDot:2
+23 SET TEXT="Processing entry "_IND
+24 DO MES^XPDUTL(TEXT)
End DoDot:2
+25 IF IND#10000=0
WRITE "."
+26 ;IHS/MSC/MGH Put a $G around it p1003
+27 SET TEMP=$GET(^AUPNVPOV(DAS,0))
+28 SET POV=$PIECE(TEMP,U,1)
+29 IF POV=""
Begin DoDot:2
+30 SET ETEXT=DAS_" missing POV (ICD9)"
+31 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+32 IF '$DATA(^ICD9(POV))
Begin DoDot:2
+33 SET ETEXT=DAS_" invalid ICD9"
+34 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+35 SET DFN=$PIECE(TEMP,U,2)
+36 IF DFN=""
Begin DoDot:2
+37 SET ETEXT=DAS_" missing DFN"
+38 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+39 SET VISIT=$PIECE(TEMP,U,3)
+40 IF VISIT=""
Begin DoDot:2
+41 SET ETEXT=DAS_" missing visit"
+42 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+43 IF '$DATA(^AUPNVSIT(VISIT))
Begin DoDot:2
+44 SET ETEXT=DAS_" invalid visit"
+45 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+46 SET PS=$PIECE(TEMP,U,12)
+47 IF PS=""
SET PS="U"
+48 ;IHS/MSC/MGH wrap it
+49 SET DATE=$PIECE($GET(^AUPNVSIT(VISIT,0)),U,1)
+50 IF DATE=""
Begin DoDot:2
+51 SET ETEXT=DAS_" missing visit date"
+52 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+53 SET NE=NE+1
+54 SET ^PXRMINDX(9000010.07,"IPP",POV,PS,DFN,DATE,DAS)=""
+55 SET ^PXRMINDX(9000010.07,"PPI",DFN,PS,POV,DATE,DAS)=""
End DoDot:1
+56 SET END=$HOROLOG
+57 SET TEXT=NE_" V POV results indexed."
+58 DO MES^XPDUTL(TEXT)
+59 DO DETIME^PXRMSXRM(START,END)
+60 ;If there were errors send a message.
+61 IF NERROR>0
DO ERRMSG^PXRMSXRM(NERROR,GLOBAL)
+62 ;Send a MailMan message with the results.
+63 DO COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
+64 SET ^PXRMINDX(9000010.07,"GLOBAL NAME")=GLOBAL
+65 SET ^PXRMINDX(9000010.07,"BUILT BY")=DUZ
+66 SET ^PXRMINDX(9000010.07,"DATE BUILT")=$$NOW^XLFDT
+67 QUIT
+68 ;
+69 ;===============================================================
VSK ;Build the indexes for V SKIN TEST.
+1 NEW DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,GLOBAL,IND,NE,NERROR
+2 NEW SK,START,TEMP,TENP,TEXT,VISIT
+3 ;Don't leave any old stuff around.
+4 KILL ^PXRMINDX(9000010.12)
+5 SET GLOBAL=$$GET1^DID(9000010.12,"","","GLOBAL NAME")
+6 SET ENTRIES=$PIECE(^AUPNVSK(0),U,4)
+7 SET TENP=ENTRIES/10
+8 SET TENP=+$PIECE(TENP,".",1)
+9 IF TENP<1
SET TENP=1
+10 DO BMES^XPDUTL("Building indexes for V SKIN TEST")
+11 SET TEXT="There are "_ENTRIES_" entries to process."
+12 DO MES^XPDUTL(TEXT)
+13 SET START=$HOROLOG
+14 SET (DAS,DONE,IND,NE,NERROR)=0
+15 FOR
SET DAS=$ORDER(^AUPNVSK(DAS))
IF DONE
QUIT
Begin DoDot:1
+16 IF +DAS=0
SET DONE=1
QUIT
+17 IF +DAS'=DAS
Begin DoDot:2
+18 SET DONE=1
+19 SET ETEXT="Bad ien: "_DAS_", cannot continue."
+20 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+21 SET IND=IND+1
+22 IF IND#TENP=0
Begin DoDot:2
+23 SET TEXT="Processing entry "_IND
+24 DO MES^XPDUTL(TEXT)
End DoDot:2
+25 IF IND#10000=0
WRITE "."
+26 ;IHS/MSC/MGH Put a $G around it p1003
+27 SET TEMP=$GET(^AUPNVSK(DAS,0))
+28 SET SK=$PIECE(TEMP,U,1)
+29 IF SK=""
Begin DoDot:2
+30 SET ETEXT=DAS_" missing skin test"
+31 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+32 IF '$DATA(^AUTTSK(SK))
Begin DoDot:2
+33 SET ETEXT=DAS_" invalid skin test"
+34 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+35 SET DFN=$PIECE(TEMP,U,2)
+36 IF DFN=""
Begin DoDot:2
+37 SET ETEXT=DAS_" missing DFN"
+38 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+39 SET VISIT=$PIECE(TEMP,U,3)
+40 IF VISIT=""
Begin DoDot:2
+41 SET ETEXT=DAS_" missing visit"
+42 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+43 IF '$DATA(^AUPNVSIT(VISIT))
Begin DoDot:2
+44 SET ETEXT=DAS_" invalid visit"
+45 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+46 ;IHS/MSC/MGH wrap it
+47 SET DATE=$PIECE($GET(^AUPNVSIT(VISIT,0)),U,1)
+48 IF DATE=""
Begin DoDot:2
+49 SET ETEXT=DAS_" missing visit date"
+50 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+51 SET NE=NE+1
+52 SET ^PXRMINDX(9000010.12,"IP",SK,DFN,DATE,DAS)=""
+53 SET ^PXRMINDX(9000010.12,"PI",DFN,SK,DATE,DAS)=""
End DoDot:1
+54 SET END=$HOROLOG
+55 SET TEXT=NE_" V SKIN TEST results indexed."
+56 DO MES^XPDUTL(TEXT)
+57 DO DETIME^PXRMSXRM(START,END)
+58 ;If there were errors send a message.
+59 IF NERROR>0
DO ERRMSG^PXRMSXRM(NERROR,GLOBAL)
+60 ;Send a MailMan message with the results.
+61 DO COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
+62 SET ^PXRMINDX(9000010.12,"GLOBAL NAME")=GLOBAL
+63 SET ^PXRMINDX(9000010.12,"BUILT BY")=DUZ
+64 SET ^PXRMINDX(9000010.12,"DATE BUILT")=$$NOW^XLFDT
+65 QUIT
+66 ;
+67 ;===============================================================
VXAM ;Build the indexes for V EXAM.
+1 NEW DAS,DATE,DFN,DIFF,DONE,END,ENTRIES,ETEXT,EXAM,GLOBAL,IND,NE,NERROR
+2 NEW START,TEMP,TENP,TEXT,VISIT
+3 ;Don't leave any old stuff around.
+4 KILL ^PXRMINDX(9000010.13)
+5 SET GLOBAL=$$GET1^DID(9000010.13,"","","GLOBAL NAME")
+6 SET ENTRIES=$PIECE(^AUPNVXAM(0),U,4)
+7 SET TENP=ENTRIES/10
+8 SET TENP=+$PIECE(TENP,".",1)
+9 IF TENP<1
SET TENP=1
+10 DO BMES^XPDUTL("Building indexes for V EXAM")
+11 SET TEXT="There are "_ENTRIES_" entries to process."
+12 DO MES^XPDUTL(TEXT)
+13 SET START=$HOROLOG
+14 SET (DAS,DONE,IND,NE,NERROR)=0
+15 FOR
SET DAS=$ORDER(^AUPNVXAM(DAS))
IF DONE
QUIT
Begin DoDot:1
+16 IF +DAS=0
SET DONE=1
QUIT
+17 IF +DAS'=DAS
Begin DoDot:2
+18 SET DONE=1
+19 SET ETEXT="Bad ien: "_DAS_", cannot continue."
+20 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+21 SET IND=IND+1
+22 IF IND#TENP=0
Begin DoDot:2
+23 SET TEXT="Processing entry "_IND
+24 DO MES^XPDUTL(TEXT)
End DoDot:2
+25 IF IND#10000=0
WRITE "."
+26 ;IHS/MSC/MGH Put a $G around it p1003
+27 SET TEMP=$GET(^AUPNVXAM(DAS,0))
+28 SET EXAM=$PIECE(TEMP,U,1)
+29 IF EXAM=""
Begin DoDot:2
+30 SET ETEXT=DAS_" missing exam"
+31 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+32 IF '$DATA(^AUTTEXAM(EXAM))
Begin DoDot:2
+33 SET ETEXT=DAS_" invalid exam"
+34 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+35 SET DFN=$PIECE(TEMP,U,2)
+36 IF DFN=""
Begin DoDot:2
+37 SET ETEXT=DAS_" missing DFN"
+38 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+39 SET VISIT=$PIECE(TEMP,U,3)
+40 IF VISIT=""
Begin DoDot:2
+41 SET ETEXT=DAS_" missing visit"
+42 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+43 IF '$DATA(^AUPNVSIT(VISIT))
Begin DoDot:2
+44 SET ETEXT=DAS_" invalid visit"
+45 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+46 ;IHS/MSC/MGH wrap it
+47 SET DATE=$PIECE($GET(^AUPNVSIT(VISIT,0)),U,1)
+48 IF DATE=""
Begin DoDot:2
+49 SET ETEXT=DAS_" missing visit date"
+50 DO ADDERROR^PXRMSXRM(GLOBAL,ETEXT,.NERROR)
End DoDot:2
QUIT
+51 SET NE=NE+1
+52 SET ^PXRMINDX(9000010.13,"IP",EXAM,DFN,DATE,DAS)=""
+53 SET ^PXRMINDX(9000010.13,"PI",DFN,EXAM,DATE,DAS)=""
End DoDot:1
+54 SET END=$HOROLOG
+55 SET TEXT=NE_" V EXAM results indexed."
+56 DO MES^XPDUTL(TEXT)
+57 DO DETIME^PXRMSXRM(START,END)
+58 ;If there were errors send a message.
+59 IF NERROR>0
DO ERRMSG^PXRMSXRM(NERROR,GLOBAL)
+60 ;Send a MailMan message with the results.
+61 DO COMMSG^PXRMSXRM(GLOBAL,START,END,NE,NERROR)
+62 SET ^PXRMINDX(9000010.13,"GLOBAL NAME")=GLOBAL
+63 SET ^PXRMINDX(9000010.13,"BUILT BY")=DUZ
+64 SET ^PXRMINDX(9000010.13,"DATE BUILT")=$$NOW^XLFDT
+65 QUIT
+66 ;