Changeset 586 for ccr


Ignore:
Timestamp:
Oct 28, 2009, 9:27:37 AM (15 years ago)
Author:
Christopher Edwards
Message:

refactored routine to get RPMS Problem list in the correct format.
TODO: parse and code more problem statuses.

File:
1 edited

Legend:

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

    r508 r586  
    1 C0CPROBS        ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
    2  ;;1.0;C0C;;May 19, 2009;
     1C0CPROBS ; CCDCCR/GPL/CJE - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
     2 ;;1.0;C0C;;May 19, 2009;Build 32
    33 ;Copyright 2008,2009 George Lilly, University of Minnesota.
    44 ;Licensed under the terms of the GNU General Public License.
     
    2222 ; PROCESS THE PROBLEMS SECTION OF THE CCR
    2323 ;
    24 EXTRACT(IPXML,DFN,OUTXML)       ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
     24EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
    2525 ;
    2626 ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
     
    3434 S TARYTMP=$NA(^TMP("C0CCCR",$J,"PROBARYTMP"))
    3535 K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
    36  I '$T(GET^BGOPRB) D  ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
    37  . D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
    38  E  D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
     36 I $$RPMS^C0CUTIL() D RPMS ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
     37 I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
     38 Q
     39 ;
     40RPMS ; GETS THE PROBLEM LIST FOR RPMS
     41 S RPCGLO=$NA(^TMP("BGO",$J))
     42 D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
     43 ; FORMAT OF RPC:
     44 ;   Number Code [1] ^ Patient IEN [2] ^ ICD Code [3] ^ Modify Date [4] ^ Class [5] ^ Provider Narrative [6] ^
     45 ;   Date Entered [7] ^ Status [8] ^ Date Onset [9] ^ Problem IEN [10] ^ Notes [11] ^ ICD9 IEN [12] ^
     46 ;   ICD9 Short Name [13] ^ Provider [14] ^ Facility IEN [15] ^ Priority [16]
     47 I '$D(@RPCGLO) W "NULL RESULT FROM GET^BGOPROB ",! S @OUTXML@(0)=0 Q
     48 S J=""
     49 F  S J=$O(@RPCGLO@(J)) Q:J=""  D  ; FOR EACH PROBLEM IN THE LIST
     50 . S VMAP=$NA(@TVMAP@(J))
     51 . K @VMAP
     52 . I DEBUG W "VMAP= ",VMAP,!
     53 . S PTMP=@RPCRSLT@(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
     54 . N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
     55 . D GETN1^C0CRNF("C0CG1",9000011,$P(PTMP,U,10),"") ;GET VALUES BY NAME
     56 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
     57 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,10)
     58 . S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,8)="A":"Active",1:"")
     59 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,6)
     60 . S @VMAP@("PROBLEMCODINGVERSION")=""
     61 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,3)
     62 . S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE OF ONSET","C0CG1"),"DT")
     63 . S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE LAST MODIFIED","C0CG1"),"DT")
     64 . ;S @VMAP@("PROBLEMSC")=$P(PTMP,U,7) ;UNKNOWN NOT MAPPED IN C0CCCR0
     65 . ;S @VMAP@("PROBLEMSE")=$P(PTMP,U,8) ;UNKNOWN NOT MAPPED IN C0CCCR0
     66 . ;S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9) ;NOT MAPPED IN C0CCCR0
     67 . ;S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10) ;NOT MAPPED IN C0CCCR0
     68 . ;S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11) ;NOT MAPPED IN C0CCCR0
     69 . ;S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12) ;NOT MAPPED IN C0CCCR0
     70 . ;S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
     71 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$$ZVALUEI^C0CRNF("RECORDING PROVIDER","C0CG1")
     72 . ;S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13) ;NOT MAPPED IN C0CCCR0
     73 . ;S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14) ;NOT MAPPED IN C0CCCR0
     74 . ;S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT") ;NOT MAPPED IN C0CCCR0
     75 . ;S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT") ;NOT MAPPED IN C0CCCR0
     76 . S ARYTMP=$NA(@TARYTMP@(J))
     77 . ; W "ARYTMP= ",ARYTMP,!
     78 . K @ARYTMP
     79 . D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
     80 . I J=1 D  ; FIRST ONE IS JUST A COPY
     81 . . ; W "FIRST ONE",!
     82 . . D CP^C0CXPATH(ARYTMP,OUTXML)
     83 . . ; W "OUTXML ",OUTXML,!
     84 . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
     85 . . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
     86 ; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
     87 ; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
     88 ; ZWR @OUTXML
     89 ; $$HTML^DILF(
     90 ; GENERATE THE NARITIVE HTML FOR THE CCD
     91 I CCD D CCD ; IF THIS IS FOR A CCD
     92 D MISSINGVARS
     93 Q
     94 ;
     95VISTA ; GETS THE PROBLEM LIST FOR VISTA
     96 D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
    3997 I '$D(RPCRSLT(1)) D  Q  ; RPC RETURNS NULL
    4098 . W "NULL RESULT FROM LIST^ORQQPL3 ",!
     
    83141 ; $$HTML^DILF(
    84142 ; GENERATE THE NARITIVE HTML FOR THE CCD
    85  I CCD D  ; IF THIS IS FOR A CCD
    86  . N HTMP,HOUT,HTMLO,C0CPROBI,ZX
    87  . F C0CPROBI=1:1:RPCRSLT(0) D  ; FOR EACH PROBLEM
    88  . . S VMAP=$NA(@TVMAP@(C0CPROBI))
    89  . . I DEBUG W "VMAP =",VMAP,!
    90  . . D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
    91  . . D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
    92  . . ; D PARY^C0CXPATH("HTMP") ; PRINT IT
    93  . . D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
    94  . . ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
    95  . . I C0CPROBI=1 D  ; FIRST ONE IS JUST A COPY
    96  . . . D CP^C0CXPATH("HOUT","HTMLO")
    97  . . I C0CPROBI>1 D  ; AFTER THE FIRST, INSERT INNER HTML
    98  . . . I DEBUG W "DOING INNER",!
    99  . . . N HTMLBLD,HTMLTMP
    100  . . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
    101  . . . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
    102  . . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
    103  . . . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
    104  . . . D CP^C0CXPATH("HTMLTMP","HTMLO")
    105  . . . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
    106  . I DEBUG D PARY^C0CXPATH("HTMLO")
    107  . D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
     143 I CCD D CCD ; IF THIS IS FOR A CCD
     144 D MISSINGVARS
     145 Q
     146CCD
     147 N HTMP,HOUT,HTMLO,C0CPROBI,ZX
     148 F C0CPROBI=1:1:RPCRSLT(0) D  ; FOR EACH PROBLEM
     149 . S VMAP=$NA(@TVMAP@(C0CPROBI))
     150 . I DEBUG W "VMAP =",VMAP,!
     151 . D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
     152 . D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
     153 . ; D PARY^C0CXPATH("HTMP") ; PRINT IT
     154 . D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
     155 . ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
     156 . I C0CPROBI=1 D  ; FIRST ONE IS JUST A COPY
     157 . . D CP^C0CXPATH("HOUT","HTMLO")
     158 . I C0CPROBI>1 D  ; AFTER THE FIRST, INSERT INNER HTML
     159 . . I DEBUG W "DOING INNER",!
     160 . . N HTMLBLD,HTMLTMP
     161 . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
     162 . . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
     163 . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
     164 . . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
     165 . . D CP^C0CXPATH("HTMLTMP","HTMLO")
     166 . . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
     167 I DEBUG D PARY^C0CXPATH("HTMLO")
     168 D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
     169 Q
     170MISSINGVARS
    108171 N PROBSTMP,I
    109172 D MISSING^C0CXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
Note: See TracChangeset for help on using the changeset viewer.