source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGQEREQ.m@ 1586

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1DGQEREQ ;ALB/RPM - VIC REPLACEMENT VIC REQUEST FILE ACCESS API'S ; 12/09/03
2 ;;5.3;Registration;**571**;Aug 13, 1993
3 ;
4 ; This routine contains the functions and procedures used to access
5 ; and manipulate the VIC REQUEST (#39.6) file.
6 ;
7 ; $$FINDCID - locate NCMD Card ID
8 ; $$FINDLST - locate last (most recent) VIC request
9 ; $$GETREQ - retrieve a single VIC REQUEST record
10 ; $$STOCID - store the NCMD Card ID
11 ; $$STOSTAT - store the Card Print Release Status
12 ; $$DELREQ - delete a single VIC REQUEST record
13 ;
14 Q ;no direct entry
15 ;
16FINDCID(DGCID) ;locate record for a given NCMD Card ID
17 ; This function performs a lookup of the VIC REQUEST (#39.6) file
18 ; for a given Card ID.
19 ;
20 ; Input:
21 ; DGCID - NCMD Card ID
22 ;
23 ; Output:
24 ; Function value - IEN of VIC REQUEST on success;
25 ; 0 on failure
26 ;
27 Q:$G(DGCID)']"" 0
28 Q +$O(^DGQE(39.6,"B",DGCID,""))
29 ;
30 ;
31FINDLST(DGDFN) ;locate the IEN of the last request for a given patient
32 ;
33 ; Input:
34 ; DGDFN - pointer to patient in PATIENT (#2) file
35 ;
36 ; Output:
37 ; Function value - IEN of VIC REQUEST (#39.6) file on success,
38 ; 0 on failure
39 ;
40 N DGDAT
41 ;
42 S DGDFN=+$G(DGDFN)
43 S DGDAT=+$O(^DGQE(39.6,"APDAT",DGDFN,""),-1)
44 Q +$O(^DGQE(39.6,"APDAT",DGDFN,DGDAT,0))
45 ;
46 ;
47GETREQ(DGIEN,DGREQ) ;retrieve a single record
48 ; This function retrieves all fields belonging to a single record
49 ; in the VIC REQUEST (#39.6) file for a given IEN. The field data
50 ; is placed in an array format.
51 ;
52 ; Input:
53 ; DGIEN - VIC REQUEST (#39.6) file record number
54 ;
55 ; Output:
56 ; Function value - 1 on success, 0 on failure
57 ; DGREQ - array of field data
58 ; Array subscripts are:
59 ; "DFN" - pointer to patient in PATIENT (#2) file
60 ; "CARDID" - NCMD Card ID
61 ; "NAME" - patient name
62 ; "CPRSTAT" - card print release status
63 ; "REQDATE" - VIC Request Date in internal format
64 ;
65 N DGERR ;FM result error message
66 N DGFIL ;FM file number
67 N DGFLD ;FM result field array
68 N DGIENS ;FM IENS value
69 N DGRSLT ;Function value
70 ;
71 S DGRSLT=0
72 S DGFIL=39.6
73 ;
74 I $G(DGIEN),$D(^DGQE(DGFIL,DGIEN)) D
75 . S DGIENS=DGIEN_","
76 . D GETS^DIQ(DGFIL,DGIENS,"*","IE","DGFLD","DGERR")
77 . Q:$D(DGERR)
78 . S DGREQ("CARDID")=$G(DGFLD(DGFIL,DGIENS,.01,"I"))
79 . S DGREQ("DFN")=$G(DGFLD(DGFIL,DGIENS,.02,"I"))
80 . S DGREQ("NAME")=$G(DGFLD(DGFIL,DGIENS,.02,"E"))
81 . S DGREQ("CPRSTAT")=$G(DGFLD(DGFIL,DGIENS,.03,"I"))
82 . S DGREQ("REQDT")=$G(DGFLD(DGFIL,DGIENS,.04,"I"))
83 . S DGRSLT=1 ;success
84 ;
85 Q DGRSLT
86 ;
87 ;
88STOCID(DGCID,DGDFN,DGSTAT) ;store the NCMD-assigned Card ID
89 ; This procedure creates a record in the VIC REQUEST (#39.6) file.
90 ;
91 ; Input:
92 ; DGCID - Card ID [format: lastname_"-"_SSN_"-"_number of requests]
93 ; DGDFN - pointer to patient in PATIENT(#2) file
94 ; DGSTAT - Card Print Release Status
95 ;
96 ; Output:
97 ; none
98 ;
99 N DGERR
100 N DGFDA
101 N DGFIL
102 N DGIEN
103 N DGIENS
104 ;
105 S DGFIL=39.6
106 ;
107 ;validate input params
108 Q:+$G(DGDFN)'>0
109 Q:'$D(^DPT(DGDFN,0))
110 Q:$G(DGCID)']""
111 Q:$$EXTERNAL^DILFD(DGFIL,.03,"F",$G(DGSTAT),"")']""
112 ;
113 S DGIEN=$$FINDCID(DGCID)
114 S DGIENS=$S('DGIEN:"+1,",1:DGIEN_",")
115 ;
116 S DGFDA(DGFIL,DGIENS,.01)=DGCID
117 S DGFDA(DGFIL,DGIENS,.02)=DGDFN
118 S DGFDA(DGFIL,DGIENS,.03)=DGSTAT
119 S DGFDA(DGFIL,DGIENS,.04)=$$NOW^XLFDT()
120 D UPDATE^DIE("","DGFDA","","DGERR")
121 ;
122 Q
123 ;
124 ;
125STOSTAT(DGIEN,DGSTAT) ;update CARD PRINT RELEASE STATUS
126 ; This procedure is used to update the CARD PRINT RELEASE STATUS(#.03)
127 ; field of the VIC REQUEST (#39.6) file.
128 ;
129 ; Input:
130 ; DGIEN - IEN of VIC REQUEST file record
131 ; DGSTAT - card print release status
132 ;
133 ; Output:
134 ; none
135 ;
136 N DGERR
137 N DGFDA
138 N DGFIL
139 ;
140 S DGFIL=39.6
141 ;
142 ;validate input parameters
143 Q:'$G(DGIEN)
144 Q:$G(DGSTAT)']""
145 Q:$$EXTERNAL^DILFD(DGFIL,.03,"F",DGSTAT,"")']""
146 ;
147 S DGFDA(DGFIL,DGIEN_",",.03)=DGSTAT
148 D FILE^DIE("","DGFDA","DGERR")
149 Q
150 ;
151 ;
152DELREQ(DGIEN) ;delete a single VIC REQUEST record
153 ;
154 ; Input:
155 ; DGIEN - IEN of record in VIC REQUEST (#39.6) file
156 ;
157 ; Output:
158 ; Function value - 1 on success, 0 on failure
159 ;
160 N DGDT ;HL7 transmission date
161 N DGERR
162 N DGFDA
163 N DGLIEN ;pointer to VIC HL7 TRANSMISSION LOG (#39.7) file
164 N DGRSLT ;function value
165 ;
166 S DGRSLT=0
167 I $G(DGIEN) D
168 . S DGFDA(39.6,DGIEN_",",.01)="@"
169 . D FILE^DIE("","DGFDA","DGERR")
170 . Q:$D(DGERR)
171 . ;
172 . ;cleanup HL7 TRANSMISSION LOG
173 . S DGDT=0
174 . F S DGDT=$O(^DGQE(39.7,"ADATE",DGIEN,DGDT)) Q:'DGDT D Q:$D(DGERR)
175 . . S DGLIEN=$O(^DGQE(39.7,"ADATE",DGIEN,DGDT,0))
176 . . I DGLIEN,'$$DELXMIT^DGQEHLL(DGLIEN) S DGERR=1
177 . Q:$D(DGERR)
178 . S DGRSLT=1 ;success
179 ;
180 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.