BADESND ;IHS/MSC/MGH - Dentrix HL7 interface (cont) ;30-Jun-2009 12:49;PLS
;;1.0;DENTAL/EDR INTERFACE;;Oct 13, 2009
Q
RESEND ;EP Resend one HL7 message
N MSGIEN,DIC,DT,NEWIEN,ERROR,Y
S DIC=778,DIC(0)="AEQ",DIC("A")="Select Message Number: ",DT=$$DT^XLFDT D ^DIC I +Y>0 D
.S MSGIEN=+Y
.S NEWIEN=$$RESEND^HLOAPI3(MSGIEN,.ERROR)
.I '$D(ERROR) W !,"Message Resent, New Number: "_NEWIEN H 2
.I $D(ERROR) W !,ERROR H 2
Q
REPROC ;EP Reprocess one message
N MSGIEN,DIC,DT,NEWIEN,ERROR,Y
S DIC=778,DIC(0)="AEQ",DIC("A")="Select Message Number: ",DT=$$DT^XLFDT D ^DIC I +Y>0 D
.S MSGIEN=+Y
.S NEWIEN=$$REPROC^HLOAPI3(MSGIEN,.ERROR)
.I NEWIEN=1 W !,"Message Reprocessed successfully" H 2
.I NEWIEN=0 W !,ERROR H 2
Q
SNDACK ;
N MIEN,HLMSTATE,HLST,Y,MSA,MSGIEN,MSGBDY,APPARMS,X,DIC,DT,Y,ACK,ERR,ARY
S DIC=778,DIC(0)="AEQ",DIC("A")="Select Message Number: ",DT=$$DT^XLFDT D ^DIC I +Y>0 D
.S MIEN=+Y
.;S MIEN=$P($G(^HLB(MSGIEN,0)),U,2)
.;S MIEN=MSGIEN_"^"_MSGBDY
.S APPARMS("QUEUE")="DENT ERX"
.S APPARMS("ACK CODE")="AA"
.S X=$$STARTMSG^HLOPRS(.HLMSTATE,MIEN)
.I X=0 W !,"Unable to setup application" H 2 Q
.I '$$ACK^HLOAPI2(.HLMSTATE,.APPARMS,.ACK,.ERR) W !,ERR H 2 Q
.D SET^BADEHL1(.ARY,"MSA",0)
.D SET^BADEHL1(.ARY,APPARMS("ACK CODE"),1)
.S MSA=$$ADDSEG^HLOAPI(.HLST,.ARY)
.I '$$SENDACK^HLOAPI2(.ACK,.ERR) W !,ERR H 2
.E W !,"Message sent"
Q
BADESND ;IHS/MSC/MGH - Dentrix HL7 interface (cont) ;30-Jun-2009 12:49;PLS
+1 ;;1.0;DENTAL/EDR INTERFACE;;Oct 13, 2009
+2 QUIT
RESEND ;EP Resend one HL7 message
+1 NEW MSGIEN,DIC,DT,NEWIEN,ERROR,Y
+2 SET DIC=778
SET DIC(0)="AEQ"
SET DIC("A")="Select Message Number: "
SET DT=$$DT^XLFDT
DO ^DIC
IF +Y>0
Begin DoDot:1
+3 SET MSGIEN=+Y
+4 SET NEWIEN=$$RESEND^HLOAPI3(MSGIEN,.ERROR)
+5 IF '$DATA(ERROR)
WRITE !,"Message Resent, New Number: "_NEWIEN
HANG 2
+6 IF $DATA(ERROR)
WRITE !,ERROR
HANG 2
End DoDot:1
+7 QUIT
REPROC ;EP Reprocess one message
+1 NEW MSGIEN,DIC,DT,NEWIEN,ERROR,Y
+2 SET DIC=778
SET DIC(0)="AEQ"
SET DIC("A")="Select Message Number: "
SET DT=$$DT^XLFDT
DO ^DIC
IF +Y>0
Begin DoDot:1
+3 SET MSGIEN=+Y
+4 SET NEWIEN=$$REPROC^HLOAPI3(MSGIEN,.ERROR)
+5 IF NEWIEN=1
WRITE !,"Message Reprocessed successfully"
HANG 2
+6 IF NEWIEN=0
WRITE !,ERROR
HANG 2
End DoDot:1
+7 QUIT
SNDACK ;
+1 NEW MIEN,HLMSTATE,HLST,Y,MSA,MSGIEN,MSGBDY,APPARMS,X,DIC,DT,Y,ACK,ERR,ARY
+2 SET DIC=778
SET DIC(0)="AEQ"
SET DIC("A")="Select Message Number: "
SET DT=$$DT^XLFDT
DO ^DIC
IF +Y>0
Begin DoDot:1
+3 SET MIEN=+Y
+4 ;S MIEN=$P($G(^HLB(MSGIEN,0)),U,2)
+5 ;S MIEN=MSGIEN_"^"_MSGBDY
+6 SET APPARMS("QUEUE")="DENT ERX"
+7 SET APPARMS("ACK CODE")="AA"
+8 SET X=$$STARTMSG^HLOPRS(.HLMSTATE,MIEN)
+9 IF X=0
WRITE !,"Unable to setup application"
HANG 2
QUIT
+10 IF '$$ACK^HLOAPI2(.HLMSTATE,.APPARMS,.ACK,.ERR)
WRITE !,ERR
HANG 2
QUIT
+11 DO SET^BADEHL1(.ARY,"MSA",0)
+12 DO SET^BADEHL1(.ARY,APPARMS("ACK CODE"),1)
+13 SET MSA=$$ADDSEG^HLOAPI(.HLST,.ARY)
+14 IF '$$SENDACK^HLOAPI2(.ACK,.ERR)
WRITE !,ERR
HANG 2
+15 IF '$TEST
WRITE !,"Message sent"
End DoDot:1
+16 QUIT