working version of loading routines for CCR E2 element file
This commit is contained in:
parent
ebb8eaf7fd
commit
57cf1d97c3
73
p/C0CFM2.m
73
p/C0CFM2.m
|
@ -27,12 +27,15 @@ C0CFM2 ; CCDCCR/GPL - CCR FILEMAN utilities; 12/6/08
|
|||
W !
|
||||
Q
|
||||
;
|
||||
SHOWBUG ;
|
||||
M C0CFDA=^KBAI("C0CFDA",1)
|
||||
D CLEAN^DILF
|
||||
D UPDATE^DIE("","C0CFDA","","ZERR")
|
||||
ZWR C0CFDA
|
||||
ZWR ZERR
|
||||
RIMTBL(ZWHICH) ; PUT ALL PATIENT IN RIMTBL ZWHICH INTO THE CCR ELEMENTS FILE
|
||||
;
|
||||
I '$D(RIMBASE) D ASETUP^GPLRIMA ; FOR COMMAND LINE CALLS
|
||||
N ZI,ZJ,ZC,ZPATBASE
|
||||
S ZPATBASE=$NA(@RIMBASE@("RIMTBL","PATS",ZWHICH))
|
||||
S ZI=""
|
||||
F ZJ=0:0 D Q:$O(@ZPATBASE@(ZI))="" ; TIL END
|
||||
. S ZI=$O(@ZPATBASE@(ZI))
|
||||
. D PUTRIM(ZI) ; EXPORT THE PATIENT TO A FILE
|
||||
Q
|
||||
;
|
||||
PUTRIM(DFN,ZWHICH) ;DFN IS PATIENT , WHICH IS ELEMENT TYPE
|
||||
|
@ -55,8 +58,23 @@ PUTRIM1(DFN,ZZTYP,ZVARS) ; PUT ONE SECTION OF VARIABLES INTO CCR ELEMENTS
|
|||
S C0CX=0
|
||||
F S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX="" D ; FOR EACH OCCURANCE
|
||||
. W "ZOCC=",C0CX,!
|
||||
. K C0CMDO ; MULTIPLE SUBELEMENTS FOR THIS OCCURANCE PASSED BY NAME
|
||||
. S C0CV=$NA(@ZVARS@(C0CX)) ; VARIABLES FOR THIS OCCURANCE
|
||||
. D PUTELS(DFN,ZZTYP,C0CX,C0CV) ; PUT THEM TO THE CCR ELEMENTS FILE
|
||||
. I $D(C0CMDO) D ; MULTIPLES TO HANDLE (THIS IS INSTEAD OF RECURSION :()
|
||||
. . N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
|
||||
. . S ZZCNT=0
|
||||
. . S ZZC0CI=0
|
||||
. . S ZZVALS=$NA(@C0CMDO@("M")) ; LOCATION OF THIS MULTILPE
|
||||
. . S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
|
||||
. . S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
|
||||
. . W "MULTIPLE:",ZZVALS,!
|
||||
. . ;B
|
||||
. . F S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI="" D ; EACH MULTIPLE
|
||||
. . . S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
|
||||
. . . W "COUNT:",ZZCNT,!
|
||||
. . . S ZV=$NA(@ZZVALS@(ZZC0CI))
|
||||
. . . D PUTELS(DFN,ZT,C0CX_";"_ZZCNT,ZV)
|
||||
Q
|
||||
;
|
||||
PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
||||
|
@ -67,7 +85,7 @@ PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
|||
; @ZVALS@("VAR1")="VALUE1" FOR ALL VARIABLES IN THIS ELEMENT
|
||||
; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
|
||||
;
|
||||
N ZSRC
|
||||
N ZSRC,PATN,ZTYPN,XD0,ZTYP
|
||||
S ZSRC=1 ; CCR SOURCE IS ASSUMED TO BE THIS EHR, WHICH IS ALWAYS SOURCE 1
|
||||
; PUT THIS IN PARAMETERS - SO SOURCE NUMBER FOR PROCESSING IN CONFIGURABLE
|
||||
N C0CFPAT S C0CFPAT=171.101 ; FILE AT PATIENT LEVEL
|
||||
|
@ -77,7 +95,7 @@ PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
|||
N C0CFVAR S C0CFVAR=171.1311 ; FILE AT VARIABLE LVL
|
||||
;FILE IS ^C0CE(PAT,1,SCR,1,TYP,1,OCC,1,VAR,1, ...
|
||||
; AND WE HAVE TO ADD THEM LEVEL AT A TIME I THINK
|
||||
K C0CFDA
|
||||
N C0CFDA
|
||||
S C0CFDA(C0CFPAT,"?+1,",.01)=DFN
|
||||
D UPDIE ; ADD THE PATIENT
|
||||
S PATN=$O(^C0CE("B",DFN,"")) ; IEN FOR THE PATIENT
|
||||
|
@ -93,7 +111,8 @@ PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
|||
D UPDIE ; ADD THE OCCURANCE
|
||||
S ZD0=$O(^C0CE(PATN,1,ZSRC,1,ZTYP,1,"B"," "_ZOCC,""))
|
||||
W "RECORD NUMBER: ",ZD0,!
|
||||
;B
|
||||
;I ZD0=32 B
|
||||
;I ZD0=31 B
|
||||
N ZCNT,ZC0CI,ZVARN,C0CZ1
|
||||
S ZCNT=0
|
||||
S ZC0CI="" ;
|
||||
|
@ -106,26 +125,22 @@ PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
|||
. . S C0CFDA(C0CFVAR,"?+"_ZCNT_","_ZD0_","_C0CZ1,.01)=ZVARN
|
||||
. . S C0CFDA(C0CFVAR,"?+"_ZCNT_","_ZD0_","_C0CZ1,1)=@ZVALS@(ZC0CI)
|
||||
. E D ; THIS IS A SUBELEMENT
|
||||
. . N ZZCNT,ZZC0CI,ZZVALS,ZZVALS,ZT
|
||||
. . S ZZCNT=0
|
||||
. . S ZZC0CI=0
|
||||
. . S ZZVALS=$NA(@ZVALS@("M")) ; LOCATION OF THIS MULTILPE
|
||||
. . S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
|
||||
. . S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
|
||||
. . W "MULTIPLE:",ZZVALS,!
|
||||
. . ;B
|
||||
. . F S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI="" D ; EACH MULTIPLE
|
||||
. . . S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
|
||||
. . . W "COUNT:",ZZCNT,!
|
||||
. . . S ZV=$NA(@ZZVALS@(ZZC0CI))
|
||||
. . . D PUTELS(DFN,ZT,ZOCC_";"_ZZCNT,ZV)
|
||||
D CLEAN^DILF
|
||||
D UPDATE^DIE("","C0CFDA","","ZERR")
|
||||
I $D(ZERR) D ;
|
||||
. W "ERROR",!
|
||||
. ZWR ZERR
|
||||
. B
|
||||
K C0CFDA
|
||||
. . ;PUT THE FOLLOWING BACK TO USE RECURSION
|
||||
. . ;N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
|
||||
. . ;S ZZCNT=0
|
||||
. . ;S ZZC0CI=0
|
||||
. . ;S ZZVALS=$NA(@ZVALS@("M")) ; LOCATION OF THIS MULTILPE
|
||||
. . ;S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
|
||||
. . ;S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
|
||||
. . ;W "MULTIPLE:",ZZVALS,!
|
||||
. . ;B
|
||||
. . ;F S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI="" D ; EACH MULTIPLE
|
||||
. . ;. S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
|
||||
. . ;. W "COUNT:",ZZCNT,!
|
||||
. . ;. S ZV=$NA(@ZZVALS@(ZZC0CI))
|
||||
. . ;. D PUTELS(DFN,ZT,ZOCC_";"_ZZCNT,ZV) ; PUT THIS BACK TO DEBUG RECURSION
|
||||
. . S C0CMDO=ZVALS ; FLAG TO HANDLE MULTIPLES (INSTEAD OF RECURSION)
|
||||
D UPDIE ; UPDATE
|
||||
Q
|
||||
;
|
||||
UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
|
||||
|
|
Loading…
Reference in New Issue