source: WorldVistAEHR/trunk/r/PHARMACY_BENEFITS_MANAGEMENT-PSU/PSUDEM3.m@ 836

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

initial load of WorldVistAEHR

File size: 1.7 KB
RevLine 
[613]1PSUDEM3 ;BIR/DAM - ICD9 codes for Outpatient Encounter Extract ; 20 DEC 2001
2 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
3 ;
4 ;DBIA's
5 ; Reference to file 80 supported by DBIA 10082
6 ; Reference to file 9000010.18 supported by DBIA 3560
7 ;
8EN ;EN Called from PSUDEM2
9 D ICD
10 D CLEAN
11 Q
12 ;
13ICD ;Find all ICD9 pointers associated with Patient pointer
14 ;
15 N PSUICD
16 S PSUC1=0
17 F S PSUC1=$O(^AUPNVCPT("C",PSUPT,PSUC1)) Q:PSUC1="" D ;V CPT IEN
18 .I $P($G(^AUPNVCPT(PSUC1,0)),U,3)=$G(PSUVIEN) D ;V CPT IEN=Visit IEN
19 ..S PSUICD=$P($G(^AUPNVCPT(PSUC1,0)),U,5) D ICD1 ;ICD9 Ptr
20 ..S PSUCPT=$P($G(^AUPNVCPT(PSUC1,0)),U,1) D EN^PSUDEM6 ;grab CPT codes
21 I '$D(^AUPNVCPT("C",PSUPT)) S PSUCPT="" D EN^PSUDEM6
22 D FIN
23 Q
24 ;
25ICD1 ;Find ICD9 codes from pointers and place in an array
26 ;
27 ;
28 N PSUID2
29 I PSUICD S PSUID2=$P($G(^ICD9(PSUICD,0)),U) D
30 .I $D(PSUID2) S ^XTMP("PSU_"_PSUJOB,"PSUTMP1",PSUVIEN,PSUID2)="" ;ICD9 codes set into array
31 ;
32 Q
33 ;
34FIN ;$O through array, and set codes into the Outpatient Visit
35 ;Encounter global, ^XTMP("PSU_"_PSUJOB,"PSUOPV"
36 ;
37 ;
38 S PSUIDF=0
39 S I=8
40 F S PSUIDF=$O(^XTMP("PSU_"_PSUJOB,"PSUTMP1",PSUVIEN,PSUIDF)) Q:'PSUIDF Q:I=17 D
41 .S $P(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUVIEN),U,I)=PSUIDF
42 .S I=I+1
43 ;
44 F N=8:1:16 I '$P($G(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUVIEN)),U,N) D
45 .S $P(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUVIEN),U,N)=""
46 Q
47 ;
48CLEAN ;Delete all ^XTMP("PSU_"_PSUJOB,"PSUOPV" entries that do not have associated
49 ;ICD9 or CPT codes.
50 ;
51 S PSUCL=0
52 F S PSUCL=$O(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUCL)) Q:'PSUCL D
53 .I $P(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUCL),U,7)="" D
54 ..I $P(^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUCL),U,17)="" K ^XTMP("PSU_"_PSUJOB,"PSUOPV",PSUCL)
55 Q
Note: See TracBrowser for help on using the repository browser.