source: FOIAVistA/trunk/r/GEN_MED_OTHER-GMV/GMVDCVAM.m@ 794

Last change on this file since 794 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1GMVDCVAM ;HOIFO/DAD,FT-VITALS COMPONENT: VALIDATE DATA (CONT.) ;9/26/00 15:31
2 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #10104 - ^XLFSTR calls (supported)
6 ;
7DUPCHK ; *** Check for duplicate records ***
8 N GMVD0,GMVDATA,GMVDUP
9 S (GMVD0,GMVDUP)=0
10 D DUPCH
11 F S GMVD0=$O(^GMR(120.5,"AA",GMVDFN,GMVVD0,9999999-GMVDTDUN,GMVD0)) Q:(GMVD0'>0)!(GMVDUP>0) I $P($G(^GMR(120.5,GMVD0,2)),U)'>0 D
12 . S GMVDATA=$G(^GMR(120.5,GMVD0,0))
13 . I $P(GMVDATA,U,5,6)=(GMVHOSPL_U_GMVENTBY),$P(GMVDATA,U,8)=$P(GMVVMEAS,";") D DUPCH
14 . Q
15 S ^TMP($J,"GMVXREF",GMVVABBR,GMVQARRY)=""
16 Q
17 ;
18DUPCH ; *** Get qualifier lists for duplicate check ***
19 I "^BP^CG^P^R^"[(U_GMVVABBR_U) D ; Vital types allowed to have dups
20 . N GMVFLAG,GMVQD0,GMVSUB,GMVSUP
21 . I GMVD0>0 D
22 .. S GMVQD0=0,GMVQARRY(0)=U
23 .. S GMVDUP(0)=$S($O(^GMR(120.5,GMVD0,5,"B",GMVQD0))>0:1,1:0)
24 .. F S GMVQD0=$O(^GMR(120.5,GMVD0,5,"B",GMVQD0)) Q:GMVQD0'>0 D
25 ... S GMVQARRY(0)=GMVQARRY(0)_GMVQD0_U
26 ... Q
27 .. S GMVDUP(0)=$$DUPC(GMVQARRY(0),GMVQARRY,GMVDUP(0))
28 .. Q
29 . E D
30 .. S GMVQARRY(0)=""
31 .. S GMVDUP(0)=$S($O(^TMP($J,"GMVXREF",GMVVABBR,GMVQARRY(0)))]"":1,1:0)
32 .. F S GMVQARRY(0)=$O(^TMP($J,"GMVXREF",GMVVABBR,GMVQARRY(0))) Q:(GMVQARRY(0)="")!(GMVDUP(0)'>0) S GMVDUP(0)=$$DUPC(GMVQARRY(0),GMVQARRY,GMVDUP(0))
33 .. Q
34 . I GMVDUP(0)>0 D DUPMSG
35 . Q
36 E D
37 . I GMVD0>0 D
38 .. D DUPMSG
39 .. Q
40 . E D
41 .. I $D(^TMP($J,"GMVXREF",GMVVABBR)) D DUPMSG
42 .. Q
43 . Q
44 Q
45 ;
46DUPC(GMVQ1,GMVQ2,GMVDUP) ;
47 ; *** Compare qualifiers look for duplicates ***
48 N GMV,GMVSUB,GMVSUP
49 S GMVSUP=$S($L(GMVQ1,U)>$L(GMVQ2,U):GMVQ1,1:GMVQ2)
50 S GMVSUB=$S($L(GMVQ1,U)<$L(GMVQ2,U):GMVQ1,1:GMVQ2)
51 I $L(GMVQ1,U)=$L(GMVQ2,U) S GMVSUP=GMVQ1,GMVSUB=GMVQ2
52 F GMV=2:1:$L(GMVSUB,U)-1 I GMVSUP'[(U_$P(GMVSUB,U,GMV)_U) S GMVDUP=0 Q
53 Q GMVDUP
54 ;
55DUPMSG ; *** Duplicate message ***
56 S GMVDUP=1
57 D MSG^GMVDCVAL("ERROR: Duplicate Vital Measurement data found (V^"_GMVVNUM_"="_GMVVHOLD_")")
58 Q
59 ;
60BP ; *** Validate Systolic only Blood Pressure data ***
61 I GMVVABBR'="BP" Q
62 I $P(GMVVMEAS,";")?1.N S GMVSYSBP=1
63 Q
64 ;
65PO2 ; *** Validate Supplemental O2 data ***
66 S GMVVMEAS("PO2")=""
67 I GMVVABBR'="PO2" Q
68 I $$OMIT(GMVVMEAS),($P(GMVVMEAS,";",2)]"")!($P(GMVVMEAS,";",3)]"") D
69 . D MSG^GMVDCVAL("ERROR: Supplemental O2 data not allowed if Pulse Oximetry is omitted (V^"_GMVVNUM_"="_GMVVHOLD_")")
70 . Q
71 I $P(GMVVMEAS,";",2)]"" D
72 . I ($P(GMVVMEAS,";",2)'<.5)&($P(GMVVMEAS,";",2)'>20) D
73 .. S GMVVMEAS("PO2")=$P(GMVVMEAS,";",2)_"L/min"
74 .. Q
75 . E D
76 .. D MSG^GMVDCVAL("ERROR: O2 Flow Rate must be in the range 0.5-20 (V^"_GMVVNUM_"="_GMVVHOLD_")")
77 .. Q
78 . Q
79 I $P(GMVVMEAS,";",3)]"" D
80 . I ($P(GMVVMEAS,";",3)'<0)&($P(GMVVMEAS,";",3)'>100) D
81 .. S GMVVMEAS("PO2")=GMVVMEAS("PO2")_$S(GMVVMEAS("PO2")]"":" ",1:"")_$P(GMVVMEAS,";",3)_"%"
82 .. Q
83 . E D
84 .. D MSG^GMVDCVAL("ERROR: Percent O2 Concentration must be in the range 0-100 (V^"_GMVVNUM_"="_GMVVHOLD_")")
85 .. Q
86 . Q
87 S GMVVMEAS=$P(GMVVMEAS,";")
88 Q
89 ;
90OMIT(GMVVMEAS) ;
91 ; *** Determine if measurement was omitted ***
92 ; Input:
93 ; GMVVMEAS = A vital measurement
94 ; Output:
95 ; 1 - Measurement was omitted, 0 - Measurement was not omitted
96 Q "^UNAVAILABLE^PASS^REFUSED^"[(U_$$UP^XLFSTR($P(GMVVMEAS,";"))_U)
97 ;
Note: See TracBrowser for help on using the repository browser.