source: FOIAVistA/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMPTRN7.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1IVMPTRN7 ;ALB/KCL/CJM/PHH/BAJ - HL7 FULL DATA TRANSMISSION (Z07) BUILDER ;10/20/2005
2 ;;2.0;INCOME VERIFICATION MATCH;**9,11,24,34,74,88,105**;JUL 8,1996;Build 2
3 ;
4 ;
5FULL(DFN,IVMMTDT,EVENTS,IVMCT,IVMGTOT,IVMFLL,IVMNOMSH,IVMREC,IVMQUERY) ;
6 ;Description: This entry point will be used to create an HL7 "Full Data Transmission" message for a patient. Transmission of these messages will be in a batch of 1-100 individual HL7 messages.
7 ;
8 ;Input:
9 ; DFN - Patient IEN
10 ; IVMMTDT - date of the patient's Means Test or Copay Test
11 ; EVENTS () - an array of reasons for transmission, pass by reference.
12 ; EVENTS("IVM") = 1 if transmission due to IVM criteria, 0 otherwise
13 ; EVENTS(" "DCD")=1 if transmission due to DCD criteria, 0 otherwise
14 ; EVENTS("ENROLL")=1 if transmission due to enrollment criteria, 0 otherwise
15 ; IVMCT - count of segments transmitted, pass by reference
16 ; IVMGTOT - count of batchs transmitted, pass by reference
17 ; IVMFLL - (optional), flag for creating MSA, QRD segments for FULL query transmission, $G(IVMFLL) means yes
18 ; IVMNOMSH - (optional), if IVMNOMSH=1, means the MSH segment should not be built
19 ; IVMREC - (optional), if $G(IVMFLL), then this variable will contain the internal entry number of Query Income Year #301.9001 mult.
20 ; IVMQUERY - array passed in by reference where
21 ; IVMQUERY("LTD") -- # of the QUERY that is currently open or
22 ; undefined, zero, or null if no QUERY opened for
23 ; last treatment date
24 ; IVMQUERY("OVIS") -- # of the QUERY that is currently open or
25 ; undefined, zero, or null if no QUERY opened for
26 ; finding outpatient visits
27 ;
28 ;HL7 variables as defined by call to INIT^IVMUFNC:
29 ; HLEVN - HL7 message event counter
30 ; HLSDT - a flag that indicates that the data to be sent is stored in the ^TMP("HLS") global array.
31 ;
32 ;The following variables returned by the INIT^HLTRANS entry point:
33 ; HLNDAP - Non-DHCP Application Pointer from file 770
34 ; HLNDAP0 - Zero node from file 770 corresponding to HLNDAP
35 ; HLDAP - DHCP Application Pointer from file 771
36 ; HLDAN - The DHCP Application Name (.01 field, file 771) for HLDAP
37 ; HLPID - HL7 processing ID from file 770
38 ; HLVER - HL7 version number from file 770
39 ; HLFS - HL7 Field Separater from the 'FS' node of file 771
40 ; HLECH - HL7 Encoding Characters from the 'EC' node of file 771
41 ; HLQ - Double quotes ("") for use in building HL7 segments
42 ; HLERR - if an error is encountered, an error message is returned in the HLERR variable.
43 ; HLDA - the internal entry number for the entry created in file 772
44 ;
45 ; HLDT - the transmission date/time (associated with the entry in in file 772 identified by HLDA) in internal VA FileMan format.
46 ; HLDT1 - the same transmission date/time as the HLDT variable, only in HL7 format.
47 ;
48 ;Output:
49 ; ^TMP("HLS",$J,IVMCT) - global array containing all segments of the HL7 message that the VistA application wishes to send. The HLSDT variable is defined above and the IVMCT variable is a sequential number starting at 1.
50 ;
51 N DGREL,DGINC,DR,I,IVMI,IVMDFN,IVMHLMID,IVMNTE,IVMPAT,IVMQRD,X,IVMCNTID
52 ;
53 ; IVM*2.0*105 BAJ 10/20/2005
54 ; Do Z07 Consistency checks and, if fail, prevent Z07 Build
55 I '$$EN^IVMZ07C(DFN) Q
56 ;
57 ; INITIALIZE HL7 1.6 VARIABLES
58 D INIT^HLFNC2(HLEID,.HL)
59 ;
60 ; quit if Pseudo SSN and not verified
61 ; Q:'$$SNDPSSN(DFN) ;Removed by IVM*2*105
62 ;
63 ; if count=0 and not first batch
64 ;RMC;I IVMCT=0,$G(IVMGTOT) D FILE^HLTF
65 ;
66 ; HL7 event/message counter
67 S HLEVN=$G(HLEVN)+1
68 ;
69 ; CREATE SLOT FOR EACH NEW BATCH
70 I HLEVN=1 D
71 . K HLMID,MTIEN,HLDT,HLDT1
72 . D CREATE^HLTF(.HLMID,.MTIEN,.HLDT,.HLDT1)
73 ;
74 ; handle message header processing for HL7 full data trans (Z07) msg
75 D MSH^IVMUFNC4($G(IVMNOMSH),$G(IVMFLL),$G(IVMREC),.IVMCT,.IVMCNTID)
76 ;
77 I IVMMTDT="" D
78 .S IVMMTDT=$P($$LST^DGMTU(DFN,DT),"^",2)
79 .I IVMMTDT="" S IVMMTDT=DT
80 ;
81 ; build HL7 Full Data Transmission (Z07) message
82 D BUILD^IVMPTRN8(DFN,IVMMTDT,.IVMCT,.IVMQUERY)
83 ;
84 ; log patient transmission
85 D
86 .N IVMSTAT
87 .S X=$$LST^DGMTCOU1(DFN,IVMMTDT,3)
88 .S IVMSTAT=$S($E($P(X,"^",2),1,3)=$E(IVMMTDT,1,3):$P($G(^DGMT(408.31,+X,0)),"^",3),1:"")
89 .;
90 .D FILEPT^IVMPTRN3(DFN,$$LYR^DGMTSCU1(IVMMTDT),HLDT,IVMCNTID,.EVENTS,IVMSTAT,IVMINS)
91 ;
92 ;if number of HL7 events/msgs is 100 then call HL7 pkg to transmit batch
93 I HLEVN=100 D
94 .N IVMEVENT
95 .; event code for Full Data Transmission
96 .S IVMEVENT="Z07"
97 .I $G(IVMFLL) D FILE1^IVMPTRN3 Q
98 .D FILE^IVMPTRN3
99 Q
100 ;
101SNDPSSN(DFN) ; check SSN and patient eligibility
102 ;
103 ; Input:
104 ; DFN Patient file (#2) IEN
105 ; Output:
106 ; <expression> 1: Pseudo SSN and Eligibility verified or
107 ; not a Pseudo SSN
108 ; 0: Psuedo SSN and Eligibility Pending verification
109 ; Pending re-verification
110 ;
111 N SSN,PFLG
112 ;
113 ; Don't process records with corrupted nodes
114 I '$D(^DPT(DFN,0)) D REM Q 0
115 ;
116 S SSN=$P(^DPT(DFN,0),U,9)
117 S PFLG=($E(SSN,$L(SSN))="P") I 'PFLG Q 1
118 I ($P($G(^DPT(DFN,.361)),U)="V") Q 1
119 ;
120 D REM
121 Q 0
122 ;
123REM ; Remove Psuedo SSN from Queue
124 ; Set TRANSMISSION STATUS to transmission not required
125 S PDATA(.03)=1 I $$UPD^DGENDBS(301.5,IVMDA,.PDATA,.ERR)
126 K PDATA,ERR
127 Q
Note: See TracBrowser for help on using the repository browser.