Changeset 370 for ccr


Ignore:
Timestamp:
Feb 16, 2009, 12:34:31 PM (16 years ago)
Author:
George Lilly
Message:

working version of loading routines for CCR E2 element file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CFM2.m

    r368 r370  
    2828 Q
    2929 ;
    30 SHOWBUG ;
    31  M C0CFDA=^KBAI("C0CFDA",1)
    32  D CLEAN^DILF
    33  D UPDATE^DIE("","C0CFDA","","ZERR")
    34  ZWR C0CFDA
    35  ZWR ZERR
     30RIMTBL(ZWHICH) ; PUT ALL PATIENT IN RIMTBL ZWHICH INTO THE CCR ELEMENTS FILE
     31 ;
     32 I '$D(RIMBASE) D ASETUP^GPLRIMA ; FOR COMMAND LINE CALLS
     33 N ZI,ZJ,ZC,ZPATBASE
     34 S ZPATBASE=$NA(@RIMBASE@("RIMTBL","PATS",ZWHICH))
     35 S ZI=""
     36 F ZJ=0:0 D  Q:$O(@ZPATBASE@(ZI))=""  ; TIL END
     37 . S ZI=$O(@ZPATBASE@(ZI))
     38 . D PUTRIM(ZI) ; EXPORT THE PATIENT TO A FILE
    3639 Q
    3740 ;
     
    5659 F  S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX=""  D  ; FOR EACH OCCURANCE
    5760 . W "ZOCC=",C0CX,!
     61 . K C0CMDO ; MULTIPLE SUBELEMENTS FOR THIS OCCURANCE PASSED BY NAME
    5862 . S C0CV=$NA(@ZVARS@(C0CX)) ; VARIABLES FOR THIS OCCURANCE
    5963 . D PUTELS(DFN,ZZTYP,C0CX,C0CV) ; PUT THEM TO THE CCR ELEMENTS FILE
     64 . I $D(C0CMDO) D  ; MULTIPLES TO HANDLE (THIS IS INSTEAD OF RECURSION :()
     65 . . N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
     66 . . S ZZCNT=0
     67 . . S ZZC0CI=0
     68 . . S ZZVALS=$NA(@C0CMDO@("M")) ; LOCATION OF THIS MULTILPE
     69 . . S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
     70 . . S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
     71 . . W "MULTIPLE:",ZZVALS,!
     72 . . ;B
     73 . . F  S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI=""  D  ; EACH MULTIPLE
     74 . . . S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
     75 . . . W "COUNT:",ZZCNT,!
     76 . . . S ZV=$NA(@ZZVALS@(ZZC0CI))
     77 . . . D PUTELS(DFN,ZT,C0CX_";"_ZZCNT,ZV)
    6078 Q
    6179 ;
     
    6886 ; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
    6987 ;
    70  N ZSRC
     88 N ZSRC,PATN,ZTYPN,XD0,ZTYP
    7189 S ZSRC=1 ; CCR SOURCE IS ASSUMED TO BE THIS EHR, WHICH IS ALWAYS SOURCE 1
    7290 ; PUT THIS IN PARAMETERS - SO SOURCE NUMBER FOR PROCESSING IN CONFIGURABLE
     
    7896 ;FILE IS ^C0CE(PAT,1,SCR,1,TYP,1,OCC,1,VAR,1, ...
    7997 ; AND WE HAVE TO ADD THEM LEVEL AT A TIME I THINK
    80  K C0CFDA
     98 N C0CFDA
    8199 S C0CFDA(C0CFPAT,"?+1,",.01)=DFN
    82100 D UPDIE ; ADD THE PATIENT
     
    94112 S ZD0=$O(^C0CE(PATN,1,ZSRC,1,ZTYP,1,"B"," "_ZOCC,""))
    95113 W "RECORD NUMBER: ",ZD0,!
    96  ;B
     114 ;I ZD0=32 B
     115 ;I ZD0=31 B
    97116 N ZCNT,ZC0CI,ZVARN,C0CZ1
    98117 S ZCNT=0
     
    107126 . . S C0CFDA(C0CFVAR,"?+"_ZCNT_","_ZD0_","_C0CZ1,1)=@ZVALS@(ZC0CI)
    108127 . E  D  ; THIS IS A SUBELEMENT
    109  . . N ZZCNT,ZZC0CI,ZZVALS,ZZVALS,ZT
    110  . . S ZZCNT=0
    111  . . S ZZC0CI=0
    112  . . S ZZVALS=$NA(@ZVALS@("M")) ; LOCATION OF THIS MULTILPE
    113  . . S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
    114  . . S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
    115  . . W "MULTIPLE:",ZZVALS,!
    116  . . ;B
    117  . . F  S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI=""  D  ; EACH MULTIPLE
    118  . . . S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
    119  . . . W "COUNT:",ZZCNT,!
    120  . . . S ZV=$NA(@ZZVALS@(ZZC0CI))
    121  . . . D PUTELS(DFN,ZT,ZOCC_";"_ZZCNT,ZV)
    122  D CLEAN^DILF
    123  D UPDATE^DIE("","C0CFDA","","ZERR")
    124  I $D(ZERR) D  ;
    125  . W "ERROR",!
    126  . ZWR ZERR
    127  . B
    128  K C0CFDA
     128 . . ;PUT THE FOLLOWING BACK TO USE RECURSION
     129 . . ;N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
     130 . . ;S ZZCNT=0
     131 . . ;S ZZC0CI=0
     132 . . ;S ZZVALS=$NA(@ZVALS@("M")) ; LOCATION OF THIS MULTILPE
     133 . . ;S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
     134 . . ;S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
     135 . . ;W "MULTIPLE:",ZZVALS,!
     136 . . ;B
     137 . . ;F  S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI=""  D  ; EACH MULTIPLE
     138 . . ;. S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
     139 . . ;. W "COUNT:",ZZCNT,!
     140 . . ;. S ZV=$NA(@ZZVALS@(ZZC0CI))
     141 . . ;. D PUTELS(DFN,ZT,ZOCC_";"_ZZCNT,ZV) ; PUT THIS BACK TO DEBUG RECURSION
     142 . . S C0CMDO=ZVALS ; FLAG TO HANDLE MULTIPLES (INSTEAD OF RECURSION)
     143 D UPDIE ; UPDATE
    129144 Q
    130145 ;
Note: See TracChangeset for help on using the changeset viewer.