Changeset 36 for ccr/trunk/p/GPLVITALS.m


Ignore:
Timestamp:
Jul 3, 2008, 4:54:25 PM (16 years ago)
Author:
Christopher Edwards
Message:

switch proccessing of vitals and problems so CCR would validate
added date time for ccr
cleaned up template ccr (more to come)
more work done in vitals section

File:
1 edited

Legend:

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

    r34 r36  
    1 GPLVITALS       ; CCDCCR/GPL - CCR/CCD PROCESSING FOR VITALS ; 6/6/08
    2         ;;0.1;CCDCCR;nopatch;noreleasedate
     1GPLVITALS       ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/03/08
     2                ;;0.1;CCDCCR;;JUL 3,2008;
    33EXTRACT(VITXML,DFN,VITOUTXML)   ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
    4            ;
    5            ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
    6            ; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
    7            ;
    8            N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
    9            D VITALS^ORQQVI(.VITRSLT,DFN,"","")
    10            I '$D(VITRSLT(1)) W "ERROR RUNNINIG VITALS RPC",! Q
    11            ;ZWR RPCRSLT
    12            S VITTVMAP=$NA(^TMP($J,"VITALS"))
    13            S VITTARYTMP=$NA(^TMP($J,"VITALARYTMP"))
    14            F J=1:1:VITRSLT(1)  D  ; FOR EACH VITAL IN THE LIST
    15            . I $D(VITRSLT(J)) D 
    16            . . S VITVMAP=$NA(@VITTVMAP@(J))
    17            . . K @VITVMAP
    18            . . I DEBUG W "VMAP= ",VMAP,!
    19            . . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
    20            . . S @VITVMAP@("DATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
    21            . . I $P(VITPTMP,U,2)="HT" D
    22            . . . S @VITVMAP@("HEIGHTWEIGHTDATATIME")=$P(VITPTMP,U,4)
    23            . . . S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
    24            . . . S @VITVMAP@("HEIGHTSOURCEID")=$P(VITPTMP,U,1)
    25            . . . S @VITVMAP@("HEIGHTINCHES")=$P(VITPTMP,U,3)
    26            . . I $P(VITPTMP,U,2)="WT" D
    27            . . . S @VITVMAP@("WEIGHTSOURCEID")=$P(VITPTMP,U,1)
    28            . . . S @VITVMAP@("WEIGHTLBS")=$P(VITPTMP,U,3)
    29            . . S VITARYTMP=$NA(@VITTARYTMP@(J))
    30            . . K @VITARYTMP
    31            . . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
    32            . . I J=1 D  ; FIRST ONE IS JUST A COPY
    33            . . . ; W "FIRST ONE",!
    34            . . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
    35            . . . ; W "OUTXML ",OUTXML,!
    36            . . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
    37            . . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
    38            ;ZWR ^TMP($J,"VITALS",*)
    39            ;ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
    40            ; W "OUT OF FOR LOOP.",!
    41            ;ZWR
    42            ; ZWR @OUTXML
    43            ; $$HTML^DILF(
    44            N VITTMP,I
    45            D MISSING^GPLXPATH(VITXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
    46            I VITTMP(0)>0 D  ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
    47            . W "VITALS MISSING ",!
    48            . F I=1:1:VITTMP(0) W VITTMP(I),!
    49            Q
     4        ;
     5        ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
     6        ; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
     7        ;
     8        N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
     9        D VITALS^ORQQVI(.VITRSLT,DFN,"","")
     10        I '$D(VITRSLT(1)) W "ERROR RUNNINIG VITALS RPC",! Q
     11        ; ZWR RPCRSLT
     12        S VITTVMAP=$NA(^TMP($J,"VITALS"))
     13        S VITTARYTMP=$NA(^TMP($J,"VITALARYTMP"))
     14        F J=1:1:VITRSLT(1)  D  ; FOR EACH VITAL IN THE LIST
     15        . I $D(VITRSLT(J)) D 
     16        . . S VITVMAP=$NA(@VITTVMAP@(J))
     17        . . K @VITVMAP
     18        . . I DEBUG W "VMAP= ",VMAP,!
     19        . . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
     20        . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
     21        . . I $P(VITPTMP,U,2)="HT" D
     22        . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     23        . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
     24        . . . W "CONVERTED DATE TIME: ",@VITVMAP@("VITALSIGNSEXACTDATETIME"),!
     25        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
     26        . . . ;S @VITVMAP@("VITALSIGNSSOURCEACTORID")=""
     27        . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     28        . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     29        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
     30        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
     31        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
     32        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
     33        . . . ;S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")=""
     34        . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
     35        . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
     36        . . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
     37        . . E  I $P(VITPTMP,U,2)="WT" D
     38        . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     39        . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
     40        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
     41        . . . ;S @VITVMAP@("VITALSIGNSSOURCEACTORID")=""
     42        . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     43        . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     44        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
     45        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
     46        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
     47        . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
     48        . . . ;S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")=""
     49        . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
     50        . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
     51        . . E  D
     52        . . . ;W "IN VITAL:  OTHER",!
     53        . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     54        . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
     55        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
     56        . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")=""
     57        . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     58        . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     59        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
     60        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
     61        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
     62        . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
     63        . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")=""
     64        . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
     65        . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
     66        . . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
     67        . . S VITARYTMP=$NA(@VITTARYTMP@(J))
     68        . . K @VITARYTMP
     69        . . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
     70        . . I J=1 D  ; FIRST ONE IS JUST A COPY
     71        . . . ; W "FIRST ONE",!
     72        . . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
     73        . . . ; W "OUTXML ",OUTXML,!
     74        . . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
     75        . . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
     76        ; ZWR ^TMP($J,"VITALS",*)
     77        ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
     78        ; ZWR @OUTXML
     79        N VITTMP,I
     80        D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
     81        I VITTMP(0)>0 D  ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
     82        . W "VITALS MISSING ",!
     83        . F I=1:1:VITTMP(0) W VITTMP(I),!
     84        Q
     85        ;
Note: See TracChangeset for help on using the changeset viewer.