AMHEXC1 ; IHS/CMI/LAB - RECORD REVIEW PROCESS ;
;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
;
;
;
;
START ;
S (AMHBT,AMHBTH)=$H,AMHJOB=$J,AMH("ERROR COUNT")=0,AMHO("RUN")="NEW"
D DATE,XIT
Q
;
DATE ; Run by encounter date
S X1=AMHBD,X2=-1 D C^%DTC S AMHSD=X
S AMHODAT=AMHSD_".9999" F S AMHODAT=$O(^AMHREC("AEX",AMHODAT)) Q:AMHODAT=""!((AMHODAT\1)>AMHED) D D1
Q
;
XIT ;
S AMHET=$H
D EOJ
Q
EOJ ;
Q
D1 ;
S (AMHR,AMHRCNT)=0 F S AMHR=$O(^AMHREC("AEX",AMHODAT,AMHR)) Q:AMHR'=+AMHR S AMHREC=^AMHREC(AMHR,0) D PROC
Q
PROC ;
K AMHE,AMHTX D RECORD^AMHEXD2
Q:AMHE=""
S AMH("ERROR COUNT")=AMH("ERROR COUNT")+1
S AMHE("ERR DFN")=$O(^AMHERR("B",AMHE,"")) I AMHE("ERR DFN")="" S AMHE("MSG")=AMHE_"-ERROR INFORMATION NOT IN ERROR FILE" G ERR
S AMHE("MSG")=AMHE_"-"_$P(^AMHERR(AMHE("ERR DFN"),0),U,2) S:$L(AMHE("MSG"))=5 AMHE("MSG")=AMHE("MSG")_"- ERROR INFORMATION NOT IN ERROR FILE" S AMHE("MSG")=$E(AMHE("MSG"),1,45)
ERR S ^XTMP("AMHEXC",AMHJOB,AMHBT,"ERRORS",AMHR)=AMHE("MSG")
Q
;
AMHEXC1 ; IHS/CMI/LAB - RECORD REVIEW PROCESS ;
+1 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
+2 ;
+3 ;
+4 ;
+5 ;
START ;
+1 SET (AMHBT,AMHBTH)=$HOROLOG
SET AMHJOB=$JOB
SET AMH("ERROR COUNT")=0
SET AMHO("RUN")="NEW"
+2 DO DATE
DO XIT
+3 QUIT
+4 ;
DATE ; Run by encounter date
+1 SET X1=AMHBD
SET X2=-1
DO C^%DTC
SET AMHSD=X
+2 SET AMHODAT=AMHSD_".9999"
FOR
SET AMHODAT=$ORDER(^AMHREC("AEX",AMHODAT))
IF AMHODAT=""!((AMHODAT\1)>AMHED)
QUIT
DO D1
+3 QUIT
+4 ;
XIT ;
+1 SET AMHET=$HOROLOG
+2 DO EOJ
+3 QUIT
EOJ ;
+1 QUIT
D1 ;
+1 SET (AMHR,AMHRCNT)=0
FOR
SET AMHR=$ORDER(^AMHREC("AEX",AMHODAT,AMHR))
IF AMHR'=+AMHR
QUIT
SET AMHREC=^AMHREC(AMHR,0)
DO PROC
+2 QUIT
PROC ;
+1 KILL AMHE,AMHTX
DO RECORD^AMHEXD2
+2 IF AMHE=""
QUIT
+3 SET AMH("ERROR COUNT")=AMH("ERROR COUNT")+1
+4 SET AMHE("ERR DFN")=$ORDER(^AMHERR("B",AMHE,""))
IF AMHE("ERR DFN")=""
SET AMHE("MSG")=AMHE_"-ERROR INFORMATION NOT IN ERROR FILE"
GOTO ERR
+5 SET AMHE("MSG")=AMHE_"-"_$PIECE(^AMHERR(AMHE("ERR DFN"),0),U,2)
IF $LENGTH(AMHE("MSG"))=5
SET AMHE("MSG")=AMHE("MSG")_"- ERROR INFORMATION NOT IN ERROR FILE"
SET AMHE("MSG")=$EXTRACT(AMHE("MSG"),1,45)
ERR SET ^XTMP("AMHEXC",AMHJOB,AMHBT,"ERRORS",AMHR)=AMHE("MSG")
+1 QUIT
+2 ;