PXRM7API ;SLC/JVS Clinical Reminders HL7 API; 09/21/2006
;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
;This is the beginning of the HL7 API's
;
;VARIABLE LIST
;IEN = IEN OF ENTRY IN EXTRACT FILE 810.3
Q
;======================================================
HL7(IEN,SEE,ID) ;AllRequiredParameters
;IEN= The Ien of the entry in file 810.3 (Extract File)
;SEE=If you want to view the HL7 message, set to 1
;.ID= ID of the message.
;MODE=A or I A=from archive I=initial Load
D EXTRACT^PXRM7XT(IEN,SEE,.ID)
Q
;=======================================================
STATUS(ID) ;
;RETURNS THE STATUS OF THE MESSAGE
;ID= MESSAGE ID WHICH IS THE IEN IN FILE #772
D STORE
N IEND0,IEND1,STATUS
S STATUS=""
Q:'$D(^PXRMXT(810.3,"AHLID"))
S IEND0=$O(^PXRMXT(810.3,"AHLID",ID,0))
S IEND1=$O(^PXRMXT(810.3,"AHLID",ID,IEND0,0))
S STATUS=$P($G(^PXRMXT(810.3,IEND0,5,IEND1,0)),"^",3)
Q STATUS
;=======================================================
STATUS2(ID) ;
;RETURNS THE STATUS OF THE MESSAGE
;ID= MESSAGE ID WHICH IS THE IEN IN FILE #772
N IDD,ID1,ID2,STATUS
S STATUS=""
S ID1=$O(^HL(772,"C",ID,0))
S ID2=$O(^HL(772,"C",ID,ID1))
D GETS^DIQ(772,ID2,20,"E","STATUS")
S IDD=ID2_","
S STATUS=$G(STATUS(772,IDD,20,"E"))
Q STATUS
;======================================================
STORE ;
N IEND0,IEND1,HL7ID,STATHL,STATX
S HL7ID=""
S IEND0=0 F S IEND0=$O(^PXRMXT(810.3,IEND0)) Q:IEND0="" D
.S IEND1=0 F S IEND1=$O(^PXRMXT(810.3,IEND0,5,IEND1)) Q:IEND1="" D
..S HL7ID=$P($G(^PXRMXT(810.3,IEND0,5,IEND1,0)),"^",1)
..Q:HL7ID=""
..S STATHL=$$STATUS2^PXRM7API(HL7ID)
..S STATX=$P(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)
..I STATHL'="" D
...S $P(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)=STATHL
..I STATHL="",STATX="" D
...S $P(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)="Successfully Completed"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRM7API 1891 printed Sep 15, 2024@21:07:07 Page 2
PXRM7API ;SLC/JVS Clinical Reminders HL7 API; 09/21/2006
+1 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
+2 ;This is the beginning of the HL7 API's
+3 ;
+4 ;VARIABLE LIST
+5 ;IEN = IEN OF ENTRY IN EXTRACT FILE 810.3
+6 QUIT
+7 ;======================================================
HL7(IEN,SEE,ID) ;AllRequiredParameters
+1 ;IEN= The Ien of the entry in file 810.3 (Extract File)
+2 ;SEE=If you want to view the HL7 message, set to 1
+3 ;.ID= ID of the message.
+4 ;MODE=A or I A=from archive I=initial Load
+5 DO EXTRACT^PXRM7XT(IEN,SEE,.ID)
+6 QUIT
+7 ;=======================================================
STATUS(ID) ;
+1 ;RETURNS THE STATUS OF THE MESSAGE
+2 ;ID= MESSAGE ID WHICH IS THE IEN IN FILE #772
+3 DO STORE
+4 NEW IEND0,IEND1,STATUS
+5 SET STATUS=""
+6 if '$DATA(^PXRMXT(810.3,"AHLID"))
QUIT
+7 SET IEND0=$ORDER(^PXRMXT(810.3,"AHLID",ID,0))
+8 SET IEND1=$ORDER(^PXRMXT(810.3,"AHLID",ID,IEND0,0))
+9 SET STATUS=$PIECE($GET(^PXRMXT(810.3,IEND0,5,IEND1,0)),"^",3)
+10 QUIT STATUS
+11 ;=======================================================
STATUS2(ID) ;
+1 ;RETURNS THE STATUS OF THE MESSAGE
+2 ;ID= MESSAGE ID WHICH IS THE IEN IN FILE #772
+3 NEW IDD,ID1,ID2,STATUS
+4 SET STATUS=""
+5 SET ID1=$ORDER(^HL(772,"C",ID,0))
+6 SET ID2=$ORDER(^HL(772,"C",ID,ID1))
+7 DO GETS^DIQ(772,ID2,20,"E","STATUS")
+8 SET IDD=ID2_","
+9 SET STATUS=$GET(STATUS(772,IDD,20,"E"))
+10 QUIT STATUS
+11 ;======================================================
STORE ;
+1 NEW IEND0,IEND1,HL7ID,STATHL,STATX
+2 SET HL7ID=""
+3 SET IEND0=0
FOR
SET IEND0=$ORDER(^PXRMXT(810.3,IEND0))
if IEND0=""
QUIT
Begin DoDot:1
+4 SET IEND1=0
FOR
SET IEND1=$ORDER(^PXRMXT(810.3,IEND0,5,IEND1))
if IEND1=""
QUIT
Begin DoDot:2
+5 SET HL7ID=$PIECE($GET(^PXRMXT(810.3,IEND0,5,IEND1,0)),"^",1)
+6 if HL7ID=""
QUIT
+7 SET STATHL=$$STATUS2^PXRM7API(HL7ID)
+8 SET STATX=$PIECE(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)
+9 IF STATHL'=""
Begin DoDot:3
+10 SET $PIECE(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)=STATHL
End DoDot:3
+11 IF STATHL=""
IF STATX=""
Begin DoDot:3
+12 SET $PIECE(^PXRMXT(810.3,IEND0,5,IEND1,0),"^",3)="Successfully Completed"
End DoDot:3
End DoDot:2
End DoDot:1
+13 QUIT
+14 ;