Changeset 272 for ccr/trunk


Ignore:
Timestamp:
Nov 11, 2008, 5:33:55 PM (16 years ago)
Author:
George Lilly
Message:

lab output in CCR

Location:
ccr/trunk/p
Files:
3 edited

Legend:

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

    r266 r272  
    134134    D PUSH^GPLXPATH(TAB,"EXTRACT;CCRMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""GPLCCR"",$J,DFN,""MEDICATIONS"")")
    135135    D PUSH^GPLXPATH(TAB,"EXTRACT;GPLVITAL;//ContinuityOfCareRecord/Body/VitalSigns;^TMP(""GPLCCR"",$J,DFN,""VITALS"")")
    136     D PUSH^GPLXPATH(TAB,"EXTRACT;GPLLABS;//ContinuityOfCareRecord/Body/Results;^TMP(""GPLCCR"",$J,DFN,""RESULTS"")")
     136    D PUSH^GPLXPATH(TAB,"MAP;GPLLABS;//ContinuityOfCareRecord/Body/Results;^TMP(""GPLCCR"",$J,DFN,""RESULTS"")")
    137137    I TESTALERT D PUSH^GPLXPATH(TAB,"EXTRACT;GPLALERT;//ContinuityOfCareRecord/Body/Alerts;^TMP(""GPLCCR"",$J,DFN,""ALERTS"")")
    138138    Q
  • ccr/trunk/p/GPLCCR0.m

    r254 r272  
    493493 ;;</Actor>
    494494 ;;</Source>
    495  ;;<TEST_NORMALDESCRIPTION>
    496495 ;;<Test>
    497496 ;;<CCRDataObjectID>@@RESULTTESTOBJECTID@@</CCRDataObjectID>
     
    505504 ;;<Text>@@RESULTTESTDESCRIPTIONTEXT@@</Text>
    506505 ;;<Code>
    507  ;;<Value>@@RESULTTESTCODE@@</Value>
     506 ;;<Value>@@RESULTTESTCODEVALUE@@</Value>
    508507 ;;<CodingSystem>@@RESULTTESTCODINGSYSTEM@@</CodingSystem>
    509508 ;;</Code>
     
    539538 ;;</Flag>
    540539 ;;</Test>
    541  ;;</TEST_NORMALDESCRIPTION>
    542  ;;<TEST_NORMALSEQUENCE>
    543  ;;<Test>
    544  ;;<CCRDataObjectID>@@RESULTTESTOBJECTID@@</CCRDataObjectID>
    545  ;;<DateTime>
    546  ;;<Type>
    547  ;;<Text>Assessment Time</Text>
    548  ;;</Type>
    549  ;;<ExactDateTime>@@RESULTTESTDATETIME@@</ExactDateTime>
    550  ;;</DateTime>
    551  ;;<Description>
    552  ;;<Text>@@RESULTTESTDESCRIPTIONTEXT@@</Text>
    553  ;;<Code>
    554  ;;<Value>@@RESULTTESTCODEVALUE@@</Value>
    555  ;;<CodingSystem>@@RESULTTESTCODINGSYSTEM@@</CodingSystem>
    556  ;;</Code>
    557  ;;</Description>
    558  ;;<Status>
    559  ;;<Text>@@RESULTTESTSTATUSTEXT@@</Text>
    560  ;;</Status>
    561  ;;<Source>
    562  ;;<Actor>
    563  ;;<ActorID>@@RESULTTESTSOURCEACTORID@@</ActorID>
    564  ;;</Actor>
    565  ;;</Source>
    566  ;;<TestResult>
    567  ;;<Value>@@RESULTTESTVALUE@@</Value>
    568  ;;<Units>
    569  ;;<Unit>@@RESULTTESTUNITS@@</Unit>
    570  ;;</Units>
    571  ;;</TestResult>
    572  ;;<NormalResult>
    573  ;;<Normal>
    574  ;;<Value>@@RESULTTESTNORMALVALUESEQ1@@</Value>
    575  ;;<Units>
    576  ;;<Unit>@@RESULTTESTNORMALUNITSEQ1@@</Unit>
    577  ;;</Units>
    578  ;;<ValueSequencePosition>1</ValueSequencePosition>
    579  ;;<Source>
    580  ;;<Actor>
    581  ;;<ActorID>@@RESULTTESTNORMALSOURCEACTORID@@</ActorID>
    582  ;;</Actor>
    583  ;;</Source>
    584  ;;</Normal>
    585  ;;<Normal>
    586  ;;<Value>@@RESULTTESTNORMALVALUESEQ2@@</Value>
    587  ;;<Units>
    588  ;;<Unit>@@RESULTTESTNORMALUNITSEQ2@@</Unit>
    589  ;;</Units>
    590  ;;<ValueSequencePosition>2</ValueSequencePosition>
    591  ;;<VariableNomalModifier>
    592  ;;<Text>@@RESULTTESTNORMALMODIFIER@@</Text>
    593  ;;</VariableNomalModifier>
    594  ;;<Source>
    595  ;;<Actor>
    596  ;;<ActorID>@@RESULTTESTNORMALSOURCEACTORID@@</ActorID>
    597  ;;</Actor>
    598  ;;</Source>
    599  ;;</Normal>
    600  ;;</NormalResult>
    601  ;;<Flag>
    602  ;;<Text>@@RESULTTESTFLAG@@</Text>
    603  ;;</Flag>
    604  ;;</Test>
    605  ;;</TEST_NORMALSEQUENCE>
    606540 ;;</Result>
    607541 ;;</Results>
  • ccr/trunk/p/GPLLABS.m

    r268 r272  
    1818 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    1919           ;
     20;MAP(DFN,MOXML,MIVAR,MIXML) ; MAP RESULTS VARIABLES TO XML - GPL -TBD
     21MAP(MIXML,DFN,MOXML) ;TO MAKE THIS COMPATIBLE WITH OLD CALLING FOR EXTRACT
     22 ; ASSUMES THAT EXTRACT HAS BEEN RUN AND THE VARIABLES STORED IN MIVAR
     23 ; MIXML,MIVAR, AND MOXML ARE PASSED BY NAME
     24 ; MIXML IS THE TEMPLATE TO USE
     25 ; MOXML IS THE OUTPUT XML ARRAY
     26 ; DFN IS THE PATIENT RECORD NUMBER
     27 N C0COXML,C0CO,C0CV,C0CIXML
     28 I '$D(MIVAR) S C0CV="" ;DEFAULT
     29 E  S C0CV=MIVAR ;PASSED VARIABLE ARRAY
     30 I '$D(MIXML) S C0CIXML="" ;DEFAULT
     31 E  S C0CIXML=MIXML ;PASSED INPUT XML
     32 D RPCMAP(.C0COXML,DFN,C0CV,C0CIXML) ; CALL RPC TO DO THE WORK
     33 I '$D(MOXML) S C0CO=$NA(^TMP("GPLCCR",$J,DFN,"RESULTS")) ;DEFAULT FOR OUTPUT
     34 E  S C0CO=MOXML
     35 ; ZWR C0COXML
     36 M @C0CO=C0COXML ; COPY RESULTS TO OUTPUT
     37 Q
     38 ;
     39RPCMAP(RTN,DFN,RMIVAR,RMIXML) ; RPC ENTRY POINT FOR MAPPING RESULTS
     40 ; RTN IS PASSED BY REFERENCE
     41 ;N C0CT0,C0CT,C0CV ; CCR TEMPLATE, RESULTS SUBTEMPLATE, VARIABLES
     42 ;N C0CRT,C0CTT ; TEST REQUEST TEMPLATE, TEST RESULT TEMPLATE
     43 I '$D(DEBUG) S DEBUG=0 ; DEFAULT NO DEBUGGING
     44 I RMIXML="" D  ; INPUT XML NOT PASSED
     45 . D LOAD^GPLCCR0("C0CT0") ; LOAD ENTIRE CCR TEMPLATE
     46 . D QUERY^GPLXPATH("C0CT0","//ContinuityOfCareRecord/Body/Results","C0CT")
     47 E  S C0CT=RMIXML ; WE ARE PASSED THE RESULTS PART OF THE TEMPLATE
     48 I RMIVAR="" D  ; LOCATION OF VARIABLES NOT PASSED
     49 . S C0CV=$NA(^TMP("GPLRIM","VARS",DFN,"RESULTS")) ;DEFAULT VARIABLE LOCATION
     50 E  S C0CV=RMIVAR ; PASSED LOCATIONS OF VARS
     51 D CP^GPLXPATH(C0CT,"C0CRT") ; START MAKING TEST REQUEST TEMPLATE
     52 D REPLACE^GPLXPATH("C0CRT","","//Results/Result/Test") ; DELETE TEST FROM REQ
     53 D QUERY^GPLXPATH(C0CT,"//Results/Result/Test","C0CTT") ; MAKE TEST TEMPLATE
     54 I '$D(C0CQT) S C0CQT=0 ; DEFAULT NOT SILENT
     55 I 'C0CQT D  ; WE ARE DEBUGGING
     56 . W "I MAPPED",!
     57 . W "VARS:",C0CV,!
     58 . W "DFN:",DFN,!
     59 . ;D PARY^GPLXPATH("C0CT") ; SECTION TEMPLATE
     60 . D PARY^GPLXPATH("C0CRT") ;REQUEST TEMPLATE (OCR)
     61 . D PARY^GPLXPATH("C0CTT") ;TEST TEMPLATE (OCX)
     62 D EXTRACT("C0CT",DFN,) ; FIRST CALL EXTRACT
     63 I '$D(@C0CV@(0)) D  Q  ; NO VARS THERE
     64 . S @C0CO@(0)=0 ; PASS BACK NO RESULTS INDICATOR
     65 N C0CI,C0CJ,C0CMAP,C0CTMAP,C0CTMP
     66 S C0CIN=@C0CV@(0) ; COUNT OF RESULTS (OBR)
     67 N C0CRTMP ; AREA TO BUILD ONE RESULT REQUEST AND ALL TESTS FOR IT
     68 F C0CI=1:1:C0CIN D  ; LOOP THROUGH VARIABLES
     69 . K C0CMAP,C0CTMP,C0CRTMP ;EMPTY OUT LAST BATCH OF VARIABLES
     70 . S C0CMAP=$NA(@C0CV@(C0CI)) ;
     71 . I 'C0CQT W "MAPOBR:",C0CMAP,!
     72 . ;MAPPING FOR TEST REQUEST GOES HERE
     73 . D MAP^GPLXPATH("C0CRT",C0CMAP,"C0CRTMP") ; MAP OBR DATA
     74 . I $D(@C0CMAP@("M","TESTS",0)) D  ; TESTS EXIST
     75 . . S C0CJN=@C0CMAP@("M","TESTS",0) ; NUMBER OF TESTS
     76 . . K C0CTO ; CLEAR OUTPUT VARIABLE
     77 . . F C0CJ=1:1:C0CJN D   ;FOR EACH TEST RESULT
     78 . . . K C0CTMAP,C0CTMP ; EMPTY MAPS FOR TEST RESULTS
     79 . . . S C0CTMAP=$NA(@C0CMAP@("M","TESTS",C0CJ)) ;
     80 . . . I 'C0CQT W "MAPOBX:",C0CTMAP,!
     81 . . . D MAP^GPLXPATH("C0CTT",C0CTMAP,"C0CTMP") ; MAP TO TMP
     82 . . . ;I C0CJ=1 D  ; FIRST TIME, JUST COPY
     83 . . . ;. D CP^GPLXPATH("C0CTMP","C0CTO") ; START BUILDING TEST XML
     84 . . . ;E  D INSINNER^GPLXPATH("C0CTO","C0CTMP")
     85 . . . ;
     86 . . . D PUSHA^GPLXPATH("C0CTO","C0CTMP") ;ADD THE TEST TO BUFFER
     87 . . I 'C0CQT D PARY^GPLXPATH("C0CTO")
     88 . . D INSINNER^GPLXPATH("C0CRTMP","C0CTO","//Results/Result/Test") ;INSERT TST
     89 . I C0CI=1 D  ; FIRST TIME, COPY INSTEAD OF INSERT
     90 . . D CP^GPLXPATH("C0CRTMP","RTN") ;
     91 . E  D INSINNER^GPLXPATH("RTN","C0CRTMP") ; INSERT THIS TEST REQUEST
     92 Q
     93 ;
    2094EXTRACT(ILXML,DFN,OLXML) ; EXTRACT LABS INTO THE C0CLVAR GLOBAL
    2195 ;
     
    27101 S C0CLB=$NA(^TMP("GPLCCR",$J,"RESULTS")) ; BASE GLB FOR LABS VARS
    28102 K @C0CLB ; CLEAR OUT OLD VARS IF ANY
    29  S C0CSILENT=1 ; SURPRESS LISTING
     103 N QTSAV S QTSAV=C0CQT ;SAVE QUIET FLAG
     104 S C0CQT=1 ; SURPRESS LISTING
    30105 D LIST ; EXTRACT THE VARIABLES
    31  K C0CSILENT ; RESET SILENT FLAG
     106 S C0CQT=QTSAV ; RESET SILENT FLAG
    32107 K ^TMP("HLS",$J) ; KILL HL7 MESSAGE OUTPUT
    33108 I $D(OLXML) S @OLXML@(0)=0 ; EXTRACT DOES NOT PRODUCE XML... SEE MAP^GPLLABS
     
    46121 Q
    47122 ;
    48 LIST ; LIST THE HL7 MESSAGE
     123LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
    49124 ;
    50125 ; N C0CI,C0CJ,C0COBT,C0CHB,C0CVAR
    51  ; D EXTRACT^GPLLABS(1)
    52126 I '$D(C0CLB) S C0CLB=$NA(^TMP("GPLCCR",$J,"RESULTS")) ; BASE GLB FOR LABS VARS
    53  I '$D(C0CSILENT) S C0CSILENT=0
     127 I '$D(C0CQT) S C0CQT=0
    54128 I '$D(DFN) S DFN=1 ; DEFAULT TEST PATIENT
    55129 I '$D(^KVAI(0)) D SETTBL ; INITIALIZE LAB TABLE
     
    63137 . K C0CVAR,XV ; CLEAR OUT VARIABLE VALUES
    64138 . S C0CTYP=$P(@C0CHB@(C0CI),"|",1)
    65  . D LTYP(@C0CHB@(C0CI),C0CTYP,.C0CVAR,C0CSILENT)
     139 . D LTYP(@C0CHB@(C0CI),C0CTYP,.C0CVAR,C0CQT)
    66140 . M XV=C0CVAR ;
    67141 . I C0CTYP="OBR" D  ; BEGINNING OF NEW SECTION
     
    69143 . . S C0CLI=@C0CLB@(0) ; INDEX FOR THIS RESULT
    70144 . . M @C0CLB@(C0CLI)=C0CVAR ; PERSIST THE OBR VARS
     145 . . S @C0CLB@(C0CLI,"RESULTOBJECTID")="RESULT_"_C0CLI
    71146 . . S C0CLOBX=0 ; MARK THE BEGINNING OF A NEW SECTION
    72147 . I C0CTYP="OBX" D  ; SPECIAL CASE FOR OBX3
     
    89164 . . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C3") ; PRIMARY DISPLAY NAME
    90165 . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; USE PRIMARY TEXT
    91  . . I 'C0CSILENT D  ;
    92  . . . ZWR XV
    93166 . I C0CTYP="OBX" D  ; PROCESS TEST RESULTS
    94167 . . I C0CLOBX=0 D  ; FIRST TEST RESULT FOR THIS SECTION
     
    96169 . . S C0CLOBX=C0CLOBX+1 ; INCREMENT TEST COUNT
    97170 . . S @C0CLB2@(0)=C0CLOBX ; STORE THE TEST COUNT
     171 . . S XV("RESULTTESTOBJECTID")="RESULTTEST_"_C0CLI_"_"_C0CLOBX
     172 . . I 'C0CQT ZWR XV
    98173 . . M @C0CLB2@(C0CLOBX)=XV ; PERSIST THE TEST RESULT VARIABLES
    99  . I 'C0CSILENT D  ;
     174 . I 'C0CQT D  ;
    100175 . . W C0CI," ",C0CTYP,!
    101176 . ; S C0CI=$O(@C0CHB@(C0CI))
     
    103178 ;M ^TMP("GPLRIM","VARS",DFN,"RESULTS")=@C0CLB
    104179 Q
    105 LTYP(OSEG,OTYP,OVARA,OC0CSILENT) ;
     180LTYP(OSEG,OTYP,OVARA,OC0CQT) ;
    106181 S OTAB=$NA(@C0CTAB@(OTYP)) ; TABLE FOR SEGMENT TYPE
    107  I '$D(OC0CSILENT) S C0CSILENT=0 ; NOT C0CSILENT IS DEFAULT
    108  E  S C0CSILENT=OC0CSILENT ; ACCEPT C0CSILENT FLAG
     182 I '$D(OC0CQT) S C0CQT=0 ; NOT C0CQT IS DEFAULT
     183 E  S C0CQT=OC0CQT ; ACCEPT C0CQT FLAG
    109184 I 1 D  ; FOR HL7 SEGMENT TYPE
    110185 . S OI="" ; INDEX INTO FIELDS IN SEG
     
    117192 . . . S OV=$P(OV,"^",OI2) ; PULL OUT SUB-VALUE
    118193 . . I OVAR'="" S OVARA(OVAR)=OV ; PASS BACK VARIABLE AND VALUE
    119  . . I 'C0CSILENT D  ; PRINT OUTPUT IF C0CSILENT IS FALSE
     194 . . I 'C0CQT D  ; PRINT OUTPUT IF C0CQT IS FALSE
    120195 . . . I OV'="" W OI_": "_$P(@OTAB@(OI),"^",3),": ",OVAR,": ",OV,!
    121196 Q
     
    183258 S X("OBR","OBR4;LOINC")="4;1^00238^Universal Service ID - LOINC^RESULTCODE"
    184259 S X("OBR","OBR4;DESC")="4;2^00238^Universal Service ID - DESC^RESULTDESCRIPTIONTEXT"
    185  S X("OBR","OBR4;VACODE")="4;3^00238^Universal Service ID - VACODE"
     260 S X("OBR","OBR4;VACODE")="4;3^00238^Universal Service ID - VACODE^RESULTCODINGSYSTEM"
    186261 S X("OBR","OBR5")="5^00239^Priority"
    187262 S X("OBR","OBR6")="6^00240^Requested Date/Time"
Note: See TracChangeset for help on using the changeset viewer.