source: ccr/trunk/p/GPLACTOR.m@ 183

Last change on this file since 183 was 175, checked in by Sam Habiel, 16 years ago

Refactored CCRDPT and updated GPLACTOR accordingly

File size: 7.7 KB
Line 
1GPLACTOR ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
2 ;;0.4;CCDCCR;nopatch;noreleasedate
3 ; Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ; General Public License See attached copy of the License.
5 ;
6 ; This program is free software; you can redistribute it and/or modify
7 ; it under the terms of the GNU General Public License as published by
8 ; the Free Software Foundation; either version 2 of the License, or
9 ; (at your option) any later version.
10 ;
11 ; This program is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
15 ;
16 ; You should have received a copy of the GNU General Public License along
17 ; with this program; if not, write to the Free Software Foundation, Inc.,
18 ; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 ; PROCESS THE ACTORS SECTION OF THE CCR
21 ;
22 ; ===Revision History===
23 ; 0.1 Initial Writing of Skeleton--GPL
24 ; 0.2 Patient Data Extraction--SMH
25 ; 0.3 Information System Info Extraction--SMH
26 ; 0.4 Patient data rouine refactored; adjustments here--SMH
27 ;
28EXTRACT(IPXML,ALST,AXML) ; EXTRACT ACTOR FROM ALST INTO PROVIDED XML TEMPLATE
29 ; IPXML is the Input Actor Template into which we substitute values
30 ; This is straight XML. Values to be substituted are in @@VAL@@ format.
31 ; ALST is the actor list global generated by ACTLST^GPLCCR and has format:
32 ; ^TMP(7542,1,"ACTORS",0)=Count
33 ; ^TMP(7542,1,"ACTORS",n)="ActorID^ActorType^ActorIEN"
34 ; ActorType is an enum containing either "PROVIDER" "PATIENT" "SYSTEM"
35 ; AXML is the output arrary, to contain XML.
36 ;
37 N I,J,AMAP,AOID,ATYP,AIEN
38 D CP^GPLXPATH(IPXML,AXML) ; MAKE A COPY OF ACTORS XML
39 D REPLACE^GPLXPATH(AXML,"","//Actors") ; DELETE THE INSIDES
40 I DEBUG W "PROCESSING ACTORS ",!
41 F I=1:1:@ALST@(0) D ; PROCESS ALL ACTORS IN THE LIST
42 . I @ALST@(I)["@@" Q ; NOT A VALID ACTOR
43 . S AOID=$P(@ALST@(I),"^",1) ; ACTOR OBJECT ID
44 . S ATYP=$P(@ALST@(I),"^",2) ; ACTOR TYPE
45 . S AIEN=$P(@ALST@(I),"^",3) ; ACTOR RECORD NUMBER
46 . I ATYP="" Q ; NOT A VALID ACTOR
47 . ;
48 . I DEBUG W AOID_" "_ATYP_" "_AIEN,!
49 . I ATYP="PATIENT" D ; PATIENT ACTOR TYPE
50 . . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-PATIENT","ATMP")
51 . . D PATIENT("ATMP",AIEN,AOID,"ATMP2")
52 . ;
53 . I ATYP="SYSTEM" D ; SYSTEM ACTOR TYPE
54 . . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-SYSTEM","ATMP")
55 . . D SYSTEM("ATMP",AIEN,AOID,"ATMP2")
56 . ;
57 . I ATYP="NOK" D ; NOK ACTOR TYPE
58 . . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-NOK","ATMP")
59 . . D NOK("ATMP",AIEN,AOID,"ATMP2")
60 . ;
61 . I ATYP="PROVIDER" D ; PROVIDER ACTOR TYPE
62 . . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-PROVIDER","ATMP")
63 . . D PROVIDER("ATMP",AIEN,AOID,"ATMP2")
64 . ;
65 . I ATYP="ORGANIZATION" D ; PROVIDER ACTOR TYPE
66 . . D QUERY^GPLXPATH(IPXML,"//Actors/ACTOR-ORG","ATMP")
67 . . D ORG("ATMP",AIEN,AOID,"ATMP2")
68 . ;
69 . D INSINNER^GPLXPATH(AXML,"ATMP2") ; INSERT INTO ROOT
70 ;
71 N ACTTMP
72 D MISSING^GPLXPATH(AXML,"ACTTMP") ; SEARCH XML FOR MISSING VARS
73 I ACTTMP(0)>0 D ; IF THERE ARE MISSING VARS -
74 . ; STRINGS MARKED AS @@X@@
75 . W "ACTORS Missing list: ",!
76 . F I=1:1:ACTTMP(0) W ACTTMP(I),!
77 Q
78 ;
79PATIENT(INXML,AIEN,AOID,OUTXML) ; PROCESS A PATIENT ACTOR
80 I DEBUG W "PROCESSING ACTOR PATIENT ",AIEN,!
81 N AMAP,ZX
82 S AMAP=$NA(^TMP($J,"AMAP"))
83 K @AMAP
84 S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
85 S @AMAP@("ACTORGIVENNAME")=$$GIVEN^CCRDPT(AIEN)
86 S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^CCRDPT(AIEN)
87 S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^CCRDPT(AIEN)
88 S @AMAP@("ACTORDATEOFBIRTH")=$$DOB^CCRDPT(AIEN)
89 S @AMAP@("ACTORGENDER")=$$GENDER^CCRDPT(AIEN)
90 S @AMAP@("ACTORSSN")=""
91 S @AMAP@("ACTORSSNTEXT")=""
92 S @AMAP@("ACTORSSNSOURCEID")=""
93 S ZX=$$SSN^CCRDPT(AIEN)
94 I ZX'="" D ; IF THERE IS A SSN IN THE RECORD
95 . S @AMAP@("ACTORSSN")=ZX
96 . S @AMAP@("ACTORSSNTEXT")="SSN"
97 . S @AMAP@("ACTORSSNSOURCEID")=AOID
98 S @AMAP@("ACTORADDRESSTYPE")=$$ADDRTYPE^CCRDPT(AIEN)
99 S @AMAP@("ACTORADDRESSLINE1")=$$ADDR1^CCRDPT(AIEN)
100 S @AMAP@("ACTORADDRESSLINE2")=$$ADDR2^CCRDPT(AIEN)
101 S @AMAP@("ACTORADDRESSCITY")=$$CITY^CCRDPT(AIEN)
102 S @AMAP@("ACTORADDRESSSTATE")=$$STATE^CCRDPT(AIEN)
103 S @AMAP@("ACTORADDRESSZIPCODE")=$$ZIP^CCRDPT(AIEN)
104 S @AMAP@("ACTORRESTEL")=""
105 S @AMAP@("ACTORRESTELTEXT")=""
106 S ZX=$$RESTEL^CCRDPT(AIEN)
107 I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
108 . S @AMAP@("ACTORRESTEL")=ZX
109 . S @AMAP@("ACTORRESTELTEXT")="Residential Telephone"
110 S @AMAP@("ACTORWORKTEL")=""
111 S @AMAP@("ACTORWORKTELTEXT")=""
112 S ZX=$$WORKTEL^CCRDPT(AIEN)
113 I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
114 . S @AMAP@("ACTORWORKTEL")=ZX
115 . S @AMAP@("ACTORWORKTELTEXT")="Work Telephone"
116 S @AMAP@("ACTORCELLTEL")=""
117 S @AMAP@("ACTORCELLTELTEXT")=""
118 S ZX=$$CELLTEL^CCRDPT(AIEN)
119 I ZX'="" D ; IF THERE IS A CELL PHONE IN THE RECORD
120 . S @AMAP@("ACTORCELLTEL")=ZX
121 . S @AMAP@("ACTORCELLTELTEXT")="Cell Phone"
122 S @AMAP@("ACTOREMAIL")=$$EMAIL^CCRDPT(AIEN)
123 S @AMAP@("ACTORADDRESSSOURCEID")=AOID
124 S @AMAP@("ACTORIEN")=AIEN
125 S @AMAP@("ACTORSUFFIXNAME")="" ; DOES VISTA STORE THE SUFFIX
126 S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
127 D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
128 Q
129 ;
130SYSTEM(INXML,AIEN,AOID,OUTXML) ; PROCESS A SYSTEM ACTOR
131 ;
132 ; N AMAP
133 S AMAP=$NA(^TMP($J,"AMAP"))
134 K @AMAP
135 S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
136 S @AMAP@("ACTORINFOSYSNAME")=$$SYSNAME^CCRSYS
137 S @AMAP@("ACTORINFOSYSVER")=$$SYSVER^CCRSYS
138 S @AMAP@("ACTORINFOSYSSOURCEID")=AOID
139 D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
140 Q
141 ;
142NOK(INXML,AIEN,AOID,OUTXML) ; PROCESS A NEXT OF KIN TYPE ACTOR
143 ;
144 ; N AMAP
145 S AMAP=$NA(^TMP($J,"AMAP"))
146 K @AMAP
147 S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
148 S @AMAP@("ACTORDISPLAYNAME")=""
149 S @AMAP@("ACTORRELATION")=""
150 S @AMAP@("ACTORRELATIONSOURCEID")=""
151 S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
152 D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
153 Q
154 ;
155ORG(INXML,AIEN,AOID,OUTXML) ; PROCESS AN ORGANIZATION TYPE ACTOR
156 ;
157 ; N AMAP
158 S AMAP=$NA(^TMP($J,"AMAP"))
159 K @AMAP
160 S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
161 S @AMAP@("ORGANIZATIONNAME")=$P($$SITE^VASITE,U,2)
162 S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1"
163 D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
164 Q
165 ;
166PROVIDER(INXML,AIEN,AOID,OUTXML) ; PROCESS A PROVIDER TYPE ACTOR
167 ;
168 ; N AMAP
169 S AMAP=$NA(^TMP($J,"AMAP"))
170 K @AMAP
171 S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
172 S @AMAP@("ACTORGIVENNAME")=$$GIVEN^CCRVA200(AIEN)
173 S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^CCRVA200(AIEN)
174 S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^CCRVA200(AIEN)
175 S @AMAP@("ACTORTITLE")=$$TITLE^CCRVA200(AIEN)
176 S @AMAP@("IDTYPE")=$P($$NPI^CCRVA200(AIEN),U,1)
177 S @AMAP@("ID")=$P($$NPI^CCRVA200(AIEN),U,2)
178 S @AMAP@("IDDESC")=$P($$NPI^CCRVA200(AIEN),U,3)
179 S @AMAP@("ACTORSPECIALITY")=$$SPEC^CCRVA200(AIEN)
180 S @AMAP@("ACTORADDRESSTYPE")=$$ADDTYPE^CCRVA200(AIEN)
181 S @AMAP@("ACTORADDRESSLINE1")=$$ADDLINE1^CCRVA200(AIEN)
182 S @AMAP@("ACTORADDRESSCITY")=$$CITY^CCRVA200(AIEN)
183 S @AMAP@("ACTORADDRESSSTATE")=$$STATE^CCRVA200(AIEN)
184 S @AMAP@("ACTORPOSTALCODE")=$$POSTCODE^CCRVA200(AIEN)
185 S @AMAP@("ACTORTELEPHONE")=""
186 S @AMAP@("ACTORTELEPHONETYPE")=""
187 S ZX=$$TEL^CCRVA200(AIEN)
188 I ZX'="" D ; THERE IS A PHONE NUMBER AVAILABLE
189 . S @AMAP@("ACTORTELEPHONE")=ZX
190 . S @AMAP@("ACTORTELEPHONETYPE")=$$TELTYPE^CCRVA200(AIEN)
191 S @AMAP@("ACTOREMAIL")=$$EMAIL^CCRVA200(AIEN)
192 S @AMAP@("ACTORADDRESSSOURCEID")="ACTORSYSTEM_1"
193 S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
194 D MAP^GPLXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
195 Q
196 ;
Note: See TracBrowser for help on using the repository browser.