2009-03-14 18:23:22 -04:00
|
|
|
C0CACTOR ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
|
2008-10-03 22:57:33 -04:00
|
|
|
;;0.4;CCDCCR;nopatch;noreleasedate
|
2009-03-14 18:23:22 -04:00
|
|
|
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
|
|
|
;Licensed under the terms of the GNU General Public License.
|
|
|
|
;See attached copy of the License.
|
2008-10-10 14:45:04 -04:00
|
|
|
;
|
2008-10-03 22:57:33 -04:00
|
|
|
; This program is free software; you can redistribute it and/or modify
|
|
|
|
; it under the terms of the GNU General Public License as published by
|
|
|
|
; the Free Software Foundation; either version 2 of the License, or
|
|
|
|
; (at your option) any later version.
|
2008-10-10 14:45:04 -04:00
|
|
|
;
|
2008-10-03 22:57:33 -04:00
|
|
|
; This program is distributed in the hope that it will be useful,
|
|
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
; GNU General Public License for more details.
|
2008-10-10 14:45:04 -04:00
|
|
|
;
|
2008-10-03 22:57:33 -04:00
|
|
|
; You should have received a copy of the GNU General Public License along
|
|
|
|
; with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-14 10:53:09 -04:00
|
|
|
;
|
2008-10-03 22:57:33 -04:00
|
|
|
; PROCESS THE ACTORS SECTION OF THE CCR
|
2008-07-14 10:53:09 -04:00
|
|
|
;
|
2008-10-03 22:57:33 -04:00
|
|
|
; ===Revision History===
|
|
|
|
; 0.1 Initial Writing of Skeleton--GPL
|
|
|
|
; 0.2 Patient Data Extraction--SMH
|
|
|
|
; 0.3 Information System Info Extraction--SMH
|
|
|
|
; 0.4 Patient data rouine refactored; adjustments here--SMH
|
2008-07-14 10:53:09 -04:00
|
|
|
;
|
2008-07-05 19:57:32 -04:00
|
|
|
EXTRACT(IPXML,ALST,AXML) ; EXTRACT ACTOR FROM ALST INTO PROVIDED XML TEMPLATE
|
2008-10-03 22:57:33 -04:00
|
|
|
; IPXML is the Input Actor Template into which we substitute values
|
|
|
|
; This is straight XML. Values to be substituted are in @@VAL@@ format.
|
2009-03-14 18:23:22 -04:00
|
|
|
; ALST is the actor list global generated by ACTLST^C0CCCR and has format:
|
2008-10-03 22:57:33 -04:00
|
|
|
; ^TMP(7542,1,"ACTORS",0)=Count
|
|
|
|
; ^TMP(7542,1,"ACTORS",n)="ActorID^ActorType^ActorIEN"
|
|
|
|
; ActorType is an enum containing either "PROVIDER" "PATIENT" "SYSTEM"
|
|
|
|
; AXML is the output arrary, to contain XML.
|
|
|
|
;
|
|
|
|
N I,J,AMAP,AOID,ATYP,AIEN
|
2009-03-14 18:23:22 -04:00
|
|
|
D CP^C0CXPATH(IPXML,AXML) ; MAKE A COPY OF ACTORS XML
|
|
|
|
D REPLACE^C0CXPATH(AXML,"","//Actors") ; DELETE THE INSIDES
|
2008-10-03 22:57:33 -04:00
|
|
|
I DEBUG W "PROCESSING ACTORS ",!
|
|
|
|
F I=1:1:@ALST@(0) D ; PROCESS ALL ACTORS IN THE LIST
|
|
|
|
. I @ALST@(I)["@@" Q ; NOT A VALID ACTOR
|
|
|
|
. S AOID=$P(@ALST@(I),"^",1) ; ACTOR OBJECT ID
|
|
|
|
. S ATYP=$P(@ALST@(I),"^",2) ; ACTOR TYPE
|
|
|
|
. S AIEN=$P(@ALST@(I),"^",3) ; ACTOR RECORD NUMBER
|
2008-11-18 10:57:13 -05:00
|
|
|
. I AIEN="" D Q ; IEN CAN'T BE NULL
|
|
|
|
. . W "WARING NUL ACTOR: ",ATYP,!
|
2008-10-03 22:57:33 -04:00
|
|
|
. I ATYP="" Q ; NOT A VALID ACTOR
|
|
|
|
. ;
|
|
|
|
. I DEBUG W AOID_" "_ATYP_" "_AIEN,!
|
|
|
|
. I ATYP="PATIENT" D ; PATIENT ACTOR TYPE
|
2009-03-14 18:23:22 -04:00
|
|
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PATIENT","ATMP")
|
2008-10-03 22:57:33 -04:00
|
|
|
. . D PATIENT("ATMP",AIEN,AOID,"ATMP2")
|
|
|
|
. ;
|
|
|
|
. I ATYP="SYSTEM" D ; SYSTEM ACTOR TYPE
|
2009-03-14 18:23:22 -04:00
|
|
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-SYSTEM","ATMP")
|
2008-10-03 22:57:33 -04:00
|
|
|
. . D SYSTEM("ATMP",AIEN,AOID,"ATMP2")
|
|
|
|
. ;
|
|
|
|
. I ATYP="NOK" D ; NOK ACTOR TYPE
|
2009-03-14 18:23:22 -04:00
|
|
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-NOK","ATMP")
|
2008-10-03 22:57:33 -04:00
|
|
|
. . D NOK("ATMP",AIEN,AOID,"ATMP2")
|
|
|
|
. ;
|
|
|
|
. I ATYP="PROVIDER" D ; PROVIDER ACTOR TYPE
|
2009-03-14 18:23:22 -04:00
|
|
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PROVIDER","ATMP")
|
2008-10-03 22:57:33 -04:00
|
|
|
. . D PROVIDER("ATMP",AIEN,AOID,"ATMP2")
|
|
|
|
. ;
|
|
|
|
. I ATYP="ORGANIZATION" D ; PROVIDER ACTOR TYPE
|
2009-03-14 18:23:22 -04:00
|
|
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-ORG","ATMP")
|
2008-10-03 22:57:33 -04:00
|
|
|
. . D ORG("ATMP",AIEN,AOID,"ATMP2")
|
|
|
|
. ;
|
2008-11-18 10:32:58 -05:00
|
|
|
. W "PROCESSING:",ATYP," ",AIEN,!
|
|
|
|
. ;I @ATMP2@(0)=0 Q ; NOTHING RETURNED, SKIP THIS ONE
|
2009-03-14 18:23:22 -04:00
|
|
|
. D INSINNER^C0CXPATH(AXML,"ATMP2") ; INSERT INTO ROOT
|
2008-11-12 14:09:42 -05:00
|
|
|
. K ATYP,AIEN,AOID,ATMP,ATMP2 ; BE SURE TO GET THE NEXT ONE
|
2008-10-03 22:57:33 -04:00
|
|
|
;
|
|
|
|
N ACTTMP
|
2009-03-14 18:23:22 -04:00
|
|
|
D MISSING^C0CXPATH(AXML,"ACTTMP") ; SEARCH XML FOR MISSING VARS
|
2008-10-03 22:57:33 -04:00
|
|
|
I ACTTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
|
|
|
. ; STRINGS MARKED AS @@X@@
|
|
|
|
. W "ACTORS Missing list: ",!
|
|
|
|
. F I=1:1:ACTTMP(0) W ACTTMP(I),!
|
|
|
|
Q
|
|
|
|
;
|
2008-07-26 15:16:58 -04:00
|
|
|
PATIENT(INXML,AIEN,AOID,OUTXML) ; PROCESS A PATIENT ACTOR
|
2008-10-03 22:57:33 -04:00
|
|
|
I DEBUG W "PROCESSING ACTOR PATIENT ",AIEN,!
|
|
|
|
N AMAP,ZX
|
|
|
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
|
|
|
K @AMAP
|
|
|
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
|
|
|
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORDATEOFBIRTH")=$$DOB^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORGENDER")=$$GENDER^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORSSN")=""
|
|
|
|
S @AMAP@("ACTORSSNTEXT")=""
|
|
|
|
S @AMAP@("ACTORSSNSOURCEID")=""
|
2009-02-24 23:27:46 -05:00
|
|
|
S X="MSCDPTID" ; ROUTINE TO TEST FOR MRN ON OPENVISTA
|
2009-02-24 23:16:28 -05:00
|
|
|
X ^%ZOSF("TEST") ; TEST TO SEE IF THE ROUTINE EXISTS
|
|
|
|
I $T S MRN=$$^MSCDPTID(DFN) ;TEST FOR MRN ON OPENVISTA ;GPL
|
2009-02-20 10:55:40 -05:00
|
|
|
I $D(MRN) D ; IF MRN IS PRESENT
|
|
|
|
. S @AMAP@("ACTORSSN")=MRN
|
|
|
|
. S @AMAP@("ACTORSSNTEXT")="MRN"
|
2008-10-03 22:57:33 -04:00
|
|
|
. S @AMAP@("ACTORSSNSOURCEID")=AOID
|
2009-02-20 10:55:40 -05:00
|
|
|
E D ; NO MRN, USE SSN
|
|
|
|
. S ZX=$$SSN^CCRDPT(AIEN)
|
|
|
|
. I ZX'="" D ; IF THERE IS A SSN IN THE RECORD
|
|
|
|
. . S @AMAP@("ACTORSSN")=ZX
|
|
|
|
. . S @AMAP@("ACTORSSNTEXT")="SSN"
|
|
|
|
. . S @AMAP@("ACTORSSNSOURCEID")=AOID
|
2008-10-03 22:57:33 -04:00
|
|
|
S @AMAP@("ACTORADDRESSTYPE")=$$ADDRTYPE^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSLINE1")=$$ADDR1^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSLINE2")=$$ADDR2^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSCITY")=$$CITY^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSZIPCODE")=$$ZIP^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORRESTEL")=""
|
|
|
|
S @AMAP@("ACTORRESTELTEXT")=""
|
|
|
|
S ZX=$$RESTEL^CCRDPT(AIEN)
|
|
|
|
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
|
|
|
. S @AMAP@("ACTORRESTEL")=ZX
|
|
|
|
. S @AMAP@("ACTORRESTELTEXT")="Residential Telephone"
|
|
|
|
S @AMAP@("ACTORWORKTEL")=""
|
|
|
|
S @AMAP@("ACTORWORKTELTEXT")=""
|
|
|
|
S ZX=$$WORKTEL^CCRDPT(AIEN)
|
|
|
|
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
|
|
|
. S @AMAP@("ACTORWORKTEL")=ZX
|
|
|
|
. S @AMAP@("ACTORWORKTELTEXT")="Work Telephone"
|
|
|
|
S @AMAP@("ACTORCELLTEL")=""
|
|
|
|
S @AMAP@("ACTORCELLTELTEXT")=""
|
|
|
|
S ZX=$$CELLTEL^CCRDPT(AIEN)
|
|
|
|
I ZX'="" D ; IF THERE IS A CELL PHONE IN THE RECORD
|
|
|
|
. S @AMAP@("ACTORCELLTEL")=ZX
|
|
|
|
. S @AMAP@("ACTORCELLTELTEXT")="Cell Phone"
|
|
|
|
S @AMAP@("ACTOREMAIL")=$$EMAIL^CCRDPT(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSSOURCEID")=AOID
|
|
|
|
S @AMAP@("ACTORIEN")=AIEN
|
|
|
|
S @AMAP@("ACTORSUFFIXNAME")="" ; DOES VISTA STORE THE SUFFIX
|
|
|
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
2009-03-14 18:23:22 -04:00
|
|
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
2008-10-03 22:57:33 -04:00
|
|
|
Q
|
|
|
|
;
|
2008-07-26 15:16:58 -04:00
|
|
|
SYSTEM(INXML,AIEN,AOID,OUTXML) ; PROCESS A SYSTEM ACTOR
|
2008-07-05 11:49:50 -04:00
|
|
|
;
|
2008-07-05 19:57:32 -04:00
|
|
|
; N AMAP
|
|
|
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
2008-07-26 15:16:58 -04:00
|
|
|
K @AMAP
|
2008-07-05 11:49:50 -04:00
|
|
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
2009-03-15 20:35:00 -04:00
|
|
|
S @AMAP@("ACTORINFOSYSNAME")=$$SYSNAME^C0CSYS
|
|
|
|
S @AMAP@("ACTORINFOSYSVER")=$$SYSVER^C0CSYS
|
2008-07-06 17:00:17 -04:00
|
|
|
S @AMAP@("ACTORINFOSYSSOURCEID")=AOID
|
2009-03-14 18:23:22 -04:00
|
|
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
2008-07-05 11:49:50 -04:00
|
|
|
Q
|
|
|
|
;
|
2008-07-26 15:16:58 -04:00
|
|
|
NOK(INXML,AIEN,AOID,OUTXML) ; PROCESS A NEXT OF KIN TYPE ACTOR
|
2008-07-05 11:49:50 -04:00
|
|
|
;
|
2008-07-05 19:57:32 -04:00
|
|
|
; N AMAP
|
|
|
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
2008-07-26 15:16:58 -04:00
|
|
|
K @AMAP
|
2008-07-05 11:49:50 -04:00
|
|
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
|
|
|
S @AMAP@("ACTORDISPLAYNAME")=""
|
|
|
|
S @AMAP@("ACTORRELATION")=""
|
|
|
|
S @AMAP@("ACTORRELATIONSOURCEID")=""
|
2008-07-29 16:57:24 -04:00
|
|
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
2009-03-14 18:23:22 -04:00
|
|
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
2008-07-05 11:49:50 -04:00
|
|
|
Q
|
|
|
|
;
|
2008-07-26 15:16:58 -04:00
|
|
|
ORG(INXML,AIEN,AOID,OUTXML) ; PROCESS AN ORGANIZATION TYPE ACTOR
|
2008-07-11 19:08:09 -04:00
|
|
|
;
|
|
|
|
; N AMAP
|
|
|
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
2008-07-26 15:16:58 -04:00
|
|
|
K @AMAP
|
2008-07-11 19:08:09 -04:00
|
|
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
2008-07-22 11:39:53 -04:00
|
|
|
S @AMAP@("ORGANIZATIONNAME")=$P($$SITE^VASITE,U,2)
|
2008-07-11 19:08:09 -04:00
|
|
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1"
|
2009-03-14 18:23:22 -04:00
|
|
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
2008-07-11 19:08:09 -04:00
|
|
|
Q
|
|
|
|
;
|
2008-07-26 15:16:58 -04:00
|
|
|
PROVIDER(INXML,AIEN,AOID,OUTXML) ; PROCESS A PROVIDER TYPE ACTOR
|
2008-07-05 11:49:50 -04:00
|
|
|
;
|
2008-07-05 19:57:32 -04:00
|
|
|
; N AMAP
|
|
|
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
2008-07-26 15:16:58 -04:00
|
|
|
K @AMAP
|
2008-11-18 10:32:58 -05:00
|
|
|
I '$D(^VA(200,AIEN,0)) D Q ; IF NO PROVIDER RECORD (SHOULDN'T HAPPEN)
|
|
|
|
. W "WARNING - MISSING PROVIDER: ",AIEN,!
|
|
|
|
. S @OUTXML@(0)=0 ; SIGNAL NO OUTPUT
|
2008-07-05 11:49:50 -04:00
|
|
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
2009-03-15 20:21:30 -04:00
|
|
|
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORTITLE")=$$TITLE^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("IDTYPE")=$P($$NPI^C0CVA200(AIEN),U,1)
|
|
|
|
S @AMAP@("ID")=$P($$NPI^C0CVA200(AIEN),U,2)
|
|
|
|
S @AMAP@("IDDESC")=$P($$NPI^C0CVA200(AIEN),U,3)
|
|
|
|
S @AMAP@("ACTORSPECIALITY")=$$SPEC^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSTYPE")=$$ADDTYPE^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSLINE1")=$$ADDLINE1^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSCITY")=$$CITY^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTORPOSTALCODE")=$$POSTCODE^C0CVA200(AIEN)
|
2008-07-29 16:57:24 -04:00
|
|
|
S @AMAP@("ACTORTELEPHONE")=""
|
|
|
|
S @AMAP@("ACTORTELEPHONETYPE")=""
|
2009-03-15 20:21:30 -04:00
|
|
|
S ZX=$$TEL^C0CVA200(AIEN)
|
2008-07-29 16:57:24 -04:00
|
|
|
I ZX'="" D ; THERE IS A PHONE NUMBER AVAILABLE
|
|
|
|
. S @AMAP@("ACTORTELEPHONE")=ZX
|
2009-03-15 20:21:30 -04:00
|
|
|
. S @AMAP@("ACTORTELEPHONETYPE")=$$TELTYPE^C0CVA200(AIEN)
|
|
|
|
S @AMAP@("ACTOREMAIL")=$$EMAIL^C0CVA200(AIEN)
|
2008-07-17 00:16:33 -04:00
|
|
|
S @AMAP@("ACTORADDRESSSOURCEID")="ACTORSYSTEM_1"
|
2008-07-29 16:57:24 -04:00
|
|
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
2009-03-14 18:23:22 -04:00
|
|
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
2008-07-05 11:49:50 -04:00
|
|
|
Q
|
|
|
|
;
|