Changeset 328 for ccr/trunk


Ignore:
Timestamp:
Jan 19, 2009, 1:18:05 PM (16 years ago)
Author:
George Lilly
Message:

fixes for RPMS

File:
1 edited

Legend:

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

    r314 r328  
    11GPLPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
    2  ;;0.1;CCDCCR;nopatch;noreleasedate
     2 ;;0.1;CCDCCR;nopatch;noreleasedate;Build 7
    33 ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
    44 ;General Public License See attached copy of the License.
     
    1717 ;with this program; if not, write to the Free Software Foundation, Inc.,
    1818 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     19 ;
     20 ;
     21 ; PROCESS THE PROBLEMS SECTION OF THE CCR
    1922 ;
    20            ;
    21            ;  PROCESS THE PROBLEMS SECTION OF THE CCR
    22            ;
    2323EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
    24           ;
    25           ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
    26           ; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
    27           ; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
    28           ; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
    29           ; INSERT^GPLXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
    30           ;
    31           N RPCRSLT,J,K,PTMP,X,VMAP,TBU
    32           S TVMAP=$NA(^TMP("GPLCCR",$J,"PROBVALS"))
    33           S TARYTMP=$NA(^TMP("GPLCCR",$J,"PROBARYTMP"))
    34           K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
    35           I $D(^TMP("GPLCCR","RPMS")) D  ; IF IN RPMS
    36           . D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
    37           E  D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
    38           I '$D(RPCRSLT(1)) D  Q  ; RPC RETURNS NULL
    39           . W "NULL RESULT FROM LIST^ORQQPL3 ",!
    40           . S @OUTXML@(0)=0
    41           . ; Q
    42           ; I DEBUG ZWR RPCRSLT
    43           S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
    44           F J=1:1:RPCRSLT(0)  D  ; FOR EACH PROBLEM IN THE LIST
    45           . S VMAP=$NA(@TVMAP@(J))
    46           . K @VMAP
    47           . I DEBUG W "VMAP= ",VMAP,!
    48           . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
    49           . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
    50           . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
    51           . S @VMAP@("PROBLEMSTATUS")=$P(PTMP,U,2)
    52           . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
    53           . S @VMAP@("PROBLEMCODINGVERSION")=""
    54           . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
    55           . S @VMAP@("PROBLEMDATEOFONSET")=$P(PTMP,U,5)
    56           . S @VMAP@("PROBLEMDATEMOD")=$P(PTMP,U,6)
    57           . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
    58           . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
    59           . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
    60           . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
    61           . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
    62           . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
    63           . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
    64           . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
    65           . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
    66           . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
    67           . S @VMAP@("PROBLEMDTREC")=$P(PTMP,U,15)
    68           . S @VMAP@("PROBLEMINACT")=$P(PTMP,U,16)
    69           . S ARYTMP=$NA(@TARYTMP@(J))
    70           . ; W "ARYTMP= ",ARYTMP,!
    71           . K @ARYTMP
    72           . D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
    73           . I J=1 D  ; FIRST ONE IS JUST A COPY
    74           . . ; W "FIRST ONE",!
    75           . . D CP^GPLXPATH(ARYTMP,OUTXML)
    76           . . ; W "OUTXML ",OUTXML,!
    77           . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
    78           . . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
    79           ; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
    80           ; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
    81           ; ZWR @OUTXML
    82           ; $$HTML^DILF(
    83           ; GENERATE THE NARITIVE HTML FOR THE CCD
    84           I CCD D  ; IF THIS IS FOR A CCD
    85           . N HTMP,HOUT,HTMLO,GPLPROBI,ZX
    86           . F GPLPROBI=1:1:RPCRSLT(0) D  ; FOR EACH PROBLEM
    87           . . S VMAP=$NA(@TVMAP@(GPLPROBI))
    88           . . I DEBUG W "VMAP =",VMAP,!
    89           . . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
    90           . . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
    91           . . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
    92           . . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
    93           . . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
    94           . . I GPLPROBI=1 D  ; FIRST ONE IS JUST A COPY
    95           . . . D CP^GPLXPATH("HOUT","HTMLO")
    96           . . I GPLPROBI>1 D  ; AFTER THE FIRST, INSERT INNER HTML
    97           . . . I DEBUG W "DOING INNER",!
    98           . . . N HTMLBLD,HTMLTMP
    99           . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
    100           . . . D QUEUE^GPLXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
    101           . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
    102           . . . D BUILD^GPLXPATH("HTMLBLD","HTMLTMP")
    103           . . . D CP^GPLXPATH("HTMLTMP","HTMLO")
    104           . . . ; D INSINNER^GPLXPATH("HOUT","HTMLO","//")
    105           . I DEBUG D PARY^GPLXPATH("HTMLO")
    106           . D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
    107           N PROBSTMP,I
    108           D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
    109           I PROBSTMP(0)>0  D  ; IF THERE ARE MISSING VARS -
    110           . ; STRINGS MARKED AS @@X@@
    111           . W !,"PROBLEMS Missing list: ",!
    112           . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
    113           Q
    114           ;
     24 ;
     25 ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
     26 ; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
     27 ; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
     28 ; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
     29 ; INSERT^GPLXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
     30 ;
     31 N RPCRSLT,J,K,PTMP,X,VMAP,TBU
     32 S TVMAP=$NA(^TMP("GPLCCR",$J,"PROBVALS"))
     33 S TARYTMP=$NA(^TMP("GPLCCR",$J,"PROBARYTMP"))
     34 K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
     35 I '$T(GET^BGOPRB) D  ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
     36 . D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
     37 E  D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
     38 I '$D(RPCRSLT(1)) D  Q  ; RPC RETURNS NULL
     39 . W "NULL RESULT FROM LIST^ORQQPL3 ",!
     40 . S @OUTXML@(0)=0
     41 . ; Q
     42 ; I DEBUG ZWR RPCRSLT
     43 S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
     44 F J=1:1:RPCRSLT(0)  D  ; FOR EACH PROBLEM IN THE LIST
     45 . S VMAP=$NA(@TVMAP@(J))
     46 . K @VMAP
     47 . I DEBUG W "VMAP= ",VMAP,!
     48 . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
     49 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
     50 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
     51 . S @VMAP@("PROBLEMSTATUS")=$P(PTMP,U,2)
     52 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
     53 . S @VMAP@("PROBLEMCODINGVERSION")=""
     54 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
     55 . S @VMAP@("PROBLEMDATEOFONSET")=$P(PTMP,U,5)
     56 . S @VMAP@("PROBLEMDATEMOD")=$P(PTMP,U,6)
     57 . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
     58 . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
     59 . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
     60 . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
     61 . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
     62 . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
     63 . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
     64 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
     65 . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
     66 . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
     67 . S @VMAP@("PROBLEMDTREC")=$P(PTMP,U,15)
     68 . S @VMAP@("PROBLEMINACT")=$P(PTMP,U,16)
     69 . S ARYTMP=$NA(@TARYTMP@(J))
     70 . ; W "ARYTMP= ",ARYTMP,!
     71 . K @ARYTMP
     72 . D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
     73 . I J=1 D  ; FIRST ONE IS JUST A COPY
     74 . . ; W "FIRST ONE",!
     75 . . D CP^GPLXPATH(ARYTMP,OUTXML)
     76 . . ; W "OUTXML ",OUTXML,!
     77 . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
     78 . . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
     79 ; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
     80 ; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
     81 ; ZWR @OUTXML
     82 ; $$HTML^DILF(
     83 ; GENERATE THE NARITIVE HTML FOR THE CCD
     84 I CCD D  ; IF THIS IS FOR A CCD
     85 . N HTMP,HOUT,HTMLO,GPLPROBI,ZX
     86 . F GPLPROBI=1:1:RPCRSLT(0) D  ; FOR EACH PROBLEM
     87 . . S VMAP=$NA(@TVMAP@(GPLPROBI))
     88 . . I DEBUG W "VMAP =",VMAP,!
     89 . . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
     90 . . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
     91 . . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
     92 . . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
     93 . . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
     94 . . I GPLPROBI=1 D  ; FIRST ONE IS JUST A COPY
     95 . . . D CP^GPLXPATH("HOUT","HTMLO")
     96 . . I GPLPROBI>1 D  ; AFTER THE FIRST, INSERT INNER HTML
     97 . . . I DEBUG W "DOING INNER",!
     98 . . . N HTMLBLD,HTMLTMP
     99 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
     100 . . . D QUEUE^GPLXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
     101 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
     102 . . . D BUILD^GPLXPATH("HTMLBLD","HTMLTMP")
     103 . . . D CP^GPLXPATH("HTMLTMP","HTMLO")
     104 . . . ; D INSINNER^GPLXPATH("HOUT","HTMLO","//")
     105 . I DEBUG D PARY^GPLXPATH("HTMLO")
     106 . D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
     107 N PROBSTMP,I
     108 D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
     109 I PROBSTMP(0)>0  D  ; IF THERE ARE MISSING VARS -
     110 . ; STRINGS MARKED AS @@X@@
     111 . W !,"PROBLEMS Missing list: ",!
     112 . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
     113 Q
     114 ;
Note: See TracChangeset for help on using the changeset viewer.