SCDXFU10 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;03-JUL-97
;;5.3;Scheduling;**128**;AUG 13, 1993
;
CRTHIST(XMITPTR,XMITDATE,MID4XMIT,BID4XMIT) ;Create entry in ACRP
; Transmission History file (#409.77) for entry in Transmitted
; Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
; XMITDATE - Date/time of transmission (value for field #11)
; - Pass in FileMan format
; - Defaults to current date/time (NOW)
; MID4XMIT - Message ID of transmission (value for field #12)
; BID4XMIT - Batch ID of transmission (value for field #13)
;Output : HistPtr - Pointer to entry created
; -1^ErrorText - Error/bad input
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) "-1^Did not pass valid pointer to TRANSMITTED OUTPATIENT ENCOUNTER file"
S XMITDATE=+$G(XMITDATE)
S:('XMITDATE) XMITDATE=$$NOW^XLFDT()
S MID4XMIT=$G(MID4XMIT)
Q:(MID4XMIT="") "-1^Did not pass HL7 Message Control ID given to the transmitted encounter"
S BID4XMIT=$G(BID4XMIT)
Q:(BID4XMIT="") "-1^Did not pass HL7 Batch Control ID given to the transmitted encounter"
;Declare variables
N SCDXFDA,SCDXIEN,SCDXMSG,HISTPTR,TMP
;Build FDA array
S SCDXFDA(409.77,"+1,",.01)=XMITPTR
;Encounter date/time
S TMP=+$$EDT4XMIT^SCDXFU11(XMITPTR)
Q:('TMP) "-1^Unable to determine encounter date/time"
S SCDXFDA(409.77,"+1,",.02)=TMP
;Patient
S TMP=+$$PAT4XMIT^SCDXUTL4(XMITPTR)
Q:('TMP) "-1^Unable to determine patient"
S SCDXFDA(409.77,"+1,",.03)=TMP
;Clinic
S TMP=+$$LOC4XMIT^SCDXFU11(XMITPTR)
Q:('TMP) "-1^Unable to determine encounter's clinic"
S SCDXFDA(409.77,"+1,",.04)=TMP
;Division
S TMP=+$$DIV4XMIT^SCDXFU11(XMITPTR)
Q:('TMP) "-1^Unable to determine encounter's division"
S SCDXFDA(409.77,"+1,",.05)=TMP
;Visit ID
S TMP=$$VID4XMIT^SCDXFU11(XMITPTR)
Q:(TMP="") "-1^Unable to determine encounter's Unique Visit ID"
S SCDXFDA(409.77,"+1,",.06)=TMP
;Transmission date/time
S SCDXFDA(409.77,"+1,",11)=XMITDATE
;Message ID
S SCDXFDA(409.77,"+1,",12)=MID4XMIT
;Batch ID
S SCDXFDA(409.77,"+1,",13)=BID4XMIT
;Create entry
D UPDATE^DIE("S","SCDXFDA","SCDXIEN","SCDXMSG")
;Get entry number created
S HISTPTR=+$G(SCDXIEN(1))
;Error
Q:(('HISTPTR)!($D(SCDXMSG("DIERR")))) "-1^Unable to create entry in ACRP TRANSMISSION HISTORY file"
;Done
Q HISTPTR
;
XMITHIST(HISTPTR,MID4XMIT,BID4XMIT) ;Store/update transmission information
; for entry in ACRP Transmission History file (#409.77)
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
; MID4XMIT - Message ID of transmission (value for field #12)
; BID4XMIT - Batch ID of transmission (value for field #13)
;Output : None
;Note : This call does not update the Date/time of Transmission
; field (#11)
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('$D(^SD(409.77,HISTPTR,0)))
S MID4XMIT=$G(MID4XMIT)
Q:(MID4XMIT="")
S BID4XMIT=$G(BID4XMIT)
Q:(BID4XMIT="")
;Declare variables
N SCDXFDA,SCDXMSG,SCDXIENS
;Set up FDA array
S SCDXIENS=HISTPTR_","
S SCDXFDA(409.77,SCDXIENS,12)=MID4XMIT
S SCDXFDA(409.77,SCDXIENS,13)=BID4XMIT
;Store/update transmission info
D FILE^DIE("S","SCDXFDA","SCDXMSG")
;Done
Q
;
ACKHIST(HISTPTR,ACKDATE,ACKCODE) ;Store/update acknowledgement
; information for entry in ACRP Transmission History file (#409.77)
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
; ACKDATE - Date/time of acknowledgement (value for field #21)
; - Pass in FileMan format
; - Defaults to current date/time (NOW)
; ACKCODE - Acknowledgement code (value for field #22)
; - A = Accepted R = Rejected E = Error
; - Defaults to E (Error)
;Output : None
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('$D(^SD(409.77,HISTPTR,0)))
S ACKDATE=+$G(ACKDATE)
S:('ACKDATE) ACKDATE=$$NOW^XLFDT()
S ACKCODE=$TR($G(ACKCODE),"are","ARE")
S:(ACKCODE="") ACKCODE="E"
S:($L(ACKCODE)>1) ACKCODE="E"
S:("ARE"'[ACKCODE) ACKCODE="E"
;Declare variables
N SCDXFDA,SCDXMSG,SCDXIENS
;Set up FDA array
S SCDXIENS=HISTPTR_","
S SCDXFDA(409.77,SCDXIENS,21)=ACKDATE
S SCDXFDA(409.77,SCDXIENS,22)=ACKCODE
;Store/update transmission info
D FILE^DIE("S","SCDXFDA","SCDXMSG")
;Done
Q
;
DELHIST(HISTPTR) ;Delete entry in ACRP Transmission History file
; (#409.77)
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
;Output : None
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('HISTPTR)
;Declare variables
N DIK,DA,DIC,DIE,X,Y
;Delete
S DIK="^SD(409.77,"
S DA=HISTPTR
D ^DIK
;Done
Q
;
DELAHIST(XMITPTR) ;Delete all entries in ACRP Transmission History file
; (#409.77) for entry in Transmitted Outpatient Encounter file (#409.73)
;
;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
; Encounter file
;Output : None
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0)))
;Declare variables
N HISTPTR
;Loop through 'B' x-ref of history file and delete all entries found
S HISTPTR=0
F S HISTPTR=+$O(^SD(409.77,"B",XMITPTR,HISTPTR)) Q:('HISTPTR) D DELHIST(HISTPTR)
;Done
Q
;
WIPEHIST(HISTPTR,WIPEFLAG) ;Delete transmission and acknowledgement
; information for entry in ACRP Transmission History file (#409.77)
;
;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
; WIPEFLAG - Flag indicating which information to delete
; 0 = Transmission & acknowledgment info (default)
; 1 = Transmission information
; 2 = Acknowledgement information
;Output : None
;Notes : This call should be used when the history information needs
; to be deleted and the actual entry can not
; : This call does not delete required fields (.01 - .06 & 11)
;
;Check input
S HISTPTR=+$G(HISTPTR)
Q:('$D(^SD(409.77,HISTPTR,0)))
S WIPEFLAG=+$G(WIPEFLAG)
S:((WIPEFLAG<0)!(WIPEFLAG>2)) WIPEFLAG=0
;Declare variables
N SCDXFDA,SCDXMSG,SCDXIENS
;Set up FDA array
S SCDXIENS=HISTPTR_","
;Transmission info
I (WIPEFLAG'=2) D
.S SCDXFDA(409.77,SCDXIENS,12)=""
.S SCDXFDA(409.77,SCDXIENS,13)=""
;Acknowledgement info
I (WIPEFLAG'=1) D
.S SCDXFDA(409.77,SCDXIENS,21)=""
.S SCDXFDA(409.77,SCDXIENS,22)=""
;Delete requested info
D FILE^DIE("S","SCDXFDA","SCDXMSG")
;Done
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXFU10 6648 printed Nov 22, 2024@17:49:09 Page 2
SCDXFU10 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;03-JUL-97
+1 ;;5.3;Scheduling;**128**;AUG 13, 1993
+2 ;
CRTHIST(XMITPTR,XMITDATE,MID4XMIT,BID4XMIT) ;Create entry in ACRP
+1 ; Transmission History file (#409.77) for entry in Transmitted
+2 ; Outpatient Encounter file (#409.73)
+3 ;
+4 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+5 ; Encounter file
+6 ; XMITDATE - Date/time of transmission (value for field #11)
+7 ; - Pass in FileMan format
+8 ; - Defaults to current date/time (NOW)
+9 ; MID4XMIT - Message ID of transmission (value for field #12)
+10 ; BID4XMIT - Batch ID of transmission (value for field #13)
+11 ;Output : HistPtr - Pointer to entry created
+12 ; -1^ErrorText - Error/bad input
+13 ;
+14 ;Check input
+15 SET XMITPTR=+$GET(XMITPTR)
+16 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT "-1^Did not pass valid pointer to TRANSMITTED OUTPATIENT ENCOUNTER file"
+17 SET XMITDATE=+$GET(XMITDATE)
+18 if ('XMITDATE)
SET XMITDATE=$$NOW^XLFDT()
+19 SET MID4XMIT=$GET(MID4XMIT)
+20 if (MID4XMIT="")
QUIT "-1^Did not pass HL7 Message Control ID given to the transmitted encounter"
+21 SET BID4XMIT=$GET(BID4XMIT)
+22 if (BID4XMIT="")
QUIT "-1^Did not pass HL7 Batch Control ID given to the transmitted encounter"
+23 ;Declare variables
+24 NEW SCDXFDA,SCDXIEN,SCDXMSG,HISTPTR,TMP
+25 ;Build FDA array
+26 SET SCDXFDA(409.77,"+1,",.01)=XMITPTR
+27 ;Encounter date/time
+28 SET TMP=+$$EDT4XMIT^SCDXFU11(XMITPTR)
+29 if ('TMP)
QUIT "-1^Unable to determine encounter date/time"
+30 SET SCDXFDA(409.77,"+1,",.02)=TMP
+31 ;Patient
+32 SET TMP=+$$PAT4XMIT^SCDXUTL4(XMITPTR)
+33 if ('TMP)
QUIT "-1^Unable to determine patient"
+34 SET SCDXFDA(409.77,"+1,",.03)=TMP
+35 ;Clinic
+36 SET TMP=+$$LOC4XMIT^SCDXFU11(XMITPTR)
+37 if ('TMP)
QUIT "-1^Unable to determine encounter's clinic"
+38 SET SCDXFDA(409.77,"+1,",.04)=TMP
+39 ;Division
+40 SET TMP=+$$DIV4XMIT^SCDXFU11(XMITPTR)
+41 if ('TMP)
QUIT "-1^Unable to determine encounter's division"
+42 SET SCDXFDA(409.77,"+1,",.05)=TMP
+43 ;Visit ID
+44 SET TMP=$$VID4XMIT^SCDXFU11(XMITPTR)
+45 if (TMP="")
QUIT "-1^Unable to determine encounter's Unique Visit ID"
+46 SET SCDXFDA(409.77,"+1,",.06)=TMP
+47 ;Transmission date/time
+48 SET SCDXFDA(409.77,"+1,",11)=XMITDATE
+49 ;Message ID
+50 SET SCDXFDA(409.77,"+1,",12)=MID4XMIT
+51 ;Batch ID
+52 SET SCDXFDA(409.77,"+1,",13)=BID4XMIT
+53 ;Create entry
+54 DO UPDATE^DIE("S","SCDXFDA","SCDXIEN","SCDXMSG")
+55 ;Get entry number created
+56 SET HISTPTR=+$GET(SCDXIEN(1))
+57 ;Error
+58 if (('HISTPTR)!($DATA(SCDXMSG("DIERR"))))
QUIT "-1^Unable to create entry in ACRP TRANSMISSION HISTORY file"
+59 ;Done
+60 QUIT HISTPTR
+61 ;
XMITHIST(HISTPTR,MID4XMIT,BID4XMIT) ;Store/update transmission information
+1 ; for entry in ACRP Transmission History file (#409.77)
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ; MID4XMIT - Message ID of transmission (value for field #12)
+5 ; BID4XMIT - Batch ID of transmission (value for field #13)
+6 ;Output : None
+7 ;Note : This call does not update the Date/time of Transmission
+8 ; field (#11)
+9 ;
+10 ;Check input
+11 SET HISTPTR=+$GET(HISTPTR)
+12 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT
+13 SET MID4XMIT=$GET(MID4XMIT)
+14 if (MID4XMIT="")
QUIT
+15 SET BID4XMIT=$GET(BID4XMIT)
+16 if (BID4XMIT="")
QUIT
+17 ;Declare variables
+18 NEW SCDXFDA,SCDXMSG,SCDXIENS
+19 ;Set up FDA array
+20 SET SCDXIENS=HISTPTR_","
+21 SET SCDXFDA(409.77,SCDXIENS,12)=MID4XMIT
+22 SET SCDXFDA(409.77,SCDXIENS,13)=BID4XMIT
+23 ;Store/update transmission info
+24 DO FILE^DIE("S","SCDXFDA","SCDXMSG")
+25 ;Done
+26 QUIT
+27 ;
ACKHIST(HISTPTR,ACKDATE,ACKCODE) ;Store/update acknowledgement
+1 ; information for entry in ACRP Transmission History file (#409.77)
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ; ACKDATE - Date/time of acknowledgement (value for field #21)
+5 ; - Pass in FileMan format
+6 ; - Defaults to current date/time (NOW)
+7 ; ACKCODE - Acknowledgement code (value for field #22)
+8 ; - A = Accepted R = Rejected E = Error
+9 ; - Defaults to E (Error)
+10 ;Output : None
+11 ;
+12 ;Check input
+13 SET HISTPTR=+$GET(HISTPTR)
+14 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT
+15 SET ACKDATE=+$GET(ACKDATE)
+16 if ('ACKDATE)
SET ACKDATE=$$NOW^XLFDT()
+17 SET ACKCODE=$TRANSLATE($GET(ACKCODE),"are","ARE")
+18 if (ACKCODE="")
SET ACKCODE="E"
+19 if ($LENGTH(ACKCODE)>1)
SET ACKCODE="E"
+20 if ("ARE"'[ACKCODE)
SET ACKCODE="E"
+21 ;Declare variables
+22 NEW SCDXFDA,SCDXMSG,SCDXIENS
+23 ;Set up FDA array
+24 SET SCDXIENS=HISTPTR_","
+25 SET SCDXFDA(409.77,SCDXIENS,21)=ACKDATE
+26 SET SCDXFDA(409.77,SCDXIENS,22)=ACKCODE
+27 ;Store/update transmission info
+28 DO FILE^DIE("S","SCDXFDA","SCDXMSG")
+29 ;Done
+30 QUIT
+31 ;
DELHIST(HISTPTR) ;Delete entry in ACRP Transmission History file
+1 ; (#409.77)
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ;Output : None
+5 ;
+6 ;Check input
+7 SET HISTPTR=+$GET(HISTPTR)
+8 if ('HISTPTR)
QUIT
+9 ;Declare variables
+10 NEW DIK,DA,DIC,DIE,X,Y
+11 ;Delete
+12 SET DIK="^SD(409.77,"
+13 SET DA=HISTPTR
+14 DO ^DIK
+15 ;Done
+16 QUIT
+17 ;
DELAHIST(XMITPTR) ;Delete all entries in ACRP Transmission History file
+1 ; (#409.77) for entry in Transmitted Outpatient Encounter file (#409.73)
+2 ;
+3 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
+4 ; Encounter file
+5 ;Output : None
+6 ;
+7 ;Check input
+8 SET XMITPTR=+$GET(XMITPTR)
+9 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT
+10 ;Declare variables
+11 NEW HISTPTR
+12 ;Loop through 'B' x-ref of history file and delete all entries found
+13 SET HISTPTR=0
+14 FOR
SET HISTPTR=+$ORDER(^SD(409.77,"B",XMITPTR,HISTPTR))
if ('HISTPTR)
QUIT
DO DELHIST(HISTPTR)
+15 ;Done
+16 QUIT
+17 ;
WIPEHIST(HISTPTR,WIPEFLAG) ;Delete transmission and acknowledgement
+1 ; information for entry in ACRP Transmission History file (#409.77)
+2 ;
+3 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
+4 ; WIPEFLAG - Flag indicating which information to delete
+5 ; 0 = Transmission & acknowledgment info (default)
+6 ; 1 = Transmission information
+7 ; 2 = Acknowledgement information
+8 ;Output : None
+9 ;Notes : This call should be used when the history information needs
+10 ; to be deleted and the actual entry can not
+11 ; : This call does not delete required fields (.01 - .06 & 11)
+12 ;
+13 ;Check input
+14 SET HISTPTR=+$GET(HISTPTR)
+15 if ('$DATA(^SD(409.77,HISTPTR,0)))
QUIT
+16 SET WIPEFLAG=+$GET(WIPEFLAG)
+17 if ((WIPEFLAG<0)!(WIPEFLAG>2))
SET WIPEFLAG=0
+18 ;Declare variables
+19 NEW SCDXFDA,SCDXMSG,SCDXIENS
+20 ;Set up FDA array
+21 SET SCDXIENS=HISTPTR_","
+22 ;Transmission info
+23 IF (WIPEFLAG'=2)
Begin DoDot:1
+24 SET SCDXFDA(409.77,SCDXIENS,12)=""
+25 SET SCDXFDA(409.77,SCDXIENS,13)=""
End DoDot:1
+26 ;Acknowledgement info
+27 IF (WIPEFLAG'=1)
Begin DoDot:1
+28 SET SCDXFDA(409.77,SCDXIENS,21)=""
+29 SET SCDXFDA(409.77,SCDXIENS,22)=""
End DoDot:1
+30 ;Delete requested info
+31 DO FILE^DIE("S","SCDXFDA","SCDXMSG")
+32 ;Done
+33 QUIT