source: ccr/trunk/p/GPLVITALS.m@ 56

Last change on this file since 56 was 51, checked in by Christopher Edwards, 16 years ago

Added Providers to Vitals section
Fixed hanging : in CCRUTIL (thanks to Skip for more optimized code)
Fixed GPLCCR to write correct time

File size: 5.0 KB
Line 
1GPLVITALS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/03/08
2 ;;0.1;CCDCCR;;JUL 3,2008;
3EXTRACT(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("GPLCCR",$J,"VITALS"))
13 S VITTARYTMP=$NA(^TMP("GPLCCR",$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 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
25 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
26 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
27 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
28 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
29 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
30 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
31 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
32 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
33 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
34 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
35 . . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
36 . . E I $P(VITPTMP,U,2)="WT" D
37 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
38 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
39 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
40 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
41 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
42 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
43 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
44 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
45 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
46 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
47 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
48 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
49 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
50 . . E D
51 . . . ;W "IN VITAL: OTHER",!
52 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
53 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
54 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
55 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
56 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
57 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
58 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
59 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
60 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
61 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
62 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
63 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
64 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
65 . . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
66 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
67 . . K @VITARYTMP
68 . . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
69 . . I J=1 D ; FIRST ONE IS JUST A COPY
70 . . . ; W "FIRST ONE",!
71 . . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
72 . . . ; W "OUTXML ",OUTXML,!
73 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
74 . . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
75 ; ZWR ^TMP($J,"VITALS",*)
76 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
77 ; ZWR @OUTXML
78 N VITTMP,I
79 D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
80 I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
81 . W "VITALS MISSING ",!
82 . F I=1:1:VITTMP(0) W VITTMP(I),!
83 Q
84 ;
Note: See TracBrowser for help on using the repository browser.