support for incoming CCDs
This commit is contained in:
parent
b6c5c14f75
commit
1330ad24b5
450
p/C0CACTOR.m
450
p/C0CACTOR.m
|
@ -1,225 +1,225 @@
|
||||||
C0CACTOR ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
|
C0CACTOR ; CCDCCR/GPL - CCR/CCD PROCESSING FOR ACTORS ; 7/3/08
|
||||||
;;1.0;C0C;;May 19, 2009;
|
;;1.0;C0C;;May 19, 2009;
|
||||||
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
||||||
;Licensed under the terms of the GNU General Public License.
|
;Licensed under the terms of the GNU General Public License.
|
||||||
;See attached copy of the License.
|
;See attached copy of the License.
|
||||||
;
|
;
|
||||||
; This program is free software; you can redistribute it and/or modify
|
; 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
|
; it under the terms of the GNU General Public License as published by
|
||||||
; the Free Software Foundation; either version 2 of the License, or
|
; the Free Software Foundation; either version 2 of the License, or
|
||||||
; (at your option) any later version.
|
; (at your option) any later version.
|
||||||
;
|
;
|
||||||
; This program is distributed in the hope that it will be useful,
|
; This program is distributed in the hope that it will be useful,
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
; GNU General Public License for more details.
|
; GNU General Public License for more details.
|
||||||
;
|
;
|
||||||
; You should have received a copy of the GNU General Public License along
|
; 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.,
|
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
;
|
;
|
||||||
; PROCESS THE ACTORS SECTION OF THE CCR
|
; PROCESS THE ACTORS SECTION OF THE CCR
|
||||||
;
|
;
|
||||||
; ===Revision History===
|
; ===Revision History===
|
||||||
; 0.1 Initial Writing of Skeleton--GPL
|
; 0.1 Initial Writing of Skeleton--GPL
|
||||||
; 0.2 Patient Data Extraction--SMH
|
; 0.2 Patient Data Extraction--SMH
|
||||||
; 0.3 Information System Info Extraction--SMH
|
; 0.3 Information System Info Extraction--SMH
|
||||||
; 0.4 Patient data rouine refactored; adjustments here--SMH
|
; 0.4 Patient data rouine refactored; adjustments here--SMH
|
||||||
;
|
;
|
||||||
EXTRACT(IPXML,ALST,AXML) ; EXTRACT ACTOR FROM ALST INTO PROVIDED XML TEMPLATE
|
EXTRACT(IPXML,ALST,AXML) ; EXTRACT ACTOR FROM ALST INTO PROVIDED XML TEMPLATE
|
||||||
; IPXML is the Input Actor Template into which we substitute values
|
; IPXML is the Input Actor Template into which we substitute values
|
||||||
; This is straight XML. Values to be substituted are in @@VAL@@ format.
|
; This is straight XML. Values to be substituted are in @@VAL@@ format.
|
||||||
; ALST is the actor list global generated by ACTLST^C0CCCR and has format:
|
; ALST is the actor list global generated by ACTLST^C0CCCR and has format:
|
||||||
; ^TMP(7542,1,"ACTORS",0)=Count
|
; ^TMP(7542,1,"ACTORS",0)=Count
|
||||||
; ^TMP(7542,1,"ACTORS",n)="ActorID^ActorType^ActorIEN"
|
; ^TMP(7542,1,"ACTORS",n)="ActorID^ActorType^ActorIEN"
|
||||||
; ActorType is an enum containing either "PROVIDER" "PATIENT" "SYSTEM"
|
; ActorType is an enum containing either "PROVIDER" "PATIENT" "SYSTEM"
|
||||||
; AXML is the output arrary, to contain XML.
|
; AXML is the output arrary, to contain XML.
|
||||||
;
|
;
|
||||||
N I,J,AMAP,AOID,ATYP,AIEN
|
N I,J,AMAP,AOID,ATYP,AIEN
|
||||||
D CP^C0CXPATH(IPXML,AXML) ; MAKE A COPY OF ACTORS XML
|
D CP^C0CXPATH(IPXML,AXML) ; MAKE A COPY OF ACTORS XML
|
||||||
D REPLACE^C0CXPATH(AXML,"","//Actors") ; DELETE THE INSIDES
|
D REPLACE^C0CXPATH(AXML,"","//Actors") ; DELETE THE INSIDES
|
||||||
I DEBUG W "PROCESSING ACTORS ",!
|
I DEBUG W "PROCESSING ACTORS ",!
|
||||||
F I=1:1:@ALST@(0) D ; PROCESS ALL ACTORS IN THE LIST
|
F I=1:1:@ALST@(0) D ; PROCESS ALL ACTORS IN THE LIST
|
||||||
. I @ALST@(I)["@@" Q ; NOT A VALID ACTOR
|
. I @ALST@(I)["@@" Q ; NOT A VALID ACTOR
|
||||||
. S AOID=$P(@ALST@(I),"^",1) ; ACTOR OBJECT ID
|
. S AOID=$P(@ALST@(I),"^",1) ; ACTOR OBJECT ID
|
||||||
. S ATYP=$P(@ALST@(I),"^",2) ; ACTOR TYPE
|
. S ATYP=$P(@ALST@(I),"^",2) ; ACTOR TYPE
|
||||||
. S AIEN=$P(@ALST@(I),"^",3) ; ACTOR RECORD NUMBER
|
. S AIEN=$P(@ALST@(I),"^",3) ; ACTOR RECORD NUMBER
|
||||||
. I AIEN="" D Q ; IEN CAN'T BE NULL
|
. I AIEN="" D Q ; IEN CAN'T BE NULL
|
||||||
. . W "WARING NUL ACTOR: ",ATYP,!
|
. . W "WARING NUL ACTOR: ",ATYP,!
|
||||||
. I ATYP="" Q ; NOT A VALID ACTOR
|
. I ATYP="" Q ; NOT A VALID ACTOR
|
||||||
. ;
|
. ;
|
||||||
. I DEBUG W AOID_" "_ATYP_" "_AIEN,!
|
. I DEBUG W AOID_" "_ATYP_" "_AIEN,!
|
||||||
. I ATYP="PATIENT" D ; PATIENT ACTOR TYPE
|
. I ATYP="PATIENT" D ; PATIENT ACTOR TYPE
|
||||||
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PATIENT","ATMP")
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PATIENT","ATMP")
|
||||||
. . D PATIENT("ATMP",AIEN,AOID,"ATMP2")
|
. . D PATIENT("ATMP",AIEN,AOID,"ATMP2")
|
||||||
. ;
|
. ;
|
||||||
. I ATYP="SYSTEM" D ; SYSTEM ACTOR TYPE
|
. I ATYP="SYSTEM" D ; SYSTEM ACTOR TYPE
|
||||||
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-SYSTEM","ATMP")
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-SYSTEM","ATMP")
|
||||||
. . D SYSTEM("ATMP",AIEN,AOID,"ATMP2")
|
. . D SYSTEM("ATMP",AIEN,AOID,"ATMP2")
|
||||||
. ;
|
. ;
|
||||||
. I ATYP="NOK" D ; NOK ACTOR TYPE
|
. I ATYP="NOK" D ; NOK ACTOR TYPE
|
||||||
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-NOK","ATMP")
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-NOK","ATMP")
|
||||||
. . D NOK("ATMP",AIEN,AOID,"ATMP2")
|
. . D NOK("ATMP",AIEN,AOID,"ATMP2")
|
||||||
. ;
|
. ;
|
||||||
. I ATYP="PROVIDER" D ; PROVIDER ACTOR TYPE
|
. I ATYP="PROVIDER" D ; PROVIDER ACTOR TYPE
|
||||||
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PROVIDER","ATMP")
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-PROVIDER","ATMP")
|
||||||
. . D PROVIDER("ATMP",AIEN,AOID,"ATMP2")
|
. . D PROVIDER("ATMP",AIEN,AOID,"ATMP2")
|
||||||
. ;
|
. ;
|
||||||
. I ATYP="ORGANIZATION" D ; PROVIDER ACTOR TYPE
|
. I ATYP="ORGANIZATION" D ; PROVIDER ACTOR TYPE
|
||||||
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-ORG","ATMP")
|
. . D QUERY^C0CXPATH(IPXML,"//Actors/ACTOR-ORG","ATMP")
|
||||||
. . D ORG("ATMP",AIEN,AOID,"ATMP2")
|
. . D ORG("ATMP",AIEN,AOID,"ATMP2")
|
||||||
. ;
|
. ;
|
||||||
. W "PROCESSING:",ATYP," ",AIEN,!
|
. W "PROCESSING:",ATYP," ",AIEN,!
|
||||||
. ;I @ATMP2@(0)=0 Q ; NOTHING RETURNED, SKIP THIS ONE
|
. ;I @ATMP2@(0)=0 Q ; NOTHING RETURNED, SKIP THIS ONE
|
||||||
. D INSINNER^C0CXPATH(AXML,"ATMP2") ; INSERT INTO ROOT
|
. D INSINNER^C0CXPATH(AXML,"ATMP2") ; INSERT INTO ROOT
|
||||||
. K ATYP,AIEN,AOID,ATMP,ATMP2 ; BE SURE TO GET THE NEXT ONE
|
. K ATYP,AIEN,AOID,ATMP,ATMP2 ; BE SURE TO GET THE NEXT ONE
|
||||||
;
|
;
|
||||||
N ACTTMP
|
N ACTTMP
|
||||||
D MISSING^C0CXPATH(AXML,"ACTTMP") ; SEARCH XML FOR MISSING VARS
|
D MISSING^C0CXPATH(AXML,"ACTTMP") ; SEARCH XML FOR MISSING VARS
|
||||||
I ACTTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
I ACTTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
||||||
. ; STRINGS MARKED AS @@X@@
|
. ; STRINGS MARKED AS @@X@@
|
||||||
. W "ACTORS Missing list: ",!
|
. W "ACTORS Missing list: ",!
|
||||||
. F I=1:1:ACTTMP(0) W ACTTMP(I),!
|
. F I=1:1:ACTTMP(0) W ACTTMP(I),!
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
PATIENT(INXML,AIEN,AOID,OUTXML) ; PROCESS A PATIENT ACTOR
|
PATIENT(INXML,AIEN,AOID,OUTXML) ; PROCESS A PATIENT ACTOR
|
||||||
I DEBUG W "PROCESSING ACTOR PATIENT ",AIEN,!
|
I DEBUG W "PROCESSING ACTOR PATIENT ",AIEN,!
|
||||||
;GPL SEPARATED EXTRACT FROM MAP FOR PROCESSING PATIENTS - TO MAKE
|
;GPL SEPARATED EXTRACT FROM MAP FOR PROCESSING PATIENTS - TO MAKE
|
||||||
; CODE REUSABLE FROM ERX
|
; CODE REUSABLE FROM ERX
|
||||||
N AMAP
|
N AMAP
|
||||||
S AMAP=$NA(^TMP($J,"AMAP"))
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
||||||
K @AMAP
|
K @AMAP
|
||||||
D PEXTRACT(AMAP,AIEN,AOID) ;EXTRACT THE PATIENT ACTOR
|
D PEXTRACT(AMAP,AIEN,AOID) ;EXTRACT THE PATIENT ACTOR
|
||||||
D MAP(INXML,AMAP,OUTXML) ;MAP TO XML
|
D MAP(INXML,AMAP,OUTXML) ;MAP TO XML
|
||||||
K @AMAP ; CLEAN UP BEHIND US
|
K @AMAP ; CLEAN UP BEHIND US
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
PEXTRACT(AMAP,AIEN,AOID) ; EXTRACT TO RETURN ARRAY RARY PASSED BY NAME
|
PEXTRACT(AMAP,AIEN,AOID) ; EXTRACT TO RETURN ARRAY RARY PASSED BY NAME
|
||||||
N ZX
|
N ZX
|
||||||
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
||||||
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^C0CDPT(AIEN)
|
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^C0CDPT(AIEN)
|
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^C0CDPT(AIEN)
|
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORDATEOFBIRTH")=$$DOB^C0CDPT(AIEN)
|
S @AMAP@("ACTORDATEOFBIRTH")=$$DOB^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORGENDER")=$$GENDER^C0CDPT(AIEN)
|
S @AMAP@("ACTORGENDER")=$$GENDER^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORSSN")=""
|
S @AMAP@("ACTORSSN")=""
|
||||||
S @AMAP@("ACTORSSNTEXT")=""
|
S @AMAP@("ACTORSSNTEXT")=""
|
||||||
S @AMAP@("ACTORSSNSOURCEID")=""
|
S @AMAP@("ACTORSSNSOURCEID")=""
|
||||||
S X="MSCDPTID" ; ROUTINE TO TEST FOR MRN ON OPENVISTA
|
S X="MSCDPTID" ; ROUTINE TO TEST FOR MRN ON OPENVISTA
|
||||||
X ^%ZOSF("TEST") ; TEST TO SEE IF THE ROUTINE EXISTS
|
X ^%ZOSF("TEST") ; TEST TO SEE IF THE ROUTINE EXISTS
|
||||||
I $T S MRN=$$^MSCDPTID(DFN) ;TEST FOR MRN ON OPENVISTA ;GPL
|
I $T S MRN=$$^MSCDPTID(DFN) ;TEST FOR MRN ON OPENVISTA ;GPL
|
||||||
I MRN'="" D ; IF MRN IS PRESENT
|
I $G(MRN)'="" D ; IF MRN IS PRESENT
|
||||||
. S @AMAP@("ACTORSSN")=MRN
|
. S @AMAP@("ACTORSSN")=MRN
|
||||||
. S @AMAP@("ACTORSSNTEXT")="MRN"
|
. S @AMAP@("ACTORSSNTEXT")="MRN"
|
||||||
. S @AMAP@("ACTORSSNSOURCEID")=AOID
|
. S @AMAP@("ACTORSSNSOURCEID")=AOID
|
||||||
E D ; NO MRN, USE SSN
|
E D ; NO MRN, USE SSN
|
||||||
. S ZX=$$SSN^C0CDPT(AIEN)
|
. S ZX=$$SSN^C0CDPT(AIEN)
|
||||||
. I ZX'="" D ; IF THERE IS A SSN IN THE RECORD
|
. I ZX'="" D ; IF THERE IS A SSN IN THE RECORD
|
||||||
. . S @AMAP@("ACTORSSN")=ZX
|
. . S @AMAP@("ACTORSSN")=ZX
|
||||||
. . S @AMAP@("ACTORSSNTEXT")="SSN"
|
. . S @AMAP@("ACTORSSNTEXT")="SSN"
|
||||||
. . S @AMAP@("ACTORSSNSOURCEID")=AOID
|
. . S @AMAP@("ACTORSSNSOURCEID")=AOID
|
||||||
S @AMAP@("ACTORADDRESSTYPE")=$$ADDRTYPE^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSTYPE")=$$ADDRTYPE^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSLINE1")=$$ADDR1^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSLINE1")=$$ADDR1^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSLINE2")=$$ADDR2^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSLINE2")=$$ADDR2^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSCITY")=$$CITY^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSCITY")=$$CITY^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSZIPCODE")=$$ZIP^C0CDPT(AIEN)
|
S @AMAP@("ACTORADDRESSZIPCODE")=$$ZIP^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORRESTEL")=""
|
S @AMAP@("ACTORRESTEL")=""
|
||||||
S @AMAP@("ACTORRESTELTEXT")=""
|
S @AMAP@("ACTORRESTELTEXT")=""
|
||||||
S ZX=$$RESTEL^C0CDPT(AIEN)
|
S ZX=$$RESTEL^C0CDPT(AIEN)
|
||||||
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
||||||
. S @AMAP@("ACTORRESTEL")=ZX
|
. S @AMAP@("ACTORRESTEL")=ZX
|
||||||
. S @AMAP@("ACTORRESTELTEXT")="Residential Telephone"
|
. S @AMAP@("ACTORRESTELTEXT")="Residential Telephone"
|
||||||
S @AMAP@("ACTORWORKTEL")=""
|
S @AMAP@("ACTORWORKTEL")=""
|
||||||
S @AMAP@("ACTORWORKTELTEXT")=""
|
S @AMAP@("ACTORWORKTELTEXT")=""
|
||||||
S ZX=$$WORKTEL^C0CDPT(AIEN)
|
S ZX=$$WORKTEL^C0CDPT(AIEN)
|
||||||
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
I ZX'="" D ; IF THERE IS A RESIDENT PHONE IN THE RECORD
|
||||||
. S @AMAP@("ACTORWORKTEL")=ZX
|
. S @AMAP@("ACTORWORKTEL")=ZX
|
||||||
. S @AMAP@("ACTORWORKTELTEXT")="Work Telephone"
|
. S @AMAP@("ACTORWORKTELTEXT")="Work Telephone"
|
||||||
S @AMAP@("ACTORCELLTEL")=""
|
S @AMAP@("ACTORCELLTEL")=""
|
||||||
S @AMAP@("ACTORCELLTELTEXT")=""
|
S @AMAP@("ACTORCELLTELTEXT")=""
|
||||||
S ZX=$$CELLTEL^C0CDPT(AIEN)
|
S ZX=$$CELLTEL^C0CDPT(AIEN)
|
||||||
I ZX'="" D ; IF THERE IS A CELL PHONE IN THE RECORD
|
I ZX'="" D ; IF THERE IS A CELL PHONE IN THE RECORD
|
||||||
. S @AMAP@("ACTORCELLTEL")=ZX
|
. S @AMAP@("ACTORCELLTEL")=ZX
|
||||||
. S @AMAP@("ACTORCELLTELTEXT")="Cell Phone"
|
. S @AMAP@("ACTORCELLTELTEXT")="Cell Phone"
|
||||||
S @AMAP@("ACTOREMAIL")=$$EMAIL^C0CDPT(AIEN)
|
S @AMAP@("ACTOREMAIL")=$$EMAIL^C0CDPT(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSSOURCEID")=AOID
|
S @AMAP@("ACTORADDRESSSOURCEID")=AOID
|
||||||
S @AMAP@("ACTORIEN")=AIEN
|
S @AMAP@("ACTORIEN")=AIEN
|
||||||
S @AMAP@("ACTORSUFFIXNAME")="" ; DOES VISTA STORE THE SUFFIX
|
S @AMAP@("ACTORSUFFIXNAME")="" ; DOES VISTA STORE THE SUFFIX
|
||||||
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
MAP(INXML,AMAP,OUTXML) ;MAP ANY ACTOR TO XML
|
MAP(INXML,AMAP,OUTXML) ;MAP ANY ACTOR TO XML
|
||||||
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
SYSTEM(INXML,AIEN,AOID,OUTXML) ; PROCESS A SYSTEM ACTOR
|
SYSTEM(INXML,AIEN,AOID,OUTXML) ; PROCESS A SYSTEM ACTOR
|
||||||
;
|
;
|
||||||
; N AMAP
|
; N AMAP
|
||||||
S AMAP=$NA(^TMP($J,"AMAP"))
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
||||||
K @AMAP
|
K @AMAP
|
||||||
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
||||||
S @AMAP@("ACTORINFOSYSNAME")=$$SYSNAME^C0CSYS
|
S @AMAP@("ACTORINFOSYSNAME")=$$SYSNAME^C0CSYS
|
||||||
S @AMAP@("ACTORINFOSYSVER")=$$SYSVER^C0CSYS
|
S @AMAP@("ACTORINFOSYSVER")=$$SYSVER^C0CSYS
|
||||||
S @AMAP@("ACTORINFOSYSSOURCEID")=AOID
|
S @AMAP@("ACTORINFOSYSSOURCEID")=AOID
|
||||||
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
NOK(INXML,AIEN,AOID,OUTXML) ; PROCESS A NEXT OF KIN TYPE ACTOR
|
NOK(INXML,AIEN,AOID,OUTXML) ; PROCESS A NEXT OF KIN TYPE ACTOR
|
||||||
;
|
;
|
||||||
; N AMAP
|
; N AMAP
|
||||||
S AMAP=$NA(^TMP($J,"AMAP"))
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
||||||
K @AMAP
|
K @AMAP
|
||||||
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
||||||
S @AMAP@("ACTORDISPLAYNAME")=""
|
S @AMAP@("ACTORDISPLAYNAME")=""
|
||||||
S @AMAP@("ACTORRELATION")=""
|
S @AMAP@("ACTORRELATION")=""
|
||||||
S @AMAP@("ACTORRELATIONSOURCEID")=""
|
S @AMAP@("ACTORRELATIONSOURCEID")=""
|
||||||
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
||||||
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
ORG(INXML,AIEN,AOID,OUTXML) ; PROCESS AN ORGANIZATION TYPE ACTOR
|
ORG(INXML,AIEN,AOID,OUTXML) ; PROCESS AN ORGANIZATION TYPE ACTOR
|
||||||
;
|
;
|
||||||
; N AMAP
|
; N AMAP
|
||||||
S AMAP=$NA(^TMP($J,"AMAP"))
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
||||||
K @AMAP
|
K @AMAP
|
||||||
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
||||||
S @AMAP@("ORGANIZATIONNAME")=$P($$SITE^VASITE,U,2)
|
S @AMAP@("ORGANIZATIONNAME")=$P($$SITE^VASITE,U,2)
|
||||||
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1"
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1"
|
||||||
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
PROVIDER(INXML,AIEN,AOID,OUTXML) ; PROCESS A PROVIDER TYPE ACTOR
|
PROVIDER(INXML,AIEN,AOID,OUTXML) ; PROCESS A PROVIDER TYPE ACTOR
|
||||||
;
|
;
|
||||||
; N AMAP
|
; N AMAP
|
||||||
S AMAP=$NA(^TMP($J,"AMAP"))
|
S AMAP=$NA(^TMP($J,"AMAP"))
|
||||||
K @AMAP
|
K @AMAP
|
||||||
I '$D(^VA(200,AIEN,0)) D Q ; IF NO PROVIDER RECORD (SHOULDN'T HAPPEN)
|
I '$D(^VA(200,AIEN,0)) D Q ; IF NO PROVIDER RECORD (SHOULDN'T HAPPEN)
|
||||||
. W "WARNING - MISSING PROVIDER: ",AIEN,!
|
. W "WARNING - MISSING PROVIDER: ",AIEN,!
|
||||||
. S @OUTXML@(0)=0 ; SIGNAL NO OUTPUT
|
. S @OUTXML@(0)=0 ; SIGNAL NO OUTPUT
|
||||||
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
S @AMAP@("ACTOROBJECTID")=AOID ;ACTOR OBJECT ID
|
||||||
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^C0CVA200(AIEN)
|
S @AMAP@("ACTORGIVENNAME")=$$GIVEN^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^C0CVA200(AIEN)
|
S @AMAP@("ACTORMIDDLENAME")=$$MIDDLE^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^C0CVA200(AIEN)
|
S @AMAP@("ACTORFAMILYNAME")=$$FAMILY^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORTITLE")=$$TITLE^C0CVA200(AIEN)
|
S @AMAP@("ACTORTITLE")=$$TITLE^C0CVA200(AIEN)
|
||||||
S @AMAP@("IDTYPE")=$P($$NPI^C0CVA200(AIEN),U,1)
|
S @AMAP@("IDTYPE")=$P($$NPI^C0CVA200(AIEN),U,1)
|
||||||
S @AMAP@("ID")=$P($$NPI^C0CVA200(AIEN),U,2)
|
S @AMAP@("ID")=$P($$NPI^C0CVA200(AIEN),U,2)
|
||||||
S @AMAP@("IDDESC")=$P($$NPI^C0CVA200(AIEN),U,3)
|
S @AMAP@("IDDESC")=$P($$NPI^C0CVA200(AIEN),U,3)
|
||||||
S @AMAP@("ACTORSPECIALITY")=$$SPEC^C0CVA200(AIEN)
|
S @AMAP@("ACTORSPECIALITY")=$$SPEC^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSTYPE")=$$ADDTYPE^C0CVA200(AIEN)
|
S @AMAP@("ACTORADDRESSTYPE")=$$ADDTYPE^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSLINE1")=$$ADDLINE1^C0CVA200(AIEN)
|
S @AMAP@("ACTORADDRESSLINE1")=$$ADDLINE1^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSCITY")=$$CITY^C0CVA200(AIEN)
|
S @AMAP@("ACTORADDRESSCITY")=$$CITY^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^C0CVA200(AIEN)
|
S @AMAP@("ACTORADDRESSSTATE")=$$STATE^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORPOSTALCODE")=$$POSTCODE^C0CVA200(AIEN)
|
S @AMAP@("ACTORPOSTALCODE")=$$POSTCODE^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORTELEPHONE")=""
|
S @AMAP@("ACTORTELEPHONE")=""
|
||||||
S @AMAP@("ACTORTELEPHONETYPE")=""
|
S @AMAP@("ACTORTELEPHONETYPE")=""
|
||||||
S ZX=$$TEL^C0CVA200(AIEN)
|
S ZX=$$TEL^C0CVA200(AIEN)
|
||||||
I ZX'="" D ; THERE IS A PHONE NUMBER AVAILABLE
|
I ZX'="" D ; THERE IS A PHONE NUMBER AVAILABLE
|
||||||
. S @AMAP@("ACTORTELEPHONE")=ZX
|
. S @AMAP@("ACTORTELEPHONE")=ZX
|
||||||
. S @AMAP@("ACTORTELEPHONETYPE")=$$TELTYPE^C0CVA200(AIEN)
|
. S @AMAP@("ACTORTELEPHONETYPE")=$$TELTYPE^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTOREMAIL")=$$EMAIL^C0CVA200(AIEN)
|
S @AMAP@("ACTOREMAIL")=$$EMAIL^C0CVA200(AIEN)
|
||||||
S @AMAP@("ACTORADDRESSSOURCEID")="ACTORSYSTEM_1"
|
S @AMAP@("ACTORADDRESSSOURCEID")="ACTORSYSTEM_1"
|
||||||
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
S @AMAP@("ACTORSOURCEID")="ACTORSYSTEM_1" ; THE SYSTEM IS THE SOURCE
|
||||||
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
D MAP^C0CXPATH(INXML,AMAP,OUTXML) ; MAP THE VARIABLE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
|
|
246
p/C0CALERT.m
246
p/C0CALERT.m
|
@ -1,123 +1,123 @@
|
||||||
C0CALERT ; CCDCCR/CKU/GPL - CCR/CCD PROCESSING FOR ALERTS ; 09/11/08
|
C0CALERT ; CCDCCR/CKU/GPL - CCR/CCD PROCESSING FOR ALERTS ; 09/11/08
|
||||||
;;1.0;C0C;;May 19, 2009;
|
;;1.0;C0C;;May 19, 2009;
|
||||||
;Copyright 2008,2009 George Lilly, University of Minnesota and others.
|
;Copyright 2008,2009 George Lilly, University of Minnesota and others.
|
||||||
;Licensed under the terms of the GNU General Public License.
|
;Licensed under the terms of the GNU General Public License.
|
||||||
;See attached copy of the License.
|
;See attached copy of the License.
|
||||||
;
|
;
|
||||||
;This program is free software; you can redistribute it and/or modify
|
;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
|
;it under the terms of the GNU General Public License as published by
|
||||||
;the Free Software Foundation; either version 2 of the License, or
|
;the Free Software Foundation; either version 2 of the License, or
|
||||||
;(at your option) any later version.
|
;(at your option) any later version.
|
||||||
;
|
;
|
||||||
;This program is distributed in the hope that it will be useful,
|
;This program is distributed in the hope that it will be useful,
|
||||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;GNU General Public License for more details.
|
;GNU General Public License for more details.
|
||||||
;
|
;
|
||||||
;You should have received a copy of the GNU General Public License along
|
;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.,
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
;
|
;
|
||||||
W "NO ENTRY FROM TOP",!
|
W "NO ENTRY FROM TOP",!
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
EXTRACT(ALTXML,DFN,ALTOUTXML) ; EXTRACT ALERTS INTO PROVIDED XML TEMPLATE
|
EXTRACT(ALTXML,DFN,ALTOUTXML) ; EXTRACT ALERTS INTO PROVIDED XML TEMPLATE
|
||||||
;
|
;
|
||||||
; ALTXML AND ALTOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
; ALTXML AND ALTOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
||||||
;
|
;
|
||||||
; GET ADVERSE REACTIONS AND ALLERGIES
|
; GET ADVERSE REACTIONS AND ALLERGIES
|
||||||
; N GMRA,GMRAL ; FOR DEBUGGING, DON'T NEW THESE VARIABLES
|
; N GMRA,GMRAL ; FOR DEBUGGING, DON'T NEW THESE VARIABLES
|
||||||
S GMRA="0^0^111"
|
S GMRA="0^0^111"
|
||||||
D EN1^GMRADPT
|
D EN1^GMRADPT
|
||||||
I $G(GMRAL)'=1 D Q ; NO ALLERGIES FOUND THUS *QUIT*
|
I $G(GMRAL)'=1 D Q ; NO ALLERGIES FOUND THUS *QUIT*
|
||||||
. S @ALTOUTXML@(0)=0
|
. S @ALTOUTXML@(0)=0
|
||||||
; DEFINE MAPPING
|
; DEFINE MAPPING
|
||||||
N ALTTVMAP,ALTVMAP,ALTTARYTMP,ALTARYTMP
|
N ALTTVMAP,ALTVMAP,ALTTARYTMP,ALTARYTMP
|
||||||
S ALTTVMAP=$NA(^TMP("C0CCCR",$J,"ALERTS"))
|
S ALTTVMAP=$NA(^TMP("C0CCCR",$J,"ALERTS"))
|
||||||
S ALTTARYTMP=$NA(^TMP("C0CCCR",$J,"ALERTSARYTMP"))
|
S ALTTARYTMP=$NA(^TMP("C0CCCR",$J,"ALERTSARYTMP"))
|
||||||
K @ALTTVMAP,@ALTTARYTMP
|
K @ALTTVMAP,@ALTTARYTMP
|
||||||
N ALTTMP,ALTCNT S ALTG=$NA(GMRAL),ALTCNT=1
|
N ALTTMP,ALTCNT S ALTG=$NA(GMRAL),ALTCNT=1
|
||||||
S ALTTMP="" ;
|
S ALTTMP="" ;
|
||||||
F S ALTTMP=$O(@ALTG@(ALTTMP)) Q:ALTTMP="" D ; CHANGED TO $O BY GPL
|
F S ALTTMP=$O(@ALTG@(ALTTMP)) Q:ALTTMP="" D ; CHANGED TO $O BY GPL
|
||||||
. W "ALTTMP="_ALTTMP,!
|
. W "ALTTMP="_ALTTMP,!
|
||||||
. ; I $QS(ALTTMP,2)="S" W !,"S FOUND",! Q
|
. ; I $QS(ALTTMP,2)="S" W !,"S FOUND",! Q
|
||||||
. S ALTVMAP=$NA(@ALTTVMAP@(ALTCNT))
|
. S ALTVMAP=$NA(@ALTTVMAP@(ALTCNT))
|
||||||
. K @ALTVMAP
|
. K @ALTVMAP
|
||||||
. S @ALTVMAP@("ALERTOBJECTID")="ALERT"_ALTCNT
|
. S @ALTVMAP@("ALERTOBJECTID")="ALERT"_ALTCNT
|
||||||
. N A1 S A1=@ALTG@(ALTTMP) ; ALL THE PIECES
|
. N A1 S A1=@ALTG@(ALTTMP) ; ALL THE PIECES
|
||||||
. N A2 S A2=$$GET1^DIQ(120.8,ALTTMP,"MECHANISM","I") ; MECHANISM
|
. N A2 S A2=$$GET1^DIQ(120.8,ALTTMP,"MECHANISM","I") ; MECHANISM
|
||||||
. N A3 S A3=$P(A1,U,5) ; ADVERSE FLAG
|
. N A3 S A3=$P(A1,U,5) ; ADVERSE FLAG
|
||||||
. N ADT S ADT="Patient has an " ; X $ZINT H 5
|
. N ADT S ADT="Patient has an " ; X $ZINT H 5
|
||||||
. S ADT=ADT_$S(A2="P":"ADVERSE",A2="A":"ALLERGIC",1:"UNKNOWN")
|
. S ADT=ADT_$S(A2="P":"ADVERSE",A2="A":"ALLERGIC",1:"UNKNOWN")
|
||||||
. S ADT=ADT_" reaction to "_$P(@ALTG@(ALTTMP),U,2)_"."
|
. S ADT=ADT_" reaction to "_$P(@ALTG@(ALTTMP),U,2)_"."
|
||||||
. S @ALTVMAP@("ALERTDESCRIPTIONTEXT")=ADT
|
. S @ALTVMAP@("ALERTDESCRIPTIONTEXT")=ADT
|
||||||
. N ADTY S ADTY=$S(A2="P":"Adverse Reaction",A2="A":"Allergy",1:"") ;
|
. N ADTY S ADTY=$S(A2="P":"Adverse Reaction",A2="A":"Allergy",1:"") ;
|
||||||
. S @ALTVMAP@("ALERTTYPE")=ADTY ; type of allergy
|
. S @ALTVMAP@("ALERTTYPE")=ADTY ; type of allergy
|
||||||
. N ALTCDE ; SNOMED CODE THE THE ALERT
|
. N ALTCDE ; SNOMED CODE THE THE ALERT
|
||||||
. S ALTCDE=$S(A2="P":"282100009",A2="A":"418634005",1:"") ; IF NOT ADVERSE, IT IS ALLERGIC
|
. S ALTCDE=$S(A2="P":"282100009",A2="A":"418634005",1:"") ; IF NOT ADVERSE, IT IS ALLERGIC
|
||||||
. S @ALTVMAP@("ALERTCODEVALUE")=ALTCDE ;
|
. S @ALTVMAP@("ALERTCODEVALUE")=ALTCDE ;
|
||||||
. ; WILL USE 418634005 FOR ALLERGIC REACTION TO A SUBSTANCE
|
. ; WILL USE 418634005 FOR ALLERGIC REACTION TO A SUBSTANCE
|
||||||
. ; AND 282100009 FOR ADVERSE REACTION TO A SUBSTANCE
|
. ; AND 282100009 FOR ADVERSE REACTION TO A SUBSTANCE
|
||||||
. I ALTCDE'="" D ; IF THERE IS A CODE
|
. I ALTCDE'="" D ; IF THERE IS A CODE
|
||||||
. . S @ALTVMAP@("ALERTCODESYSTEM")="SNOMED CT"
|
. . S @ALTVMAP@("ALERTCODESYSTEM")="SNOMED CT"
|
||||||
. . S @ALTVMAP@("ALERTCODESYSTEMVERSION")="2008"
|
. . S @ALTVMAP@("ALERTCODESYSTEMVERSION")="2008"
|
||||||
. E D ; SET TO NULL
|
. E D ; SET TO NULL
|
||||||
. . S @ALTVMAP@("ALERTCODESYSTEM")=""
|
. . S @ALTVMAP@("ALERTCODESYSTEM")=""
|
||||||
. . S @ALTVMAP@("ALERTCODESYSTEMVERSION")=""
|
. . S @ALTVMAP@("ALERTCODESYSTEMVERSION")=""
|
||||||
. S @ALTVMAP@("ALERTSTATUSTEXT")="" ; WHERE DO WE GET THIS?
|
. S @ALTVMAP@("ALERTSTATUSTEXT")="" ; WHERE DO WE GET THIS?
|
||||||
. N ALTPROV S ALTPROV=$P(^GMR(120.8,ALTTMP,0),U,5) ; SOURCE PROVIDER IEN
|
. N ALTPROV S ALTPROV=$P(^GMR(120.8,ALTTMP,0),U,5) ; SOURCE PROVIDER IEN
|
||||||
. I ALTPROV'="" D ; PROVIDER PROVIDEED
|
. I ALTPROV'="" D ; PROVIDER PROVIDEED
|
||||||
. . S @ALTVMAP@("ALERTSOURCEID")="ACTORPROVIDER_"_ALTPROV
|
. . S @ALTVMAP@("ALERTSOURCEID")="ACTORPROVIDER_"_ALTPROV
|
||||||
. E S @ALTVMAP@("ALERTSOURCEID")="" ; SOURCE NULL - SHOULD NOT HAPPEN
|
. E S @ALTVMAP@("ALERTSOURCEID")="" ; SOURCE NULL - SHOULD NOT HAPPEN
|
||||||
. W "RUNNING ALERTS, PROVIDER: ",@ALTVMAP@("ALERTSOURCEID"),!
|
. W "RUNNING ALERTS, PROVIDER: ",@ALTVMAP@("ALERTSOURCEID"),!
|
||||||
. N ACGL1,ACGFI,ACIEN,ACVUID,ACNM,ACTMP
|
. N ACGL1,ACGFI,ACIEN,ACVUID,ACNM,ACTMP
|
||||||
. S ACGL1=$P(@ALTG@(ALTTMP),U,9) ; ADDRESS OF THE REACTANT XX;GLB(YY.Z,
|
. S ACGL1=$P(@ALTG@(ALTTMP),U,9) ; ADDRESS OF THE REACTANT XX;GLB(YY.Z,
|
||||||
. S ACGFI=$$PRSGLB($P(ACGL1,";",2)) ; FILE NUMBER
|
. S ACGFI=$$PRSGLB($P(ACGL1,";",2)) ; FILE NUMBER
|
||||||
. S ACIEN=$P(ACGL1,";",1) ; IEN OF REACTANT
|
. S ACIEN=$P(ACGL1,";",1) ; IEN OF REACTANT
|
||||||
. S ACVUID=$$GET1^DIQ(ACGFI,ACIEN,"VUID") ; VUID OF THE REACTANT
|
. S ACVUID=$$GET1^DIQ(ACGFI,ACIEN,"VUID") ; VUID OF THE REACTANT
|
||||||
. S @ALTVMAP@("ALERTAGENTPRODUCTOBJECTID")="PRODUCT_"_ACIEN ; IE OF REACTANT
|
. S @ALTVMAP@("ALERTAGENTPRODUCTOBJECTID")="PRODUCT_"_ACIEN ; IE OF REACTANT
|
||||||
. S @ALTVMAP@("ALERTAGENTPRODUCTSOURCEID")="" ; WHERE DO WE GET THIS?
|
. S @ALTVMAP@("ALERTAGENTPRODUCTSOURCEID")="" ; WHERE DO WE GET THIS?
|
||||||
. S ACNM=$P(@ALTG@(ALTTMP),U,2) ; REACTANT
|
. S ACNM=$P(@ALTG@(ALTTMP),U,2) ; REACTANT
|
||||||
. S @ALTVMAP@("ALERTAGENTPRODUCTNAMETEXT")=ACNM
|
. S @ALTVMAP@("ALERTAGENTPRODUCTNAMETEXT")=ACNM
|
||||||
. S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=ACVUID
|
. S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=ACVUID
|
||||||
. I ACVUID'="" D ; IF VUID IS NOT NULL
|
. I ACVUID'="" D ; IF VUID IS NOT NULL
|
||||||
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")="VUID"
|
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")="VUID"
|
||||||
. E D ; IF REACTANT CODE VALUE IS NULL
|
. E D ; IF REACTANT CODE VALUE IS NULL
|
||||||
. . I $G(DUZ("AG"))="I" D ; IF WE ARE RUNNING ON RPMS
|
. . I $G(DUZ("AG"))="I" D ; IF WE ARE RUNNING ON RPMS
|
||||||
. . . S ACTMP=$O(^C0CCODES(176.112,"C",ACNM,0)) ;
|
. . . S ACTMP=$O(^C0CCODES(176.112,"C",ACNM,0)) ;
|
||||||
. . . W "RPMS NAME FOUND",ACNM," ",ACTMP,!
|
. . . W "RPMS NAME FOUND",ACNM," ",ACTMP,!
|
||||||
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")=""
|
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")=""
|
||||||
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=""
|
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=""
|
||||||
. ; REACTIONS - THIS SHOULD BE MULTIPLE, IS SINGLE NOW
|
. ; REACTIONS - THIS SHOULD BE MULTIPLE, IS SINGLE NOW
|
||||||
. N ARTMP,ARIEN,ARDES,ARVUID
|
. N ARTMP,ARIEN,ARDES,ARVUID
|
||||||
. S (ARTMP,ARDES,ARVUID)=""
|
. S (ARTMP,ARDES,ARVUID)=""
|
||||||
. I $D(@ALTG@(ALTTMP,"S",1)) D ; IF REACTION EXISTS
|
. I $D(@ALTG@(ALTTMP,"S",1)) D ; IF REACTION EXISTS
|
||||||
. . S ARTMP=@ALTG@(ALTTMP,"S",1)
|
. . S ARTMP=@ALTG@(ALTTMP,"S",1)
|
||||||
. . W "REACTION:",ARTMP,!
|
. . W "REACTION:",ARTMP,!
|
||||||
. . S ARIEN=$P(ARTMP,";",2)
|
. . S ARIEN=$P(ARTMP,";",2)
|
||||||
. . S ARDES=$P(ARTMP,";",1)
|
. . S ARDES=$P(ARTMP,";",1)
|
||||||
. . S ARVUID=$$GET1^DIQ(120.83,ARIEN,"VUID")
|
. . S ARVUID=$$GET1^DIQ(120.83,ARIEN,"VUID")
|
||||||
. S @ALTVMAP@("ALERTREACTIOINDESCRIPTIONTEXT")=ARDES
|
. S @ALTVMAP@("ALERTREACTIOINDESCRIPTIONTEXT")=ARDES
|
||||||
. I ARVUID'="" D ; IF REACTION VUID IS NOT NULL
|
. I ARVUID'="" D ; IF REACTION VUID IS NOT NULL
|
||||||
. . S @ALTVMAP@("ALERTREACTIONCODEVALUE")=ARVUID
|
. . S @ALTVMAP@("ALERTREACTIONCODEVALUE")=ARVUID
|
||||||
. . S @ALTVMAP@("ALERTREACTIONCODESYSTEM")="VUID"
|
. . S @ALTVMAP@("ALERTREACTIONCODESYSTEM")="VUID"
|
||||||
. E D ; IF IT IS NULL DON'T SET CODE SYSTEM
|
. E D ; IF IT IS NULL DON'T SET CODE SYSTEM
|
||||||
. . S @ALTVMAP@("ALERTREACTIONCODEVALUE")=""
|
. . S @ALTVMAP@("ALERTREACTIONCODEVALUE")=""
|
||||||
. . S @ALTVMAP@("ALERTREACTIONCODESYSTEM")=""
|
. . S @ALTVMAP@("ALERTREACTIONCODESYSTEM")=""
|
||||||
. S ALTARYTMP=$NA(@ALTTARYTMP@(ALTCNT))
|
. S ALTARYTMP=$NA(@ALTTARYTMP@(ALTCNT))
|
||||||
. ; NOW GO TO THE GLOBAL TO GET THE DATE/TIME AND BETTER DESCRIPTION
|
. ; NOW GO TO THE GLOBAL TO GET THE DATE/TIME AND BETTER DESCRIPTION
|
||||||
. N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
|
. N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
|
||||||
. D GETN1^C0CRNF("C0CG1",120.8,ALTTMP,"") ;GET VALUES BY NAME
|
. D GETN1^C0CRNF("C0CG1",120.8,ALTTMP,"") ;GET VALUES BY NAME
|
||||||
. S C0CT=$$ZVALUEI^C0CRNF("ORIGINATION DATE/TIME","C0CG1")
|
. S C0CT=$$ZVALUEI^C0CRNF("ORIGINATION DATE/TIME","C0CG1")
|
||||||
. S @ALTVMAP@("ALERTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CT,"DT")
|
. S @ALTVMAP@("ALERTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CT,"DT")
|
||||||
. K @ALTARYTMP
|
. K @ALTARYTMP
|
||||||
. D MAP^C0CXPATH(ALTXML,ALTVMAP,ALTARYTMP)
|
. D MAP^C0CXPATH(ALTXML,ALTVMAP,ALTARYTMP)
|
||||||
. I ALTCNT=1 D CP^C0CXPATH(ALTARYTMP,ALTOUTXML)
|
. I ALTCNT=1 D CP^C0CXPATH(ALTARYTMP,ALTOUTXML)
|
||||||
. I ALTCNT>1 D INSINNER^C0CXPATH(ALTOUTXML,ALTARYTMP)
|
. I ALTCNT>1 D INSINNER^C0CXPATH(ALTOUTXML,ALTARYTMP)
|
||||||
. S ALTCNT=ALTCNT+1
|
. S ALTCNT=ALTCNT+1
|
||||||
S @ALTTVMAP@(0)=ALTCNT-1 ; RECORD THE NUMBER OF ALERTS
|
S @ALTTVMAP@(0)=ALTCNT-1 ; RECORD THE NUMBER OF ALERTS
|
||||||
Q
|
Q
|
||||||
PRSGLB(INGLB) ; EXTRINSIC TO PARSE GLOBALS AND RETURN THE FILE NUMBER
|
PRSGLB(INGLB) ; EXTRINSIC TO PARSE GLOBALS AND RETURN THE FILE NUMBER
|
||||||
; INGLB IS OF THE FORM: PSNDF(50.6,
|
; INGLB IS OF THE FORM: PSNDF(50.6,
|
||||||
; RETURN 50.6
|
; RETURN 50.6
|
||||||
Q $P($P(INGLB,"(",2),",",1) ;
|
Q $P($P(INGLB,"(",2),",",1) ;
|
||||||
|
|
1588
p/C0CCCR0.m
1588
p/C0CCCR0.m
File diff suppressed because it is too large
Load Diff
168
p/C0CMXML.m
168
p/C0CMXML.m
|
@ -33,6 +33,26 @@ TEST2 ;
|
||||||
D XPATH(1,"/","GIDX","GARY","",REDUX)
|
D XPATH(1,"/","GIDX","GARY","",REDUX)
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
|
TEST3
|
||||||
|
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||||
|
K GARY,GTMP,GIDX
|
||||||
|
K @C0CXMLIN
|
||||||
|
W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
|
||||||
|
D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
|
||||||
|
K @C0CXMLIN
|
||||||
|
M @C0CXMLIN=GTMP
|
||||||
|
K GTMP
|
||||||
|
D STRIPTXT("GTMP",C0CXMLIN)
|
||||||
|
K @C0CXMLIN
|
||||||
|
M @C0CXMLIN=GTMP
|
||||||
|
K GTMP
|
||||||
|
S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID
|
||||||
|
S REDUX="//ClinicalDocument/component/structuredBody"
|
||||||
|
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||||
|
S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER
|
||||||
|
D XPATH(1,"/","GIDX2","GARY2",,REDUX)
|
||||||
|
Q
|
||||||
|
;
|
||||||
XPATH(ZOID,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; RECURSIVE ROUTINE TO POPULATE
|
XPATH(ZOID,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; RECURSIVE ROUTINE TO POPULATE
|
||||||
; THE XPATH INDEX ZXIDX, PASSED BY NAME
|
; THE XPATH INDEX ZXIDX, PASSED BY NAME
|
||||||
; THE XPATH ARRAY XPARY, PASSED BY NAME
|
; THE XPATH ARRAY XPARY, PASSED BY NAME
|
||||||
|
@ -58,7 +78,11 @@ XPATH(ZOID,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; RECURSIVE ROUTINE TO POPULATE
|
||||||
. D XPATH(ZFRST,NEWPATH,ZXIDX,ZXPARY,$S(ZMULT:1,1:""),ZREDUX) ; DO THE CHILD
|
. D XPATH(ZFRST,NEWPATH,ZXIDX,ZXPARY,$S(ZMULT:1,1:""),ZREDUX) ; DO THE CHILD
|
||||||
N GNXT S GNXT=$$NXTSIB(ZOID)
|
N GNXT S GNXT=$$NXTSIB(ZOID)
|
||||||
I GNXT'=0 D ;
|
I GNXT'=0 D ;
|
||||||
. D XPATH(GNXT,ZPATH,ZXIDX,ZXPARY,$S(ZNUM>0:ZNUM+1,1:""),ZREDUX) ; DO NEXT SIB
|
. N ZMULT S ZMULT=$$ISMULT(GNXT) ; IS THE SIBLING A MULTIPLE?
|
||||||
|
. I (ZNUM="")&(ZMULT) D ; SIBLING IS FIRST OF MULTIPLES
|
||||||
|
. . S ZNUM=1 ;
|
||||||
|
. . D XPATH(GNXT,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; DO NEXT SIB
|
||||||
|
. E D XPATH(GNXT,ZPATH,ZXIDX,ZXPARY,$S(ZNUM>0:ZNUM+1,1:""),ZREDUX) ; DO NEXT SIB
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
PARSE(INXML,INDOC) ;CALL THE MXML PARSER ON INXML, PASSED BY NAME
|
PARSE(INXML,INDOC) ;CALL THE MXML PARSER ON INXML, PASSED BY NAME
|
||||||
|
@ -69,6 +93,7 @@ PARSE(INXML,INDOC) ;CALL THE MXML PARSER ON INXML, PASSED BY NAME
|
||||||
;
|
;
|
||||||
ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
|
ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
|
||||||
N ZN
|
N ZN
|
||||||
|
;I $$TAG(ZOID)["entry" B
|
||||||
S ZN=$$NXTSIB(ZOID)
|
S ZN=$$NXTSIB(ZOID)
|
||||||
I ZN'="" Q $$TAG(ZOID)=$$TAG(ZN) ; IF TAG IS THE SAME AS NEXT SIB TAG
|
I ZN'="" Q $$TAG(ZOID)=$$TAG(ZN) ; IF TAG IS THE SAME AS NEXT SIB TAG
|
||||||
Q 0
|
Q 0
|
||||||
|
@ -76,6 +101,9 @@ ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
|
||||||
FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
|
FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
|
||||||
Q $$CHILD^MXMLDOM(C0CDOCID,ZOID)
|
Q $$CHILD^MXMLDOM(C0CDOCID,ZOID)
|
||||||
;
|
;
|
||||||
|
PARENT(ZOID) ;RETURNS THE OID OF THE PARENT OF ZOID
|
||||||
|
Q $$PARENT^MXMLDOM(C0CDOCID,ZOID)
|
||||||
|
;
|
||||||
TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
|
TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
|
||||||
Q $$NAME^MXMLDOM(C0CDOCID,ZOID)
|
Q $$NAME^MXMLDOM(C0CDOCID,ZOID)
|
||||||
;
|
;
|
||||||
|
@ -89,3 +117,141 @@ DATA(ZT,ZOID) ; RETURNS DATA FOR THE NODE
|
||||||
S ZN=$$TEXT^MXMLDOM(C0CDOCID,ZOID,ZT)
|
S ZN=$$TEXT^MXMLDOM(C0CDOCID,ZOID,ZT)
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
|
PARSCCD(DOC,OPTION) ; THIS WAS COPIED FROM EN^MXMLDOM TO CUSTIMIZE FOR
|
||||||
|
; PROCESSING CCDS
|
||||||
|
N CBK,SUCCESS,LEVEL,NODE,HANDLE
|
||||||
|
K ^TMP("MXMLERR",$J)
|
||||||
|
L +^TMP("MXMLDOM",$J):5
|
||||||
|
E Q 0
|
||||||
|
S HANDLE=$O(^TMP("MXMLDOM",$J,""),-1)+1,^(HANDLE)=""
|
||||||
|
L -^TMP("MXMLDOM",$J)
|
||||||
|
S CBK("STARTELEMENT")="STARTELE^C0CMXML" ; ONLY THIS ONE IS CHANGED ;GPL
|
||||||
|
S CBK("ENDELEMENT")="ENDELE^MXMLDOM"
|
||||||
|
S CBK("COMMENT")="COMMENT^MXMLDOM"
|
||||||
|
S CBK("CHARACTERS")="CHAR^MXMLDOM"
|
||||||
|
S CBK("ENDDOCUMENT")="ENDDOC^MXMLDOM"
|
||||||
|
S CBK("ERROR")="ERROR^MXMLDOM"
|
||||||
|
S (SUCCESS,LEVEL,LEVEL(0),NODE)=0,OPTION=$G(OPTION,"V1")
|
||||||
|
D EN^MXMLPRSE(DOC,.CBK,OPTION)
|
||||||
|
D:'SUCCESS DELETE^MXMLDOM(HANDLE)
|
||||||
|
Q $S(SUCCESS:HANDLE,1:0)
|
||||||
|
; Start element
|
||||||
|
; Create new child node and push info on stack
|
||||||
|
STARTELE(ELE,ATTR) ; COPIED FROM STARTELE^MXMLDOM AND MODIFIED TO TREAT
|
||||||
|
; ATTRIBUTES AS SUBELEMENTS TO MAKE CCD XPATH PROCESSING EASIER
|
||||||
|
N PARENT
|
||||||
|
S PARENT=LEVEL(LEVEL),NODE=NODE+1
|
||||||
|
S:PARENT ^TMP("MXMLDOM",$J,HANDLE,PARENT,"C",NODE)=ELE
|
||||||
|
S LEVEL=LEVEL+1,LEVEL(LEVEL)=NODE,LEVEL(LEVEL,0)=ELE
|
||||||
|
S ^TMP("MXMLDOM",$J,HANDLE,NODE)=ELE,^(NODE,"P")=PARENT
|
||||||
|
;M ^("A")=ATTR
|
||||||
|
N ZI S ZI="" ; INDEX FOR ATTR
|
||||||
|
F S ZI=$O(ATTR(ZI)) Q:ZI="" D ; FOR EACH ATTRIBUTE
|
||||||
|
. N ELE,TXT ; ABOUT TO RECURSE
|
||||||
|
. S ELE=ZI ; TAG
|
||||||
|
. S TXT=ATTR(ZI) ; DATA
|
||||||
|
. D STARTELE(ELE,"") ; CREATE A NEW SUBNODE
|
||||||
|
. D TXT^MXMLDOM("T") ; INSERT DATA TO TAG
|
||||||
|
. D ENDELE^MXMLDOM(ELE) ; POP BACK UP A LEVEL
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
CLEANARY(OUTARY,INARY) ; GOES THROUGH AN ARRAY AND CALLS CLEAN ON EACH NODE
|
||||||
|
; INARY AND OUTARY PASSED BY NAME
|
||||||
|
N ZI S ZI=""
|
||||||
|
F S ZI=$O(@INARY@(ZI)) Q:ZI="" D ; FOR EACH NODE
|
||||||
|
. S @OUTARY@(ZI)=$$CLEAN(@INARY@(ZI)) ; CLEAN THE NODE
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
CLEAN(STR) ; extrinsic function; returns string
|
||||||
|
;; Removes all non printable characters from a string.
|
||||||
|
;; STR by Value
|
||||||
|
N TR,I
|
||||||
|
F I=0:1:31 S TR=$G(TR)_$C(I)
|
||||||
|
S TR=TR_$C(127)
|
||||||
|
QUIT $TR(STR,TR)
|
||||||
|
;
|
||||||
|
STRIPTXT(OUTARY,ZARY) ; STRIPS THE "TEXT" PORTION OUT OF AN XML FILE
|
||||||
|
; THIS IS USED TO DELETE THE NARATIVE HTML OUT OF THE CCD XML FILES BECAUSE
|
||||||
|
; THEY DO NOT WORK RIGHT WITH THE PARSER
|
||||||
|
;N ZWRK,ZBLD,ZI ; WORK ARRAY,BUILD ARRAY, AND COUNTER
|
||||||
|
S ZI=$O(@ZARY@("")) ; GET FIRST LINE NUMBER
|
||||||
|
D C0CBEGIN("ZWRK",ZI) ; INSERT FIRST LINE IN WORK ARRAY
|
||||||
|
F S ZI=$O(@ZARY@(ZI)) Q:ZI="" D ; FOR EACH LINE OF THE ARRAY
|
||||||
|
. I $O(@ZARY@(ZI))="" D Q ; AT THE END
|
||||||
|
. . D C0CEND("ZWRK",ZI) ; INCLUDE LAST LINE IN WORK ARRAY
|
||||||
|
. I ZI=1 D C0CBEGIN("ZWRK",ZI) ; START WITH FIRST LINE
|
||||||
|
. I @ZARY@(ZI)["<text" D C0CEND("ZWRK",ZI-1) ;PREV LINE IS AN END
|
||||||
|
. I @ZARY@(ZI)["</text>" D C0CBEGIN("ZWRK",ZI+1) ;NEXT LINE IS A BEGIN
|
||||||
|
S ZI=""
|
||||||
|
F S ZI=$O(ZWRK(ZI)) Q:ZI="" D ; MAKE A BUILD LIST FROM THE WORK ARRAY
|
||||||
|
. D QUEUE^C0CXPATH("ZBLD",ZARY,$P(ZWRK(ZI),"^",1),$P(ZWRK(ZI),"^",2))
|
||||||
|
D BUILD^C0CXPATH("ZBLD",OUTARY) ; BUILD NEW ARRAY WITHOUT TEXT SECTIONS
|
||||||
|
K @OUTARY@(0) ; GET RID OF THE LINE COUNT
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
C0CBEGIN(ZA,LN) ; INSERTS A BEGIN LINE LN INTO ARRAY ZWRK, PASSED BY NAME
|
||||||
|
N ZI
|
||||||
|
S ZI=$O(@ZA@(""),-1)
|
||||||
|
I ZI="" S ZI=1
|
||||||
|
E S ZI=ZI+1 ; INCREMENT COUNT IN WORK ARRAY
|
||||||
|
S $P(@ZA@(ZI),"^",1)=LN
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
C0CEND(ZB,LN) ; INSERTS AN END LINE LN INTO ARRAY ZWRK, PASSED BY NAME
|
||||||
|
N ZI
|
||||||
|
S ZI=$O(@ZB@(""),-1)
|
||||||
|
I ZI="" S ZI=1
|
||||||
|
S $P(@ZB@(ZI),"^",2)=LN
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
FINDTID ; FIND TEMPLATE IDS IN DOM 1
|
||||||
|
S C0CDOCID=1
|
||||||
|
S ZD=$NA(^TMP("MXMLDOM",$J,C0CDOCID))
|
||||||
|
S ZN=""
|
||||||
|
S CURSEC=""
|
||||||
|
S TID=""
|
||||||
|
F S ZN=$O(@ZD@(ZN)) Q:ZN="" D ;
|
||||||
|
. I $$TAG(ZN)="root" D ;
|
||||||
|
. . I $$TAG($$PARENT(ZN))="templateId" D ; ONLY LOOKING FOR TEMPLATES
|
||||||
|
. . . S ZG=$$PARENT($$PARENT(ZN))
|
||||||
|
. . . S CMT=$G(@ZD@(ZG,"X",1))
|
||||||
|
. . . I $$TAG(ZG)="section" D ;START OF A SECTION
|
||||||
|
. . . . S CURSEC=ZG
|
||||||
|
. . . . S SECCMT=$G(@ZD@(CURSEC,"X",1))
|
||||||
|
. . . S TID=$G(@ZD@(ZN,"T",1)) ;TEMPLATE ID
|
||||||
|
. . . I CURSEC'="" D ; IF WE ARE IN A SECTION
|
||||||
|
. . . . S CCDDIR(CURSEC,SECCMT,ZG,$$TAG(ZG),CMT)=TID
|
||||||
|
. . . W !,$$TAG(ZG)," ",$G(@ZD@(ZG,"X",1))
|
||||||
|
. . . W " root ",ZN," ",@ZD@(ZN,"T",1)
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
GENXDS(ZD) ; GENERATE THE XDS PROTOTYPE RECORDS FROM A CCDDIR ARRAY
|
||||||
|
; ARRAY ELEMENTS LOOK LIKE:
|
||||||
|
; CCDDIR(1634," Vital signs section template ",1659,"observation"," Result observaion template ")="2.16.840.1.113883.10.20.1.31"
|
||||||
|
;or CCDDIR(section node,sec name, cur node,cur tag,cur name)=templateId
|
||||||
|
S ZF=178.101 ; FILE NUMBER FOR THE C0C XDS PROTOTYPE FILE
|
||||||
|
S ZI=$Q(@ZD@("")) ;FIRST ARRAY ELEMENT
|
||||||
|
S DONE=0
|
||||||
|
F Q:DONE D ;
|
||||||
|
. W @ZI,!
|
||||||
|
. S ZJ=$QS(ZI,5)
|
||||||
|
. S ZJ=$E(ZJ,2,$L(ZJ)) ;STRIP THE LEADING SPACE
|
||||||
|
. S C0CFDA(ZF,"?+1,",.01)=ZJ
|
||||||
|
. S C0CFDA(ZF,"?+1,",.02)=$QS(ZI,4) ; TAG FOR THIS TEMPLATE
|
||||||
|
. S C0CFDA(ZF,"?+1,",1)=@ZI
|
||||||
|
. D UPDIE
|
||||||
|
. S ZI=$Q(@ZI)
|
||||||
|
. I ZI="" S DONE=1
|
||||||
|
Q
|
||||||
|
;
|
||||||
|
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
|
||||||
|
K ZERR
|
||||||
|
D CLEAN^DILF
|
||||||
|
D UPDATE^DIE("","C0CFDA","","ZERR")
|
||||||
|
I $D(ZERR) D ;
|
||||||
|
. W "ERROR",!
|
||||||
|
. ZWR ZERR
|
||||||
|
. B
|
||||||
|
K C0CFDA
|
||||||
|
Q
|
||||||
|
;
|
356
p/C0CPROBS.m
356
p/C0CPROBS.m
|
@ -1,178 +1,178 @@
|
||||||
C0CPROBS ; CCDCCR/GPL/CJE - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
C0CPROBS ; CCDCCR/GPL/CJE - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
||||||
;;1.0;C0C;;May 19, 2009;
|
;;1.0;C0C;;May 19, 2009;
|
||||||
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
||||||
;Licensed under the terms of the GNU General Public License.
|
;Licensed under the terms of the GNU General Public License.
|
||||||
;See attached copy of the License.
|
;See attached copy of the License.
|
||||||
;
|
;
|
||||||
;This program is free software; you can redistribute it and/or modify
|
;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
|
;it under the terms of the GNU General Public License as published by
|
||||||
;the Free Software Foundation; either version 2 of the License, or
|
;the Free Software Foundation; either version 2 of the License, or
|
||||||
;(at your option) any later version.
|
;(at your option) any later version.
|
||||||
;
|
;
|
||||||
;This program is distributed in the hope that it will be useful,
|
;This program is distributed in the hope that it will be useful,
|
||||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;GNU General Public License for more details.
|
;GNU General Public License for more details.
|
||||||
;
|
;
|
||||||
;You should have received a copy of the GNU General Public License along
|
;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.,
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
; PROCESS THE PROBLEMS SECTION OF THE CCR
|
; PROCESS THE PROBLEMS SECTION OF THE CCR
|
||||||
;
|
;
|
||||||
EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
||||||
;
|
;
|
||||||
; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
||||||
; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
|
; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
|
||||||
; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
|
; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
|
||||||
; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
|
; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
|
||||||
; INSERT^C0CXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
|
; INSERT^C0CXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
|
||||||
;
|
;
|
||||||
N RPCRSLT,J,K,PTMP,X,VMAP,TBU
|
N RPCRSLT,J,K,PTMP,X,VMAP,TBU
|
||||||
S TVMAP=$NA(^TMP("C0CCCR",$J,"PROBVALS"))
|
S TVMAP=$NA(^TMP("C0CCCR",$J,"PROBVALS"))
|
||||||
S TARYTMP=$NA(^TMP("C0CCCR",$J,"PROBARYTMP"))
|
S TARYTMP=$NA(^TMP("C0CCCR",$J,"PROBARYTMP"))
|
||||||
K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
|
K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
|
||||||
I $$RPMS^C0CUTIL() D RPMS ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
|
I $$RPMS^C0CUTIL() D RPMS ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
|
||||||
I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
|
I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
RPMS ; GETS THE PROBLEM LIST FOR RPMS
|
RPMS ; GETS THE PROBLEM LIST FOR RPMS
|
||||||
S RPCGLO=$NA(^TMP("BGO",$J))
|
S RPCGLO=$NA(^TMP("BGO",$J))
|
||||||
D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
|
D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
|
||||||
; FORMAT OF RPC:
|
; FORMAT OF RPC:
|
||||||
; Number Code [1] ^ Patient IEN [2] ^ ICD Code [3] ^ Modify Date [4] ^ Class [5] ^ Provider Narrative [6] ^
|
; Number Code [1] ^ Patient IEN [2] ^ ICD Code [3] ^ Modify Date [4] ^ Class [5] ^ Provider Narrative [6] ^
|
||||||
; Date Entered [7] ^ Status [8] ^ Date Onset [9] ^ Problem IEN [10] ^ Notes [11] ^ ICD9 IEN [12] ^
|
; Date Entered [7] ^ Status [8] ^ Date Onset [9] ^ Problem IEN [10] ^ Notes [11] ^ ICD9 IEN [12] ^
|
||||||
; ICD9 Short Name [13] ^ Provider [14] ^ Facility IEN [15] ^ Priority [16]
|
; ICD9 Short Name [13] ^ Provider [14] ^ Facility IEN [15] ^ Priority [16]
|
||||||
I '$D(@RPCGLO) W "NULL RESULT FROM GET^BGOPROB ",! S @OUTXML@(0)=0 Q
|
I '$D(@RPCGLO) W "NULL RESULT FROM GET^BGOPROB ",! S @OUTXML@(0)=0 Q
|
||||||
S J=""
|
S J=""
|
||||||
F S J=$O(@RPCGLO@(J)) Q:J="" D ; FOR EACH PROBLEM IN THE LIST
|
F S J=$O(@RPCGLO@(J)) Q:J="" D ; FOR EACH PROBLEM IN THE LIST
|
||||||
. S VMAP=$NA(@TVMAP@(J))
|
. S VMAP=$NA(@TVMAP@(J))
|
||||||
. K @VMAP
|
. K @VMAP
|
||||||
. I DEBUG W "VMAP= ",VMAP,!
|
. I DEBUG W "VMAP= ",VMAP,!
|
||||||
. S PTMP=@RPCRSLT@(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
. S PTMP=@RPCRSLT@(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
||||||
. N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
|
. N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
|
||||||
. D GETN1^C0CRNF("C0CG1",9000011,$P(PTMP,U,10),"") ;GET VALUES BY NAME
|
. D GETN1^C0CRNF("C0CG1",9000011,$P(PTMP,U,10),"") ;GET VALUES BY NAME
|
||||||
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
||||||
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,10)
|
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,10)
|
||||||
. S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,8)="A":"Active",$P(PTMP,U,8)="I":"Inactive",1:"")
|
. S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,8)="A":"Active",$P(PTMP,U,8)="I":"Inactive",1:"")
|
||||||
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,6)
|
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,6)
|
||||||
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
||||||
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,3)
|
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,3)
|
||||||
. S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE OF ONSET","C0CG1"),"DT")
|
. S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE OF ONSET","C0CG1"),"DT")
|
||||||
. S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE LAST MODIFIED","C0CG1"),"DT")
|
. S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE LAST MODIFIED","C0CG1"),"DT")
|
||||||
. ;S @VMAP@("PROBLEMSC")=$P(PTMP,U,7) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMSC")=$P(PTMP,U,7) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMSE")=$P(PTMP,U,8) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMSE")=$P(PTMP,U,8) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
. ;S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
||||||
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$$ZVALUEI^C0CRNF("RECORDING PROVIDER","C0CG1")
|
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$$ZVALUEI^C0CRNF("RECORDING PROVIDER","C0CG1")
|
||||||
. ;S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14) ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14) ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT") ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT") ;NOT MAPPED IN C0CCCR0
|
||||||
. ;S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT") ;NOT MAPPED IN C0CCCR0
|
. ;S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT") ;NOT MAPPED IN C0CCCR0
|
||||||
. S ARYTMP=$NA(@TARYTMP@(J))
|
. S ARYTMP=$NA(@TARYTMP@(J))
|
||||||
. ; W "ARYTMP= ",ARYTMP,!
|
. ; W "ARYTMP= ",ARYTMP,!
|
||||||
. K @ARYTMP
|
. K @ARYTMP
|
||||||
. D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
|
. D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
|
||||||
. I J=1 D ; FIRST ONE IS JUST A COPY
|
. I J=1 D ; FIRST ONE IS JUST A COPY
|
||||||
. . ; W "FIRST ONE",!
|
. . ; W "FIRST ONE",!
|
||||||
. . D CP^C0CXPATH(ARYTMP,OUTXML)
|
. . D CP^C0CXPATH(ARYTMP,OUTXML)
|
||||||
. . ; W "OUTXML ",OUTXML,!
|
. . ; W "OUTXML ",OUTXML,!
|
||||||
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
||||||
. . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
|
. . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
|
||||||
; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
|
; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
|
||||||
; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
||||||
; ZWR @OUTXML
|
; ZWR @OUTXML
|
||||||
; $$HTML^DILF(
|
; $$HTML^DILF(
|
||||||
; GENERATE THE NARITIVE HTML FOR THE CCD
|
; GENERATE THE NARITIVE HTML FOR THE CCD
|
||||||
I CCD D CCD ; IF THIS IS FOR A CCD
|
I CCD D CCD ; IF THIS IS FOR A CCD
|
||||||
D MISSINGVARS
|
D MISSINGVARS
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
VISTA ; GETS THE PROBLEM LIST FOR VISTA
|
VISTA ; GETS THE PROBLEM LIST FOR VISTA
|
||||||
D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
|
D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
|
||||||
I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
|
I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
|
||||||
. W "NULL RESULT FROM LIST^ORQQPL3 ",!
|
. W "NULL RESULT FROM LIST^ORQQPL3 ",!
|
||||||
. S @OUTXML@(0)=0
|
. S @OUTXML@(0)=0
|
||||||
. ; Q
|
. ; Q
|
||||||
; I DEBUG ZWR RPCRSLT
|
; I DEBUG ZWR RPCRSLT
|
||||||
S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
|
S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
|
||||||
F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
|
F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
|
||||||
. S VMAP=$NA(@TVMAP@(J))
|
. S VMAP=$NA(@TVMAP@(J))
|
||||||
. K @VMAP
|
. K @VMAP
|
||||||
. I DEBUG W "VMAP= ",VMAP,!
|
. I DEBUG W "VMAP= ",VMAP,!
|
||||||
. S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
. S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
||||||
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
||||||
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
|
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
|
||||||
. S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,2)="A":"Active",1:"")
|
. S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,2)="A":"Active",1:"")
|
||||||
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
|
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
|
||||||
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
||||||
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
|
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
|
||||||
. S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,5),"DT")
|
. S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,5),"DT")
|
||||||
. S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,6),"DT")
|
. S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,6),"DT")
|
||||||
. S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
|
. S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
|
||||||
. S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
|
. S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
|
||||||
. S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
|
. S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
|
||||||
. S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
|
. S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
|
||||||
. S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
|
. S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
|
||||||
. S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
|
. S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
|
||||||
. S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
. S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
||||||
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
|
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
|
||||||
. S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
|
. S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
|
||||||
. S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
|
. S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
|
||||||
. S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT")
|
. S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT")
|
||||||
. S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT")
|
. S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT")
|
||||||
. S ARYTMP=$NA(@TARYTMP@(J))
|
. S ARYTMP=$NA(@TARYTMP@(J))
|
||||||
. ; W "ARYTMP= ",ARYTMP,!
|
. ; W "ARYTMP= ",ARYTMP,!
|
||||||
. K @ARYTMP
|
. K @ARYTMP
|
||||||
. D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
|
. D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
|
||||||
. I J=1 D ; FIRST ONE IS JUST A COPY
|
. I J=1 D ; FIRST ONE IS JUST A COPY
|
||||||
. . ; W "FIRST ONE",!
|
. . ; W "FIRST ONE",!
|
||||||
. . D CP^C0CXPATH(ARYTMP,OUTXML)
|
. . D CP^C0CXPATH(ARYTMP,OUTXML)
|
||||||
. . ; W "OUTXML ",OUTXML,!
|
. . ; W "OUTXML ",OUTXML,!
|
||||||
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
||||||
. . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
|
. . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
|
||||||
; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
|
; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
|
||||||
; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
||||||
; ZWR @OUTXML
|
; ZWR @OUTXML
|
||||||
; $$HTML^DILF(
|
; $$HTML^DILF(
|
||||||
; GENERATE THE NARITIVE HTML FOR THE CCD
|
; GENERATE THE NARITIVE HTML FOR THE CCD
|
||||||
I CCD D CCD ; IF THIS IS FOR A CCD
|
I CCD D CCD ; IF THIS IS FOR A CCD
|
||||||
D MISSINGVARS
|
D MISSINGVARS
|
||||||
Q
|
Q
|
||||||
CCD
|
CCD
|
||||||
N HTMP,HOUT,HTMLO,C0CPROBI,ZX
|
N HTMP,HOUT,HTMLO,C0CPROBI,ZX
|
||||||
F C0CPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
|
F C0CPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
|
||||||
. S VMAP=$NA(@TVMAP@(C0CPROBI))
|
. S VMAP=$NA(@TVMAP@(C0CPROBI))
|
||||||
. I DEBUG W "VMAP =",VMAP,!
|
. I DEBUG W "VMAP =",VMAP,!
|
||||||
. D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
|
. D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
|
||||||
. D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
|
. D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
|
||||||
. ; D PARY^C0CXPATH("HTMP") ; PRINT IT
|
. ; D PARY^C0CXPATH("HTMP") ; PRINT IT
|
||||||
. D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
|
. D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
|
||||||
. ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
|
. ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
|
||||||
. I C0CPROBI=1 D ; FIRST ONE IS JUST A COPY
|
. I C0CPROBI=1 D ; FIRST ONE IS JUST A COPY
|
||||||
. . D CP^C0CXPATH("HOUT","HTMLO")
|
. . D CP^C0CXPATH("HOUT","HTMLO")
|
||||||
. I C0CPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
|
. I C0CPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
|
||||||
. . I DEBUG W "DOING INNER",!
|
. . I DEBUG W "DOING INNER",!
|
||||||
. . N HTMLBLD,HTMLTMP
|
. . N HTMLBLD,HTMLTMP
|
||||||
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
|
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
|
||||||
. . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
|
. . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
|
||||||
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
|
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
|
||||||
. . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
|
. . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
|
||||||
. . D CP^C0CXPATH("HTMLTMP","HTMLO")
|
. . D CP^C0CXPATH("HTMLTMP","HTMLO")
|
||||||
. . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
|
. . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
|
||||||
I DEBUG D PARY^C0CXPATH("HTMLO")
|
I DEBUG D PARY^C0CXPATH("HTMLO")
|
||||||
D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
|
D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
|
||||||
Q
|
Q
|
||||||
MISSINGVARS
|
MISSINGVARS
|
||||||
N PROBSTMP,I
|
N PROBSTMP,I
|
||||||
D MISSING^C0CXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
|
D MISSING^C0CXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
|
||||||
I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
||||||
. ; STRINGS MARKED AS @@X@@
|
. ; STRINGS MARKED AS @@X@@
|
||||||
. W !,"PROBLEMS Missing list: ",!
|
. W !,"PROBLEMS Missing list: ",!
|
||||||
. F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
|
. F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
|
|
|
@ -39,7 +39,8 @@ EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
VITVISTA ; EXTRACT VITALS FROM VISTA INTO PROVIDED XML TEMPLATE
|
VITVISTA ; EXTRACT VITALS FROM VISTA INTO PROVIDED XML TEMPLATE
|
||||||
D VITALS^ORQQVI(.VITRSLT,DFN,C0CSDT,C0CEDT)
|
D VITALS^ORQQVI(.VITRSLT,DFN,C0CEDT,C0CSDT)
|
||||||
|
;D VITALS^ORQQVI(.VITRSLT,DFN,C0CSDT,C0CEDT)
|
||||||
;D VITALS^ORQQVI(.VITRSLT,DFN,C0CVSTRT,C0CVLMT) ; GPL LET GMR HANDLE THE DATES
|
;D VITALS^ORQQVI(.VITRSLT,DFN,C0CVSTRT,C0CVLMT) ; GPL LET GMR HANDLE THE DATES
|
||||||
I '$D(VITRSLT(1)) S @VITOUTXML@(0)=0 Q ; RETURN NOT FOUND AND QUIT
|
I '$D(VITRSLT(1)) S @VITOUTXML@(0)=0 Q ; RETURN NOT FOUND AND QUIT
|
||||||
I $P(VITRSLT(1),U,2)="No vitals found." D Q ; NULL RESULT FROM RPC
|
I $P(VITRSLT(1),U,2)="No vitals found." D Q ; NULL RESULT FROM RPC
|
||||||
|
|
26
p/C0CXPATH.m
26
p/C0CXPATH.m
|
@ -385,12 +385,12 @@ BUILD(BLIST,BDEST) ; A COPY MACHINE THAT TAKE INSTRUCTIONS IN ARRAY BLIST
|
||||||
F I=1:1:@BLIST@(0) D ; FOR EACH INSTRUCTION IN BLIST
|
F I=1:1:@BLIST@(0) D ; FOR EACH INSTRUCTION IN BLIST
|
||||||
. N J,ATMP
|
. N J,ATMP
|
||||||
. S ATMP=$$ARRAY(@BLIST@(I))
|
. S ATMP=$$ARRAY(@BLIST@(I))
|
||||||
. I DEBUG W "ATMP=",ATMP,!
|
. I $G(DEBUG) W "ATMP=",ATMP,!
|
||||||
. I DEBUG W @BLIST@(I),!
|
. I $G(DEBUG) W @BLIST@(I),!
|
||||||
. F J=$$START(@BLIST@(I)):1:$$FINISH(@BLIST@(I)) D ;
|
. F J=$$START(@BLIST@(I)):1:$$FINISH(@BLIST@(I)) D ;
|
||||||
. . ; FOR EACH LINE IN THIS INSTR
|
. . ; FOR EACH LINE IN THIS INSTR
|
||||||
. . I DEBUG W "BDEST= ",BDEST,!
|
. . I $G(DEBUG) W "BDEST= ",BDEST,!
|
||||||
. . I DEBUG W "ATMP= ",@ATMP@(J),!
|
. . I $G(DEBUG) W "ATMP= ",@ATMP@(J),!
|
||||||
. . D PUSH(BDEST,@ATMP@(J))
|
. . D PUSH(BDEST,@ATMP@(J))
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
|
@ -403,7 +403,7 @@ QUEUE(BLST,ARRAY,FIRST,LAST) ; ADD AN ENTRY TO A BLIST
|
||||||
CP(CPSRC,CPDEST) ; COPIES CPSRC TO CPDEST BOTH PASSED BY NAME
|
CP(CPSRC,CPDEST) ; COPIES CPSRC TO CPDEST BOTH PASSED BY NAME
|
||||||
; KILLS CPDEST FIRST
|
; KILLS CPDEST FIRST
|
||||||
N CPINSTR
|
N CPINSTR
|
||||||
I DEBUG W "MADE IT TO COPY",CPSRC,CPDEST,!
|
I $G(DEBUG) W "MADE IT TO COPY",CPSRC,CPDEST,!
|
||||||
I @CPSRC@(0)<1 D ; BAD LENGTH
|
I @CPSRC@(0)<1 D ; BAD LENGTH
|
||||||
. W "ERROR IN COPY BAD SOURCE LENGTH: ",CPSRC,!
|
. W "ERROR IN COPY BAD SOURCE LENGTH: ",CPSRC,!
|
||||||
. Q
|
. Q
|
||||||
|
@ -419,7 +419,7 @@ QOPEN(QOBLIST,QOXML,QOXPATH) ; ADD ALL BUT THE LAST LINE OF QOXML TO QOBLIST
|
||||||
I @QOXML@(0)<1 D ; MALFORMED XML
|
I @QOXML@(0)<1 D ; MALFORMED XML
|
||||||
. W "MALFORMED XML PASSED TO QOPEN: ",QOXML,!
|
. W "MALFORMED XML PASSED TO QOPEN: ",QOXML,!
|
||||||
. Q
|
. Q
|
||||||
I DEBUG W "DOING QOPEN",!
|
I $G(DEBUG) W "DOING QOPEN",!
|
||||||
N S1,E1,QOT,QOTMP
|
N S1,E1,QOT,QOTMP
|
||||||
S S1=1 ; OPEN FROM THE BEGINNING OF THE XML
|
S S1=1 ; OPEN FROM THE BEGINNING OF THE XML
|
||||||
I $D(QOXPATH) D ; XPATH PROVIDED
|
I $D(QOXPATH) D ; XPATH PROVIDED
|
||||||
|
@ -439,7 +439,7 @@ QCLOSE(QCBLIST,QCXML,QCXPATH) ; CLOSE XML AFTER A QOPEN
|
||||||
; IF QOPEN WAS CALLED WITH XPATH, QCLOSE SHOULD BE TOO
|
; IF QOPEN WAS CALLED WITH XPATH, QCLOSE SHOULD BE TOO
|
||||||
I @QCXML@(0)<1 D ; MALFORMED XML
|
I @QCXML@(0)<1 D ; MALFORMED XML
|
||||||
. W "MALFORMED XML PASSED TO QCLOSE: ",QCXML,!
|
. W "MALFORMED XML PASSED TO QCLOSE: ",QCXML,!
|
||||||
I DEBUG W "GOING TO CLOSE",!
|
I $G(DEBUG) W "GOING TO CLOSE",!
|
||||||
N S1,E1,QCT,QCTMP
|
N S1,E1,QCT,QCTMP
|
||||||
S E1=@QCXML@(0) ; CLOSE UNTIL THE END OF THE XML
|
S E1=@QCXML@(0) ; CLOSE UNTIL THE END OF THE XML
|
||||||
I $D(QCXPATH) D ; XPATH PROVIDED
|
I $D(QCXPATH) D ; XPATH PROVIDED
|
||||||
|
@ -458,14 +458,14 @@ INSERT(INSXML,INSNEW,INSXPATH) ; INSERT INSNEW INTO INSXML AT THE
|
||||||
; XML AT THE END OF THE XPATH POINT
|
; XML AT THE END OF THE XPATH POINT
|
||||||
; INSXML AND INSNEW ARE PASSED BY NAME INSXPATH IS A VALUE
|
; INSXML AND INSNEW ARE PASSED BY NAME INSXPATH IS A VALUE
|
||||||
N INSBLD,INSTMP
|
N INSBLD,INSTMP
|
||||||
I DEBUG W "DOING INSERT ",INSXML,INSNEW,INSXPATH,!
|
I $G(DEBUG) W "DOING INSERT ",INSXML,INSNEW,INSXPATH,!
|
||||||
I DEBUG F G1=1:1:@INSXML@(0) W @INSXML@(G1),!
|
I $G(DEBUG) F G1=1:1:@INSXML@(0) W @INSXML@(G1),!
|
||||||
I '$D(@INSXML@(0)) D ; INSERT INTO AN EMPTY ARRAY
|
I '$D(@INSXML@(0)) D ; INSERT INTO AN EMPTY ARRAY
|
||||||
. D CP^C0CXPATH(INSNEW,INSXML) ; JUST COPY INTO THE OUTPUT
|
. D CP^C0CXPATH(INSNEW,INSXML) ; JUST COPY INTO THE OUTPUT
|
||||||
I $D(@INSXML@(0)) D ; IF ORIGINAL ARRAY IS NOT EMPTY
|
I $D(@INSXML@(0)) D ; IF ORIGINAL ARRAY IS NOT EMPTY
|
||||||
. I $D(INSXPATH) D ; XPATH PROVIDED
|
. I $D(INSXPATH) D ; XPATH PROVIDED
|
||||||
. . D QOPEN("INSBLD",INSXML,INSXPATH) ; COPY THE BEFORE
|
. . D QOPEN("INSBLD",INSXML,INSXPATH) ; COPY THE BEFORE
|
||||||
. . I DEBUG D PARY^C0CXPATH("INSBLD")
|
. . I $G(DEBUG) D PARY^C0CXPATH("INSBLD")
|
||||||
. I '$D(INSXPATH) D ; NO XPATH PROVIDED, OPEN AT ROOT
|
. I '$D(INSXPATH) D ; NO XPATH PROVIDED, OPEN AT ROOT
|
||||||
. . D QOPEN("INSBLD",INSXML,"//") ; OPEN WITH ROOT XPATH
|
. . D QOPEN("INSBLD",INSXML,"//") ; OPEN WITH ROOT XPATH
|
||||||
. D QUEUE("INSBLD",INSNEW,1,@INSNEW@(0)) ; COPY IN NEW XML
|
. D QUEUE("INSBLD",INSNEW,1,@INSNEW@(0)) ; COPY IN NEW XML
|
||||||
|
@ -505,7 +505,7 @@ INSB4(XDEST,XNEW) ; INSERT XNEW AT THE BEGINNING OF XDEST
|
||||||
D QUEUE("XBLD",XDEST,2,@XDEST@(0)) ; FOLLOWED BY THE REST OF SECTION
|
D QUEUE("XBLD",XDEST,2,@XDEST@(0)) ; FOLLOWED BY THE REST OF SECTION
|
||||||
D BUILD("XBLD","XTMP") ; BUILD THE RESULT
|
D BUILD("XBLD","XTMP") ; BUILD THE RESULT
|
||||||
D CP("XTMP",XDEST) ; COPY TO THE DESTINATION
|
D CP("XTMP",XDEST) ; COPY TO THE DESTINATION
|
||||||
I DEBUG D PARY("XDEST")
|
I $G(DEBUG) D PARY("XDEST")
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
REPLACE(REXML,RENEW,REXPATH) ; REPLACE THE XML AT THE XPATH POINT
|
REPLACE(REXML,RENEW,REXPATH) ; REPLACE THE XML AT THE XPATH POINT
|
||||||
|
@ -525,8 +525,8 @@ REPLACE(REXML,RENEW,REXPATH) ; REPLACE THE XML AT THE XPATH POINT
|
||||||
. D QUEUE("REBLD",REXML,1,XFIRST-1) ; THE BEFORE
|
. D QUEUE("REBLD",REXML,1,XFIRST-1) ; THE BEFORE
|
||||||
. D QUEUE("REBLD",RENEW,1,@RENEW@(0)) ; THE NEW
|
. D QUEUE("REBLD",RENEW,1,@RENEW@(0)) ; THE NEW
|
||||||
. D QUEUE("REBLD",REXML,XLAST+1,@REXML@(0)) ; THE REST
|
. D QUEUE("REBLD",REXML,XLAST+1,@REXML@(0)) ; THE REST
|
||||||
I DEBUG W "REPLACE PREBUILD",!
|
I $G(DEBUG) W "REPLACE PREBUILD",!
|
||||||
I DEBUG D PARY("REBLD")
|
I $G(DEBUG) D PARY("REBLD")
|
||||||
D BUILD("REBLD","RTMP")
|
D BUILD("REBLD","RTMP")
|
||||||
K @REXML ; KILL WHAT WAS THERE
|
K @REXML ; KILL WHAT WAS THERE
|
||||||
D CP("RTMP",REXML) ; COPY IN THE RESULT
|
D CP("RTMP",REXML) ; COPY IN THE RESULT
|
||||||
|
|
Loading…
Reference in New Issue