source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCDXFU10.m@ 1147

Last change on this file since 1147 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1SCDXFU10 ;ALB/JRP - ACRP TRANSMISSION MANAGEMENT FILE UTILS;03-JUL-97
2 ;;5.3;Scheduling;**128**;AUG 13, 1993
3 ;
4CRTHIST(XMITPTR,XMITDATE,MID4XMIT,BID4XMIT) ;Create entry in ACRP
5 ; Transmission History file (#409.77) for entry in Transmitted
6 ; Outpatient Encounter file (#409.73)
7 ;
8 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
9 ; Encounter file
10 ; XMITDATE - Date/time of transmission (value for field #11)
11 ; - Pass in FileMan format
12 ; - Defaults to current date/time (NOW)
13 ; MID4XMIT - Message ID of transmission (value for field #12)
14 ; BID4XMIT - Batch ID of transmission (value for field #13)
15 ;Output : HistPtr - Pointer to entry created
16 ; -1^ErrorText - Error/bad input
17 ;
18 ;Check input
19 S XMITPTR=+$G(XMITPTR)
20 Q:('$D(^SD(409.73,XMITPTR,0))) "-1^Did not pass valid pointer to TRANSMITTED OUTPATIENT ENCOUNTER file"
21 S XMITDATE=+$G(XMITDATE)
22 S:('XMITDATE) XMITDATE=$$NOW^XLFDT()
23 S MID4XMIT=$G(MID4XMIT)
24 Q:(MID4XMIT="") "-1^Did not pass HL7 Message Control ID given to the transmitted encounter"
25 S BID4XMIT=$G(BID4XMIT)
26 Q:(BID4XMIT="") "-1^Did not pass HL7 Batch Control ID given to the transmitted encounter"
27 ;Declare variables
28 N SCDXFDA,SCDXIEN,SCDXMSG,HISTPTR,TMP
29 ;Build FDA array
30 S SCDXFDA(409.77,"+1,",.01)=XMITPTR
31 ;Encounter date/time
32 S TMP=+$$EDT4XMIT^SCDXFU11(XMITPTR)
33 Q:('TMP) "-1^Unable to determine encounter date/time"
34 S SCDXFDA(409.77,"+1,",.02)=TMP
35 ;Patient
36 S TMP=+$$PAT4XMIT^SCDXUTL4(XMITPTR)
37 Q:('TMP) "-1^Unable to determine patient"
38 S SCDXFDA(409.77,"+1,",.03)=TMP
39 ;Clinic
40 S TMP=+$$LOC4XMIT^SCDXFU11(XMITPTR)
41 Q:('TMP) "-1^Unable to determine encounter's clinic"
42 S SCDXFDA(409.77,"+1,",.04)=TMP
43 ;Division
44 S TMP=+$$DIV4XMIT^SCDXFU11(XMITPTR)
45 Q:('TMP) "-1^Unable to determine encounter's division"
46 S SCDXFDA(409.77,"+1,",.05)=TMP
47 ;Visit ID
48 S TMP=$$VID4XMIT^SCDXFU11(XMITPTR)
49 Q:(TMP="") "-1^Unable to determine encounter's Unique Visit ID"
50 S SCDXFDA(409.77,"+1,",.06)=TMP
51 ;Transmission date/time
52 S SCDXFDA(409.77,"+1,",11)=XMITDATE
53 ;Message ID
54 S SCDXFDA(409.77,"+1,",12)=MID4XMIT
55 ;Batch ID
56 S SCDXFDA(409.77,"+1,",13)=BID4XMIT
57 ;Create entry
58 D UPDATE^DIE("S","SCDXFDA","SCDXIEN","SCDXMSG")
59 ;Get entry number created
60 S HISTPTR=+$G(SCDXIEN(1))
61 ;Error
62 Q:(('HISTPTR)!($D(SCDXMSG("DIERR")))) "-1^Unable to create entry in ACRP TRANSMISSION HISTORY file"
63 ;Done
64 Q HISTPTR
65 ;
66XMITHIST(HISTPTR,MID4XMIT,BID4XMIT) ;Store/update transmission information
67 ; for entry in ACRP Transmission History file (#409.77)
68 ;
69 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
70 ; MID4XMIT - Message ID of transmission (value for field #12)
71 ; BID4XMIT - Batch ID of transmission (value for field #13)
72 ;Output : None
73 ;Note : This call does not update the Date/time of Transmission
74 ; field (#11)
75 ;
76 ;Check input
77 S HISTPTR=+$G(HISTPTR)
78 Q:('$D(^SD(409.77,HISTPTR,0)))
79 S MID4XMIT=$G(MID4XMIT)
80 Q:(MID4XMIT="")
81 S BID4XMIT=$G(BID4XMIT)
82 Q:(BID4XMIT="")
83 ;Declare variables
84 N SCDXFDA,SCDXMSG,SCDXIENS
85 ;Set up FDA array
86 S SCDXIENS=HISTPTR_","
87 S SCDXFDA(409.77,SCDXIENS,12)=MID4XMIT
88 S SCDXFDA(409.77,SCDXIENS,13)=BID4XMIT
89 ;Store/update transmission info
90 D FILE^DIE("S","SCDXFDA","SCDXMSG")
91 ;Done
92 Q
93 ;
94ACKHIST(HISTPTR,ACKDATE,ACKCODE) ;Store/update acknowledgement
95 ; information for entry in ACRP Transmission History file (#409.77)
96 ;
97 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
98 ; ACKDATE - Date/time of acknowledgement (value for field #21)
99 ; - Pass in FileMan format
100 ; - Defaults to current date/time (NOW)
101 ; ACKCODE - Acknowledgement code (value for field #22)
102 ; - A = Accepted R = Rejected E = Error
103 ; - Defaults to E (Error)
104 ;Output : None
105 ;
106 ;Check input
107 S HISTPTR=+$G(HISTPTR)
108 Q:('$D(^SD(409.77,HISTPTR,0)))
109 S ACKDATE=+$G(ACKDATE)
110 S:('ACKDATE) ACKDATE=$$NOW^XLFDT()
111 S ACKCODE=$TR($G(ACKCODE),"are","ARE")
112 S:(ACKCODE="") ACKCODE="E"
113 S:($L(ACKCODE)>1) ACKCODE="E"
114 S:("ARE"'[ACKCODE) ACKCODE="E"
115 ;Declare variables
116 N SCDXFDA,SCDXMSG,SCDXIENS
117 ;Set up FDA array
118 S SCDXIENS=HISTPTR_","
119 S SCDXFDA(409.77,SCDXIENS,21)=ACKDATE
120 S SCDXFDA(409.77,SCDXIENS,22)=ACKCODE
121 ;Store/update transmission info
122 D FILE^DIE("S","SCDXFDA","SCDXMSG")
123 ;Done
124 Q
125 ;
126DELHIST(HISTPTR) ;Delete entry in ACRP Transmission History file
127 ; (#409.77)
128 ;
129 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
130 ;Output : None
131 ;
132 ;Check input
133 S HISTPTR=+$G(HISTPTR)
134 Q:('HISTPTR)
135 ;Declare variables
136 N DIK,DA,DIC,DIE,X,Y
137 ;Delete
138 S DIK="^SD(409.77,"
139 S DA=HISTPTR
140 D ^DIK
141 ;Done
142 Q
143 ;
144DELAHIST(XMITPTR) ;Delete all entries in ACRP Transmission History file
145 ; (#409.77) for entry in Transmitted Outpatient Encounter file (#409.73)
146 ;
147 ;Input : XMITPTR - Pointer to entry in Transmitted Outpatient
148 ; Encounter file
149 ;Output : None
150 ;
151 ;Check input
152 S XMITPTR=+$G(XMITPTR)
153 Q:('$D(^SD(409.73,XMITPTR,0)))
154 ;Declare variables
155 N HISTPTR
156 ;Loop through 'B' x-ref of history file and delete all entries found
157 S HISTPTR=0
158 F S HISTPTR=+$O(^SD(409.77,"B",XMITPTR,HISTPTR)) Q:('HISTPTR) D DELHIST(HISTPTR)
159 ;Done
160 Q
161 ;
162WIPEHIST(HISTPTR,WIPEFLAG) ;Delete transmission and acknowledgement
163 ; information for entry in ACRP Transmission History file (#409.77)
164 ;
165 ;Input : HISTPTR - Pointer to entry in ACRP Transmission History file
166 ; WIPEFLAG - Flag indicating which information to delete
167 ; 0 = Transmission & acknowledgment info (default)
168 ; 1 = Transmission information
169 ; 2 = Acknowledgement information
170 ;Output : None
171 ;Notes : This call should be used when the history information needs
172 ; to be deleted and the actual entry can not
173 ; : This call does not delete required fields (.01 - .06 & 11)
174 ;
175 ;Check input
176 S HISTPTR=+$G(HISTPTR)
177 Q:('$D(^SD(409.77,HISTPTR,0)))
178 S WIPEFLAG=+$G(WIPEFLAG)
179 S:((WIPEFLAG<0)!(WIPEFLAG>2)) WIPEFLAG=0
180 ;Declare variables
181 N SCDXFDA,SCDXMSG,SCDXIENS
182 ;Set up FDA array
183 S SCDXIENS=HISTPTR_","
184 ;Transmission info
185 I (WIPEFLAG'=2) D
186 .S SCDXFDA(409.77,SCDXIENS,12)=""
187 .S SCDXFDA(409.77,SCDXIENS,13)=""
188 ;Acknowledgement info
189 I (WIPEFLAG'=1) D
190 .S SCDXFDA(409.77,SCDXIENS,21)=""
191 .S SCDXFDA(409.77,SCDXIENS,22)=""
192 ;Delete requested info
193 D FILE^DIE("S","SCDXFDA","SCDXMSG")
194 ;Done
195 Q
Note: See TracBrowser for help on using the repository browser.