initial CCR ELEMENT FILE

This commit is contained in:
george 2009-02-15 03:56:46 +00:00
parent 2fc931c0cf
commit e08eb643c7
3 changed files with 2916 additions and 20 deletions

2622
p/C0CE_1_0_1_T1.KID Normal file

File diff suppressed because it is too large Load Diff

278
p/C0CFM2.m Normal file
View File

@ -0,0 +1,278 @@
C0CFM2 ; CCDCCR/GPL - CCR FILEMAN utilities; 12/6/08
;;0.1;CCDCCR;nopatch;noreleasedate
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
;General Public License See attached copy of the License.
;
;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
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;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.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;
W "This is the CCR FILEMAN Utility Library ",!
; THIS SET OF ROUTINES USE CCR E2 (^C0CE(, FILE 171.101) INSTEAD OF
; CCR ELEMENTS (^C0C(179.201,
; E2 IS A SIMPLIFICATION OF CCR ELEMENTS WHERE SUB-ELEMENTS ARE
; AT THE TOP LEVEL. OCCURANCE, THE 4TH PART OF THE KEY IS NOW FREE TEXT
; AND HAS THE FORM X;Y FOR SUB-ELEMENTS
; ALL SUB-VARIABLES HAVE BEEN REMOVED
W !
Q
;
SHOWBUG ;
M C0CFDA=^KBAI("C0CFDA",1)
D CLEAN^DILF
D UPDATE^DIE("","C0CFDA","","ZERR")
ZWR C0CFDA
ZWR ZERR
Q
;
PUTRIM(DFN,ZWHICH) ;DFN IS PATIENT , WHICH IS ELEMENT TYPE
;
S C0CGLB=$NA(^TMP("GPLRIM","VARS",DFN))
I '$D(ZWHICH) S ZWHICH="ALL"
I ZWHICH'="ALL" D ; SINGLE SECTION REQUESTED
. S C0CVARS=$NA(@C0CGLB@(ZWHICH))
. D PUTRIM1(DFN,ZWHICH,C0CVARS) ; IF ONE SECTION
E D ; MULTIPLE SECTIONS
. S C0CVARS=$NA(@C0CGLB)
. S C0CI=""
. F S C0CI=$O(@C0CVARS@(C0CI)) Q:C0CI="" D ;FOR EACH SECTION
. . S C0CVARSN=$NA(@C0CVARS@(C0CI)) ; GRAB ONE SECTION
. . D PUTRIM1(DFN,C0CI,C0CVARSN)
Q
;
PUTRIM1(DFN,ZZTYP,ZVARS) ; PUT ONE SECTION OF VARIABLES INTO CCR ELEMENTS
; ZVARS IS PASSED BY NAME AN HAS THE FORM @ZVARS@(1,"VAR1")="VAL1"
S C0CX=0
F S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX="" D ; FOR EACH OCCURANCE
. W "ZOCC=",C0CX,!
. S C0CV=$NA(@ZVARS@(C0CX)) ; VARIABLES FOR THIS OCCURANCE
. D PUTELS(DFN,ZZTYP,C0CX,C0CV) ; PUT THEM TO THE CCR ELEMENTS FILE
Q
;
PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
; 171.101, ^C0CE DFN IS THE PATIENT IEN PASSED BY VALUE
; ZTYPE IS THE NODE TYPE IE RESULTS,PROBLEMS PASSED BY VALUE
; ZOCC IS THE OCCURANCE NUMBER IE PROBLEM NUMBER 1,2,3 ETC
; ZVALS ARE THE VARIABLES AND VALUES PASSED BY NAME AND IN THE FORM
; @ZVALS@("VAR1")="VALUE1" FOR ALL VARIABLES IN THIS ELEMENT
; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
;
N ZSRC
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
N C0CFSRC S C0CFSRC=171.111 ; FILE AT CCR SOURCE LVL
N C0CFTYP S C0CFTYP=171.121 ; FILE AT ELEMENT TYPE LVL
N C0CFOCC S C0CFOCC=171.131 ; FILE AT OCCURANCE LVL
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
S C0CFDA(C0CFPAT,"?+1,",.01)=DFN
D UPDIE ; ADD THE PATIENT
S PATN=$O(^C0CE("B",DFN,"")) ; IEN FOR THE PATIENT
S C0CFDA(C0CFSRC,"?+1,"_PATN_",",.01)=ZSRC
D UPDIE ; ADD THE CCR SOURCE
N ZTYPN S ZTYPN=$O(^C0CDIC(170.101,"B",ZTYPE,"")) ; FIND THE ELE TYPE
S C0CFDA(C0CFTYP,"?+1,"_ZSRC_","_PATN_",",.01)=ZTYPN
D UPDIE ; ADD THE ELEMENT TYPE
S ZTYP=$O(^C0CE(PATN,1,ZSRC,1,"B",ZTYPN,"")) ; IEN OF ELEMENT TYPE
S C0CFDA(C0CFOCC,"?+1,"_ZTYP_","_ZSRC_","_PATN_",",.01)=" "_ZOCC ; STRING OCC
; OCC IS PRECEDED BY " " TO FORCE STRING STORAGE AND PRESERVE
; STRING COLLATION ON THE INDEX
D UPDIE ; ADD THE OCCURANCE
S ZD0=$O(^C0CE(PATN,1,ZSRC,1,ZTYP,1,"B"," "_ZOCC,""))
W "RECORD NUMBER: ",ZD0,!
;B
N ZCNT,ZC0CI,ZVARN,C0CZ1
S ZCNT=0
S ZC0CI="" ;
F S ZC0CI=$O(@ZVALS@(ZC0CI)) Q:ZC0CI="" D ;
. I ZC0CI'="M" D ; NOT A SUBVARIABLE
. . S ZCNT=ZCNT+1 ;INCREMENT COUNT
. . S ZVARN=$$VARPTR(ZC0CI,ZTYPE) ;GET THE POINTER TO THE VAR IN THE CCR DICT
. . ; WILL ALLOW FOR LAYGO IF THE VARIABLE IS NOT FOUND
. . S C0CZ1=ZTYP_","_ZSRC_","_PATN_","
. . 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
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
;
PUTELSOLD(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
; 171.101, ^C0CE DFN IS THE PATIENT IEN PASSED BY VALUE
; ZTYPE IS THE NODE TYPE IE RESULTS,PROBLEMS PASSED BY VALUE
; ZOCC IS THE OCCURANCE NUMBER IE PROBLEM NUMBER 1,2,3 ETC
; ZVALS ARE THE VARIABLES AND VALUES PASSED BY NAME AND IN THE FORM
; @ZVALS@("VAR1")="VALUE1" FOR ALL VARIABLES IN THIS ELEMENT
; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
;
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 ZF,ZFV S ZF=171.101 S ZFV=171.1011
;S ZSUBF=171.20122 ;FILE AND SUBFILE NUMBERS
;N ZSFV S ZSFV=171.201221 ; SUBFILE VARIABLE FILE NUMBER
N ZTYPN S ZTYPN=$O(^C0CDIC(170.101,"B",ZTYPE,""))
W "ZTYPE: ",ZTYPE," ",ZTYPN,!
N ZVARN ; IEN OF VARIABLE BEING PROCESSED
;N C0CFDA ; FDA FOR CCR ELEMENT UPDATE
K C0CFDA
S C0CFDA(ZF,"?+1,",.01)=DFN
S C0CFDA(ZF,"?+1,",.02)=ZSRC
S C0CFDA(ZF,"?+1,",.03)=ZTYPN
S C0CFDA(ZF,"?+1,",.04)=" "_ZOCC ;CREATE OCCURANCE
K ZERR
;B
D UPDATE^DIE("","C0CFDA","","ZERR") ;ASSIGN RECORD NUMBER
I $D(ZERR) B ;OOPS
K C0CFDA
S ZD0=$O(^C0CE("C",DFN,ZSRC,ZTYPN,ZOCC,""))
W "RECORD NUMBER: ",ZD0,!
;B
S ZCNT=0
S ZC0CI="" ;
F S ZC0CI=$O(@ZVALS@(ZC0CI)) Q:ZC0CI="" D ;
. I ZC0CI'="M" D ; NOT A SUBVARIABLE
. . S ZCNT=ZCNT+1 ;INCREMENT COUNT
. . S ZVARN=$$VARPTR(ZC0CI,ZTYPE) ;GET THE POINTER TO THE VAR IN THE CCR DICT
. . ; WILL ALLOW FOR LAYGO IF THE VARIABLE IS NOT FOUND
. . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",.01)=ZVARN
. . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",1)=@ZVALS@(ZC0CI)
. . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",.01)=ZVARN
. . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",1)=@ZVALS@(ZC0CI)
;S GT1(170,"?+1,",.01)="ZZZ NEW MEDVEHICLETEXT"
;S GT1(170,"?+1,",12)="DIR"
;S GT1(171.201221,"?+1,1,5,1,",.01)="ZZZ NEW MEDVEHICLETEXT"
;S GT1(171.201221,"+1,1,5,1,",1)="THIRD NEW MED DIRECTION TEXT"
D CLEAN^DILF
D UPDATE^DIE("","C0CFDA","","ZERR")
I $D(ZERR) D ;
. W "ERROR",!
. ZWR ZERR
. B
K C0CFDA
Q
;
VARPTR(ZVAR,ZTYP) ;EXTRINSIC WHICH RETURNS THE POINTER TO ZVAR IN THE
; CCR DICTIONARY. IT IS LAYGO, AS IT WILL ADD THE VARIABLE TO
; THE CCR DICTIONARY IF IT IS NOT THERE. ZTYP IS REQUIRED FOR LAYGO
;
N ZCCRD,ZVARN,C0CFDA2
S ZCCRD=170 ; FILE NUMBER FOR CCR DICTIONARY
S ZVARN=$O(^C0CDIC(170,"B",ZVAR,"")) ;FIND IEN OF VARIABLE
I ZVARN="" D ; VARIABLE NOT IN CCR DICTIONARY - ADD IT
. I '$D(ZTYP) D Q ; WON'T ADD A VARIABLE WITHOUT A TYPE
. . W "CANNOT ADD VARIABLE WITHOUT A TYPE: ",ZVAR,!
. S C0CFDA2(ZCCRD,"?+1,",.01)=ZVAR ; NAME OF NEW VARIABLE
. S C0CFDA2(ZCCRD,"?+1,",12)=ZTYP ; TYPE EXTERNAL OF NEW VARIABLE
. D CLEAN^DILF ;MAKE SURE ERRORS ARE CLEAN
. D UPDATE^DIE("E","C0CFDA2","","ZERR") ;ADD VAR TO CCR DICTIONARY
. I $D(ZERR) D ; LAYGO ERROR
. . W "ERROR ADDING "_ZC0CI_" TO CCR DICTIONARY",!
. E D ;
. . D CLEAN^DILF ; CLEAN UP
. . S ZVARN=$O(^C0CDIC(170,"B",ZVAR,"")) ;FIND IEN OF VARIABLE
. . W "ADDED ",ZVAR," TO CCR DICTIONARY, IEN:",ZVARN,!
Q ZVARN
;
BLDTYPS ; ROUTINE TO POPULATE THE CCR NODE TYPES FILE (^C0CDIC(170.101,)
; THE CCR DICTIONARY (^C0CDIC(170, ) HAS MOST OF WHAT'S NEEDED
;
N C0CDIC,C0CNODE ;
S C0CDIC=$$FILEREF^C0CRNF(170) ; CLOSED FILE REFERENCE TO THE CCR DICTIONARY
S C0CNODE=$$FILEREF^C0CRNF(170.101) ; CLOSED REF TO CCR NODE TYPE FILE
Q
;
FIXSEC ;FIX THE SECTION FIELD OF THE CCR DICTIONARY.. IT HAS BEEN REDEFINED
; AS A POINTER TO CCR NODE TYPE INSTEAD OF BEING A SET
; THE SET VALUES ARE PRESERVED IN ^KBAI("SECTION") TO FACILITATE THIS
; CONVERSION
;N C0CC,C0CI,C0CJ,C0CN,C0CZX
D FIELDS^C0CRNF("C0CC",170)
S C0CI=""
F S C0CI=$O(^KBAI("SECTION",C0CI)) Q:C0CI="" D ; EACH SECTION
. S C0CZX=""
. F S C0CZX=$O(^KBAI("SECTION",C0CI,C0CZX)) Q:C0CZX="" D ; EACH VARIABLE
. . W "SECTION ",C0CI," VAR ",C0CZX
. . S C0CV=$O(^C0CDIC(170.101,"B",C0CI,""))
. . W " TYPE: ",C0CV,!
. . D SETFDA("SECTION",C0CV)
. . ;ZWR C0CFDA
Q
;
SETFDA(C0CSN,C0CSV) ; INTERNAL ROUTINE TO MAKE AN FDA ENTRY FOR FIELD C0CSN
; TO SET TO VALUE C0CSV.
; C0CFDA,C0CC,C0CZX ARE ASSUMED FROM THE CALLING ROUTINE
; C0CSN,C0CSV ARE PASSED BY VALUE
;
N C0CSI,C0CSJ
S C0CSI=$$ZFILE(C0CSN,"C0CC") ; FILE NUMBER
S C0CSJ=$$ZFIELD(C0CSN,"C0CC") ; FIELD NUMBER
S C0CFDA(C0CSI,C0CZX_",",C0CSJ)=C0CSV
Q
ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF C0CA(ZFN)
; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
I '$D(ZTAB) S ZTAB="C0CA"
N ZR
I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",1)
E S ZR=""
Q ZR
ZFIELD(ZFN,ZTAB) ;EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 2 OF C0CA(ZFN)
; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
I '$D(ZTAB) S ZTAB="C0CA"
N ZR
I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",2)
E S ZR=""
Q ZR
;
ZVALUE(ZFN,ZTAB) ;EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 3 OF C0CA(ZFN)
; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
I '$D(ZTAB) S ZTAB="C0CA"
N ZR
I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",3)
E S ZR=""
Q ZR
;

View File

@ -83,13 +83,13 @@ RPCMAP(RTN,DFN,RMIVAR,RMIXML) ; RPC ENTRY POINT FOR MAPPING RESULTS
. D MAP^GPLXPATH("C0CRT",C0CMAP,C0CRTMP) ; MAP OBR DATA
. ;D QOPEN^GPLXPATH("C0CRBLD",C0CRTMP,C0CIS) ;1ST PART OF XML
. D QUEUE^GPLXPATH("C0CRBLD",C0CRTMP,2,@C0CRTMP@(0)-4) ;UP TO <Test>
. I $D(@C0CMAP@("M","TESTS",0)) D ; TESTS EXIST
. . S C0CJN=@C0CMAP@("M","TESTS",0) ; NUMBER OF TESTS
. I $D(@C0CMAP@("M","TEST",0)) D ; TESTS EXIST
. . S C0CJN=@C0CMAP@("M","TEST",0) ; NUMBER OF TESTS
. . K C0CTO ; CLEAR OUTPUT VARIABLE
. . F C0CJ=1:1:C0CJN D ;FOR EACH TEST RESULT
. . . K C0CTMAP ; EMPTY MAPS FOR TEST RESULTS
. . . S C0CTMP=$NA(@C0CRBASE@(C0CI,C0CJ)) ;WORK AREA FOR TEST RESULTS
. . . S C0CTMAP=$NA(@C0CMAP@("M","TESTS",C0CJ)) ;
. . . S C0CTMAP=$NA(@C0CMAP@("M","TEST",C0CJ)) ;
. . . I 'C0CQT W "MAPOBX:",C0CTMAP,!
. . . D MAP^GPLXPATH("C0CTT",C0CTMAP,C0CTMP) ; MAP TO TMP
. . . I C0CJ=1 S C0CJS=2 E S C0CJS=1 ;FIRST TIME,SKIP THE <Test>
@ -141,15 +141,11 @@ GHL7 ; GET HL7 MESSAGE FOR LABS FOR THIS PATIENT
I C0CPTID="" D Q ; NO SSN, COMPLAIN AND QUIT
. W "LAB LOOKUP FAILED, NO SSN",!
. S C0CNSSN=1 ; SET NO SSN FLAG
S C0CSPC="*" ; LOOKING FOR ALL LAB TYPES
;I $D(^TMP("GPLCCR","LABLIMIT")) D ; IS LAB LIMIT SET? MOVE THIS TO PARMS
;. S C0CLLMT=^TMP("GPLCCR","LABLIMIT") ;USE THE LAB LIMIT PARAMATER
;E S C0CLLMT="T-360" ;START DATE LONG AGO TO GET EVERYTHING
S C0CLLMT=$$GET^C0CPARMS("LABLIMIT") ; GET THE LIMIT PARM
S C0CLSTRT=$$GET^C0CPARMS("LABSTART") ; GET START PARM
D DT^DILF(,C0CLLMT,.C0CSDT) ;
W "LAB LIMIT: ",C0CLLMT,!
D DT^DILF(,C0CLSTRT,.C0CEDT) ; END DATE TODAY - IMPLEMENT END DATE PARM
S C0CSPC="*" ; LOOKING FOR ALL LABS
I $D(^TMP("GPLCCR","RPMS")) D ; RUNNING RPMS
. D DT^DILF(,"T-365",.C0CSDT) ; START DATE ONE YEAR AGO TO LIMIT VOLUME
E D DT^DILF(,"T-5000",.C0CSDT) ; START DATE LONG AGO TO GET EVERYTHING
D DT^DILF(,"T",.C0CEDT) ; END DATE TODAY
S C0CR=$$GCPR^LA7QRY(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
Q
;
@ -160,9 +156,9 @@ LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
I '$D(C0CQT) S C0CQT=0
I '$D(DFN) S DFN=1 ; DEFAULT TEST PATIENT
I '$D(^KVAI(0)) D SETTBL ; INITIALIZE LAB TABLE
I ^TMP("GPLCCR","LABTBL",0)'="V2" D SETTBL ; NEED NEWEST VERSION
I ^KBAI(0)'="V2" D SETTBL ; NEED NEWEST VERSION
I '$D(^TMP("HLS",$J,1)) D GHL7 ; GET HL7 MGS IF NOT ALREADY DONE
S C0CTAB=$NA(^TMP("GPLCCR","LABTBL")) ; BASE OF OBX TABLE
S C0CTAB=$NA(^KBAI) ; BASE OF OBX TABLE
S C0CHB=$NA(^TMP("HLS",$J))
S C0CI=""
S @C0CLB@(0)=0 ; INITALIZE RESULTS VARS COUNT
@ -202,13 +198,13 @@ LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
. . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; PRIMARY CODE VALUE
. . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C3") ; PRIMARY DISPLAY NAME
. . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; USE PRIMARY TEXT
. . N C0CZG S C0CZG=XV("RESULTTESTNORMALDESCRIPTIONTEXT") ;
. . S XV("RESULTTESTNORMALDESCRIPTIONTEXT")=$$SYMENC^MXMLUTL(C0CZG) ;ESCAPE
. . N C0CZG S C0CZG=XV("RESULTTESTNORMALDESCTEXT") ;
. . S XV("RESULTTESTNORMALDESCTEXT")=$$SYMENC^MXMLUTL(C0CZG) ;ESCAPE
. . S C0CZG=XV("RESULTTESTVALUE")
. . S XV("RESULTTESTVALUE")=$$SYMENC^MXMLUTL(C0CZG) ;ESCAPE
. I C0CTYP="OBX" D ; PROCESS TEST RESULTS
. . I C0CLOBX=0 D ; FIRST TEST RESULT FOR THIS SECTION
. . . S C0CLB2=$NA(@C0CLB@(C0CLI,"M","TESTS")) ; INDENT FOR TEST RESULTS
. . . S C0CLB2=$NA(@C0CLB@(C0CLI,"M","TEST")) ; INDENT FOR TEST RESULTS
. . S C0CLOBX=C0CLOBX+1 ; INCREMENT TEST COUNT
. . S @C0CLB2@(0)=C0CLOBX ; STORE THE TEST COUNT
. . S XV("RESULTTESTOBJECTID")="RESULTTEST_"_C0CLI_"_"_C0CLOBX
@ -367,7 +363,7 @@ SETTBL ;
S X("OBX","OBX4")="4^00769^Observation Sub-Id"
S X("OBX","OBX5")="5^00561^Observation Results^RESULTTESTVALUE"
S X("OBX","OBX6")="6^00562^Units^RESULTTESTUNITS"
S X("OBX","OBX7")="7^00563^Reference Range^RESULTTESTNORMALDESCRIPTIONTEXT"
S X("OBX","OBX7")="7^00563^Reference Range^RESULTTESTNORMALDESCTEXT"
S X("OBX","OBX8")="8^00564^Abnormal Flags^RESULTTESTFLAG"
S X("OBX","OBX9")="9^00639^Probability"
S X("OBX","OBX10")="10^00565^Nature of Abnormal Test"
@ -378,7 +374,7 @@ SETTBL ;
S X("OBX","OBX15")="15^00583^Producer.s ID^RESULTTESTSOURCEACTORID"
S X("OBX","OBX16")="16^00584^Responsible Observer"
S X("OBX","OBX17")="17^00936^Observation Method"
M ^TMP("GPLCCR","LABTBL")=X ; SET VALUES IN ^TMP("GPLCCR","LABTBL")
S ^TMP("GPLCCR","LABTBL",0)="V2"
M ^KBAI=X ; SET VALUES IN ^KBAI
S ^KBAI(0)="V2"
Q
;