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

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1DGPFHLL1 ;ALB/RPM - PRF HL7 EVENT LOG API'S ; 2/23/06
2 ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
3 ;
4 Q
5 ;
6GETEVNT(DGLIEN,DGPFL) ;retrieve a given record from PRF HL7 EVENT LOG (#26.21)
7 ;
8 ; Input:
9 ; DGLIEN - IEN of PRF HL7 EVENT (#26.21)
10 ;
11 ; Output:
12 ; Function value - 1 on success; 0 on failure
13 ; DGPFL - array of event data fields
14 ; Subscript Field#
15 ; --------- ------
16 ; "DFN" .01
17 ; "EDT" .02
18 ; "STAT" .03
19 ;
20 N DGERR ;error array
21 N DGFLDS ;field result array
22 N DGIENS ;FM IENS string
23 N DGRSLT ;function value
24 ;
25 S DGRSLT=0
26 I $G(DGLIEN),$D(^DGPF(26.21,DGLIEN)) D
27 . S DGIENS=DGLIEN_","
28 . D GETS^DIQ(26.21,DGIENS,"**","IEZ","DGFLDS","DGERR")
29 . Q:$D(DGERR)
30 . S DGRSLT=1
31 . S DGPFL("DFN")=$G(DGFLDS(26.21,DGIENS,.01,"I"))_U_$G(DGFLDS(26.21,DGIENS,.01,"E"))
32 . S DGPFL("EDT")=$G(DGFLDS(26.21,DGIENS,.02,"I"))_U_$G(DGFLDS(26.21,DGIENS,.02,"E"))
33 . S DGPFL("STAT")=$G(DGFLDS(26.21,DGIENS,.03,"I"))_U_$G(DGFLDS(26.21,DGIENS,.03,"E"))
34 ;
35 Q DGRSLT
36 ;
37GETSTAT(DGDFN) ;retrieve event status for a given patient
38 ;This function retrieves the internal value of the CURRENT STATUS
39 ;(#.03) field in the PRF HL7 EVENT (#26.21) file and returns it as the
40 ;function value.
41 ;
42 ; Input:
43 ; DGDFN - pointer to patient in PATIENT (#2) file
44 ;
45 ; Output:
46 ; Function value - returns CURRENT STATUS field value in Internal
47 ; format on success; otherwise returns ""
48 ;
49 N DGERR ;DIQ error array
50 ;
51 Q:'+$G(DGDFN) ""
52 Q $$GET1^DIQ(26.21,$$FNDEVNT(DGDFN)_",",.03,"I","","DGERR")
53 ;
54FNDEVNT(DGDFN) ;find PRF HL7 EVENT (#26.21) file record number
55 ;This function finds and returns the PRF HL7 EVENT (#26.21) file record
56 ;number for a given patient.
57 ;
58 ; Input:
59 ; DGDFN - pointer to patient in PATIENT (#2) file
60 ;
61 ; Output:
62 ; Function value - IEN of PRF HL7 EVENT (#26.21) file on success;
63 ; 0 on failure
64 ;
65 N DGIEN ;function value
66 ;
67 I +$G(DGDFN) D
68 . S DGIEN=$O(^DGPF(26.21,"B",DGDFN,0))
69 Q $S($G(DGIEN)>0:DGIEN,1:0)
70 ;
71STOEVNT(DGDFN,DGSTAT,DGERR) ;store event in PRF HL7 EVENT (#26.21) file
72 ;
73 ; Input:
74 ; DGDFN - (required) pointer to patient in PATIENT (#2) file
75 ; DGSTAT - (optional) event status [default = INCOMPLETE]
76 ; DGERR - (optional) passed by reference to hold any FM errors
77 ;
78 ; Output:
79 ; DGERR - only defined when FM call fails
80 ;
81 N DGFDA ;FM FDA array
82 N DGFDAIEN ;UPDATE^DIE result
83 N DGLIEN ;PRF HL7 EVENT (#26.21) file IEN
84 N DGRSLT ;CHK^DIE result
85 ;
86 S DGSTAT=$S($G(DGSTAT)]"":DGSTAT,1:"I")
87 I $G(DGDFN),$D(^DPT(DGDFN,0)) D
88 . S DGLIEN=$$FNDEVNT(DGDFN)
89 . D CHK^DIE(26.21,.03,,DGSTAT,.DGRSLT,"DGERR")
90 . Q:$D(DGERR)
91 . I DGLIEN D
92 . . S DGFDA(26.21,DGLIEN_",",.03)=DGSTAT
93 . . D FILE^DIE("","DGFDA","DGERR")
94 . E D
95 . . S DGFDA(26.21,"+1,",.01)=DGDFN
96 . . S DGFDA(26.21,"+1,",.02)=$$NOW^XLFDT()
97 . . S DGFDA(26.21,"+1,",.03)=DGSTAT
98 . . D UPDATE^DIE("","DGFDA","DGFDAIEN","DGERR")
99 ;
100 Q
101 ;
102LOCK(DGIEN) ;lock HL7 event record
103 ;This function locks a single PRF HL7 EVENT (#26.21) file record
104 ;to prevent more than one PRF query being run at a time.
105 ;
106 ; Input:
107 ; DGIEN - IEN of PRF HL7 EVENT (#26.21) file record
108 ;
109 ; Output:
110 ; Function value - 1 on success; 0 on failure
111 ;
112 I $G(DGIEN) L +^DGPF(26.21,DGIEN):2
113 ;
114 Q $T
115 ;
116UNLOCK(DGIEN) ;unlock HL7 event record
117 ;This procedure releases a lock on a PRF HL7 EVENT (#26.21) file record
118 ;created by $$LOCK.
119 ;
120 ; Input:
121 ; DGIEN - IEN of PRF HL7 EVENT (#26.21) file record
122 ;
123 ; Output:
124 ;
125 I $G(DGIEN) L -^DGPF(26.21,DGIEN)
126 Q
127 ;
128ISINCOMP(DGIEN) ;is the HL7 event status INCOMPLETE?
129 ;
130 ; Input:
131 ; DGIEN - IEN of PRF HL7 EVENT (#26.21) file record
132 ;
133 ; Output:
134 ; Function value - return "1" when status is INCOMPLETE;
135 ; otherwise return "0".
136 ;
137 Q $D(^DGPF(26.21,"ASTAT","I",+$G(DGIEN)))
Note: See TracBrowser for help on using the repository browser.