source: WorldVistAEHR/trunk/r/VISTA_OFFICE_EHR-VEPE/VEPER7SB.m@ 1714

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

initial load of WorldVistAEHR

File size: 6.0 KB
RevLine 
[613]1VEPER7SB ;RSL/DAOU HL7 EXTRACT FROM FILE SUBROUTINES; ; 8/23/05 11:30am
2 ;;1.0;VISTA EHR DOQ IT HL7 extraction using Clinical Reminders; 05/20/05 ;;Build 1
3REGISTER ;Write REGISTER PATIENT Event segments
4 ;
5 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
6 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
7 D MSH^VEPER7SG("ZRG","Z01",SF,.MSHC)
8 D ZCR^VEPER7SG
9 D ZPP^VEPER7SG
10 D DG1^VEPER7SG
11 I ALERGY D ZL1^VEPER7SG
12 D ZPT^VEPER7SG
13 S %DT="T",X="N" D ^%DT
14 S $P(DOQREG(19904.4,DFN,TOPTYP),"^",TTP+1)=Y
15 ; ****** SET THIS BACK INTO THE GLOBAL HERE *******
16 Q
17 ;
18 ;
19CANCEL ;Write CANCEL PATIENT Event segments
20 ;
21 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
22 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
23 D MSH^VEPER7SG("ZDL","Z02",SF,.MSHC)
24 D ZCR^VEPER7SG
25 D ZPP^VEPER7SG
26 S %DT="T",X="N" D ^%DT
27 S $P(DOQREG(19904.4,DFN,TOPTYP),"^",TTP+1)=Y
28 ; *** SET THIS BACK INTO THE GLOBAL HERE ********
29 Q
30 ;
31 ;
32PTVISIT ;Write PATIENT VISIT Event Segments
33 ;
34 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
35 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
36 D MSH^VEPER7SG("ADT","A04",SF,.MSHC)
37 D ZCR^VEPER7SG
38 D PID^VEPER7SG
39 D PV1^VEPER7SG
40 ;
41 ;--- Observations have to be sent for several different files
42 ;- Files to be included are:
43 ;- V MEASUREMENT (9000010.01)
44 ;- V LAB (9000010.09) Tests and results
45 ;- V EXAM (9000010.13)
46 ;- V PATIENT EDUCATION (9000010.16)
47 ;- V HEALTH FACTORS (9000010.23) (May not need... vitals may be in V MEASUREMENT... if so, remove this part
48 ;-
49 ;- Series of loops to report these associated observations
50 ;-
51 N OBXC,OBX,OIEN,VOBX
52 S BVDATE=9999998-EDT,EVDATE=9999999-BDT,OBXC=0
53 S OBX="" F S OBX=$O(^AUPNVMEA("AA",DFN,OBX)) Q:OBX="" D
54 .S BVDATE=$O(^AUPNVMEA("AA",DFN,OBX,BVDATE)) Q:BVDATE=""!(BVDATE>EVDATE) D
55 ..S OIEN="" F S OIEN=$O(^AUPNVMEA("AA",DFN,OBX,BVDATE,OIEN)) Q:OIEN="" D
56 ...I $D(^TMP("VEPER7EX",$J,"MEA",DFN,OBX,BVDATE,OIEN)) Q ;Don't process a 2nd time
57 ...K VOBX D GETS^DIQ(9000010.01,OIEN_",","**","","VOBX")
58 ...D GETS^DIQ(9000010.01,OIEN_",",1201,"I","VOBX")
59 ...D OBX^VEPER7SG(.OBXC)
60 ...S ^TMP("VEPER7EX",$J,"MEA",DFN,OBX,BVDATE,OIEN)=""
61 ...K VOBX
62 S BVDATE=9999998-EDT
63 S OBX="" F S OBX=$O(^AUPNVLAB("AA",DFN,OBX)) Q:OBX="" D
64 .S BVDATE=$O(^AUPNVLAB("AA",DFN,OBX,BVDATE)) Q:BVDATE=""!(BVDATE>EVDATE) D
65 ..S OIEN="" F S OIEN=$O(^AUPNVLAB("AA",DFN,OBX,BVDATE,OIEN)) Q:OIEN="" D
66 ...I $D(^TMP("VEPER7EX",$J,"LAB",DFN,OBX,BVDATE,OIEN)) Q ;Don't process a 2nd time
67 ...K VOBX D GETS^DIQ(9000010.09,OIEN_",","**","","VOBX")
68 ...D GETS^DIQ(9000010.09,OIEN_",",1201,"I","VOBX")
69 ...D OBX^VEPER7SG(.OBXC)
70 ...S ^TMP("VEPER7EX",$J,"LAB",DFN,OBX,BVDATE,OIEN)=""
71 ...K VOBX
72 S BVDATE=9999998-EDT
73 S OBX="" F S OBX=$O(^AUPNVXAM("AA",DFN,OBX)) Q:OBX="" D
74 .S BVDATE=$O(^AUPNVXAM("AA",DFN,OBX,BVDATE)) Q:BVDATE=""!(BVDATE>EVDATE) D
75 ..S OIEN="" F S OIEN=$O(^AUPNVXAM("AA",DFN,OBX,BVDATE,OIEN)) Q:OIEN="" D
76 ...I $D(^TMP("VEPER7EX",$J,"XAM",DFN,OBX,BVDATE,OIEN)) Q ;Don't process a 2nd time
77 ...K VOBX D GETS^DIQ(9000010.13,OIEN_",","**","","VOBX")
78 ...D GETS^DIQ(9000010.13,OIEN_",",1201,"I","VOBX")
79 ...D OBX^VEPER7SG(.OBXC)
80 ...S ^TMP("VEPER7EX",$J,"XAM",DFN,OBX,BVDATE,OIEN)=""
81 ...K VOBX
82 S BVDATE=9999998-EDT
83 S OBX="" F S OBX=$O(^AUPNVPED("AA",DFN,OBX)) Q:OBX="" D
84 .S BVDATE=$O(^AUPNVPED("AA",DFN,OBX,BVDATE)) Q:BVDATE=""!(BVDATE>EVDATE) D
85 ..S OIEN="" F S OIEN=$O(^AUPNVPED("AA",DFN,OBX,BVDATE,OIEN)) Q:OIEN="" D
86 ...I $D(^TMP("VEPER7EX",$J,"PED",DFN,OBX,BVDATE,OIEN)) Q ;Don't process a 2nd time
87 ...K VOBX D GETS^DIQ(9000010.16,OIEN_",","**","","VOBX")
88 ...D GETS^DIQ(9000010.16,OIEN_",",1201,"I","VOBX")
89 ...D OBX^VEPER7SG(.OBXC)
90 ...S ^TMP("VEPER7EX",$J,"PED",DFN,OBX,BVDATE,OIEN)=""
91 ...K VOBX
92 S BVDATE=9999998-EDT
93 S OBX="" F S OBX=$O(^AUPNVHF("AA",DFN,OBX)) Q:OBX="" D
94 .S BVDATE=$O(^AUPNVHF("AA",DFN,OBX,BVDATE)) Q:BVDATE=""!(BVDATE>EVDATE) D
95 ..S OIEN="" F S OIEN=$O(^AUPNVHF("AA",DFN,OBX,BVDATE,OIEN)) Q:OIEN="" D
96 ...I $D(^TMP("VEPER7EX",$J,"HF",DFN,OBX,BVDATE,OIEN)) Q ;Don't process a 2nd time
97 ...K VOBX D GETS^DIQ(9000010.23,OIEN_",","**","","VOBX")
98 ...D GETS^DIQ(9000010.23,OIEN_",",1201,"I","VOBX")
99 ...D OBX^VEPER7SG(.OBXC)
100 ...S ^TMP("VEPER7EX",$J,"HF",DFN,OBX,BVDATE,OIEN)=""
101 ...K VOBX
102 ;
103 ;--- Process lab results...
104 ;
105 N LRDATA
106 K LRDATA I VEPER7PT(2,DFN,.09)'="" D GCPR^LA7QRY(VEPER7PT(2,DFN,.09),BDT,EDT_"^RAD","*","*",.LRDATA)
107 ;Loop through LRDATA to return Lab Results for DOQIT
108 ;
109 ;-- at this time, the array is unkown as to what it looks like. Will
110 ;- have to add this later when there's some lab data to process.
111 ;
112 ;
113 ;--- End of recording Observations ----
114 ;
115 D DG1^VEPER7SG
116 I ALERGY D ZL1^VEPER7SG
117 Q
118 ;
119 ;
120CPTVISIT ;WRITE CANCEL PATIENT VISIT Event segments
121 ;
122 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
123 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
124 D MSH^VEPER7SG("ADT","A11",SF,.MSHC)
125 D ZCR^VEPER7SG
126 D PID^VEPER7SG
127 D PV1^VEPER7SG
128 Q
129 ;
130UNSOLOM ;Write UNSOLICITED OBSERVATION Event segments
131 ;
132 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
133 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
134 D MSH^VEPER7SG("ORU","R01",SF,.MSHC)
135 D ZCR^VEPER7SG
136 D PID^VEPER7SG
137 D PV1^VEPER7SG
138 D ORC^VEPER7SG
139 D OBR^VEPER7SG
140 D OBX^VEPER7SG
141 Q
142 ;
143 ;
144PXTRTOM ;Write PHARMACY/TREATMENT ORDER Event segments
145 ;
146 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
147 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
148 D MSH^VEPER7SG("OMP","O09",SF,.MSHC)
149 D ZCR^VEPER7SG
150 D PID^VEPER7SG
151 D PV1^VEPER7SG
152 D ORC^VEPER7SG
153 D RXO^VEPER7SG
154 Q
155 ;
156 ;
157VAXMSG ;Write VACCINATION MESSAGE Event segments
158 ;
159 I 'FHSC D FHS^VEPER7SG(SF,.FHSC,.BHSC,PROD,HL7DIR_HL7FN,FNMID)
160 I 'BHSC D BHS^VEPER7SG(SF,.BHSC,.MSHC)
161 D MSH^VEPER7SG("VXU","V04",SV,.MSHC)
162 D ZCR^VEPER7SG
163 D PID^VEPER7SG
164 ;
165 ;
166 ;---- Fetch physician and clinic information
167 N PRIPHN,INST,PIEN
168 D GETS^DIQ(9000010.11,VIMMIEN_",",1202,"I","PRIPHN")
169 S PIEN=$G(PRIPHN(9000010.11,VIMMIEN_",",1204))_","
170 D GETS^DIQ(200,PIEN,"16;53.2","","INST")
171 I $G(INST(200,PIEN,16))="" S INST(200,PIEN,16)=SF
172 ;
173 ;
174 D ORC^VEPER7SG
175 D RXA^VEPER7SG(.RXAC)
176 Q
177 ;
178 ;
Note: See TracBrowser for help on using the repository browser.