source: FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFEXT2.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1MPIFEXT2 ;SFCIO/CMC-EXTENDED PDAT - RPC ;26 JUN 01
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**20,28**;30 Apr 99
3 ;
4 ;Integration Agreements Utilized:
5 ; ^DPT( - #2070
6 ; NOTICE^DGSEC4 - #3027
7 ; PTSEC^DGSEC4 - #3027
8 ; D GETS^DIQ(2,DFN_",",".097","I","MPIFAR") - #3581
9 ;
10PATINFO(RETN,ICN,SSN,RPC) ;get patient info array
11 N MPINODE,MPIFAR,DFN,TICN,TSSN,TEXT,CNTD,PICN,XX,X,XXX
12 I $G(ICN)=""&($G(SSN)="") S RETN="-1^NO ICN OR SSN PASSED" Q
13 S TICN=ICN,TSSN=SSN,TEXT=""
14 I $G(SSN)'="" D
15 .S ICN=$$GETICNS^MPIF002(SSN)
16 .I RPC=1 S TEXT="MPI(""SSN USED"")="
17 .S RETN(1,"SSN USED")=TEXT_""""_SSN_""""
18 .; possible to have multiple entries with same SSN
19 S PICN=ICN,CNTD=0
20 F XX=1:1 S ICN=$P(PICN,"^",XX) Q:ICN="" D
21 .S DFN=$$GETDFN^MPIF001(+ICN),CNTD=CNTD+1
22 .I +DFN=-1 S RETN(XX)="-1^NO SUCH ICN "_ICN Q
23 .I '$D(^DPT(DFN)) S RETN(XX)="-1^BAD AICN X-REF, PT FILE ENTRY DOESN'T EXIST DFN= "_DFN_" ICN= "_ICN Q
24 .; check if this data can be returned and if sensative pt bulletin needed
25 .N SENS D PTSEC^DGSEC4(.SENS,DFN,1,"Remote Procedure from MPI^RPC frm MPI ext PDAT infor")
26 .N NOT D NOTICE^DGSEC4(.NOT,DFN,"Remote Procedure from MPI^RPC frm MPI ext PDAT infor")
27 .I SENS(1)=3!(SENS(1)=4)!(SENS(1)=-1) S RETN(XX)="-1^SENSATIVE PT ISSUE "_SENS(2)_" DFN= "_DFN_" ICN= "_ICN Q
28 .I RPC=1 S TEXT="MPI("_DFN_",""DFN"")="
29 .S RETN(XX,"DFN")=TEXT_""""_DFN_""""
30 .S MPINODE=$$MPINODE^MPIFAPI(DFN)
31 .D GETS^DIQ(2,DFN_",",".097","I","MPIFAR")
32 .I RPC=1 S TEXT="MPI("_DFN_",""ENTERED PT FILE"")="
33 .S RETN(DFN,"ENTERED PT FILE")=TEXT_""""_$$FMTE^XLFDT(MPIFAR(2,DFN_",",.097,"I"),5)_""""
34 .K VADM
35 .D DEM^VADPT
36 .F X=1,2,3,5,6,11,12 D
37 ..I X=1 D
38 ...I RPC=1 S TEXT="MPI("_DFN_",""NAME"")="
39 ...S RETN(DFN,"NAME")=TEXT_""""_VADM(1)_""""
40 ..I X=2 D
41 ...I RPC=1 S TEXT="MPI("_DFN_",""SEX"")="
42 ...S RETN(DFN,"SEX")=TEXT_""""_VADM(5)_""""
43 ..I X=3 D
44 ...I RPC=1 S TEXT="MPI("_DFN_",""DOB"")="
45 ...S RETN(DFN,"DOB")=TEXT_""""_VADM(3)_""""
46 ..I X=12 D
47 ..I RPC=1 S TEXT="MPI("_DFN_",""RACE"","
48 ..S XXX=0
49 ..I VADM(12)=0 S RETN(DFN,"RACE",0)=TEXT_XXX_")="_"""NONE""" Q
50 ..I VADM(12)>0 F S XXX=$O(VADM(12,XXX)) Q:XXX="" S RETN(DFN,"RACE",XXX)=TEXT_XXX_")="_""""_$P($G(VADM(12,XXX)),"^",2)_""""
51 ..I X=2 D
52 ...I RPC=1 S TEXT="MPI("_DFN_",""SSN"")="
53 ...S RETN(DFN,"SSN")=TEXT_""""_VADM(2)_""""
54 ..I X=6 D
55 ...I RPC=1 S TEXT="MPI("_DFN_",""DOD"")="
56 ...S RETN(DFN,"DOD")=TEXT_""""_$$FMTE^XLFDT($P(VADM(6),"^"))_""""
57 ..I X=11 D
58 ..I RPC=1 S TEXT="MPI("_DFN_",""ETHNIC"")="
59 ..I VADM(11)=0 S RETN(DFN,"ETHNIC")=TEXT_"""NONE""" Q
60 ..I VADM(11)=1 S RETN(DFN,"ETHNIC")=TEXT_""""_$P($G(VADM(11,1)),"^",2)_""""
61 .K VAPA,VADM
62 .D ADD^VADPT
63 .F X=1,2,3,4,5,6,8,11 D
64 ..I X=1 D
65 ...I RPC=1 S TEXT="MPI("_DFN_",""ADDRESS"")="
66 ...S RETN(DFN,"ADDRESS 1")=TEXT_""""_VAPA(1)_""""
67 ..I X=6 D
68 ...I RPC=1 S TEXT="MPI("_DFN_",""ZIP"")="
69 ...S RETN(DFN,"ZIP")=TEXT_""""_VAPA(6)_""""
70 ..I X=2 D
71 ...I RPC=1 S TEXT="MPI("_DFN_",""ADDRESS 2"")="
72 ...S RETN(DFN,"ADDRESS 2")=TEXT_""""_VAPA(2)_""""
73 ..I X=3 D
74 ...I RPC=1 S TEXT="MPI("_DFN_",""ADDRESS 3"")="
75 ...S RETN(DFN,"ADDRESS 3")=TEXT_""""_VAPA(3)_""""
76 ..I X=5 D
77 ...I RPC=1 S TEXT="MPI("_DFN_",""STATE"")="
78 ...S RETN(DFN,"STATE")=TEXT_""""_$P(VAPA(5),"^",2)_""""
79 ..I X=4 D
80 ...I RPC=1 S TEXT="MPI("_DFN_",""CITY"")="
81 ...S RETN(DFN,"CITY")=TEXT_""""_VAPA(4)_""""
82 ..I X=8 D
83 ...I RPC=1 S TEXT="MPI("_DFN_",""HOME PHONE #"")="
84 ...S RETN(DFN,"HOME PHONE #")=TEXT_""""_VAPA(8)_""""
85 .K VAPA,VAEL
86 .D ELIG^VADPT
87 .I VAEL(4)=1 S VAEL("VET Y/N")="YES"
88 .I VAEL(4)'=1 S VAEL("VET Y/N")="NO"
89 .F X=1,4,7 D
90 ..I X=7 D
91 ...I RPC=1 S TEXT="MPI("_DFN_",""CLAIM #"")="
92 ...S RETN(DFN,"CLAIM #")=TEXT_""""_VAEL(7)_""""
93 ..I X=4 D
94 ...I RPC=1 S TEXT="MPI("_DFN_",""VET Y/N"")="
95 ...S RETN(DFN,"VET Y/N")=TEXT_""""_VAEL("VET Y/N")_""""
96 ..I X=1 D
97 ...I RPC=1 S TEXT="MPI("_DFN_",""PRIM ELIG"")="
98 ...S RETN(DFN,"PRIM ELIG")=TEXT_""""_$P(VAEL(1),"^",2)_""""
99 .K VAEL,VAOA
100 .D OAD^VADPT
101 .I RPC=1 S TEXT="MPI("_DFN_",""NOK NAME"")="
102 .S RETN(DFN,"NOK NAME")=TEXT_""""_VAOA(9)_""""
103 .K VAOA
104 .S VAOA("A")=1
105 .D OAD^VADPT
106 .I RPC=1 S TEXT="MPI("_DFN_",""EMERGENCY POC"")="
107 .S RETN(DFN,"EMERGENCY POC")=TEXT_""""_VAOA(9)_""""
108 .K VAOA
109 .S VAOA("A")=2
110 .D OAD^VADPT
111 .I RPC=1 S TEXT="MPI("_DFN_",""DESIGNEE"")="
112 .S RETN(DFN,"DESIGNEE")=TEXT_""""_VAOA(9)_""""
113 .K VAOA,VAPD
114 .D OPD^VADPT
115 .F X=1,2,3,4,5 D
116 ..I X=5 D
117 ...I RPC=1 S TEXT="MPI("_DFN_",""MMN"")="
118 ...S RETN(DFN,"MMN")=TEXT_""""_VAPD(5)_""""
119 ..I X=1 D
120 ...I RPC=1 S TEXT="MPI("_DFN_",""POBC"")="
121 ...S RETN(DFN,"POBC")=TEXT_""""_VAPD(1)_""""
122 ..I X=2 D
123 ...I RPC=1 S TEXT="MPI("_DFN_",""POBS"")="
124 ...S RETN(DFN,"POBS")=TEXT_""""_$P(VAPD(2),"^",2)_""""
125 ..I X=3 D
126 ...I RPC=1 S TEXT="MPI("_DFN_",""FATHER'S NAME"")="
127 ...S RETN(DFN,"FATHER'S NAME")=TEXT_""""_VAPD(3)_""""
128 ..I X=4 D
129 ...I RPC=1 S TEXT="MPI("_DFN_",""MOTHER'S NAME"")="
130 ...S RETN(DFN,"MOTHER'S NAME")=TEXT_""""_VAPD(4)_""""
131 .K VAPD,VASV
132 .D SVC^VADPT
133 .I RPC=1 S TEXT="MPI("_DFN_",""POW STATUS"")="
134 .I VASV(4)=1 S VASV(4)="YES"
135 .I VASV(4)=0 S VASV(4)="NO"
136 .S RETN(DFN,"POW STATUS")=TEXT_""""_VASV(4)_""""
137 .I RPC=1 S TEXT="MPI("_DFN_",""LAST SRV BRANCH"")="
138 .S RETN(DFN,"LAST SRV BRANCH")=TEXT_""""_$P(VASV(6,1),"^",2)_""""
139 .I RPC=1 S TEXT="MPI("_DFN_",""LAST SRV #"")="
140 .S RETN(DFN,"LAST SRV #")=TEXT_""""_VASV(6,2)_""""
141 .I RPC=1 S TEXT="MPI("_DFN_",""LAST SRV ENT DT"")="
142 .S RETN(DFN,"LAST SRV ENT DT")=TEXT_""""_$$FMTE^XLFDT($P(VASV(6,4),"^"))_""""
143 .I RPC=1 S TEXT="MPI("_DFN_",""LAST SRV SEP DT"")="
144 .S RETN(DFN,"LAST SRV SEP DT")=TEXT_""""_$$FMTE^XLFDT($P(VASV(6,5),"^"))_""""
145 .K VASV
146 .N MPINODE
147 .S MPINODE=$$MPINODE^MPIFAPI(DFN)
148 .I RPC=1 S TEXT="MPI("_DFN_",""SUB CONTROL #"")="
149 .S RETN(DFN,"SUB CONTROL #")=TEXT_""""_$P(MPINODE,"^",5)_""""
150 .I RPC=1 S TEXT="MPI("_DFN_",""SCORE"")="
151 .S RETN(DFN,"SCORE")=TEXT_""""_$P(MPINODE,"^",6)_""""
152 .I RPC=1 S TEXT="MPI("_DFN_",""SCORE DATE"")="
153 .S RETN(DFN,"SCORE DATE")=TEXT_""""_$P(MPINODE,"^",7)_""""
154 .I RPC=1 S TEXT="MPI("_DFN_",""LOCAL ICN"")="
155 .I $P(MPINODE,"^",4)=1 S RETN(DFN,"LOCAL ICN")=TEXT_"""YES"""
156 .I $P(MPINODE,"^",4)="" S RETN(DFN,"LOCAL ICN")=TEXT_"""NO"""
157 .N RESULT,SENS
158 .S SENS="NO"
159 .D PTSEC^DGSEC4(.RESULT,DFN)
160 .I RESULT(1)>0 S SENS="YES"
161 .I RPC=1 S TEXT="MPI("_DFN_",""SENSATIVE PT"")="
162 .S RETN(DFN,"SENSATIVE PT")=TEXT_""""_SENS_""""
163 .D ALIAS^MPIFEXT3(.RETN,DFN,RPC)
164 .D CMORCH^MPIFEXT3(.RETN,DFN,RPC)
165 .D TFLIST^MPIFEXT3(.RETN,DFN,RPC)
166 .D SUBLST^MPIFEXT3(.RETN,DFN,RPC)
167 D ICNSTAT^MPIFRPC(.RETN,TICN,TSSN,RPC)
168 K VA,VAERR
169 Q
170 ;
Note: See TracBrowser for help on using the repository browser.