Changeset 605
- Timestamp:
- Nov 17, 2009, 6:14:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/C0CMXML.m
r601 r605 49 49 S C0CDOCID=$$PARSCCD(C0CXMLIN,"W") W !,"DocID: ",C0CDOCID 50 50 S REDUX="//ClinicalDocument/component/structuredBody" 51 D FINDTID ; FIND THE TEMPLATE IDS 52 D FINDALT ; FIND ALTERNATE TAGS 53 D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS 51 54 D XPATH(1,"/","GIDX","GARY",,REDUX) 52 S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER 53 D XPATH(1,"/","GIDX2","GARY2",,REDUX) 55 D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING 56 ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID ;CALL REGULAR PARSER 57 ;D XPATH(1,"/","GIDX2","GARY2",,REDUX) 54 58 Q 55 59 ; … … 75 79 N ZFRST S ZFRST=$$FIRST(ZOID) ; SET FIRST CHILD 76 80 I ZFRST'=0 D ; THERE IS A CHILD 81 . N ZNUM 77 82 . N ZMULT S ZMULT=$$ISMULT(ZFRST) ; IS FIRST CHILD A MULTIPLE 78 83 . D XPATH(ZFRST,NEWPATH,ZXIDX,ZXPARY,$S(ZMULT:1,1:""),ZREDUX) ; DO THE CHILD 79 84 N GNXT S GNXT=$$NXTSIB(ZOID) 85 I $$TAG(GNXT)'=$$TAG(ZOID) S ZNUM="" ; RESET COUNTING AFTER MULTIPLES 80 86 I GNXT'=0 D ; 81 87 . N ZMULT S ZMULT=$$ISMULT(GNXT) ; IS THE SIBLING A MULTIPLE? 82 88 . I (ZNUM="")&(ZMULT) D ; SIBLING IS FIRST OF MULTIPLES 83 . . S ZNUM=1 ;89 . . N ZNUM S ZNUM=1 ; 84 90 . . D XPATH(GNXT,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; DO NEXT SIB 85 91 . E D XPATH(GNXT,ZPATH,ZXIDX,ZXPARY,$S(ZNUM>0:ZNUM+1,1:""),ZREDUX) ; DO NEXT SIB … … 106 112 ; 107 113 TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE 108 Q $$NAME^MXMLDOM(C0CDOCID,ZOID) 114 ;I ZOID=149 B ;GPLTEST 115 N X,Y 116 S Y="" 117 S X=$G(C0CCBK("TAG")) ;IS THERE A CALLBACK FOR THIS ROUTINE 118 I X'="" X X ; EXECUTE THE CALLBACK, SHOULD SET Y 119 I Y="" S Y=$$NAME^MXMLDOM(C0CDOCID,ZOID) 120 Q Y 109 121 ; 110 122 NXTSIB(ZOID) ; RETURNS THE NEXT SIBLING … … 205 217 Q 206 218 ; 219 SEPARATE(OUTARY,INARY) ; SEPARATES XPATH VARIABLES ACCORDING TO THEIR 220 ; ROOT ; /Problems/etc/etc goes to @OUTARY@("Problems","/Problems/etc/etc") 221 S ZI="" 222 F S ZI=$O(@INARY@(ZI)) Q:ZI="" D ; FOR EACH ELEMENT OF THE ARRAY 223 . S ZJ=$P(ZI,"/",2) ; 224 . S @OUTARY@(ZJ,ZI)=@INARY@(ZI) 225 Q 226 ; 207 227 FINDTID ; FIND TEMPLATE IDS IN DOM 1 208 228 S C0CDOCID=1 … … 215 235 . . I $$TAG($$PARENT(ZN))="templateId" D ; ONLY LOOKING FOR TEMPLATES 216 236 . . . S ZG=$$PARENT($$PARENT(ZN)) 237 . . . S ZG2=$$PARENT(ZG) ;COMPONENT THAT HOLDS THIS SECTION 217 238 . . . S CMT=$G(@ZD@(ZG,"X",1)) 239 . . . I CMT="" S CMT="?" 218 240 . . . I $$TAG(ZG)="section" D ;START OF A SECTION 219 . . . . S CURSEC= ZG241 . . . . S CURSEC=$$PARENT(ZG) 220 242 . . . . S SECCMT=$G(@ZD@(CURSEC,"X",1)) 243 . . . . I SECCMT="" S SECCMT="?" 244 . . . . S SECTID=$G(@ZD@(ZN,"T",1)) ;SECTION TEMPLATE ID 221 245 . . . S TID=$G(@ZD@(ZN,"T",1)) ;TEMPLATE ID 222 246 . . . I CURSEC'="" D ; IF WE ARE IN A SECTION 223 . . . . S CCDDIR(CURSEC,SECCMT,ZG,$$TAG(ZG),CMT)=TID 224 . . . W !,$$TAG(ZG)," ",$G(@ZD@(ZG,"X",1)) 247 . . . . S CCDDIR(ZG2,CURSEC,$$TAG(ZG2),CMT,SECCMT)=TID 248 . . . . S DOMMAP(ZG2)=CURSEC_U_$$TAG(ZG2)_U_TID_U_SECTID 249 . . . W !,$$TAG(ZG2)," ",$G(@ZD@(ZG,"X",1)) 225 250 . . . W " root ",ZN," ",@ZD@(ZN,"T",1) 251 Q 252 ; 253 FINDALT ; PROCESS THE DOMMAP AND FIND THE ALT TAGS FOR COMPONENTS 254 ; 255 S ZI="" 256 F S ZI=$O(DOMMAP(ZI)) Q:ZI="" D ; FOR EACH NODE IN THE MAP 257 . S ZJ=DOMMAP(ZI) ; 258 . S PARNODE=$P(ZJ,U,1) ;PARENT NODE 259 . S TAG=$P(ZJ,U,2) ;THIS TAG 260 . S TID=$P(ZJ,U,3) ;THIS TEMPLATE ID 261 . S PARTID=$P(ZJ,U,4) ;PARENT TEMPLATE ID 262 . S ZIEN=$O(^C0CXDS(178.101,"TID",TID,"")) ;THIS NODE IEN 263 . S PARIEN=$O(^C0CXDS(178.101,"TID",PARTID,"")) ;PARENT NODE IEN 264 . I ZI=PARNODE D ; IF THIS IS A SECTION NODE 265 . . S ALTTAG=$$GET1^DIQ(178.101,PARIEN_",",.03) ;ALT TAG FIELD FOR PARENT 266 . . S NAME=$$GET1^DIQ(178.101,ZIEN_",",.01) ;NAME OF THIS NODE'S TEMPLATE 267 . . W ZI," ",TAG," ",ALTTAG," ",NAME,! 268 . . S C0CTAGS(ZI)=ALTTAG 269 Q 270 ; 271 ALTTAG(NODE) ; SET Y EQUAL TO THE ALT TAG FOUND IN C0CTAGS IF NODE IF FOUND 272 ; 273 S Y=$G(C0CTAGS(NODE)) 274 Q 275 ; 276 SETCBK ; SET THE TAG CALLBACK FOR XPATH PROCESSSING OF THE CCD 277 S C0CCBK("TAG")="D ALTTAG(ZOID)" 226 278 Q 227 279 ; 228 280 GENXDS(ZD) ; GENERATE THE XDS PROTOTYPE RECORDS FROM A CCDDIR ARRAY 229 281 ; ARRAY ELEMENTS LOOK LIKE: 230 ; CCDDIR(16 34," Vital signs section template ",1659,"observation"," Result observaion template ")="2.16.840.1.113883.10.20.1.31"231 ;or CCDDIR( section node,sec name, cur node,cur tag,curname)=templateId282 ; CCDDIR(1659,1634,"observation"," Result observaion template "," Vital signs section template ")="2.16.840.1.113883.10.20.1.31" 283 ;or CCDDIR(cur node,section node,cur tag,cur name,sec name)=templateId 232 284 S ZF=178.101 ; FILE NUMBER FOR THE C0C XDS PROTOTYPE FILE 233 285 S ZI=$Q(@ZD@("")) ;FIRST ARRAY ELEMENT … … 245 297 Q 246 298 ; 299 WHRUSD(ZD) ; UPDATE THE C0C XDS FILE WITH WHERE USED DATA FROM 300 ; CCDDIR PASS BY NAME 301 ; ARRAY ELEMENTS LOOK LIKE: 302 ; CCDDIR(1634," Vital signs section template ",1659,"observation"," Result observaion template ")="2.16.840.1.113883.10.20.1.31" 303 ;or CCDDIR(section node,sec name, cur node,cur tag,cur name)=templateId 304 S ZF=178.101 ; FILE NUMBER FOR THE C0C XDS PROTOTYPE FILE 305 S ZSF=178.111 ; WHERE USED SUBFILE OF C0C XDS PROTOTYPE FILE 306 S ZI=$Q(@ZD@("")) ;FIRST ARRAY ELEMENT 307 S DONE=0 308 F Q:DONE D ; 309 . W @ZI 310 . S ZIEN=$O(^C0CXDS(178.101,"TID",@ZI,"")) ; IEN FOR THIS NODE'S TEMPLATE 311 . W " IEN:",ZIEN 312 . S ZJ=$QS(ZI,2) 313 . S ZJ=$E(ZJ,2,$L(ZJ)) ;STRIP THE LEADING SPACE 314 . S ZPIEN=$O(^C0CXDS(178.101,"B",ZJ,"")) ; PARENT IEN 315 . W " PARENT IEN:",ZPIEN 316 . S ZTAG=$QS(ZI,4) ; TAG FOR THIS TEMPLATE 317 . W " TAG:",ZTAG,! 318 . I ZIEN'=ZPIEN D ; ONLY FOR CHILD TEMPLATES 319 . . S C0CFDA(ZSF,"?+1,"_ZIEN_",",.01)=ZPIEN ; NEW SUBFILE ENTRY WITH PAR PTR 320 . . S C0CFDA(ZSF,"?+1,"_ZIEN_",",1)=ZTAG ; TAG FOR NEW ENTRY 321 . . D UPDIE 322 . ;S C0CFDA(ZF,"?+1,",1)=@ZI 323 . ;D UPDIE 324 . S ZI=$Q(@ZI) 325 . I ZI="" S DONE=1 326 Q 327 ; 247 328 UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS 248 329 K ZERR
Note:
See TracChangeset
for help on using the changeset viewer.