source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCDXFU02.m@ 1133

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

initial load of WorldVistAEHR

File size: 6.8 KB
RevLine 
[613]1SCDXFU02 ;ALB/JRP - AMB CARE FILE UTILITIES;03-MAY-1996 ; 17 Apr 2000 5:27 PM
2 ;;5.3;Scheduling;**44,110,128,66,215**;AUG 13, 1993
3 ;
4CRTDEL(ENCDATE,DFN,DELDATE,ENCNODE) ;Create entry in DELETED OUTPATIENT
5 ; ENCOUNTER file (#409.74)
6 ;
7 ;Input : ENCDATE - Date/time Outpatient Encounter occurred in
8 ; FileMan format
9 ; DFN - Pointer to entry in PATIENT file (#2) that the
10 ; deleted Outpatient Encounter was for
11 ; DELDATE - FileMan date/time Outpatient Encounter was deleted
12 ; (Defaults to NOW)
13 ; ENCNODE - Zero node of entry in OUTPATIENT ENCOUNTER file
14 ; (#409.68) that was deleted
15 ;Output : DELPTR - Pointer to entry in DELETED OUTPATIENT ENCOUNTER
16 ; file (#409.74)
17 ; -1^Error - Unable to create entry / bad input
18 ;
19 ;Check input
20 S ENCDATE=+$G(ENCDATE)
21 Q:('ENCDATE) "-1^Did not pass date/time Outpatient Encounter occurred"
22 S DFN=+$G(DFN)
23 Q:('$D(^DPT(DFN,0))) "-1^Did not pass valid pointer to patient"
24 S DELDATE=+$G(DELDATE)
25 S:('DELDATE) DELDATE="NOW"
26 S ENCNODE=$G(ENCNODE)
27 ;Declare variables
28 N DIC,DA,DINUM,DLAYGO,DIDEL,DELPTR
29 ;Create entry
30 S DIC="^SD(409.74,"
31 S DIC(0)="L"
32 S X=ENCDATE
33 S DIC("DR")=".02////^S X=DFN;.03///^S X=DELDATE;11////^S X=ENCNODE"
34 S DLAYGO=409.74
35 K DD,DO D FILE^DICN
36 ;Get pointer to entry
37 S DELPTR=+Y
38 ;Error creating entry
39 S:(DELPTR<0) DELPTR="-1^Unable to create entry in Deleted Outpatient Encounter file"
40 ;Done
41 Q DELPTR
42 ;
43DELDEL(DELPTR) ;Delete entry in DELETED OUTPATIENT ENCOUNTER file (#409.74)
44 ;
45 ;Input : DELDEL
46 ;Output : 0 - Success
47 ; -1 - Unable to delete entry
48 ;Note : Success (0) is returned when a valid pointer to the
49 ; DELETED OUTPATIENT ENCOUNTER ERROR file is not passed
50 ; (Deleting an entry that doesn't exist is successful)
51 ; : It is the calling application's responsibility to also
52 ; delete the related entry in the TRANSMITTED OUTPATIENT
53 ; ENCOUNTER file (#409.73)
54 ;
55 ;Check input
56 S DELPTR=+$G(DELPTR)
57 Q:('$D(^SD(409.74,DELPTR,0))) 0
58 ;Declare variables
59 N DIK,DA,X,Y,DIC
60 ;Delete entry
61 S DIK="^SD(409.74,"
62 S DA=DELPTR
63 D ^DIK
64 ;Done
65 Q 0
66 ;
67PTR4MID(MID) ;Find entry in TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73)
68 ; using Message Control ID
69 ;
70 ;Input : MID - Message Control ID used when entry was transmitted to
71 ; National Patient Care Database
72 ;Output : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
73 ; ENCOUNTER file (#409.73)
74 ; 0 - Entry in TRANSMITTED OUTPATIENT ENCOUNTER file with
75 ; given Message Control ID could not be found
76 ;
77 ;Check input
78 S MID=$G(MID)
79 Q:(MID="") 0
80 ;Find entry - done
81 Q +$O(^SD(409.73,"AACMID",MID,""))
82 ;
83PTRS4BID(BID,ARRAY) ;Find all entries in TRANSMITTED OUTPATIENT ENCOUNTER
84 ; file (#409.73) with a specified Batch Control ID
85 ;
86 ;Input : BID - Batch Control ID used when entries were transmitted
87 ; to National Patient Care Database
88 ; ARRAY - Array to place pointers to TRANSMITTED OUTPATIENT
89 ; ENCOUNTER file (#409.73) into (Full global reference)
90 ; (Defaults to ^TMP("AMB-CARE",$J,"BID"))
91 ;Output : None
92 ; ARRAY(XMITPTR) - Array of pointers to TRANSMITTED OUTPATIENT
93 ; ENCOUNTER file (#409.73)
94 ;Note : It is the responsibility of the calling procedure to
95 ; initialize (i.e. KILL) ARRAY
96 ;
97 ;Check input
98 S BID=$G(BID)
99 Q:(BID="")
100 S ARRAY=$G(ARRAY)
101 S:(ARRAY="") ARRAY="^TMP(""AMB-CARE"","_$J_",""BID"")"
102 ;Build array of pointers (merge AACBID cross reference into ARRAY)
103 M @ARRAY=^SD(409.73,"AACBID",BID)
104 Q
105 ;
106CRTERR(XMITPTR,ERRCODE,NPCD) ;Create entry in TRANSMITTED OUTPATIENT ENCOUNTER
107 ; ERROR file (#409.75)
108 ;
109 ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
110 ; ENCOUNTER file (#409.73)
111 ; ERRCODE - Error code (external format)
112 ; NPCD - '1' if filed by Austin acknowledgment (optional)
113 ;
114 ;Output : ERRPTR - Pointer to entry in TRANSMITTED OUTPATIENT ENCOUNTER
115 ; ERROR file (#409.75)
116 ; -1^Error - Unable to create entry / bad input
117 ;Notes : ERRCODE must be a valid entry in TRANSMITTED OUTPATIENT
118 ; ENCOUNTER ERROR CODE file (#409.76)
119 ;
120 ;Check input
121 ;Convert code to 'reason unknown' if necessary
122 I $G(NPCD) D
123 .I '$L(ERRCODE) S ERRCODE=999 Q
124 .I '$O(^SD(409.76,"B",ERRCODE,"")) S ERRCODE=999
125 .Q
126 S XMITPTR=+$G(XMITPTR)
127 Q:('$D(^SD(409.73,XMITPTR,0))) "-1^Did not pass valid pointer to Transmitted Outpatient Encounter"
128 S ERRCODE=$G(ERRCODE)
129 Q:(ERRCODE="") "-1^Did not pass valid error code"
130 Q:('$O(^SD(409.76,"B",ERRCODE,""))) "-1^Did not pass valid error code"
131 ;Declare variables
132 N DIC,DA,DINUM,DLAYGO,X,Y
133 ;Create entry
134 S DIC="^SD(409.75,"
135 S DIC(0)="L"
136 S DLAYGO=409.75
137 S X=XMITPTR
138 S DIC("DR")=".02///^S X=ERRCODE"
139 K DD,DO D FILE^DICN
140 ;Get pointer to entry
141 S ERRPTR=+Y
142 ;Error creating entry
143 S:(ERRPTR<0) ERRPTR="-1^Unable to create entry in Transmitted Outpatient Encounter Error file"
144 ;Done
145 Q ERRPTR
146 ;
147DELERR(ERRPTR) ;Delete entry in TRANSMITTED OUTPATIENT ENCOUNTER ERROR
148 ; file (#409.75)
149 ;
150 ;Input : ERRPTR - Pointer to entry in TRANSMITTED OUTPATIENT ENCOUNTER
151 ; ERROR file (#409.75) to delete
152 ;Output : 0 - Success
153 ; -1 - Unable to delete entry
154 ;Note : Success (0) is returned when a valid pointer to the
155 ; TRANSMITTED OUTPATIENT ENCOUNTER ERROR file is not passed
156 ; (Deleting an entry that doesn't exist is successful)
157 ;
158 ;Check input
159 S ERRPTR=+$G(ERRPTR)
160 Q:('$D(^SD(409.75,ERRPTR,0))) 0
161 ;Declare variables
162 N DIK,DA,X,Y,DIC
163 ;Delete entry
164 S DIK="^SD(409.75,"
165 S DA=ERRPTR
166 D ^DIK
167 ;Done
168 Q 0
169 ;
170DELAERR(XMITPTR,ERR) ;Delete all entries in TRANSMITTED OUTPATIENT ENCOUNTER
171 ; ERROR file (#409.75) for a Transmitted Outpatient Encounter
172 ;
173 ;Input : XMITPTR - Pointer to entry in TRANSMITTED OUTPATIENT
174 ; ENCOUNTER file (#409.73) to delete errors for
175 ; ERR - Which error to delete.
176 ; 0 OR NOTHING - delete ALL errors
177 ; 1 - VISTA errors
178 ; 2 - NPCDB errors
179 ; 3 - HL7 errors
180 ;
181 ;Output : None
182 ;
183 ;Check input
184 S XMITPTR=+$G(XMITPTR)
185 S ERR=+$G(ERR)
186 ;Declare variables
187 N ERRPTR,TMP
188 ;Find all entries in Transmitted Outpatient Encounter Error file that
189 ; point to the Transmitted Outpatient Encounter and delete
190 S ERRPTR=""
191 F S ERRPTR=+$O(^SD(409.75,"B",XMITPTR,ERRPTR)) Q:('ERRPTR) DO
192 .I '+ERR S TMP=$$DELERR(ERRPTR) ;default and all
193 .N ERTYPE
194 .S ERTYPE=+$P($G(^SD(409.75,ERRPTR,0)),U,2)
195 .Q:'ERTYPE
196 .S ERTYPE=$P($G(^SD(409.76,ERTYPE,0)),U,2)
197 .I ERR=1,ERTYPE="V" S TMP=$$DELERR(ERRPTR) ;delete vista errors
198 .I ERR=2,ERTYPE="N" S TMP=$$DELERR(ERRPTR) ;delete NPCDB errors
199 .I ERR=3,ERTYPE="T" S TMP=$$DELERR(ERRPTR) ;delete HL7 errors
200 .Q
201 ;Done
202 Q
Note: See TracBrowser for help on using the repository browser.