Created actor records P1=OBJID P2=TYPE P3=IEN

This commit is contained in:
george 2008-07-01 21:20:10 +00:00
parent 7f1b7be2fd
commit 8e3cfacdb1
1 changed files with 31 additions and 12 deletions

View File

@ -9,14 +9,22 @@ EXPORT ; EXPORT ENTRY POINT FOR CCR
I Y<1 Q ; EXIT
S DFN=$P(Y,U,1) ; SET THE PATIENT
N CCRGLO
D CCRRPC(.CCRGLO,DFN,"CCR")
D CCRRPC(.CCRGLO,DFN,"CCR","","","")
S OARY=$NA(^TMP($J,DFN,"CCR",1))
S ONAM="PAT_"_DFN_"_CCR_V1.xml"
S ODIR="/home/glilly/CCROUT"
D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
Q
;
CCRRPC(CCRGRTN,DFN,CCRPART) ; RPC ENTRY POINT FOR CCR OUTPUT
CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ; RPC ENTRY POINT FOR CCR OUTPUT
; CCRGRTN IS RETURN ARRAY PASSED BY NAME
; DFN IS PATIENT IEN
; CCRPART IS "CCR" FOR ENTIRE CCR, OR SECTION NAME FOR A PART OF THE
; CCR BODY.. PARTS INCLUDE "PROBLEMS" "VITALS" ETC
; TIME1 IS STARTING TIME TO INCLUDE - NULL MEANS ALL
; TIME2 IS ENDING TIME TO INCLUDE TIME IS FILEMAN TIME - NULL MEANS NOW
; HDRARY IS THE HEADER ARRAY DEFINING THE "FROM" AND "TO" VARIABLES
; IF NULL WILL DEFAULT TO "FROM" DUZ AND "TO" DFN
S DEBUG=0
S TGLOBAL=$NA(^TMP($J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
S CCRGLO=$NA(^TMP($J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
@ -33,7 +41,8 @@ CCRRPC(CCRGRTN,DFN,CCRPART) ; RPC ENTRY POINT FOR CCR OUTPUT
D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Signatures")
I DEBUG F I=1:1:@CCRGLO@(0) W @CCRGLO@(I),!
;
D CCRHDR(CCRGLO,DFN) ; MAP HEADER VARIABLES
D HDRMAP(CCRGLO,DFN,HDRARY) ; MAP HEADER VARIABLES
;
S CCRXTAB="^TMP($J,""CCRSTEP"")" ; GLOBAL TO STORE CCR PROCESSING STEPS
D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
@ -62,14 +71,17 @@ INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
D PUSH^GPLXPATH(TAB,"EXTRACT;GPLPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP($J,DFN,""PROBLEMS"")")
Q
;
CCRHDR(CXML,DFN) ; MAP HEADER VARIABLES: FROM, TO ECT
HDRMAP(CXML,DFN,IHDR) ; MAP HEADER VARIABLES: FROM, TO ECT
N VMAP S VMAP=$NA(^TMP($J,DFN,"HEADER"))
; K @VMAP
S @VMAP@("ACTORPATIENT")="ACTORPATIENT_"_DFN
S @VMAP@("ACTORFROM")="ACTORPROVIDER_"_DUZ ; FROM DUZ - ???
S @VMAP@("ACTORFROM2")="ACTORPROVIDER_"_DUZ ; NEED A BETTER WAY
S @VMAP@("ACTORTO")="ACTORPATIENT_"_DFN ; FOR TEST PURPOSES,
; THIS IS THE USE CASE FOR THE PHR WHERE "TO" IS THE PATIENT
I IHDR="" D ; HEADER ARRAY IS NOT PROVIDED, USE DEFAULTS
. S @VMAP@("ACTORPATIENT")="ACTORPATIENT_"_DFN
. S @VMAP@("ACTORFROM")="ACTORPROVIDER_"_DUZ ; FROM DUZ - ???
. S @VMAP@("ACTORFROM2")="ACTORPROVIDER_"_DUZ ; NEED A BETTER WAY
. S @VMAP@("ACTORTO")="ACTORPATIENT_"_DFN ; FOR TEST PURPOSES,
. ; THIS IS THE USE CASE FOR THE PHR WHERE "TO" IS THE PATIENT
I IHDR'="" D ; HEADER VALUES ARE PROVIDED
. D CP^GPLXPATH(IHDR,VMAP) ; COPY HEADER VARIABLES TO MAP ARRAY
N CTMP
D MAP^GPLXPATH(CXML,VMAP,"CTMP")
D CP^GPLXPATH("CTMP",CXML)
@ -77,17 +89,24 @@ CCRHDR(CXML,DFN) ; MAP HEADER VARIABLES: FROM, TO ECT
;
ACTLST(AXML,ACTRTN) ; RETURN THE ACTOR LIST FOR THE XML IN AXML
; AXML AND ACTRTN ARE PASSED BY NAME
N I,J,K
; EACH ACTOR RECORD HAS 3 PARTS - IE IF OBJECTID=ACTORPATIENT_2
; P1= OBJECTID - ACTORPATIENT_2
; P2= OBJECT TYPE - PATIENT OR PROVIDER
; P3= IEN RECORD NUMBER FOR ACTOR - 2
N I,J,K,L
K @ACTRTN ; CLEAR RETURN ARRAY
F I=1:1:@AXML@(0) D ; SCAN ALL LINES
. I @AXML@(I)?.E1"<ActorID>".E D ; THERE IS AN ACTOR ON THIS LINE
. . S J=$P($P(@AXML@(I),"<ActorID>",2),"</ActorID>",1)
. . W "<ActorID>=>",J,!
. . S K(J)="" ; HASHING ACTOR TO GET RID OF MULTIPLES
. . S K(J)="" ; HASHING ACTOR TO GET RID OF DUPLICATES
S I="" ; GOING TO $O THROUGH THE HASH
F J=0:0 D Q:$O(K(I))=""
. S I=$O(K(I)) ; WALK THROUGH THE HASH OF ACTORS
. D PUSH^GPLXPATH(ACTRTN,I) ; ADD THE ACTOR TO THE RETURN ARRAY
. S $P(L,U,1)=I ; FIRST PIECE IS THE OBJECT ID
. S $P(L,U,2)=$P($P(I,"ACTOR",2),"_",1) ; ACTOR TYPE: PATIENT/PROVIDER
. S $P(L,U,3)=$P(I,"_",2) ; IEN RECORD NUMBER FOR ACTOR
. D PUSH^GPLXPATH(ACTRTN,L) ; ADD THE ACTOR TO THE RETURN ARRAY
Q
;
TEST ; RUN ALL THE TEST CASES