| [613] | 1 | SCDXFU12 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;08-JUL-97
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**128**;AUG 13, 1993
 | 
|---|
 | 3 |  ;
 | 
|---|
 | 4 | PTR4MID(MID) ;Find entry in ACRP Transmission History file (#409.77) for
 | 
|---|
 | 5 |  ; a given HL7 Message Control ID
 | 
|---|
 | 6 |  ;
 | 
|---|
 | 7 |  ;Input  : MID - HL7 Message Control ID for the transmitted encounter
 | 
|---|
 | 8 |  ;Output : HistPtr ^ XmitPtr
 | 
|---|
 | 9 |  ;           HistPtr = Pointer to ACRP Transmission History file
 | 
|---|
 | 10 |  ;           XmitPtr = Pointer to related Transmitted Outpatient
 | 
|---|
 | 11 |  ;                     Encounter file (#409.73) entry
 | 
|---|
 | 12 |  ;         0 - Entry not found (bad input)
 | 
|---|
 | 13 |  ;
 | 
|---|
 | 14 |  ;Check input
 | 
|---|
 | 15 |  S MID=$G(MID)
 | 
|---|
 | 16 |  Q:(MID="") 0
 | 
|---|
 | 17 |  ;Declare variables
 | 
|---|
 | 18 |  N HISTPTR,XMITPTR
 | 
|---|
 | 19 |  ;Find entry in history file
 | 
|---|
 | 20 |  S HISTPTR=+$O(^SD(409.77,"AMID",MID,0))
 | 
|---|
 | 21 |  ;Bad x-ref entry
 | 
|---|
 | 22 |  Q:('$D(^SD(409.77,HISTPTR,0))) 0
 | 
|---|
 | 23 |  ;Get pointer to transmission file (.01 field of history file)
 | 
|---|
 | 24 |  S XMITPTR=+$G(^SD(409.77,HISTPTR,0))
 | 
|---|
 | 25 |  ;Done
 | 
|---|
 | 26 |  Q HISTPTR_"^"_XMITPTR
 | 
|---|
 | 27 |  ;
 | 
|---|
 | 28 | PTRS4BID(BID,ARRAY) ;Find all entries in ACRP Transmission History file
 | 
|---|
 | 29 |  ; (#409.77) for a given HL7 Batch Control ID
 | 
|---|
 | 30 |  ;
 | 
|---|
 | 31 |  ;Input  : BID - HL7 Batch Control ID for the transmitted encounters
 | 
|---|
 | 32 |  ;         ARRAY - Array to place output into (full global reference)
 | 
|---|
 | 33 |  ;               - Defaults to ^TMP("SCDXFU12",$J,"PTRS4BID")
 | 
|---|
 | 34 |  ;Output : X - Number of entries found
 | 
|---|
 | 35 |  ;         ARRAY(HistPtr) = XmitPtr
 | 
|---|
 | 36 |  ;           HistPtr = Pointer to ACRP Transmission History file
 | 
|---|
 | 37 |  ;           XmitPtr = Pointer to related Transmitted Outpatient
 | 
|---|
 | 38 |  ;                     Encounter file (#409.73) entry
 | 
|---|
 | 39 |  ;Notes  : It is the responsibility of the calling procedure to
 | 
|---|
 | 40 |  ;         initialize (i.e. KILL) the output array
 | 
|---|
 | 41 |  ;       : Zero (0) will be returned if no entries are found (bad input)
 | 
|---|
 | 42 |  ;
 | 
|---|
 | 43 |  ;Check input
 | 
|---|
 | 44 |  S BID=$G(BID)
 | 
|---|
 | 45 |  Q:(BID="") 0
 | 
|---|
 | 46 |  S ARRAY=$G(ARRAY)
 | 
|---|
 | 47 |  S:(ARRAY="") ARRAY=$NA(^TMP("SCDXFU12",$J,"PTRS4BID"))
 | 
|---|
 | 48 |  ;Declare variables
 | 
|---|
 | 49 |  N HISTPTR,XMITPTR,COUNT
 | 
|---|
 | 50 |  ;Find/count entries in history file
 | 
|---|
 | 51 |  S COUNT=0
 | 
|---|
 | 52 |  S HISTPTR=0
 | 
|---|
 | 53 |  F  S HISTPTR=+$O(^SD(409.77,"ABID",BID,HISTPTR)) Q:('HISTPTR)  D
 | 
|---|
 | 54 |  .;Bad x-ref entry (ignore)
 | 
|---|
 | 55 |  .Q:('$D(^SD(409.77,HISTPTR,0)))
 | 
|---|
 | 56 |  .;Get pointer to transmission file (.01 field of history file)
 | 
|---|
 | 57 |  .S XMITPTR=+$G(^SD(409.77,HISTPTR,0))
 | 
|---|
 | 58 |  .;Put into output array
 | 
|---|
 | 59 |  .S @ARRAY@(HISTPTR)=XMITPTR
 | 
|---|
 | 60 |  .;Increment counter
 | 
|---|
 | 61 |  .S COUNT=COUNT+1
 | 
|---|
 | 62 |  ;Done
 | 
|---|
 | 63 |  Q COUNT
 | 
|---|
 | 64 |  ;
 | 
|---|
 | 65 | ACKMID(MID,ACKDATE,ACKCODE) ;Store/update acknowledgement information
 | 
|---|
 | 66 |  ; for entry in ACRP Transmission History file (#409.77) with given
 | 
|---|
 | 67 |  ; HL7 Message Control ID
 | 
|---|
 | 68 |  ;
 | 
|---|
 | 69 |  ;Input  : MID - HL7 Message Control ID for transmitted encounters
 | 
|---|
 | 70 |  ;         ACKDATE - Date/time of acknowledgement (value for field #21)
 | 
|---|
 | 71 |  ;                 - Pass in FileMan format
 | 
|---|
 | 72 |  ;                 - Defaults to current date/time (NOW)
 | 
|---|
 | 73 |  ;         ACKCODE - Acknowledgemnt code (value for field #22)
 | 
|---|
 | 74 |  ;                 - A = Accepted     R = Rejected     E = Error
 | 
|---|
 | 75 |  ;                 - Defaults to E (Error)
 | 
|---|
 | 76 |  ;Output : None
 | 
|---|
 | 77 |  ;
 | 
|---|
 | 78 |  ;Check input
 | 
|---|
 | 79 |  S MID=$G(MID)
 | 
|---|
 | 80 |  Q:(MID="")
 | 
|---|
 | 81 |  S ACKDATE=+$G(ACKDATE)
 | 
|---|
 | 82 |  S:('ACKDATE) ACKDATE=$$NOW^XLFDT()
 | 
|---|
 | 83 |  S ACKCODE=$TR($G(ACKCODE),"are","ARE")
 | 
|---|
 | 84 |  S:(ACKCODE="") ACKCODE="E"
 | 
|---|
 | 85 |  S:($L(ACKCODE)>1) ACKCODE="E"
 | 
|---|
 | 86 |  S:("ARE"'[ACKCODE) ACKCODE="E"
 | 
|---|
 | 87 |  ;Declare variables
 | 
|---|
 | 88 |  N HISTPTR
 | 
|---|
 | 89 |  ;Find entry in history file - quit if none found
 | 
|---|
 | 90 |  S HISTPTR=+$$PTR4MID(MID)
 | 
|---|
 | 91 |  Q:('HISTPTR)
 | 
|---|
 | 92 |  ;Store/update ack data
 | 
|---|
 | 93 |  D ACKHIST^SCDXFU10(HISTPTR,ACKDATE,ACKCODE)
 | 
|---|
 | 94 |  ;Done
 | 
|---|
 | 95 |  Q
 | 
|---|
 | 96 |  ;
 | 
|---|
 | 97 | ACKBID(BID,ACKDATE,ACKCODE) ;Store/update acknowledgement information
 | 
|---|
 | 98 |  ; for all entries in ACRP Transmission History file (#409.77) for
 | 
|---|
 | 99 |  ; given HL7 Batch Control ID
 | 
|---|
 | 100 |  ;
 | 
|---|
 | 101 |  ;Input  : BID - HL7 Batch Control ID for transmitted encounters
 | 
|---|
 | 102 |  ;         ACKDATE - Date/time of acknowledgement (value for field #21)
 | 
|---|
 | 103 |  ;                 - Pass in FileMan format
 | 
|---|
 | 104 |  ;                 - Defaults to current date/time (NOW)
 | 
|---|
 | 105 |  ;         ACKCODE - Acknowledgemnt code (value for field #22)
 | 
|---|
 | 106 |  ;                 - A = Accepted     R = Rejected     E = Error
 | 
|---|
 | 107 |  ;                 - Defaults to E (Error)
 | 
|---|
 | 108 |  ;Output : None
 | 
|---|
 | 109 |  ;
 | 
|---|
 | 110 |  ;Check input
 | 
|---|
 | 111 |  S BID=$G(BID)
 | 
|---|
 | 112 |  Q:(BID="")
 | 
|---|
 | 113 |  S ACKDATE=+$G(ACKDATE)
 | 
|---|
 | 114 |  S:('ACKDATE) ACKDATE=$$NOW^XLFDT()
 | 
|---|
 | 115 |  S ACKCODE=$TR($G(ACKCODE),"are","ARE")
 | 
|---|
 | 116 |  S:(ACKCODE="") ACKCODE="E"
 | 
|---|
 | 117 |  S:($L(ACKCODE)>1) ACKCODE="E"
 | 
|---|
 | 118 |  S:("ARE"'[ACKCODE) ACKCODE="E"
 | 
|---|
 | 119 |  ;Declare variables
 | 
|---|
 | 120 |  N HISTARR,HISTPTR
 | 
|---|
 | 121 |  S HISTARR=$NA(^TMP("SCDXFU12",$J,"ACKBID"))
 | 
|---|
 | 122 |  K @HISTARR
 | 
|---|
 | 123 |  ;Find entries in history file - quit if none found
 | 
|---|
 | 124 |  Q:('$$PTRS4BID(BID,HISTARR))
 | 
|---|
 | 125 |  ;Loop through list of entries and store/update ack data
 | 
|---|
 | 126 |  S HISTPTR=0
 | 
|---|
 | 127 |  F  S HISTPTR=+$O(@HISTARR@(HISTPTR)) Q:('HISTPTR)  D ACKHIST^SCDXFU10(HISTPTR,ACKDATE,ACKCODE)
 | 
|---|
 | 128 |  ;Done - clean up and quit
 | 
|---|
 | 129 |  K @HISTARR
 | 
|---|
 | 130 |  Q
 | 
|---|